Freigeben über


How to: Animate an Embossed Visual Effect

This example shows how to animate an embossed visual effect.

Example

The following example animates the LightAngle property of an EmbossBitmapEffect so that artificial light orbits the embossed edge of the image. When the light orbits the image, the shadows that are cast by the embossing shift accordingly.

<Page xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" >

  <StackPanel>

    <Image Source="/images/WaterLilies.jpg" Width="600"  Margin="10" >
      <Image.BitmapEffect>
        <EmbossBitmapEffect x:Name="myEmbossBitmapEffect"  Relief="0.8" LightAngle="0" />
      </Image.BitmapEffect>
      <Image.Triggers>
        <EventTrigger RoutedEvent="Image.Loaded">
          <BeginStoryboard>
            <Storyboard>

              <!-- Animate the LightAngle so that the artificial light
                   orbits around the embossed image which makes the
                   shadows cast by the emboss shift accordingly. -->
              <DoubleAnimation
               Storyboard.TargetName="myEmbossBitmapEffect"
               Storyboard.TargetProperty="LightAngle"
               From="0" To="360" Duration="0:0:3" />

            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Image.Triggers>
    </Image>

  </StackPanel>

</Page>

For the complete sample, see Bitmap Effects Gallery Sample.

See Also

Tasks

How to: Create an Embossed Visual Effect
How to: Animate Multiple Visual Effects

Reference

LightAngle
EmbossBitmapEffect

Concepts

Bitmap Effects Overview

Other Resources

Bitmap Effects Gallery Sample
Bitmap Effects How-to Topics
Bitmap Effects Samples