Package com.google.gwt.animation.client
Class Animation
java.lang.Object
com.google.gwt.animation.client.Animation
- Direct Known Subclasses:
CellTree.NodeAnimation
,PopupPanel.ResizeAnimation
An
Animation
is a continuous event that updates progressively over
time at a non-fixed frame rate.-
Constructor Summary
ModifierConstructorDescriptionConstruct a newAnimation
.protected
Animation
(AnimationScheduler scheduler) Construct a newAnimationScheduler
using the specified scheduler to sheduler request frames. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Immediately cancel this animation.protected double
interpolate
(double progress) Interpolate the linear progress into a more natural easing function.boolean
Returns true if the animation is running.protected void
onCancel()
Called immediately after the animation is canceled.protected void
Called immediately after the animation completes.protected void
onStart()
Called immediately before the animation starts.protected abstract void
onUpdate
(double progress) Called when the animation should be updated.void
run
(int duration) Immediately run this animation.void
run
(int duration, double startTime) Run this animation at the given startTime.void
Run this animation at the given startTime.void
Immediately run this animation.
-
Constructor Details
-
Animation
public Animation()Construct a newAnimation
. -
Animation
Construct a newAnimationScheduler
using the specified scheduler to sheduler request frames.- Parameters:
scheduler
- anAnimationScheduler
instance
-
-
Method Details
-
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
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
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)
-