|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.animation.ZAnimation | +--edu.umd.cs.jazz.animation.ZTransformAnimation
ZTransformAnimation animates an object conforming to the ZTransformable interface from a source transform to a destination transform over time. A ZAlpha class is used to specify the start time, duration, and acceleration time for this animation.
This code demonstrates how to animate a rectangle from position 0, 0 to 300, 300.
ZRectangle aRect = new ZRectangle(0, 0, 100, 100);
ZVisualLeaf aLeaf = new ZVisualLeaf(aRect);
// The animation will apply to the transform group decorating the aLeaf node.
ZTransformGroup aTarget = aLeaf.editor().getTransformGroup();
canvas.getLayer().addChild(aTarget);
// Create a new ZAlpha that will run from the current time for 1.5 seconds.
// This alpha will change linearly; see the ZAlpha class to learn how to create
// slow in slow out animation effects.
ZAlpha alpha = new ZAlpha(1, 1500);
// Create the ZTransformAnimation with its source and destination values. Here
// we choose to animate the target from its current transform, to the identity transform
// translated by 300, 300.
AffineTransform souceTransform = aTarget.getTransform();
AffineTransform destinationTransform = AffineTransform.getTranslateInstance(300, 300);
ZTransformAnimation aTransformAnimation = new ZTransformAnimation(souceTransform, destinationTransform);
// Set the target of the animation.
aTransformAnimation.setTransformTarget(aTarget);
// Set the alpha value for the animation. This animation will start immediately,
// and run for 1.5 seconds.
aTransformAnimation.setAlpha(alpha);
// Start the animation by registering it with the ZAnimationScheduler.
aTransformAnimation.play();
ZAlpha
Constructor Summary | |
ZTransformAnimation(java.awt.geom.AffineTransform aSource, java.awt.geom.AffineTransform aDestination) Construct a new ZTransformAnimation. |
|
ZTransformAnimation(double[] aSource, double[] aDestination) Construct a new ZTransformAnimation. |
Method Summary | |
protected void |
animateFrameForTime(long aTime) Animate one frame of this animation for the given time. |
double[] |
getDestinationTransform() Return the destination transform matrix , the transform matrix that the animation will end up at. |
double[] |
getSourceTransform() Return the source transform matrix, the transform matrix that the animation will start at. |
ZTransformable |
getTransformTarget() Return the target of this transform animation. |
void |
setDestinationTransform(double[] aDestination) Set the destination transform matrix, the transform matrix that the animation will end up at. |
void |
setSourceTransform(double[] aSource) Set the source transform matrix, the transform matrix that the animation will start at. |
void |
setTransformTarget(ZTransformable aTarget) Set the target of this transform animation. |
Methods inherited from class edu.umd.cs.jazz.animation.ZAnimation |
animationRateByElapsedFrames, animationRateByElapsedTime, animationRateByNextFrame, animationStarted, animationStopped, getAlpha, isStopped, play, scheduleNextFrame, scheduleNextFrame, setAlpha, setStartedRunnable, setStoppedRunnable, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZTransformAnimation(double[] aSource, double[] aDestination)
aSource
- the source transform matrix that the animation will start at.aDestination
- the destination transform matrix that the animation will end at.public ZTransformAnimation(java.awt.geom.AffineTransform aSource, java.awt.geom.AffineTransform aDestination)
aSource
- the source transform that the animation will start at.aDestination
- the destination transform that the animation will end at.Method Detail |
public double[] getSourceTransform()
public void setSourceTransform(double[] aSource)
public double[] getDestinationTransform()
public void setDestinationTransform(double[] aDestination)
public ZTransformable getTransformTarget()
setTransform
method will be called for each frame of the animation.
public void setTransformTarget(ZTransformable aTarget)
setTransform
method will be called for each frame of the animation.
protected void animateFrameForTime(long aTime)
animateFrameForTime
in class ZAnimation
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |