예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <summary>
        /// Fade extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Fade FadeToOriginal(this TransitionStep transitionStep,
                                          float startTransparency,
                                          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 Fade(transitionStep.Target,
                                             startTransparency,
                                             0,
                                             delay,
                                             duration,
                                             TransitionStep.TransitionModeType.ToOriginal,
                                             tweenType,
                                             animationCurve,
                                             onStart,
                                             onUpdate,
                                             onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent   = transitionStep;
            newTransitionStep.EndValue = newTransitionStep.OriginalValue;
            return(newTransitionStep);
        }
        /// <summary>
        /// Animation extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static TriggerAnimation TriggerAnimation(this TransitionStep transitionStep,
                                                        float speed             = 1,
                                                        float delay             = 0,
                                                        float duration          = 0.5f,
                                                        string trigger          = "TransitionIn",
                                                        string targetState      = "TransitionOut",
                                                        bool runAtStart         = false,
                                                        Action onStart          = null,
                                                        Action <float> onUpdate = null,
                                                        Action onComplete       = null)
        {
            var newTransitionStep = new TriggerAnimation(transitionStep.Target,
                                                         speed,
                                                         delay,
                                                         duration,
                                                         trigger,
                                                         targetState,
                                                         onStart,
                                                         onUpdate,
                                                         onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
예제 #4
0
        /// <summary>
        /// Rotate extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Rotate Rotate(this TransitionStep transitionStep,
                                    Vector3 startRotation,
                                    Vector3 endRotation,
                                    float delay    = 0,
                                    float duration = 0.5f,
                                    TransitionStep.TransitionModeType transitionMode = TransitionStep.TransitionModeType.Specified,
                                    TransitionHelper.TweenType tweenType             = TransitionHelper.TweenType.linear,
                                    AnimationCurve animationCurve = null,
                                    TransitionStep.CoordinateSpaceType coordinateMode = TransitionStep.CoordinateSpaceType.Global,
                                    bool runAtStart         = false,
                                    Action onStart          = null,
                                    Action <float> onUpdate = null,
                                    Action onComplete       = null)
        {
            var newTransitionStep = new Rotate(transitionStep.Target,
                                               startRotation,
                                               endRotation,
                                               delay,
                                               duration,
                                               transitionMode,
                                               tweenType,
                                               animationCurve,
                                               coordinateMode,
                                               onStart,
                                               onUpdate,
                                               onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
예제 #5
0
        /// <summary>
        /// Move extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Move MoveFromOriginal(this TransitionStep transitionStep,
                                            Vector3 endPosition,
                                            float delay    = 0,
                                            float duration = 0.5f,
                                            TransitionHelper.TweenType tweenType = TransitionHelper.TweenType.linear,
                                            AnimationCurve animationCurve        = null,
                                            TransitionStep.CoordinateSpaceType coordinateMode = TransitionStep.CoordinateSpaceType.Global,
                                            bool runAtStart         = false,
                                            Action onStart          = null,
                                            Action <float> onUpdate = null,
                                            Action onComplete       = null)
        {
            var newTransitionStep = new Move(transitionStep.Target,
                                             Vector3.zero,
                                             endPosition,
                                             delay,
                                             duration,
                                             TransitionStep.TransitionModeType.FromCurrent,
                                             tweenType,
                                             animationCurve,
                                             coordinateMode,
                                             onStart,
                                             onUpdate,
                                             onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }