Пример #1
0
  public void initTest(String vt) {
    eh = new TestDefaultHandler.EventHandlerTestDTH(this);
    vs = vsm.addVirtualSpace("src");
    cam = vs.addCamera();
    List<Camera> cameras = new ArrayList<Camera>();
    cameras.add(cam);
    cam.setZoomFloor(-90);
    testView = vsm.addFrameView(cameras, "Test", vt, 800, 600, true);
    testView.setBackgroundColor(Color.LIGHT_GRAY);
    testView.setListener(eh);
    final Glyph circle = new VCircle(100, 0, 0, 40, Color.WHITE);
    cam.setAltitude(50);
    vs.addGlyph(circle);
    vsm.repaint();

    AnimationManager am = vsm.getAnimationManager();

    for (int i = 0; i < 4; ++i) {
      Animation anim =
          am.getAnimationFactory()
              .createAnimation(
                  3000,
                  1.0,
                  Animation.RepeatBehavior.LOOP,
                  circle,
                  Animation.Dimension.POSITION,
                  new DefaultTimingHandler() {
                    public void timingEvent(
                        float fraction, Object subject, Animation.Dimension dim) {
                      Glyph g = (Glyph) subject;
                      g.moveTo(100 - (double) 600 * fraction, 0);
                    }
                  },
                  new SplineInterpolator(0.7f, 0.1f, 0.3f, 0.9f));
      am.startAnimation(anim, false);
    }

    Animation anim =
        am.getAnimationFactory()
            .createAnimation(
                8000,
                1.0,
                Animation.RepeatBehavior.LOOP,
                circle,
                Animation.Dimension.FILLCOLOR,
                new DefaultTimingHandler() {
                  public void timingEvent(float fraction, Object subject, Animation.Dimension dim) {
                    Glyph g = (Glyph) subject;
                    g.setColor(new Color(0, 0, Float.valueOf(255 * fraction).intValue()));
                  }
                });
    am.startAnimation(anim, false);

    Animation animSize =
        am.getAnimationFactory()
            .createAnimation(
                4000,
                1.0,
                Animation.RepeatBehavior.LOOP,
                circle,
                Animation.Dimension.SIZE,
                new DefaultTimingHandler() {
                  public void timingEvent(float fraction, Object subject, Animation.Dimension dim) {
                    Glyph g = (Glyph) subject;
                    g.sizeTo(40 + 60 * fraction);
                  }
                });
    am.startAnimation(animSize, false);
  }
Пример #2
0
 TestDefaultHandler(String vt) {
   vsm = VirtualSpaceManager.INSTANCE;
   VirtualSpaceManager.setDebug(true);
   initTest(vt);
 }