public static void Scale(RectTransform target, ROJOAnimation animation, Vector3 startValue, Vector3 endValue, bool instantAction = false, UnityAction onStartCallback = null, UnityAction onCompleteCallback = null) { if (!animation.Scale.Enabled && !instantAction) { return; } startValue.z = 1; endValue.z = 1; if (instantAction) { target.localScale = endValue; onStartCallback?.Invoke(); onCompleteCallback?.Invoke(); return; } DOTween.Sequence() .SetId(GetTweenId(target, animation.AnimationType, AnimationAction.Scale)) .SetUpdate(Settings.IgnoreUnityTimescale) .SetSpeedBased(Settings.SpeedBasedAnimations) .OnStart(() => onStartCallback?.Invoke() ) .OnComplete(() => onCompleteCallback?.Invoke()) .Append(ScaleTween(target, animation, startValue, endValue)) .Play(); }
public static Tween MoveTween(RectTransform target, ROJOAnimation animation, Vector3 startValue, Vector3 endValue) { target.anchoredPosition3D = startValue; Tween tween = target.DOAnchorPos3D(endValue, animation.Move.duration).SetDelay(animation.Move.startDelay).SetUpdate(true).SetSpeedBased(false); tween.SetEase(animation.Move.ease); return(tween); }
public static Tween RotateTween(RectTransform target, ROJOAnimation animation, Vector3 startValue, Vector3 endValue) { target.localRotation = Quaternion.Euler(startValue); Tweener tween = target.DOLocalRotate(endValue, animation.Rotate.duration, animation.Rotate.rotateMode) .SetDelay(animation.Rotate.startDelay) .SetUpdate(Settings.IgnoreUnityTimescale) .SetSpeedBased(Settings.SpeedBasedAnimations); tween.SetEase(animation.Rotate.ease); return(tween); }
public static Tween ScaleTween(RectTransform target, ROJOAnimation animation, Vector3 startValue, Vector3 endValue) { startValue.z = 1f; endValue.z = 1f; target.localScale = startValue; Tweener tween = target.DOScale(endValue, animation.Scale.duration) .SetDelay(animation.Scale.startDelay) .SetUpdate(Settings.IgnoreUnityTimescale) .SetSpeedBased(Settings.SpeedBasedAnimations); tween.SetEase(animation.Scale.ease); return(tween); }