Show / Hide Table of Contents

class TransformExtensions

Convenience functions for tweening Transform.

Syntax
public static class TransformExtensions

Methods

View Source

ShakeLocalPosition(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's local position with a random vector.

Declaration
public static Tween ShakeLocalPosition(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakeLocalPosition2D(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's local position on the XY axis with a random vector.

Declaration
public static Tween ShakeLocalPosition2D(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakeLocalRotation(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's local rotation with a random vector.

Declaration
public static Tween ShakeLocalRotation(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakeLocalScale(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's local scale with a random vector.

Declaration
public static Tween ShakeLocalScale(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakeLocalScale2D(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's local scale on the XY axis with a random vector.

Declaration
public static Tween ShakeLocalScale2D(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakePosition(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's world position with a random vector.

Declaration
public static Tween ShakePosition(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakePosition2D(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's world position on the XY axis with a random vector.

Declaration
public static Tween ShakePosition2D(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

ShakeRotation(Transform, Single, Single, Int32, Single, Single)

Shake the Transform's world rotation with a random vector.

Declaration
public static Tween ShakeRotation(this Transform transform, float magnitude, float duration, int oscillationCount, float decay, float randomness)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

System.Single magnitude

The magnitude of a random direction vector that informs the range of the shake.

System.Single duration

Total tween duration in seconds.

System.Int32 oscillationCount

Number of oscillations per axis.

System.Single decay

Rate at which amplitude and frequency decrease over time.

System.Single randomness

Maximum percentage change randomly applied to amplitude and frequency per axis.

Returns
Type Description
Tween
View Source

TweenLocalPosition(Transform, Vector3, Single)

Declaration
public static Tween TweenLocalPosition(this Transform transform, Vector3 to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
UnityEngine.Vector3 to
System.Single duration
Returns
Type Description
Tween
View Source

TweenLocalPositionX(Transform, Single, Single)

Declaration
public static Tween TweenLocalPositionX(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenLocalPositionY(Transform, Single, Single)

Declaration
public static Tween TweenLocalPositionY(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenLocalPositionZ(Transform, Single, Single)

Declaration
public static Tween TweenLocalPositionZ(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenLocalRotation(Transform, Quaternion, Single)

Rotate a Transform in local space.

Declaration
public static Tween TweenLocalRotation(this Transform transform, Quaternion to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Quaternion to

The end local rotation.

System.Single duration

Length of tween in seconds.

Returns
Type Description
Tween
View Source

TweenLocalRotation(Transform, Vector3, Single)

Rotate a Transform in local space.

This supports rotating beyond 360 degrees.

Declaration
public static Tween TweenLocalRotation(this Transform transform, Vector3 to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Vector3 to

The end local rotation Euler angles in degrees.

System.Single duration

Length of tween in seconds.

Returns
Type Description
Tween
View Source

TweenLookAt(Transform, Vector3, Single)

Rotate a Transform in world space to face a point.

Declaration
public static Tween TweenLookAt(this Transform transform, Vector3 position, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Vector3 position

The point to rotate towards.

System.Single duration

Length of tween in seconds.

Returns
Type Description
Tween
View Source

TweenLookAt(Transform, Vector3, Single, Vector3)

Rotate a Transform in world space to face a point.

Declaration
public static Tween TweenLookAt(this Transform transform, Vector3 position, float duration, Vector3 up)
Parameters
Type Name Description
UnityEngine.Transform transform
UnityEngine.Vector3 position
System.Single duration
UnityEngine.Vector3 up

The up direction of the end rotation.

Returns
Type Description
Tween
View Source

TweenLookRotation(Transform, Vector3, Single)

Rotate a Transform in world space to face a direction.

Declaration
public static Tween TweenLookRotation(this Transform transform, Vector3 forward, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Vector3 forward

The end forward vector.

System.Single duration

Length of tween in seconds.

Returns
Type Description
Tween
View Source

TweenLookRotation(Transform, Vector3, Single, Vector3)

Rotate a Transform in world space to face a direction.

Declaration
public static Tween TweenLookRotation(this Transform transform, Vector3 forward, float duration, Vector3 up)
Parameters
Type Name Description
UnityEngine.Transform transform
UnityEngine.Vector3 forward
System.Single duration
UnityEngine.Vector3 up

The up direction of the end rotation.

Returns
Type Description
Tween
View Source

TweenPosition(Transform, Vector3, Single)

Declaration
public static Tween TweenPosition(this Transform transform, Vector3 to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
UnityEngine.Vector3 to
System.Single duration
Returns
Type Description
Tween
View Source

TweenPosition2D(Transform, Vector2, Single)

Declaration
public static Tween TweenPosition2D(this Transform transform, Vector2 to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
UnityEngine.Vector2 to
System.Single duration
Returns
Type Description
Tween
View Source

TweenPositionX(Transform, Single, Single)

Declaration
public static Tween TweenPositionX(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenPositionY(Transform, Single, Single)

Declaration
public static Tween TweenPositionY(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenPositionZ(Transform, Single, Single)

Declaration
public static Tween TweenPositionZ(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenRotation(Transform, Quaternion, Single)

Rotate a Transform in world space.

Quaternion rotations will always take the shortest path. For rotations beyond 360 degrees use the Euler angles override.

Declaration
public static Tween TweenRotation(this Transform transform, Quaternion to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Quaternion to

The end world rotation.

System.Single duration

Length of tween in seconds.

Returns
Type Description
Tween
View Source

TweenRotation(Transform, Vector3, Single)

Rotate a Transform in world space.

This supports rotating beyond 360 degrees.

Declaration
public static Tween TweenRotation(this Transform transform, Vector3 to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform

The transform.

UnityEngine.Vector3 to

The end world rotation Euler angles in degrees.

System.Single duration

Length of tween in seconds.

Returns
Type Description
Tween
View Source

TweenScale(Transform, Vector3, Single)

Declaration
public static Tween TweenScale(this Transform transform, Vector3 to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
UnityEngine.Vector3 to
System.Single duration
Returns
Type Description
Tween
View Source

TweenScaleX(Transform, Single, Single)

Declaration
public static Tween TweenScaleX(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenScaleY(Transform, Single, Single)

Declaration
public static Tween TweenScaleY(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
View Source

TweenScaleZ(Transform, Single, Single)

Declaration
public static Tween TweenScaleZ(this Transform transform, float to, float duration)
Parameters
Type Name Description
UnityEngine.Transform transform
System.Single to
System.Single duration
Returns
Type Description
Tween
  • View Source
On this page
Back to top Generated by DocFX