private static void OnTimerTick(RadCartesianChart chart)
        {
            CameraInfo cameraInfo = GetOrCreateCameraInfo(chart);

            double durationInSeconds = 1.5;
            Point  targetOffset      = new Point(100, -75);

            TimeSpan timeSpan = DateTime.Now - cameraInfo.initialAnimationDateTime;

            if (durationInSeconds < timeSpan.TotalSeconds)
            {
                cameraInfo.initialAnimationTimer.Stop();
                cameraInfo.initialAnimationTimer = null;
                return;
            }

            double progress = timeSpan.TotalSeconds / durationInSeconds;

            EasingFunctionBase ease = new BackEase {
                EasingMode = EasingMode.EaseIn
            };
            double easedProgress = ease.Ease(progress);
            double hOffset       = easedProgress * targetOffset.X;

            ease = new CubicEase {
                EasingMode = EasingMode.EaseInOut
            };
            easedProgress = ease.Ease(progress);
            double vOffset = easedProgress * targetOffset.Y;

            MoveCamera(chart, new Point(hOffset, vOffset));
        }
Beispiel #2
0
        public static void addBounceAnnimation(UserControl control, Thickness targetThickness)
        {
            ThicknessAnimation bounceAnimation = new ThicknessAnimation();
            //BounceEase BounceOrientation = new BounceEase();
            //BounceOrientation.Bounces = 4;
            //BounceOrientation.Bounciness = 2;

            //bounceAnimation.To = new Thickness(0, 0, 0, 0);
            //bounceAnimation.From = new Thickness(0, targetThickness.Top, 0, targetThickness.Bottom);
            //bounceAnimation.EasingFunction = BounceOrientation;
            //test
            BackEase backOrientation = new BackEase();

            backOrientation.Amplitude = 2;
            backOrientation.Ease(0.3);
            backOrientation.EasingMode = EasingMode.EaseIn;

            bounceAnimation.To             = new Thickness(0, 0, 0, 0);
            bounceAnimation.From           = new Thickness(0, 0, 0, targetThickness.Bottom); //targetThickness.Top, 0, targetThickness.Bottom
            bounceAnimation.EasingFunction = backOrientation;

            control.BeginAnimation(UserControl.MarginProperty, bounceAnimation);
        }