示例#1
0
        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));
        }