public DoubleAnimationSample(Microsoft.Xna.Framework.Game game) : base(game) { Rectangle bounds = GraphicsService.GraphicsDevice.Viewport.TitleSafeArea; // A 2 second from/to animation. DoubleFromToByAnimation doubleAnimation = new DoubleFromToByAnimation { From = bounds.Left + 200, To = bounds.Right - 200, Duration = TimeSpan.FromSeconds(2), EasingFunction = new QuadraticEase { Mode = EasingMode.EaseInOut }, }; // Make the from/to animation oscillate forever. AnimationClip<double> oscillatingDoubleAnimation = new AnimationClip<double>(doubleAnimation) { LoopBehavior = LoopBehavior.Oscillate, Duration = TimeSpan.MaxValue, }; AnimationService.StartAnimation(oscillatingDoubleAnimation, _animatableDouble).UpdateAndApply(); }
protected override void LoadContent() { Rectangle bounds = GraphicsDevice.Viewport.TitleSafeArea; // A 2 second from/to animation. DoubleFromToByAnimation doubleAnimation = new DoubleFromToByAnimation { From = bounds.Left + 200, To = bounds.Right - 200, Duration = TimeSpan.FromSeconds(2), EasingFunction = new QuadraticEase { Mode = EasingMode.EaseInOut }, }; // Make the from/to animation oscillate forever. AnimationClip<double> oscillatingDoubleAnimation = new AnimationClip<double>(doubleAnimation) { LoopBehavior = LoopBehavior.Oscillate, Duration = TimeSpan.MaxValue, }; AnimationService.StartAnimation(oscillatingDoubleAnimation, _animatableDouble); base.LoadContent(); }