|
|||||||||||
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.ZStrokeAnimation
ZStrokeAnimation animates an object conforming to the ZStroke interface from a source stroke to a destination stroke 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 the stroke of a rectangle from width 0 to width 5.
ZRectangle aRect = new ZRectangle(0, 0, 100, 100);
ZVisualLeaf aLeaf = new ZVisualLeaf(aRect);
canvas.getLayer().addChild(aLeaf);
// 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 a stroke with width 0 to a stroke with width 5.
ZStrokeAnimation aStrokeAnimation = new ZStrokeAnimation(new BasicStroke(0), new BasicStroke(5));
// Set the target of the animation.
aStrokeAnimation.setStrokeTarget(aRect);
// Set the alpha value for the animation. This animation will start immediately,
// and run for 1.5 seconds.
aStrokeAnimation.setAlpha(alpha);
// Start the animation by registering it with the ZAnimationScheduler.
aStrokeAnimation.play();
ZAlpha
Constructor Summary | |
ZStrokeAnimation(java.awt.BasicStroke aSource, java.awt.BasicStroke aDestination) Construct a new ZStrokeAnimation. |
Method Summary | |
protected void |
animateFrameForTime(long aTime) Animate one frame of this animation for the given time. |
java.awt.BasicStroke |
getDestinationStroke() Return the destination stroke, the stroke that the animation will end at. |
java.awt.BasicStroke |
getSourceStroke() Return the source stroke, the stroke that the animation will start at. |
ZStroke |
getStrokeTarget() Return the target of this stroke animation. |
void |
setDestinationStroke(java.awt.BasicStroke aStroke) Set the destination stroke, the stroke that the animation will end at. |
void |
setSourceStroke(java.awt.BasicStroke aStroke) Set the source stroke, the stroke that the animation will start at. |
void |
setStrokeTarget(ZStroke aTarget) Set the target of this stroke 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 ZStrokeAnimation(java.awt.BasicStroke aSource, java.awt.BasicStroke aDestination)
aSource
- the source stroke that the animation will start at.aDestination
- the destination stroke that the animation will end at.Method Detail |
public java.awt.BasicStroke getSourceStroke()
public void setSourceStroke(java.awt.BasicStroke aStroke)
public java.awt.BasicStroke getDestinationStroke()
public void setDestinationStroke(java.awt.BasicStroke aStroke)
public ZStroke getStrokeTarget()
setStroke
method will be called for each frame of the animation.
public void setStrokeTarget(ZStroke aTarget)
setStroke
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 |