Package com.google.gwt.animation.client
Class Animation
- java.lang.Object
-
- com.google.gwt.animation.client.Animation
-
- Direct Known Subclasses:
CellTree.NodeAnimation,PopupPanel.ResizeAnimation
public abstract class Animation extends java.lang.ObjectAnAnimationis a continuous event that updates progressively over time at a non-fixed frame rate.
-
-
Constructor Summary
Constructors Modifier Constructor Description Animation()Construct a newAnimation.protectedAnimation(AnimationScheduler scheduler)Construct a newAnimationSchedulerusing the specified scheduler to sheduler request frames.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcancel()Immediately cancel this animation.protected doubleinterpolate(double progress)Interpolate the linear progress into a more natural easing function.booleanisRunning()Returns true if the animation is running.protected voidonCancel()Called immediately after the animation is canceled.protected voidonComplete()Called immediately after the animation completes.protected voidonStart()Called immediately before the animation starts.protected abstract voidonUpdate(double progress)Called when the animation should be updated.voidrun(int duration)Immediately run this animation.voidrun(int duration, double startTime)Run this animation at the given startTime.voidrun(int duration, double startTime, Element element)Run this animation at the given startTime.voidrun(int duration, Element element)Immediately run this animation.
-
-
-
Constructor Detail
-
Animation
public Animation()
Construct a newAnimation.
-
Animation
protected Animation(AnimationScheduler scheduler)
Construct a newAnimationSchedulerusing the specified scheduler to sheduler request frames.- Parameters:
scheduler- anAnimationSchedulerinstance
-
-
Method Detail
-
cancel
public void cancel()
Immediately cancel this animation. If the animation is running or is scheduled to run,onCancel()will be called.
-
run
public void run(int duration)
Immediately run this animation. If the animation is already running, it will be canceled first.This is equivalent to
run(duration, null).- Parameters:
duration- the duration of the animation in milliseconds- See Also:
run(int, Element)
-
run
public void run(int duration, Element element)Immediately run this animation. If the animation is already running, it will be canceled first.If the element is not
null, theonUpdate(double)method might be called only if the element may be visible (generally left at the appreciation of the browser). Otherwise, it will be called unconditionally.- Parameters:
duration- the duration of the animation in millisecondselement- the element that visually bounds the entire animation
-
run
public void run(int duration, double startTime)Run this animation at the given startTime. If the startTime has already passed, the animation will run synchronously as if it started at the specified start time. If the animation is already running, it will be canceled first.This is equivalent to
run(duration, startTime, null).- Parameters:
duration- the duration of the animation in millisecondsstartTime- the synchronized start time in milliseconds- See Also:
run(int, double, Element)
-
run
public void run(int duration, double startTime, Element element)Run this animation at the given startTime. If the startTime has already passed, the animation will run synchronously as if it started at the specified start time. If the animation is already running, it will be canceled first.If the element is not
null, theonUpdate(double)method might be called only if the element may be visible (generally left at the appreciation of the browser). Otherwise, it will be called unconditionally.- Parameters:
duration- the duration of the animation in millisecondsstartTime- the synchronized start time in millisecondselement- the element that visually bounds the entire animation
-
isRunning
public boolean isRunning()
Returns true if the animation is running. Note that animation may be 'running' but no callbacks is executed yet.
-
interpolate
protected double interpolate(double progress)
Interpolate the linear progress into a more natural easing function. Depending on theAnimation, the return value of this method can be less than 0.0 or greater than 1.0.- Parameters:
progress- the linear progress, between 0.0 and 1.0- Returns:
- the interpolated progress
-
onCancel
protected void onCancel()
Called immediately after the animation is canceled. The default implementation of this method callsonComplete()only if the animation has actually started running.
-
onComplete
protected void onComplete()
Called immediately after the animation completes.
-
onStart
protected void onStart()
Called immediately before the animation starts.
-
onUpdate
protected abstract void onUpdate(double progress)
Called when the animation should be updated. The value of progress is between 0.0 and 1.0 (inclusive) (unless you override theinterpolate(double)method to provide a wider range of values). There is no guarantee thatonUpdate(double)is called with 0.0 or 1.0. If you need to perform setup or tear down procedures, you can overrideonStart()andonComplete().- Parameters:
progress- a double, normally between 0.0 and 1.0 (inclusive)
-
-