DOPunchAnchorPos Method
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
targetRectTransformpunchVector2The direction and strength of the punch (added to the RectTransform's current position)
durationfloatThe duration of the tween
vibratointIndicates how much will the punch vibrate
elasticityfloatRepresents 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
snappingboolIf TRUE the tween will smoothly snap all values to integers
Returns
- Tweener