DOTween
0.8.530
|
Main DOTween class. Contains static methods to create and control tweens in a generic way More...
Static Public Member Functions | |
static IDOTweenInit | Init (bool recycleAllByDefault=false, bool useSafeMode=true, LogBehaviour logBehaviour=LogBehaviour.ErrorsOnly) |
Must be called once, before the first ever DOTween call/reference, otherwise it will be called automatically and will use default options. Calling it a second time won't have any effect. More... | |
static void | SetTweensCapacity (int tweenersCapacity, int sequencesCapacity) |
Directly sets the current max capacity of Tweeners and Sequences (meaning how many Tweeners and Sequences can be running at the same time), so that DOTween doesn't need to automatically increase them in case the max is reached (which might lead to hiccups when that happens). Sequences capacity must be less or equal to Tweeners capacity (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). Beware: use this method only when there are no tweens running. More... | |
static void | Clear (bool destroy=false) |
Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. More... | |
static void | ClearCachedTweens () |
Clears all cached tween pools. More... | |
static TweenerCore< float, float, FloatOptions > | To (DOGetter< float > getter, DOSetter< float > setter, float endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static Tweener | To (DOGetter< int > getter, DOSetter< int > setter, int endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static Tweener | To (DOGetter< uint > getter, DOSetter< uint > setter, uint endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< string, string, StringOptions > | To (DOGetter< string > getter, DOSetter< string > setter, string endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< Vector2, Vector2, VectorOptions > | To (DOGetter< Vector2 > getter, DOSetter< Vector2 > setter, Vector2 endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< Vector3, Vector3, VectorOptions > | To (DOGetter< Vector3 > getter, DOSetter< Vector3 > setter, Vector3 endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< Vector4, Vector4, VectorOptions > | To (DOGetter< Vector4 > getter, DOSetter< Vector4 > setter, Vector4 endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< Quaternion, Vector3, QuaternionOptions > | To (DOGetter< Quaternion > getter, DOSetter< Quaternion > setter, Vector3 endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< Color, Color, ColorOptions > | To (DOGetter< Color > getter, DOSetter< Color > setter, Color endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< Rect, Rect, RectOptions > | To (DOGetter< Rect > getter, DOSetter< Rect > setter, Rect endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static Tweener | To (DOGetter< RectOffset > getter, DOSetter< RectOffset > setter, RectOffset endValue, float duration) |
Tweens a property or field to the given value using default plugins More... | |
static TweenerCore< T1, T2, TPlugOptions > | To< T1, T2, TPlugOptions > (ABSTweenPlugin< T1, T2, TPlugOptions > plugin, DOGetter< T1 > getter, DOSetter< T1 > setter, T2 endValue, float duration) |
Tweens a property or field to the given value using a custom plugin More... | |
static TweenerCore< Vector3, Vector3, VectorOptions > | ToAxis (DOGetter< Vector3 > getter, DOSetter< Vector3 > setter, float endValue, float duration, AxisConstraint axisConstraint=AxisConstraint.X) |
Tweens only one axis of a Vector3 to the given value using default plugins. More... | |
static Tweener | ToAlpha (DOGetter< Color > getter, DOSetter< Color > setter, float endValue, float duration) |
Tweens only the alpha of a Color to the given value using default plugins More... | |
static Tweener | To (DOSetter< float > setter, float startValue, float endValue, float duration) |
Tweens a virtual property from the given start to the given end value and implements a setter that allows to use that value with an external method or a lambda More... | |
static TweenerCore< Vector3, Vector3[], Vector3ArrayOptions > | Punch (DOGetter< Vector3 > getter, DOSetter< Vector3 > setter, Vector3 direction, float duration, int vibrato=10, float elasticity=1) |
Punches a Vector3 towards the given direction and then back to the starting one as if it was connected to the starting position via an elastic. More... | |
static TweenerCore< Vector3, Vector3[], Vector3ArrayOptions > | Shake (DOGetter< Vector3 > getter, DOSetter< Vector3 > setter, float duration, float strength=3, int vibrato=10, float randomness=90, bool ignoreZAxis=true) |
Shakes a Vector3 with the given values. More... | |
static TweenerCore< Vector3, Vector3[], Vector3ArrayOptions > | ToArray (DOGetter< Vector3 > getter, DOSetter< Vector3 > setter, Vector3[] endValues, float[] durations) |
Tweens a property or field to the given values using default plugins. Ease is applied between each segment and not as a whole. More... | |
static Sequence | Sequence () |
Returns a new Sequence to be used for tween groups More... | |
static int | Complete () |
Completes all tweens and returns the number of actual tweens completed (meaning tweens that don't have infinite loops and were not already complete) More... | |
static int | Complete (object targetOrId) |
Completes all tweens with the given ID or target and returns the number of actual tweens completed (meaning the tweens that don't have infinite loops and were not already complete) More... | |
static int | Flip () |
Flips all tweens (changing their direction to forward if it was backwards and viceversa), then returns the number of actual tweens flipped More... | |
static int | Flip (object targetOrId) |
Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), then returns the number of actual tweens flipped More... | |
static int | Goto (float to, bool andPlay=false) |
Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved More... | |
static int | Goto (object targetOrId, float to, bool andPlay=false) |
Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) and returns the actual tweens involved More... | |
static int | Kill () |
Kills all tweens and returns the number of actual tweens killed More... | |
static int | Kill (object targetOrId) |
Kills all tweens with the given ID or target and returns the number of actual tweens killed More... | |
static int | Pause () |
Pauses all tweens and returns the number of actual tweens paused More... | |
static int | Pause (object targetOrId) |
Pauses all tweens with the given ID or target and returns the number of actual tweens paused (meaning the tweens that were actually playing and have been paused) More... | |
static int | Play () |
Plays all tweens and returns the number of actual tweens played (meaning tweens that were not already playing or complete) More... | |
static int | Play (object targetOrId) |
Plays all tweens with the given ID or target and returns the number of actual tweens played (meaning the tweens that were not already playing or complete) More... | |
static int | PlayBackwards () |
Plays backwards all tweens and returns the number of actual tweens played (meaning tweens that were not already started, playing backwards or rewinded) More... | |
static int | PlayBackwards (object targetOrId) |
Plays backwards all tweens with the given ID or target and returns the number of actual tweens played (meaning the tweens that were not already started, playing backwards or rewinded) More... | |
static int | PlayForward () |
Plays forward all tweens and returns the number of actual tweens played (meaning tweens that were not already playing forward or complete) More... | |
static int | PlayForward (object targetOrId) |
Plays forward all tweens with the given ID or target and returns the number of actual tweens played (meaning the tweens that were not already playing forward or complete) More... | |
static int | Restart (bool includeDelay=true) |
Restarts all tweens, then returns the number of actual tweens restarted More... | |
static int | Restart (object targetOrId, bool includeDelay=true) |
Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted More... | |
static int | Rewind (bool includeDelay=true) |
Rewinds and pauses all tweens, then returns the number of actual tweens rewinded (meaning tweens that were not already rewinded) More... | |
static int | Rewind (object targetOrId, bool includeDelay=true) |
Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded (meaning the tweens that were not already rewinded) More... | |
static int | TogglePause () |
Toggles the play state of all tweens and returns the number of actual tweens toggled (meaning tweens that could be played or paused, depending on the toggle state) More... | |
static int | TogglePause (object targetOrId) |
Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled (meaning the tweens that could be played or paused, depending on the toggle state) More... | |
static bool | IsTweening (object targetOrId) |
Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not). More... | |
static int | TotPlayingTweens () |
Returns the total number of active and playing tweens. A tween is considered as playing even if its delay is actually playing More... | |
Static Public Attributes | |
static readonly string | Version = "0.8.530" |
DOTween's version More... | |
static bool | useSafeMode = true |
If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things (like targets becoming null while a tween is playing) More... | |
static bool | showUnityEditorReport = false |
If TRUE you will get a DOTween report when exiting play mode (only in the Editor). Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. Beware, this will slightly slow down your tweens while inside Unity Editor. More... | |
static float | timeScale = 1 |
Global DOTween timeScale More... | |
static AutoPlay | defaultAutoPlay = AutoPlay.All |
Default autoPlay behaviour for new tweens More... | |
static bool | defaultAutoKill = true |
Default autoKillOnComplete behaviour for new tweens More... | |
static LoopType | defaultLoopType = LoopType.Restart |
Default loopType applied to all new tweens More... | |
static bool | defaultRecyclable |
If TRUE all newly created tweens are set as recyclable, otherwise not More... | |
static Ease | defaultEaseType = Ease.InOutQuad |
Default ease applied to all new tweens More... | |
static float | defaultEaseOvershootOrAmplitude = 1.70158f |
Default overshoot/amplitude used for eases More... | |
static float | defaultEasePeriod = 0 |
Default period used for eases More... | |
Properties | |
static LogBehaviour | logBehaviour [get, set] |
DOTween's log behaviour More... | |
Main DOTween class. Contains static methods to create and control tweens in a generic way
|
static |
Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values.
destroy | If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else (so that next time you use it it will need to be re-initialized) |
|
static |
Clears all cached tween pools.
|
static |
Completes all tweens and returns the number of actual tweens completed (meaning tweens that don't have infinite loops and were not already complete)
|
static |
Completes all tweens with the given ID or target and returns the number of actual tweens completed (meaning the tweens that don't have infinite loops and were not already complete)
|
static |
Flips all tweens (changing their direction to forward if it was backwards and viceversa), then returns the number of actual tweens flipped
|
static |
Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), then returns the number of actual tweens flipped
|
static |
Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved
|
static |
Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) and returns the actual tweens involved
|
static |
Must be called once, before the first ever DOTween call/reference, otherwise it will be called automatically and will use default options. Calling it a second time won't have any effect.
You can chain SetCapacity
to this method, to directly set the max starting size of Tweeners and Sequences:
DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20);
recycleAllByDefault | If TRUE all new tweens will be set for recycling, meaning that when killed, instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active even if they were killed (since they might have been respawned and are now being used for other tweens). |
If you want to automatically set your tween references to NULL when a tween is killed you can use the OnKill callback like this:
.OnKill(()=> myTweenReference = null)
You can change this setting at any time by changing the static DOTween.defaultRecyclable property, or you can set the recycling behaviour for each tween separately, using:
SetRecyclable(bool recyclable)
Default: FALSE
useSafeMode | If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things (like targets becoming null while a tween is playing). You can change this setting at any time by changing the static DOTween.useSafeMode property. |
Default: FALSE
logBehaviour | Type of logging to use. You can change this setting at any time by changing the static DOTween.logBehaviour property. |
Default: ErrorsOnly
|
static |
Returns TRUE if a tween with the given ID or target is active (regardless if it's playing or not).
You can also use this to know if a shortcut tween is active for a given target.
Example:
transform.DOMoveX(45, 1); // transform is automatically added as the tween target
DOTween.IsTweening(transform); // Returns true
|
static |
Kills all tweens and returns the number of actual tweens killed
|
static |
Kills all tweens with the given ID or target and returns the number of actual tweens killed
|
static |
Pauses all tweens and returns the number of actual tweens paused
|
static |
Pauses all tweens with the given ID or target and returns the number of actual tweens paused (meaning the tweens that were actually playing and have been paused)
|
static |
Plays all tweens and returns the number of actual tweens played (meaning tweens that were not already playing or complete)
|
static |
Plays all tweens with the given ID or target and returns the number of actual tweens played (meaning the tweens that were not already playing or complete)
|
static |
Plays backwards all tweens and returns the number of actual tweens played (meaning tweens that were not already started, playing backwards or rewinded)
|
static |
Plays backwards all tweens with the given ID or target and returns the number of actual tweens played (meaning the tweens that were not already started, playing backwards or rewinded)
|
static |
Plays forward all tweens and returns the number of actual tweens played (meaning tweens that were not already playing forward or complete)
|
static |
Plays forward all tweens with the given ID or target and returns the number of actual tweens played (meaning the tweens that were not already playing forward or complete)
|
static |
Punches a Vector3 towards the given direction and then back to the starting one as if it was connected to the starting position via an elastic.
This tween type generates some GC allocations at startup
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
direction | The direction and strength of the punch |
duration | The duration of the tween |
vibrato | Indicates how much will the punch vibrate |
elasticity | Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. 1 creates a full oscillation between the direction and the opposite decaying direction, while 0 oscillates only between the starting position and the decaying direction |
|
static |
Restarts all tweens, then returns the number of actual tweens restarted
|
static |
Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted
|
static |
Rewinds and pauses all tweens, then returns the number of actual tweens rewinded (meaning tweens that were not already rewinded)
|
static |
Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded (meaning the tweens that were not already rewinded)
|
static |
Directly sets the current max capacity of Tweeners and Sequences (meaning how many Tweeners and Sequences can be running at the same time), so that DOTween doesn't need to automatically increase them in case the max is reached (which might lead to hiccups when that happens). Sequences capacity must be less or equal to Tweeners capacity (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). Beware: use this method only when there are no tweens running.
tweenersCapacity | Max Tweeners capacity. Default: 200 |
sequencesCapacity | Max Sequences capacity. Default: 50 |
|
static |
Shakes a Vector3 with the given values.
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
duration | The duration of the tween |
strength | The shake strength |
vibrato | Indicates how much will the shake vibrate |
randomness | Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). Setting it to 0 will shake along a single direction and behave like a random punch. |
ignoreZAxis | If TRUE only shakes on the X Y axis (looks better with things like cameras). |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a virtual property from the given start to the given end value and implements a setter that allows to use that value with an external method or a lambda
Example:
To(MyMethod, 0, 12, 0.5f);
Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween)
setter | The action to perform with the tweened value |
startValue | The value to start from |
endValue | The end value to reach |
duration | The duration of the virtual tween |
|
static |
Tweens a property or field to the given value using a custom plugin
plugin | The plugin to use. Each custom plugin implements a static Get() method you'll need to call to assign the correct plugin in the correct way, like this: |
CustomPlugin.Get()
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
TPlugOptions | : | struct |
|
static |
Tweens only the alpha of a Color to the given value using default plugins
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
|
static |
Tweens a property or field to the given values using default plugins. Ease is applied between each segment and not as a whole.
This tween type generates some GC allocations at startup
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValues | The end values to reach for each segment. This array must have the same length as durations |
durations | The duration of each segment. This array must have the same length as endValues |
|
static |
Tweens only one axis of a Vector3 to the given value using default plugins.
getter | A getter for the field or property to tween. |
Example usage with lambda:
()=> myProperty
setter | A setter for the field or property to tween |
Example usage with lambda:
x=> myProperty = x
endValue | The end value to reach |
duration | The tween's duration |
axisConstraint | The axis to tween |
|
static |
Toggles the play state of all tweens and returns the number of actual tweens toggled (meaning tweens that could be played or paused, depending on the toggle state)
|
static |
Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled (meaning the tweens that could be played or paused, depending on the toggle state)
|
static |
Returns the total number of active and playing tweens. A tween is considered as playing even if its delay is actually playing
|
static |
Default autoKillOnComplete behaviour for new tweens
|
static |
Default autoPlay behaviour for new tweens
|
static |
Default overshoot/amplitude used for eases
Default: 1.70158f
|
static |
Default period used for eases
Default: 0
|
static |
Default ease applied to all new tweens
|
static |
Default loopType applied to all new tweens
|
static |
If TRUE all newly created tweens are set as recyclable, otherwise not
|
static |
If TRUE you will get a DOTween report when exiting play mode (only in the Editor). Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. Beware, this will slightly slow down your tweens while inside Unity Editor.
Default: FALSE
|
static |
Global DOTween timeScale
|
static |
If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things (like targets becoming null while a tween is playing)
|
static |
DOTween's version
|
staticgetset |
DOTween's log behaviour