/// <summary> /// Scale extension method for TransitionStep /// </summary> /// <typeparam name="T">interface type</typeparam> /// <param name="TransitionStep"></param> /// <returns></returns> public static Scale Scale(this TransitionStep transitionStep, Vector3 startScale, Vector3 endScale, float delay = 0, float duration = 0.5f, TransitionStep.TransitionModeType transitionMode = TransitionStep.TransitionModeType.Specified, TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear, AnimationCurve animationCurve = null, bool runAtStart = false, Action onStart = null, Action<float> onUpdate = null, Action onComplete = null) { var newTransitionStep = new Scale(transitionStep.Target, startScale, endScale, delay, duration, transitionMode, tweenType, animationCurve, onStart, onUpdate, onComplete); if (runAtStart) transitionStep.AddOnStartTransitionStep(newTransitionStep); else transitionStep.AddOnCompleteTransitionStep(newTransitionStep); newTransitionStep.Parent = transitionStep; return newTransitionStep; }
void TransitionItem2() { ShowTransitionedDescription("Linked transitions in one call."); // transition the second item. var transition = new Scale(TestGameObject2, Vector3.zero, Vector3.one * 5, 0, 3, tweenType: TransitionHelper.TweenType.easeInOutBack). ScaleFromOriginal(new Vector3(7.5f, 2.5f, 1), 1, 2, tweenType: TransitionHelper.TweenType.easeInOutBack). ScaleFromOriginal(new Vector3(10, 10, 1), 1, 2, tweenType: TransitionHelper.TweenType.easeInOutBack). ScaleFromOriginal(Vector3.zero, 1, 2, tweenType: TransitionHelper.TweenType.easeInOutBack, onComplete: TransitionItem3).GetChainRoot(); transition.Start(); }
/// <summary> /// Scale extension method for TransitionStep /// </summary> /// <typeparam name="T">interface type</typeparam> /// <param name="TransitionStep"></param> /// <returns></returns> public static Scale ScaleFromOriginal(this TransitionStep transitionStep, Vector3 endScale, float delay = 0, float duration = 0.5f, TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear, AnimationCurve animationCurve = null, bool runAtStart = false, Action onStart = null, Action<float> onUpdate = null, Action onComplete = null) { var newTransitionStep = new Scale(transitionStep.Target, Vector3.zero, endScale, delay, duration, TransitionStep.TransitionModeType.FromCurrent, tweenType, animationCurve, onStart, onUpdate, onComplete); if (runAtStart) transitionStep.AddOnStartTransitionStep(newTransitionStep); else transitionStep.AddOnCompleteTransitionStep(newTransitionStep); newTransitionStep.Parent = transitionStep; newTransitionStep.StartValue = newTransitionStep.OriginalValue; return newTransitionStep; }