Como: Animate a Beveled Visual Effect
This example shows how to animate a BevelBitmapEffect on a button.
Exemplo
The following example shows how to animate the BevelWidth and LightAngle properties of a BevelBitmapEffect. As a result, when the mouse pointer moves over the Button, the inner level of the bevel increases while the artificial light source that is used for the bevel, revolves around the Button.
<Page xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" >
<StackPanel>
<Button Width="200" Height="80" Margin="50">
MouseOver ME!
<Button.BitmapEffect>
<!-- This BitmapEffect is targeted by the animation. -->
<BevelBitmapEffect x:Name="myBevelBitmapEffect" BevelWidth="0" EdgeProfile="CurvedIn" />
</Button.BitmapEffect>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.MouseEnter">
<BeginStoryboard>
<Storyboard>
<!-- Animate the BevelWidth from 0 to 15. -->
<DoubleAnimation
Storyboard.TargetName="myBevelBitmapEffect"
Storyboard.TargetProperty="BevelWidth"
From="0" To="15" Duration="0:0:0.5" AutoReverse="True"
/>
<!-- Animate the LightAngle so that the light source and
corresponding bevel shadows move around the button. -->
<DoubleAnimation
Storyboard.TargetName="myBevelBitmapEffect"
Storyboard.TargetProperty="LightAngle"
From="360" To="0" Duration="0:0:0.5" AutoReverse="True"
/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Page>
For the complete sample, see Exemplo da galeria Efeitos bitmap.
Consulte também
Tarefas
Como: Criar um efeito visual de chanfro
Como: Animate Multiple Visual Effects
Exemplo da galeria Efeitos bitmap
Conceitos
Visão Geral de Efeitos de Bitmap