private void StartAnimation(EasingFunctionBase easingFunction)
{
// show the chart
chartControl.Draw(easingFunction);
// animation
#if WPF
NameScope.SetNameScope(translate1, new NameScope());
#endif
var storyboard = new Storyboard();
var ellipseMove = new DoubleAnimation();
ellipseMove.EasingFunction = easingFunction;
ellipseMove.Duration = new Duration(TimeSpan.FromSeconds(AnimationTimeSeconds));
ellipseMove.From = 0;
ellipseMove.To = 460;
#if WPF
Storyboard.SetTargetName(ellipseMove, nameof(translate1));
Storyboard.SetTargetProperty(ellipseMove, new PropertyPath(TranslateTransform.XProperty));
#else
Storyboard.SetTarget(ellipseMove, translate1);
Storyboard.SetTargetProperty(ellipseMove, "X");
#endif
ellipseMove.BeginTime = TimeSpan.FromSeconds(0.5); // start animation in 0.5 seconds
ellipseMove.FillBehavior = FillBehavior.HoldEnd; // keep position after animation
storyboard.Children.Add(ellipseMove);
#if WPF
storyboard.Begin(this);
#else
storyboard.Begin();
#endif
}
}