A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
1.2 KiB

<UserControl
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="RenderDemo.Pages.SpringAnimationsPage"
MaxWidth="600">
<UserControl.Resources>
<SpringEasing x:Key="SpringEasing" Mass="1" Stiffness="2000" Damping="20" InitialVelocity="0" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="Border.spring">
<Style.Animations>
<Animation Duration="0:0:0.900"
IterationCount="Infinite"
PlaybackDirection="Normal"
Easing="{DynamicResource SpringEasing}">
<KeyFrame Cue="0%" KeySpline="">
<Setter Property="TranslateTransform.X" Value="-300"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.X" Value="0" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</UserControl.Styles>
<Grid>
<Border Classes="spring" Background="Red" Width="50" Height="50">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform />
</TransformGroup>
</Border.RenderTransform>
</Border>
</Grid>
</UserControl>