|
|||||||||||
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.ZColorAnimation
ZColorAnimation animates an object conforming to the ZFillPaint or ZPenPaint interface from a source color to a destination color over time. A ZAlpha class is used to specify the start time, duration, and acceleration time for this animation.
This example code demonstrates how to animate the fill color of a rectangle from color red to color yellow.
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 ZColorAnimation with its source and destination values. Here
// we choose to animate the target from color red to color yellow.
ZColorAnimation aColorAnimation = new ZColorAnimation(Color.red, Color.yellow);
// Set the target of the animation.
aColorAnimation.setFillPaintTarget(aRect);
// Set the alpha value for the animation. This animation will start immediately,
// and run for 1.5 seconds.
aColorAnimation.setAlpha(alpha);
// Start the animation by registering it with the ZAnimationScheduler.
aColorAnimation.play();
ZAlpha
Constructor Summary | |
ZColorAnimation(java.awt.Color aSource, java.awt.Color aDestination) Construct a new ZColorAnimation. |
Method Summary | |
protected void |
animateFrameForTime(long aTime) Animate one frame of this animation for the given time. |
java.awt.Color |
getDestinationColor() Return the destination color, the color that the animation will end at. |
ZFillPaint |
getFillPaintTarget() Return the fill paint target of this color animation. |
ZPenPaint |
getPenPaintTarget() Return the pen paint target of this color animation. |
java.awt.Color |
getSourceColor() Return the source color, the color that the animation will start at. |
void |
setDestinationColor(java.awt.Color aDestination) Set the destination color, the color that the animation will end at. |
void |
setFillPaintTarget(ZFillPaint aFillPaintTarget) Set the fill paint target of this color animation. |
void |
setPenPaintTarget(ZPenPaint aPenPaintTarget) Set the pen paint target of this color animation. |
void |
setSourceColor(java.awt.Color aSource) Set the source color, the color that the animation will start at. |
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 ZColorAnimation(java.awt.Color aSource, java.awt.Color aDestination)
aSource
- the source color that the animation will start at.aDestination
- the destination color that the animation will end at.Method Detail |
public java.awt.Color getSourceColor()
public void setSourceColor(java.awt.Color aSource)
public java.awt.Color getDestinationColor()
public void setDestinationColor(java.awt.Color aDestination)
public ZPenPaint getPenPaintTarget()
setPenPaint
method will be called for each frame of the animation.
public void setPenPaintTarget(ZPenPaint aPenPaintTarget)
setPenPaint
method will be called for each frame of the animation.
public ZFillPaint getFillPaintTarget()
setFillPaint
method will be called for each frame of the animation.
public void setFillPaintTarget(ZFillPaint aFillPaintTarget)
setFillPaint
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 |