I want to use this animation on errors, like the one shown here:
How to achieve that in wpf? I have feeling this should be a combination (composition?) of multiple transformations, but which ones and how exactly?
Here is a starter (mcve or call it "my attempt"), which is ugly and is not even close to what I want:
<Grid>
<Border x:Name="border"
Width="200"
Height="200"
BorderBrush="Black"
BorderThickness="1"
CornerRadius="4"
Background="LightBlue"
RenderTransformOrigin="0.5,0">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Border.RenderTransform>
<Border.Effect>
<DropShadowEffect BlurRadius="20" />
</Border.Effect>
<Button VerticalAlignment="Bottom"
HorizontalAlignment="Center"
Margin="0,0,0,10"
Padding="5"
Content="Click">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard FillBehavior="Stop">
<DoubleAnimation Storyboard.TargetName="border"
Storyboard.TargetProperty="RenderTransform.Children[1].(SkewTransform.AngleX)"
To="5" Duration="0:0:0.1"/>
<DoubleAnimation Storyboard.TargetName="border"
Storyboard.TargetProperty="RenderTransform.Children[1].(SkewTransform.AngleX)"
To="-5"
BeginTime="0:0:0.1"
Duration="0:0:0.2" />
<DoubleAnimation Storyboard.TargetName="border"
Storyboard.TargetProperty="RenderTransform.Children[1].(SkewTransform.AngleX)"
To="5"
BeginTime="0:0:0.3"
Duration="0:0:0.2" />
<DoubleAnimation Storyboard.TargetName="border"
Storyboard.TargetProperty="RenderTransform.Children[1].(SkewTransform.AngleX)"
BeginTime="0:0:0.5"
Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</Border>
</Grid>
There are many 2d shake posts around (click, click), but I need animation which tells "you are wrong" and not the one which says "let's dance".
ViewPort3D
), but animation looks similar to wanted. – Sligo