7using System.Collections;
29 [AddComponentMenu(
"UI/Extensions/UI Tween Scale")]
34 [Tooltip(
"Animation speed multiplier")]
37 [Tooltip(
"If true animation will loop, for best effect set animation curve to loop on start and end point")]
41 [Tooltip(
"If true animation will start automatically, otherwise you need to call Play() method to start the animation")]
47 [Header(
"Non uniform scale")]
48 [Tooltip(
"If true component will scale by the same amount in X and Y axis, otherwise use animCurve for X scale and animCurveY for Y scale")]
52 private Vector3 initScale;
53 private Transform myTransform;
57 myTransform = GetComponent<Transform>();
58 initScale = myTransform.localScale;
67 StartCoroutine(
"Tween");
70 Vector3 newScale = Vector3.one;
74 myTransform.localScale = initScale;
80 t +=
speed * Time.deltaTime;
87 myTransform.localScale = newScale;
91 myTransform.localScale = Vector3.one *
animCurve.Evaluate(t);
100 StopCoroutine(
"Tween");
101 myTransform.localScale = initScale;
Dynamic scaling of text or image (including button) based on curves
AnimationCurve animCurveY
Credit Erdener Gonenc - @PixelEnvision.