Tween
Tween object for creating smooth animations and transitions. Tween objects are used to create smooth animations and transitions between values. They can be used to animate properties of objects, such as position, scale, rotation, and color. Tweens can be played, paused, stopped, and updated. They can also be delayed, looped, and ping-ponged. Easing functions can be applied to tweens to create different effects, such as acceleration and deceleration. Tweens can be created using the Tween.new method.
Properties
Returns the tween duration in seconds. Note that zero will be returned if the tween is not playing.
Returns true if any tween is currently animating.
Returns true if the tween is currently paused
Returns true if the tween is valid and currently playing. Note that false will always be returned for Element tweens as the play state is managed by the top level collection tween.
Returns true if the tween has not been stopped
Get the current elapsed time using a normalized time of 0-1
Get current elapsed time in seconds.
Methods
Add a number of seconds to the existing delay amount. If the value added decreases the delay below zero the it will be set to zero.
Parameters
seconds
Returns
Whether or not the tween should automatically stop itself when the float Tween.time is greater or equal to the float Tween.duration
Note that a tween set to not auto stop will never end until manually stopped.
Parameters
value
Returns
Set the tween to automatically deactivate the GameObject attached to the target when the Tween stops
Parameters
value
Returns
Amount of time to wait before starting the tween.
Note that the OnStart method will not be called until after the delay.
When Delay is used on a looping tween the delay is only applied once and not on each loop.
Parameters
seconds
Delay in seconds
Returns
Set the tween to automatically destroy the GameObject attached to the target when the Tween stops
Parameters
value
Returns
Automatically disable the target Component when the Tween stops
Parameters
value
Returns
Set the duration in seconds of the tween.
Using the Duration modifier on either a Sequence or a Group will cause the duration of all elements to be overridden with the given duration.
Parameters
seconds
Duration in seconds
Returns
Ease in using the given easing function
Parameters
easeDelegate
Delegate to use for easing int
Returns
Ease in using the given easing function
Applies an ease-in back easing function to the tween. This function overshoots the target value before settling into place.
Parameters
amplitude
Returns
Applies an ease-in bounce easing function to the tween. This function creates a bouncing effect.
Parameters
oscillations
springiness
Returns
Applies an ease-in circle easing function to the tween. This function accelerates the tween animation.
Returns
Ease in using Cubic interpolation
Returns
Applies an ease-in cubic Bezier easing function to the tween. This function accelerates the tween animation.
Parameters
p0
p1
p2
p3
Returns
Applies an ease-in elastic easing function to the tween. This function creates a spring-like effect.
Parameters
oscillations
springiness
Returns
Applies an ease-in exponential easing function to the tween. This function accelerates the tween animation.
Parameters
exponent
Returns
Applies an ease-in-out back easing function to the tween. This function overshoots the target value before settling into place.
Parameters
amplitude
Returns
Applies an ease-in-out bounce easing function to the tween. This function creates a bouncing effect.
Parameters
oscillations
springiness
Returns
Applies an ease-in-out circle easing function to the tween. This function accelerates and decelerates the tween animation.
Returns
Ease in and out using Cubic interpolation
Returns
Applies an ease-in-out cubic Bezier easing function to the tween. This function accelerates and decelerates the tween animation.
Parameters
p0
p1
p2
p3
Returns
Applies an ease-in-out elastic easing function to the tween. This function creates a spring-like effect.
Parameters
oscillations
springiness
Returns
Applies an ease-in-out exponential easing function to the tween. This function accelerates and decelerates the tween animation.
Parameters
exponent
Returns
Ease in and out using Quadratic interpolation
Returns
Applies an ease-in-out sine easing function to the tween. This function accelerates and decelerates the tween animation.
Returns
Ease in using Quadratic interpolation
Returns
Applies an ease-in sine easing function to the tween. This function accelerates the tween animation.
Returns
Ease out using the given easing function
Parameters
easeDelegate
Delegate to use for easing out
Returns
Ease out using the given easing function
Applies an ease-out back easing function to the tween. This function overshoots the target value before settling into place.
Parameters
amplitude
Returns
Applies an ease-out bounce easing function to the tween. This function creates a bouncing effect.
Parameters
oscillations
springiness
Returns
Applies an ease-out circle easing function to the tween. This function decelerates the tween animation.
Returns
Ease Out using Cubic interpolation
Returns
Applies an ease-out cubic Bezier easing function to the tween. This function decelerates the tween animation.
Parameters
p0
p1
p2
p3
Returns
Applies an ease-out elastic easing function to the tween. This function creates a spring-like effect.
Parameters
oscillations
springiness
Returns
Applies an ease-out exponential easing function to the tween. This function decelerates the tween animation.
Parameters
exponent
Returns
Ease Out using Quadratic interpolation
Returns
Applies an ease-out sine easing function to the tween. This function decelerates the tween animation.
Returns
Switch the tween to start the configured 'from' value and end at the current value
Returns
Set a unique identifier for the tween. Setting a unique identifier value of zero indicates that a tween has no identifier.
Parameters
id
Unique identier
Returns
Loop the tween
Parameters
count
Number of loops or -1 to loop forever
Returns
Callback to invoke when the Tween starts playing and the delay is finished
Parameters
callback
Action
Returns
Callback to invoke when the Tween is stopped
Note that the OnStop callback may not be called if the tween is stopped using an executeCallbacks value of false.
Parameters
callback
Action
Returns
Pause the tween until either Play is called again or the tween is stopped
Returns
Enables or PingPong mode.
Returns
Enables or PingPong mode.
Parameters
value
Returns
Start the tween playing. Note that once a tween begins playing it can no longer me modified.
Returns
Sets a user defined value that indicates the priority of the tween. This priority is then used in Tween.Frame to allow the application to determine the max priority being run
Parameters
priority
Returns
Call to completely reset the tween system by stopping all running tweens, clearing all the caches, and stopping the updater
Returns
Stop all tweens running on a target object
Parameters
id
Optional identifier to filter by (0 = no identifier)
executeCallbacks
True if any remaining callbacks such as OnStop should be called (Default true)
Returns
Stop all tweens running on a target object
Parameters
executeCallbacks
True if any remaining callbacks such as OnStop should be called (Default true)
Returns
Stop all playing tweens
Parameters
executeCallbacks
Returns
Sets the animation to use unscaled time rather than normal scaled time
Parameters
unscaled
True to use unscaled time
Returns
Manually update the tween by adding the given amount of delta time
Parameters
deltaTime
Returns
True if the tween is still running
Updated 4 days ago