Esempio n. 1
0
        private void Test17()
        {
            var transform = new CompositeTransform();

            TestBorder.RenderTransform = transform;

            var story           = GetNewStoryBoard(transform, "CenterX");
            var animationCenter = (DoubleAnimation)story.Children.First();

            animationCenter.From = 0;
            animationCenter.To   = 100;

            var animation = new DoubleAnimation();

            animation.From     = 0;
            animation.To       = 360;
            animation.Duration = DurationHelper.FromTimeSpan(TimeSpan.FromSeconds(3));
            animation.EnableDependentAnimation = true;

            Storyboard.SetTarget(animation, transform);
            Storyboard.SetTargetProperty(animation, "Rotation");

            story.Children.Add(animation);

            story.Begin();
        }
Esempio n. 2
0
        private void LaunchAnimation2(object sender, TappedRoutedEventArgs e)
        {
            var animation = new DoubleAnimation
            {
                To       = 0,
                Duration = DurationHelper.FromTimeSpan(TimeSpan.FromSeconds(10))
            };

            Storyboard.SetTargetProperty(animation, nameof(TranslateTransform.Y));
            Storyboard.SetTarget(animation, _transform);

            new Storyboard
            {
                Children = { animation }
            }.Begin();
        }
Esempio n. 3
0
        private Storyboard GetNewStoryBoard(DependencyObject target, string property = "Height")
        {
            var storyBoard = new Storyboard();

            var animation = new DoubleAnimation();

            animation.From     = 0;
            animation.To       = 100;
            animation.Duration = DurationHelper.FromTimeSpan(TimeSpan.FromSeconds(3));
            animation.EnableDependentAnimation = true;

            Storyboard.SetTarget(animation, target);
            Storyboard.SetTargetProperty(animation, property);

            storyBoard.Children.Add(animation);

            return(storyBoard);
        }
        private void Animate(UIElement element, string targetProperty, double to)
        {
            var anim = new DoubleAnimation()
            {
                To             = to,
                Duration       = DurationHelper.FromTimeSpan(DURATION),
                EasingFunction = new CubicEase()
                {
                    EasingMode = EasingMode.EaseInOut
                }
            };

            var storyboard = new Storyboard();

            Storyboard.SetTarget(anim, element);
            Storyboard.SetTargetProperty(anim, targetProperty);

            storyboard.Children.Add(anim);
            storyboard.Begin();
        }
        private Storyboard CreateAnimation(UIElement target, FillBehavior fill)
        {
            var animation = new DoubleAnimation
            {
                To           = 0,
                Duration     = DurationHelper.FromTimeSpan(_duration),
                FillBehavior = fill
            };

            if (UseFromValue.IsChecked.GetValueOrDefault())
            {
                animation.From = .75;
            }

            Storyboard.SetTarget(animation, target);
            Storyboard.SetTargetProperty(animation, nameof(UIElement.Opacity));

            return(new Storyboard
            {
                Children = { animation }
            });
        }