Animate RenderTransform Angle
<Window x:Class="Animation.AnimateVisual"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="AnimateVisualBrush" Height="300" Width="300" Background="LightGoldenrodYellow">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button Name="visual" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button.Content>Test</Button.Content>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="rectangle"
Storyboard.TargetProperty="RenderTransform.Children[0].AngleY"
To="180" Duration="0:0:15" AutoReverse="True"></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="rectangle"
Storyboard.TargetProperty="RenderTransform.Children[1].Angle"
To="180" Duration="0:0:20" AutoReverse="True"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Rectangle Grid.Row="1" Name="rectangle" Width="100" Stretch="Uniform" ClipToBounds="False" RenderTransformOrigin="0.5,0.5">
<Rectangle.Fill>
<VisualBrush Visual="{Binding ElementName=visual}">
</VisualBrush>
</Rectangle.Fill>
<Rectangle.RenderTransform>
<TransformGroup>
<SkewTransform CenterX="0.5"></SkewTransform>
<RotateTransform CenterX="0.5" CenterY="0.5"></RotateTransform>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Window>
Related examples in the same category