Examples of IAnimationListener


Examples of org.mt4j.util.animation.IAnimationListener

    earth.rotateX(earth.getCenterPointRelativeToParent(), -90);
    earth.setTexture(new GLTexture(pa,imagesPath + "worldMap.jpg", new GLTextureSettings(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.CLAMP_TO_EDGE, WRAP_MODE.CLAMP_TO_EDGE)));
        earth.generateAndUseDisplayLists();
        earth.setPositionGlobal(new Vector3D(pa.width/2f, pa.height/2f, 250)); //earth.setPositionGlobal(new Vector3D(200, 200, 250));
        //Animate earth rotation
        new Animation("rotation animation", new MultiPurposeInterpolator(0,360, 17000, 0, 1, -1) , earth).addAnimationListener(new IAnimationListener(){
          public void processAnimationEvent(AnimationEvent ae) {
            earth.rotateY(earth.getCenterPointLocal(), ae.getCurrentStepDelta(), TransformSpace.LOCAL);
          }}).start();
       
        //Put planets in a group that can be manipulated by gestures
        //so the rotation of the planets doesent get changed by the gestures
    MTComponent group = new MTComponent(mtApplication);
    group.setComposite(true); //This makes the group "consume" all picking and gestures of the children
    group.registerInputProcessor(new DragProcessor(mtApplication));
    group.addGestureListener(DragProcessor.class, new DefaultDragAction());
    group.addGestureListener(DragProcessor.class, new InertiaDragAction(80, 0.8f, 10));
    group.registerInputProcessor(new RotateProcessor(mtApplication));
    group.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    //Scale the earth from the center. Else it might get distorted
    group.registerInputProcessor(new ScaleProcessor(mtApplication));
    group.addGestureListener(ScaleProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        ScaleEvent se = (ScaleEvent)ge;
        earth.scaleGlobal(se.getScaleFactorX(), se.getScaleFactorY(), se.getScaleFactorX(), earth.getCenterPointGlobal());
        return false;
      }
    });
    this.getCanvas().addChild(group);
        group.addChild(earth);
       
        //Create the moon
        final MTSphere moonSphere = new MTSphere(pa, "moon", 35, 35, 25, TextureMode.Polar);
         moonSphere.setMaterial(material);
        moonSphere.translate(new Vector3D(earth.getRadius() + moonSphere.getRadius() + 50, 0,0));
        moonSphere.setTexture(new GLTexture(pa, imagesPath + "moonmap1k.jpg", new GLTextureSettings(TEXTURE_TARGET.RECTANGULAR, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.CLAMP_TO_EDGE, WRAP_MODE.CLAMP_TO_EDGE)));
        moonSphere.generateAndUseDisplayLists();
        moonSphere.unregisterAllInputProcessors();
        //Rotate the moon around the earth
        new Animation("moon animation", new MultiPurposeInterpolator(0,360, 12000, 0, 1, -1) , moonSphere).addAnimationListener(new IAnimationListener(){
          public void processAnimationEvent(AnimationEvent ae) {
            moonSphere.rotateZ(earth.getCenterPointLocal(), ae.getCurrentStepDelta(), TransformSpace.RELATIVE_TO_PARENT);
          }}).start();
        //Rotate the moon around ints own center
        new Animation("moon animation around own axis", new MultiPurposeInterpolator(0,360, 9000, 0, 1, -1) , moonSphere).addAnimationListener(new IAnimationListener(){
          public void processAnimationEvent(AnimationEvent ae) {
            moonSphere.rotateZ(moonSphere.getCenterPointLocal(), -3*ae.getCurrentStepDelta(), TransformSpace.LOCAL);
            moonSphere.rotateY(moonSphere.getCenterPointLocal(), 0.5f*ae.getCurrentStepDelta(), TransformSpace.LOCAL);
          }}).start();
        earth.addChild(moonSphere);
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

    list.addListElement(this.createListCell("Blue Marble", font, new BlueMarble(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Daily Planet", font, new DailyPlanet(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
   
    MultiPurposeInterpolator in = new MultiPurposeInterpolator(0,170, 700, 0.1f, 0.7f, 1);
    final Animation slideOut = new Animation("slide out animation", in, mapMenu);
    slideOut.addAnimationListener(new IAnimationListener() {
      public void processAnimationEvent(AnimationEvent ae) {
        float delta = ae.getCurrentStepDelta();
        ((IMTComponent3D)ae.getTargetObject()).translateGlobal(new Vector3D(delta,0,0));
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_ENDED:
          doSlideIn = true;
          animationRunning = false;
          break;
        }
      }
    });
   
    final Animation slideIn = new Animation("slide out animation", in, mapMenu);
    slideIn.addAnimationListener(new IAnimationListener() {
      public void processAnimationEvent(AnimationEvent ae) {
        float delta = -ae.getCurrentStepDelta();
        ((IMTComponent3D)ae.getTargetObject()).translateGlobal(new Vector3D(delta,0,0));
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_ENDED:
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

            }
          }
          float width = referencePoly.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);

          Animation closeAnim = new Animation("comp Fade", new MultiPurposeInterpolator(width, 1, 300, 0.5f, 0.8f, 1), referencePoly);
          closeAnim.addAnimationListener(new IAnimationListener(){
            public void processAnimationEvent(AnimationEvent ae) {
              switch (ae.getId()) {
              case AnimationEvent.ANIMATION_STARTED:
              case AnimationEvent.ANIMATION_UPDATED:
                float currentVal = ae.getAnimation().getInterpolator().getCurrentValue();
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

   
    this.setClear(true);
     
    finished = false;
   
    anim2 = new Animation("Fade animation 2", new MultiPurposeInterpolator(255,0, this.duration/2f, 0, 0.8f, 1) , this).addAnimationListener(new IAnimationListener(){
      //@Override
      public void processAnimationEvent(AnimationEvent ae) {
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
          fullScreenQuad.setFillColor(new MTColor(0,0,0, ae.getAnimation().getInterpolator().getCurrentValue()));
          break;
        case AnimationEvent.ANIMATION_ENDED:
          fullScreenQuad.setFillColor(new MTColor(0,0,0, ae.getAnimation().getInterpolator().getCurrentValue()));
          finished = true;
          break;
        default:
          break;
        }
      }});
    anim2.setResetOnFinish(true);
   
        anim = new Animation("Fade animation 1", new MultiPurposeInterpolator(0,255, this.duration/2f, 0, 1, 1) , this).addAnimationListener(new IAnimationListener(){
          //@Override
          public void processAnimationEvent(AnimationEvent ae) {
            switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

    super(mtApplication, "Blend Transition");
    this.app = mtApplication;
    this.duration = duration;
    this.finished = true;
   
    anim = new Animation("Blend animation ", new MultiPurposeInterpolator(255,0, this.duration, 0, 0.7f, 1) , this).addAnimationListener(new IAnimationListener(){
      public void processAnimationEvent(AnimationEvent ae) {
        float val = ae.getAnimation().getInterpolator().getCurrentValue();
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
          lastSceneRectangle.setVisible(true);
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

    super(mtApplication, "Slide Transition");
    this.app = mtApplication;
    this.duration = duration;
    this.finished = true;
   
    anim = new Animation("Flip animation 2", new MultiPurposeInterpolator(app.width, 0, this.duration, 0.0f, 0.7f, 1) , this).addAnimationListener(new IAnimationListener(){
      //@Override
      public void processAnimationEvent(AnimationEvent ae) {
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

    super(mtApplication, "Flip Transition");
    this.app = mtApplication;
    this.duration = duration;
    this.finished = true;
   
    anim2 = new Animation("Flip animation 2", new MultiPurposeInterpolator(0,90, this.duration/2f, 0, 0.5f, 1) , this).addAnimationListener(new IAnimationListener(){
      //@Override
      public void processAnimationEvent(AnimationEvent ae) {
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
//          nextSceneWindow.rotateYGlobal(lastSceneWindow.getCenterPointGlobal(), ae.getAnimation().getInterpolator().getCurrentStepDelta());
          nextSceneRectangle.rotateYGlobal(lastSceneWindow.getCenterPointGlobal(), ae.getAnimation().getInterpolator().getCurrentStepDelta());
          break;
        case AnimationEvent.ANIMATION_ENDED:
          nextSceneRectangle.rotateYGlobal(lastSceneWindow.getCenterPointGlobal(), ae.getAnimation().getInterpolator().getCurrentStepDelta());
          finished = true;
          break;
        default:
          break;
        }
      }});
    anim2.setResetOnFinish(true);
   
        anim = new Animation("Flip animation 1", new MultiPurposeInterpolator(0,90, this.duration/2f, 0.5f, 1, 1) , this).addAnimationListener(new IAnimationListener(){
          //@Override
          public void processAnimationEvent(AnimationEvent ae) {
            switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

  }
 
  public void close(){
    float width = this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);
    Animation closeAnim = new Animation("Window Fade", new MultiPurposeInterpolator(width, 1, 350, 0.2f, 0.5f, 1), this);
    closeAnim.addAnimationListener(new IAnimationListener(){
      public void processAnimationEvent(AnimationEvent ae) {
//        float delta = ae.getAnimation().getInterpolator().getCurrentStepDelta();
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

      Animation animation = animations[i];
     
      //Go through all listeners of these animations
      IAnimationListener[] animationListeners = animation.getAnimationListeners();
      for (int j = 0; j < animationListeners.length; j++) {
        IAnimationListener listener = animationListeners[j];
        //IF a listener is a TranslationAnimationListener the animations is a translationTween
        //and should be stopped before doing this new animation
        if (listener instanceof TranslationAnimationListener)
          animation.stop();
      }
View Full Code Here

Examples of org.mt4j.util.animation.IAnimationListener

  }
 
  protected void closeKeyboard(){
    float width = this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);
    Animation keybCloseAnim = new Animation("Keyboard Fade", new MultiPurposeInterpolator(width, 1, 300, 0.2f, 0.5f, 1), this);
    keybCloseAnim.addAnimationListener(new IAnimationListener(){
      public void processAnimationEvent(AnimationEvent ae) {
//        float delta = ae.getAnimation().getInterpolator().getCurrentStepDelta();
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_STARTED:
        case AnimationEvent.ANIMATION_UPDATED:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.