Inheritance: MonoBehaviour
示例#1
0
        public override Storyboard GetAnimationStoryboard(string propertyToAnimate, AnimationTriggerValue triggerValue, GridLength newValue, GridLength oldValue)
        {
            GridAnimation animation = new GridAnimation()
            {
                To =
                    triggerValue == AnimationTriggerValue.Start || triggerValue == AnimationTriggerValue.Unset ? newValue : oldValue,

                From =
                    triggerValue == AnimationTriggerValue.Start || triggerValue == AnimationTriggerValue.Unset ? oldValue : newValue,

                Duration =
                    triggerValue == AnimationTriggerValue.Unset ? TimeSpan.FromSeconds(0.3) : TimeSpan.FromSeconds(0.18),

                AccelerationRatio =
                    triggerValue == AnimationTriggerValue.Unset ? 0.3 : 0.7,

                EasingFunction =
                    new QuarticEase()
            };

            Storyboard.SetTargetProperty(animation, new PropertyPath(propertyToAnimate));

            Storyboard animationStoryboard = new Storyboard();

            animationStoryboard.Children.Add(animation);

            return(animationStoryboard);
        }
示例#2
0
        public override Storyboard GetAnimationStoryboard(DependencyObject d)
        {
            GridAnimation animation = new GridAnimation()
            {
                To       = GetAnimationValue(d),
                From     = GetReverseAnimationValue(d),
                Duration = TimeSpan.FromSeconds(0.3)
            };

            Storyboard.SetTargetProperty(animation, new PropertyPath(GetAnimationProperty(d)));

            Storyboard animationStoryboard = new Storyboard();

            animationStoryboard.Children.Add(animation);

            return(animationStoryboard);
        }
        private void RunAnimation(GridAnimation animation, double From, double To, int span = 1, int Step = 5000, object actor = null, GridAnimation EndStep = null)
        {
            int             itor   = 0;
            double          nownum = From;
            DispatcherTimer timer  = new DispatcherTimer();

            timer.Tick +=
                (o, e) =>
            {
                animation(nownum);
                itor++;
                nownum = itor * (To - From) / Step + From;
                if (itor == Step)
                {
                    timer.IsEnabled = false;
                    EndStep?.Invoke(0);
                }
                ;
            };
            timer.IsEnabled = true;
        }
示例#4
0
 void InitComponent()
 {
     soundManager  = gameObject.AddComponent <SoundManager>() as SoundManager;
     mapLoader     = gameObject.AddComponent <MapLoader>();
     gridAnimation = gameObject.AddComponent <GridAnimation>();
 }