Objective
Dotween is still alpha, so there are some missing features (such as Path plug-ins, additional callbacks, and other tween options), and this document may change in the near future.
I. Terminology
Tweener a tween control value and animates
Sequence a special tween does not control value, and with other tween it becomes an animation group .
Tween A common word that can represent either Tweener or a sequence
Nested Tween a tween containing the sequence
Prefix
Prefixes are very important in IntelliSense, so remember them as much as possible:
The Do prefix is a shortcut to all tween (you can manipulate a known object directly, such as transform or material), and is the main prefix of the Dotween class.
Transform. Domovex (1); transform. Dorestart ();D otween.play ();
Set prefix, all tween settings
Mytween.setloops (4, Looptype.yoyo). Setspeedbased ();
On prefix, all tween callbacks
Mytween.onstart (mystartfunction). OnComplete (mycompletefunction);
Second, Dotween.init
When you create the Tween,dotween for the first time, it will be automatically initialized with default values.
If you prefer to initialize yourself (recommended), call these methods one at a time before creating any tween (there will be no effect after creation).
Think about it, you can use Dotween's global settting to change all the initialization settings.
Alternatively, you can use the chain setcapacity initialization method, which can set the initial capacity of the Tweeners maximum/fps (which can be called in a higher version)
Static Dotween.init (default)
Like what:
Dotween.init (True, Logbehaviour.verbose). Setcapacity (ten);
Third, Creating a Tweener
Tweener is like an ant working for Dotween, which animates a given value with an attribute/field.
Until now Dotween can handle these types of values:
Float,int,uint,vector2/3/4,quaternion,rect,rectoffset,string
There are three ways of creating Tweener
A. Convenient Way
Dotween includes some known unity objects, such as transform,rigidbody and material, and you can tween them directly (which also automatically sets the object itself as target) such as:
Transform. Domove (new Vector3 (2,3,4), 1); Rigidbody. Domove (new Vector3 (2,3,4), 1); material. Docolor (Color.green, 1);
All of these quick ways also have from, except for special instructions, just add the from after the method name
Transform. Domovefrom (new Vector3 (2,3,4), 1); Rigidbody. Domovefrom (new Vector3 (2,3,4), 1); material. Docolorfrom (Color.green, 1);
Camera
float duration) doshakeposition (float randomness) doshakerotation (float randomness)
Lightmaterialrigidbodymovespriterenderer
For detailed documentation please refer to the official:
Transformmove
BOOL snapping) Domovex/domovey/domovez (bool snapping) Dolocalmovex/dolocalmovey/dolocalmovez ( bool snapping)
Rotate
Float duration)
Scale
float duration) Doscalex/doscaley/doscalez (float duration)
Punch–no from
float elasticity)
Shake–no from
float elasticity)
WaitFor coroutines
WaitForCompletion () waitforelapsedloops (int elapsedloops) Waitforkill () waitforposition (float position) Waitforstart ()
The back of most simple is no longer one by one translated, the official English document:
Dotween Documentation
Dotween some Chinese documents