Table of Contents

DOShakeAnchorPos Method

Namespace
DG.Tweening

DOShakeAnchorPos(RectTransform, float, float, int, float, bool, bool, ShakeRandomnessMode)

public static Tweener DOShakeAnchorPos(this RectTransform target, float duration, float strength = 100, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true, ShakeRandomnessMode randomnessMode = null)

Shakes a RectTransform's anchoredPosition with the given values. Also stores the RectTransform as the tween's target so it can be used for filtered operations

Parameters

target RectTransform
duration float

The duration of the tween

strength float

The shake strength

vibrato int

Indicates how much will the shake vibrate

randomness float

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.

snapping bool

If TRUE the tween will smoothly snap all values to integers

fadeOut bool

If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not

randomnessMode ShakeRandomnessMode

Randomness mode

Returns

Tweener

DOShakeAnchorPos(RectTransform, float, Vector2, int, float, bool, bool, ShakeRandomnessMode)

public static Tweener DOShakeAnchorPos(this RectTransform target, float duration, Vector2 strength, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true, ShakeRandomnessMode randomnessMode = null)

Shakes a RectTransform's anchoredPosition with the given values. Also stores the RectTransform as the tween's target so it can be used for filtered operations

Parameters

target RectTransform
duration float

The duration of the tween

strength Vector2

The shake strength on each axis

vibrato int

Indicates how much will the shake vibrate

randomness float

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.

snapping bool

If TRUE the tween will smoothly snap all values to integers

fadeOut bool

If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not

randomnessMode ShakeRandomnessMode

Randomness mode

Returns

Tweener