Examples of Animation


Examples of org.mt4j.util.animation.Animation

    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.newdawn.slick.Animation

        img[i] = Util.loadImage("particle/light/light_corner_000"+i+".png").getFlippedCopy(flip, false);
        img[i].setAlpha(0.6f+(0.15f/6*damage));
        img[i].getScaledCopy(1.0f+(1.5f/((1/speed)*7)));
       
      }
      return new Animation(img, 240, true);
    }
View Full Code Here

Examples of org.newdawn.slick.Animation

      {
        img[i] = Util.loadImage("particle/light/light_000"+i+".png");
        img[i].setAlpha(0.6f+(0.25f/10*damage));
        img[i].getScaledCopy(1.0f+1.5f-(1.5f/30*(1/speed))+rand);
      }
      Animation anim = new Animation(img, 240, true);
      anim.setCurrentFrame(new Random().nextInt(5));
      return anim;
    }
View Full Code Here

Examples of org.newdawn.slick.Animation

 
  public void render(Graphics g)
  {
    for (int i = 0; i < light_anim.size(); ++i)
    {
      Animation anim = light_anim.get(i);
      anim.draw(x-width/2+(i==0?9:9+i*5), GameplayState.ground_level+19+(i==0||i==light_anim.size()-1?0:11));
    }
  }
View Full Code Here

Examples of org.newdawn.slick.Animation

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    anim = new Animation(false);
    for (int i = 0; i<ss.length; i++){
      anim.addFrame(ss[i], 80);
    }
    anim.setLooping(true);
    anim.start();
View Full Code Here

Examples of org.newdawn.slick.Animation

        }
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    anim = new Animation(false);
    for (int i = 0; i<ss.length; i++){
      anim.addFrame(ss[i], 90);
    }
    anim.setLooping(true);
    anim.start();
View Full Code Here

Examples of org.newdawn.slick.Animation

    private static Animation highlightedFireFighterDepartmentAnimation;
    private static Animation genericEmergencyAnimation;

    public static Animation getAmbulanceAnimation() {
        if (ambulanceAnimation == null) {
            ambulanceAnimation = new Animation();
            ambulanceAnimation.setLooping(false);
            ambulanceAnimation.setAutoUpdate(false);

            for (int row = 0; row < getAmbulanceSpriteSheet().getHorizontalCount(); row++) {
                for (int frame = 0; frame < getAmbulanceSpriteSheet().getVerticalCount(); frame++) {
View Full Code Here

Examples of org.newdawn.slick.Animation

        return ambulanceAnimation;
    }

    public static Animation getHighlightedHospitalAnimation() {
        if (highlightedHospitalAnimation == null) {
            highlightedHospitalAnimation = new Animation();
            highlightedHospitalAnimation.setLooping(true);
            highlightedHospitalAnimation.setAutoUpdate(true);

            for (int row = 0; row < getHighlightedHospitalSpriteSheet().getHorizontalCount(); row++) {
                for (int frame = 0; frame < getHighlightedHospitalSpriteSheet().getVerticalCount(); frame++) {
View Full Code Here

Examples of org.newdawn.slick.Animation

        return highlightedHospitalAnimation;
    }

    public static Animation getHighlightedFirefighterDepartmentAnimation() {
        if (highlightedFireFighterDepartmentAnimation == null) {
            highlightedFireFighterDepartmentAnimation = new Animation();
            highlightedFireFighterDepartmentAnimation.setLooping(true);
            highlightedFireFighterDepartmentAnimation.setAutoUpdate(true);

            for (int row = 0; row < getHighlightedFirefighterDepartmentSpriteSheet().getHorizontalCount(); row++) {
                for (int frame = 0; frame < getHighlightedFirefighterDepartmentSpriteSheet().getVerticalCount(); frame++) {
View Full Code Here

Examples of org.newdawn.slick.Animation

        }
        return genericEmergencyAnimation;
    }

    public static Animation getEmergencyAnimation(EmergencyType emergencyType, Integer numberOfPeople) {
        Animation emergencyAnimation = new Animation();
        emergencyAnimation.setLooping(true);
        emergencyAnimation.setAutoUpdate(true);

        for (int row = 0; row < getEmergencySpriteSheet(emergencyType).getHorizontalCount(); row++) {
            for (int frame = 0; frame < getEmergencySpriteSheet(emergencyType).getVerticalCount(); frame++) {
                try {
                    Image sprite = getEmergencySpriteSheet(emergencyType).getSprite(row, frame);
                    if (numberOfPeople != null) {
                        sprite.getGraphics().drawString("" + numberOfPeople, sprite.getWidth() / 2, sprite.getHeight() / 2);
                    }
                    emergencyAnimation.addFrame(sprite, 250);
                } catch (SlickException ex) {
                    Logger.getLogger(AnimationFactory.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
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.