void ShowTransitionedDescription(string text)
 {
     // fade the end text in while at the same time scaling.
     Description.text = text;
     var transition = new Fade(Description.gameObject, 0, 1);
     transition.FadeFromOriginal(0, delay: 2);
     transition.GetChainRoot().Start();
 }
Beispiel #2
0
        /// <summary>
        /// Fade extension method for TransitionStep
        /// </summary>
        /// <typeparam name="T">interface type</typeparam>
        /// <param name="TransitionStep"></param>
        /// <returns></returns>
        public static Fade Fade(this TransitionStep transitionStep,
                                float startTransparency,
                                float endTransparency,
                                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 Fade(transitionStep.Target,
                                             startTransparency,
                                             endTransparency,
                                             delay,
                                             duration,
                                             transitionMode,
                                             tweenType,
                                             animationCurve,
                                             onStart,
                                             onUpdate,
                                             onComplete);

            if (runAtStart)
            {
                transitionStep.AddOnStartTransitionStep(newTransitionStep);
            }
            else
            {
                transitionStep.AddOnCompleteTransitionStep(newTransitionStep);
            }
            newTransitionStep.Parent = transitionStep;
            return(newTransitionStep);
        }
 /// <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;
 }