I'm trying to animate a grid's width using DoubleAnimationUsingKeyFrames. I already know how to make a simple linear animation, but what I'm trying to achieve is a smooth movement that speeds up when it starts than slows down at the end. Right now I'm using LinearDoubleKeyFrame, but I've tried all the other types of DoubleKeyFrames, and none seemed to give me the effect I want. I made a graph that should give you a better idea of what I'm trying to get.
Asked
Active
Viewed 552 times
1
-
1Use one of the [`Easing Functions`](https://learn.microsoft.com/en-us/dotnet/framework/wpf/graphics-multimedia/easing-functions). [`EaseInOut`](https://learn.microsoft.com/en-us/dotnet/framework/wpf/graphics-multimedia/media/cubicease-graph.png) looks the closest to your graph. – Bradley Uffner Aug 02 '17 at 15:10
-
That's the `EaseInOut` mode of `CubicEase` to be precise. – Bradley Uffner Aug 02 '17 at 15:16
-
Thanks for the quick responses, I'll try those functions later today :) – Lázár Zsolt Aug 02 '17 at 15:17
2 Answers
1
Bradley Uffner:
Use one of the Easing Functions. EaseInOut looks the closest to your graph.

Lázár Zsolt
- 685
- 8
- 29
-
`AccelerationRatio` and `DecelerationRatio` can be ajusted for a perfect match – Xaalek Jun 29 '22 at 15:18
1
An example:
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="100" Duration="0:0:0.2" Storyboard.TargetName="e" Storyboard.TargetProperty="Width">
<DoubleAnimation.EasingFunction>
<EaseInOut ></EaseInOut >
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>

boop_the_snoot
- 3,209
- 4
- 33
- 44

zamoldar
- 548
- 10
- 13