Class TweenTransformExtensions
Provides extension methods for animating UnityEngine.Transform components using the Scylla tween system.
Covers world-space position, local position, individual position axes, world and local rotation (both UnityEngine.Quaternion and Euler overloads), local scale (uniform and per-axis), as well as higher-level movement helpers such as relative offset moves, punch-scale effects, position shakes, and look-at rotations.
All methods return a pre-configured tween instance sourced from TweenPool. The tween
is not started automatically - call Play() or
PlayManaged(ITween) on the returned instance to begin playback. The start
value is captured lazily from the transform at the moment playback begins, unless you override it
with a SetFrom call before playing.
Inherited Members
Namespace: Scylla.Core.Util.Tween
Assembly: ScyllaCore.dll
Syntax
public static class TweenTransformExtensions
Methods
TweenLocalPosition(Transform, Vector3, float)
Creates a tween that animates the UnityEngine.Transform.localPosition of a transform from its
current value to endValue over the specified duration.
Local position is relative to the transform's parent. Use TweenPosition(Transform, Vector3, float) when you need to animate in world space.
Declaration
public static TweenVector3 TweenLocalPosition(this Transform transform, Vector3 endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local position will be animated. Must not be |
| Vector3 | endValue | The target local-space position relative to the transform's parent. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenLocalRotation(Transform, Quaternion, float)
Creates a tween that animates the UnityEngine.Transform.localRotation of a transform from its
current local orientation to endValue over the specified duration using
spherical linear interpolation (Slerp).
Local rotation is relative to the transform's parent. Use TweenRotation(Transform, Quaternion, float) when you need to animate in world space.
Declaration
public static TweenQuaternion TweenLocalRotation(this Transform transform, Quaternion endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local rotation will be animated. Must not be |
| Quaternion | endValue | The target local rotation as a UnityEngine.Quaternion. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenQuaternion | A TweenQuaternion instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenLocalRotation(Transform, Vector3, float)
Creates a tween that animates the UnityEngine.Transform.localRotation of a transform from its
current local orientation to the rotation described by endEuler over the
specified duration using spherical linear interpolation (Slerp).
This overload is a convenience wrapper that converts the Euler angles to a UnityEngine.Quaternion via UnityEngine.Quaternion.Euler(UnityEngine.Vector3) before delegating to TweenLocalRotation(Transform, Quaternion, float).
Declaration
public static TweenQuaternion TweenLocalRotation(this Transform transform, Vector3 endEuler, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local rotation will be animated. Must not be |
| Vector3 | endEuler | The target local rotation expressed as Euler angles in degrees (x = pitch, y = yaw, z = roll). |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenQuaternion | A TweenQuaternion instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenLookAt(Transform, Transform, float)
Creates a tween that smoothly rotates the transform's world-space orientation so that its
forward axis points toward another target transform over the specified
duration.
This overload reads target's world position at call time and delegates to
TweenLookAt(Transform, Vector3, float). The target position is therefore
fixed - if target moves after this method returns, the rotation
destination does not update.
Declaration
public static TweenQuaternion TweenLookAt(this Transform transform, Transform target, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to rotate. Must not be |
| Transform | target | The transform the animated object should face at the end of the animation. Its world position is sampled once when this method is called. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenQuaternion | A TweenQuaternion instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenLookAt(Transform, Vector3, float)
Creates a tween that smoothly rotates the transform's world-space orientation so that its
forward axis points toward target over the specified duration.
The target rotation is calculated immediately when this method is called. If
target coincides with the transform's current position, the direction
vector would be zero; in that case the transform's current forward direction is used
as a fallback to avoid an undefined rotation.
Rotation uses UnityEngine.Quaternion.LookRotation(UnityEngine.Vector3) with Vector3.up as the
implicit up vector, then delegates to TweenRotation(Transform, Quaternion, float)
for spherical linear interpolation.
Declaration
public static TweenQuaternion TweenLookAt(this Transform transform, Vector3 target, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to rotate. Must not be |
| Vector3 | target | The world-space position the transform should face at the end of the animation. If this position is the same as the transform's current position, the current forward direction is preserved. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenQuaternion | A TweenQuaternion instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenMoveBy(Transform, Vector3, float)
Creates a tween that moves a transform by a relative world-space offset
from its current position over the specified duration.
The absolute target position is computed immediately when this method is called by adding
offset to transform.position, then delegated to
TweenPosition(Transform, Vector3, float). Because the target is captured at call time, any subsequent
movement of the transform before playback begins does not affect the destination.
Declaration
public static TweenVector3 TweenMoveBy(this Transform transform, Vector3 offset, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to move. Must not be |
| Vector3 | offset | The world-space displacement to apply relative to the transform's current position at the time this method is called. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenPosition(Transform, Vector3, float)
Creates a tween that animates the world-space UnityEngine.Transform.position of a transform
from its current value to endValue over the specified duration.
Declaration
public static TweenVector3 TweenPosition(this Transform transform, Vector3 endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose world position will be animated. Must not be |
| Vector3 | endValue | The target world-space position to move the transform to. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenPositionX(Transform, float, float)
Creates a tween that animates only the X component of the transform's world-space UnityEngine.Transform.position, leaving the Y and Z components unchanged.
Declaration
public static TweenFloat TweenPositionX(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose world X position will be animated. Must not be |
| float | endValue | The target world-space X coordinate. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenFloat | A TweenFloat instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenPositionY(Transform, float, float)
Creates a tween that animates only the Y component of the transform's world-space UnityEngine.Transform.position, leaving the X and Z components unchanged.
Declaration
public static TweenFloat TweenPositionY(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose world Y position will be animated. Must not be |
| float | endValue | The target world-space Y coordinate. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenFloat | A TweenFloat instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenPositionZ(Transform, float, float)
Creates a tween that animates only the Z component of the transform's world-space UnityEngine.Transform.position, leaving the X and Y components unchanged.
Declaration
public static TweenFloat TweenPositionZ(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose world Z position will be animated. Must not be |
| float | endValue | The target world-space Z coordinate. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenFloat | A TweenFloat instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenPunchScale(Transform, Vector3, float)
Creates a tween that produces a punch-scale effect: the transform's
UnityEngine.Transform.localScale scales up by punch and then returns to its
original value using a Yoyo loop.
The effect is implemented as two Yoyo loop iterations of a half-duration tween. The first
half animates from the current scale to currentScale + punch, and the second half
reverses back. The total elapsed time of the effect equals duration.
The original scale is captured at call time, not at playback start. If you change the transform's scale between calling this method and starting playback, the return target may differ from the actual scale at that moment.
Declaration
public static TweenVector3 TweenPunchScale(this Transform transform, Vector3 punch, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to punch. Must not be |
| Vector3 | punch | The scale delta to add during the punch-out phase. For example,
|
| float | duration | The total duration of the punch-and-return cycle in seconds. |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance configured with |
See Also
TweenRotation(Transform, Quaternion, float)
Creates a tween that animates the world-space UnityEngine.Transform.rotation of a transform
from its current orientation to endValue over the specified duration using
spherical linear interpolation (Slerp).
Declaration
public static TweenQuaternion TweenRotation(this Transform transform, Quaternion endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose world rotation will be animated. Must not be |
| Quaternion | endValue | The target world-space rotation as a UnityEngine.Quaternion. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenQuaternion | A TweenQuaternion instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenRotation(Transform, Vector3, float)
Creates a tween that animates the world-space UnityEngine.Transform.rotation of a transform
from its current orientation to the rotation described by endEuler over the
specified duration using spherical linear interpolation (Slerp).
This overload is a convenience wrapper that converts the Euler angles to a UnityEngine.Quaternion via UnityEngine.Quaternion.Euler(UnityEngine.Vector3) before delegating to TweenRotation(Transform, Quaternion, float).
Declaration
public static TweenQuaternion TweenRotation(this Transform transform, Vector3 endEuler, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose world rotation will be animated. Must not be |
| Vector3 | endEuler | The target rotation expressed as Euler angles in degrees (x = pitch, y = yaw, z = roll). |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenQuaternion | A TweenQuaternion instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenScale(Transform, float, float)
Creates a tween that animates the UnityEngine.Transform.localScale of a transform uniformly
to Vector3.one * over the specified duration.endValue
This is a convenience wrapper over TweenScale(Transform, Vector3, float) that constructs a uniform target scale vector, keeping all three axes at the same value.
Declaration
public static TweenVector3 TweenScale(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local scale will be animated uniformly. Must not be |
| float | endValue | The target uniform scale value applied equally to the X, Y, and Z axes. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenScale(Transform, Vector3, float)
Creates a tween that animates the UnityEngine.Transform.localScale of a transform from its
current value to endValue over the specified duration.
Unity only exposes local scale - there is no world-scale equivalent. If you need uniform scaling, use the TweenScale(Transform, float, float) overload instead.
Declaration
public static TweenVector3 TweenScale(this Transform transform, Vector3 endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local scale will be animated. Must not be |
| Vector3 | endValue | The target local scale as a UnityEngine.Vector3 with per-axis values. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenScaleX(Transform, float, float)
Creates a tween that animates only the X component of the transform's UnityEngine.Transform.localScale, leaving the Y and Z components unchanged.
Declaration
public static TweenFloat TweenScaleX(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local X scale will be animated. Must not be |
| float | endValue | The target local X scale value. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenFloat | A TweenFloat instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenScaleY(Transform, float, float)
Creates a tween that animates only the Y component of the transform's UnityEngine.Transform.localScale, leaving the X and Z components unchanged.
Declaration
public static TweenFloat TweenScaleY(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local Y scale will be animated. Must not be |
| float | endValue | The target local Y scale value. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenFloat | A TweenFloat instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenScaleZ(Transform, float, float)
Creates a tween that animates only the Z component of the transform's UnityEngine.Transform.localScale, leaving the X and Y components unchanged.
Declaration
public static TweenFloat TweenScaleZ(this Transform transform, float endValue, float duration)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform whose local Z scale will be animated. Must not be |
| float | endValue | The target local Z scale value. |
| float | duration | The length of the animation in seconds. Pass |
Returns
| Type | Description |
|---|---|
| TweenFloat | A TweenFloat instance ready for configuration and playback. Call Play() or PlayManaged(ITween) to start the animation. |
See Also
TweenShakePosition(Transform, Vector3, float, int)
Creates a tween that produces a shake effect by displacing the transform's world-space UnityEngine.Transform.position around its original location with a decaying, multi-axis oscillation, then restoring the exact original position on completion.
The displacement on each axis is a sine wave whose frequency scales with
vibrato and whose amplitude is the matching component of
strength, multiplied by a linear damper that falls from 1 to
0 over the duration so the shake settles instead of stopping abruptly. The three
axes use offset frequencies and phases so the motion reads as an irregular shake rather
than a straight-line oscillation. An OnComplete(Action) callback snaps the
position back to the original value to prevent floating-point drift.
Declaration
public static TweenVector3 TweenShakePosition(this Transform transform, Vector3 strength, float duration, int vibrato = 10)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | transform | The transform to shake. Must not be |
| Vector3 | strength | The shake amplitude vector. Each axis controls the maximum displacement in that direction, in world units. Zero on an axis disables shaking along it. |
| float | duration | The total duration of the shake effect in seconds. |
| int | vibrato | The number of full oscillation cycles across |
Returns
| Type | Description |
|---|---|
| TweenVector3 | A TweenVector3 instance that drives the shake and, on completion, restores the original position. Call Play() or PlayManaged(ITween) to start the animation. |