Skip to content

Tween Reference

BeauchesneFilament edited this page Apr 30, 2019 · 1 revision

Tween Shortcuts

Generic tween shortcuts currently exist for the following types:

Type Function
Float Tween.Float
Tween.ZeroToOne
Tween.OneToZero
Integer Tween.Int
Vector2 Tween.Vector
Vector3 Tween.Vector
Vector4 Tween.Vector
Rect Tween.Rect
RectOffset Tween.RectOffset
Quaternion Tween.Quaternion
Color Tween.Color
AnimationCurve Tween.FloatCurve
Gradient Tween.Gradient

Tween extension methods currently exist for the following types:

Type Property Function
Transform Position MoveTo, MoveToWithSpeed
Scale ScaleTo, SquashStretchTo
Rotation RotateTo, LookAt
Transform TransformTo
RectTransform Anchored Position AnchorPosTo
Anchors AnchorTo
Size Delta SizeDeltaTo
Pivot PivotTo
RectTransform RectTransformTo
AudioSource Volume VolumeTo
Pitch PitchTo
Pan PanTo
Camera Orthographic Size OrthoSizeTo
Field of View FieldOfViewTo
Background Color BackgroundColorTo, BackgroundGradient
Rendering
SpriteRenderer Color/Alpha ColorTo, FadeTo, Gradient
TextMesh Color/Alpha Property ColorTo, FadeTo, Gradient
Material Color/Alpha Property ColorTo, FadeTo, Gradient
Float Property FloatTo
Vector4 Property VectorTo
Light Range RangeTo
Intensity IntensityTo
Spotlight Angle SpotAngleTo
Shadow Strength ShadowStrengthTo
Color ColorTo, Gradient
SkinnedMeshRenderer Blend Shape Weight BlendShapeTo
Canvas
CanvasGroup Alpha FadeTo
CanvasRenderer Color/Alpha ColorTo, FadeTo, Gradient
Graphic Color/Alpha ColorTo, FadeTo, Gradient
Image Fill Amount FillTo
RawImage UV Rect UVRectTo, UVRectShift
ScrollRect Normalized Position NormalizedPosTo
Slider Value ValueTo
Normalized Value NormalizedValueTo
Scrollbar Value ValueTo
Size SizeTo
Layout
LayoutElement Min Width/Height MinSizeTo
Preferred Width/Height PreferredSizeTo
Flexible Width/Height FlexibleSizeTo
LayoutGroup Padding PaddingTo
HorizontalOrVerticalLayoutGroup Spacing SpacingTo
GridLayoutGroup Spacing SpacingTo
Cell Size CellSizeTo
BeauRoutine
Routine Time Scale TimeScaleTo
RoutineIdentity Time Scale TimeScaleTo

Tween Modifiers

These functions will modify Tween objects. Do not call once the Tween has started.

Function Description
Modifying Output
Ease Applies a smoothing function or AnimationCurve to the Tween.
Wave Applies a wave function to the Tween.
From Start and end values are reversed. Tween runs from end to start.
To [Default] Tween runs from start to end.
Looping
Loop Tween will loop, with an optional number of loops.
Yoyo Tween will reach the end value, then repeat from end to start.
YoyoLoop Tween will yoyo and loop, with an optional number of loops.
Once [Default] Tween will play once.
Timing
Duration Sets the duration, in seconds, of a single cycle.
Randomize Starts the Tween from a random position in its timeline.
StartsAt Starts the Tween from a set position in its timeline.
DelayBy Starts the Tween after a certain amount of seconds have elapsed.
Events
OnStart Registers a function called when the Tween starts up.
OnUpdate Registers a function called every frame while the Tween is running.
OnComplete Registers a function called when the Tween ends.
Cancel Behavior
RevertOnCancel Tween will revert back to starting value if cancelled mid-execution.
ForceOnCancel Tween will skip to its end value if cancelled mid-execution.
KeepOnCancel [Default] Tween will keep its current value if cancelled mid-execution.
Playing
Play Starts a Routine to play the Tween. Shortcut for Routine.Start( tween ) or Routine.Start( host, tween ).
Clone this wiki locally