Table of Contents

DOPunchAnchorPos Method

Namespace
DG.Tweening

DOPunchAnchorPos(RectTransform, Vector2, float, int, float, bool)

public static Tweener DOPunchAnchorPos(this RectTransform target, Vector2 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false)

Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one as if it was connected to the starting position via an elastic. Also stores the RectTransform as the tween's target so it can be used for filtered operations

Parameters

target RectTransform
punch Vector2

The direction and strength of the punch (added to the RectTransform's current position)

duration float

The duration of the tween

vibrato int

Indicates how much will the punch vibrate

elasticity float

Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. 1 creates a full oscillation between the punch direction and the opposite direction, while 0 oscillates only between the punch and the start position

snapping bool

If TRUE the tween will smoothly snap all values to integers

Returns

Tweener