I am creating doubleAniation in code and I want to add an easing function to it, so how do I do it?
It's not necessary to use DoubleAnimationUsingKeyFrames
- it can be done with just DoubleAnimation
:
CircleEase easing = new CircleEase(); // or whatever easing class you want
easing.EasingMode = EasingMode.EaseInOut;
DoubleAnimation scrollQueue = new DoubleAnimation();
scrollQueue.By = -singleScrollAmt;
scrollQueue.EasingFunction = easing;
scrollQueue.Duration = TimeSpan.FromSeconds(0.5);
MyTextBlock.BeginAnimation(Canvas.TopProperty, scrollQueue);