fr.lri.swingstates.animations
Class AnimationScaleTo

java.lang.Object
  extended by fr.lri.swingstates.animations.Animation
      extended by fr.lri.swingstates.animations.AnimationScaleTo

public class AnimationScaleTo
extends Animation

An animation that scales a CElement to a given factor by scaling smoothly this CElement every 40 milliseconds.

Author:
Caroline Appert

Field Summary
 
Fields inherited from class fr.lri.swingstates.animations.Animation
FUNCTION_LINEAR, FUNCTION_SIGMOID, INFINITE_NUMBER_OF_LAPS
 
Constructor Summary
AnimationScaleTo(double sxTarget, double syTarget)
          Builds a "scaleTo" animation.
 
Method Summary
 void doStart()
          Method called when this animation is started.
 double getScaleXTarget()
           
 double getScaleYTarget()
           
 Animation setAnimatedElement(CElement ce)
          Sets the CElement that must be animated by this animation.
 AnimationScaleTo setScaleTarget(double sxTarget, double syTarget)
          Sets the final scale factors along the x-axis and the y-axis.
 void step(double t)
          Override this abstract to specify the effect of this animation.
 
Methods inherited from class fr.lri.swingstates.animations.Animation
addTag, addTag, doResume, doStop, doSuspend, getAnimated, getDelay, getLapDuration, getNbLaps, getPacingFunction, hasTag, hasTag, isStarted, isSuspended, removeTag, removeTag, resetAnimationManager, resume, setCanvas, setDelay, setFunction, setLapDuration, setNbLaps, start, stop, suspend
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationScaleTo

public AnimationScaleTo(double sxTarget,
                        double syTarget)
Builds a "scaleTo" animation.

Parameters:
sxTarget - The final scale factor along the x-axis.
syTarget - The final scale factor along the y-axis.
Method Detail

step

public void step(double t)
Override this abstract to specify the effect of this animation.

Specified by:
step in class Animation
Parameters:
t - The parameter of this animation.

doStart

public void doStart()
Method called when this animation is started. This method does nothing. It can be redefined in derived classes.

Overrides:
doStart in class Animation
See Also:
Animation.start()

setAnimatedElement

public Animation setAnimatedElement(CElement ce)
Sets the CElement that must be animated by this animation. If the canvas that must received animation events has not yet been set, it is set to the canvas to which belongs this CElement.

Overrides:
setAnimatedElement in class Animation
Parameters:
ce - The CElement to animate.
Returns:
this animation.

getScaleXTarget

public double getScaleXTarget()
Returns:
the final scale factor along the x-axis.

getScaleYTarget

public double getScaleYTarget()
Returns:
the final scale factor along the y-axis.

setScaleTarget

public AnimationScaleTo setScaleTarget(double sxTarget,
                                       double syTarget)
Sets the final scale factors along the x-axis and the y-axis.

Parameters:
sxTarget - The final scale factor along the x-axis.
syTarget - The final scale factor along the y-axis.
Returns:
this animation.