Package org.jdesktop.core.animation.timing

Examples of org.jdesktop.core.animation.timing.Interpolator


        redrawItem(controller.getItem());
        controller.setOffsetAnimator(null);
      }
    };
   
    Interpolator interpol = new AccelerationInterpolator(0.0, 0.1);
    Animator animator = new Animator.Builder().addTarget(timingTarget).setInterpolator(interpol).setDuration(250, TimeUnit.MILLISECONDS).build();
    controller.setOffsetAnimator(animator);
    animator.start();
    System.out.println("Started: " + System.currentTimeMillis());
  }
View Full Code Here


        redrawItem(controller.getItem());
        controller.setBackgroundAnimator(null);
      }
    };
   
    Interpolator interpol = new AccelerationInterpolator(0.0, 0.1);
    Animator animator = new Animator.Builder().addTarget(timingTarget).setInterpolator(interpol).setDuration(100, TimeUnit.MILLISECONDS).build();
    controller.setBackgroundAnimator(animator);
    animator.start();
  }
View Full Code Here

        redraw(oldBounds.x, oldBounds.y, oldBounds.width, oldBounds.height, true);
        redraw(newBounds.x, newBounds.y, newBounds.width, newBounds.height, true);
      }
    };
   
    Interpolator interpol = new AccelerationInterpolator(0, 0.9);
    Animator animator = new Animator.Builder().addTarget(tt).setDuration(160, TimeUnit.MILLISECONDS).setInterpolator(interpol).build();
    controller.setOffsetAnimator(animator);
    animator.start();
  }
View Full Code Here

        Rectangle bounds = controller.getItemBounds();
        redraw(bounds.x, bounds.y, bounds.width, bounds.height, true);
      }
    };
   
    Interpolator interpol = new AccelerationInterpolator(0, 0.9);
    Animator animator = new Animator.Builder().addTarget(tt).setDuration(160, TimeUnit.MILLISECONDS).setInterpolator(interpol).build();
    controller.setBackgroundAnimator(animator);
    animator.start();
  }
View Full Code Here

    }

    /*
     * For realistic movement, we want a big acceleration on the straightaways.
     */
    Interpolator initialSpline = new SplineInterpolator(1.00f, 0.00f, 0.2f, .2f);
    Interpolator straightawaySpline = new SplineInterpolator(0.50f, 0.20f, .50f, .80f);
    Interpolator curveSpline = new SplineInterpolator(0.50f, 0.20f, .50f, .80f);
    Interpolator finalSpline = new SplineInterpolator(0.50f, 0.00f, .50f, 1.00f);
    Interpolator[] interps = { null, initialSpline, curveSpline, straightawaySpline, curveSpline, straightawaySpline, curveSpline,
        straightawaySpline, finalSpline };

    final KeyFrames.Builder<Point> builder = new KeyFrames.Builder<Point>(values[0]);
    for (int i = 1; i < values.length; i++) {
      builder.addFrame(values[i], times[i], interps[i]);

    }
    final KeyFrames<Point> keyFrames = builder.build();

    /*
     * This PropertySetter enables the animation for the car movement all the
     * way around the track.
     */
    final TimingTarget modifier = PropertySetter.getTarget(basicGUI.getTrack(), "carPosition", keyFrames);
    animator.addTarget(modifier);

    /*
     * Now create similar keyframes for rotation of car.
     */
    int[] rotationKeyValues = { 360, 315, 270, 225, 180, 135, 90, 45, 0 };
    Interpolator straightawayTurnSpline = new SplineInterpolator(1.0f, 0.0f, 1.0f, 0.0f);
    Interpolator curveTurnSpline = new SplineInterpolator(0.0f, 0.5f, 0.5f, 1.0f);
    Interpolator[] rotationInterps = { null, straightawayTurnSpline, curveTurnSpline, straightawayTurnSpline, curveTurnSpline,
        straightawayTurnSpline, curveTurnSpline, straightawayTurnSpline, curveTurnSpline };
    final KeyFrames.Builder<Integer> rotationBuilder = new KeyFrames.Builder<Integer>(rotationKeyValues[0]);
    for (int i = 1; i < values.length; i++) {
      rotationBuilder.addFrame(rotationKeyValues[i], times[i], rotationInterps[i]);
View Full Code Here

      }
    };
    /*
     * Sometimes go at a constant rate, sometimes accelerate and decelerate.
     */
    final Interpolator i = f_die.nextBoolean() ? ACCEL_4_4 : null;
    ball.animator = new Animator.Builder().setDuration(duration, TimeUnit.SECONDS).addTarget(circularMovement)
        .setRepeatCount(Animator.INFINITE).setRepeatBehavior(Animator.RepeatBehavior.LOOP).setInterpolator(i).build();
    ball.animator.start();

    f_balls.add(ball);
View Full Code Here

TOP

Related Classes of org.jdesktop.core.animation.timing.Interpolator

Copyright © 2018 www.massapicom. 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.