Adding easing effects to animations
Property-based animations are linear, whereas the key-frame-based animations are non-linear and are used to create Beizer-based interpolations. But creation of such effects is not so easy. To overcome this, WPF 4 introduces easing functions to turn a linear animation into a non-linear one and add some easing effects to those animation objects.
In this recipe, we will learn how to do this with a suitable example.
Getting ready
To get started with adding easing effects to an animation, let's open Visual Studio and create a new project named CH08.EasingEffectDemo
. Select a WPF application template while creating the project.
How to do it...
Let's follow these steps to create an animation with various kinds of easing effects:
- From
Solution Explorer
, open theMainWindow.xaml
file. - Divide the existing
Grid
panel into two columns, by applyingColumnDefinition
to it:
<Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width...