Compartilhar via


Como: Animar um efeito de brilho

Este tópico descreve como animar a propriedade GlowSize de um OuterGlowBitmapEffect.

Exemplo

O exemplo a seguir anima as alterações feitas a propriedade GlowSize do OuterGlowBitmapEffect. Como resultado, o brilho é animado expandindo-se para fora quando o TextBox obtém o foco.

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

  <StackPanel>


    <TextBox Width="200">
      <TextBox.BitmapEffect>

        <!-- This BitmapEffect is targeted by the animation. -->
        <OuterGlowBitmapEffect x:Name="myOuterGlowBitmapEffect"  
         GlowColor="Blue" GlowSize="0" />

      </TextBox.BitmapEffect>
      <TextBox.Triggers>
        <EventTrigger RoutedEvent="TextBox.GotFocus">
          <BeginStoryboard>
            <Storyboard>

              <!-- Animate the GlowSize from 0 to 40 over half a second. --> 
              <DoubleAnimation
                Storyboard.TargetName="myOuterGlowBitmapEffect"
                Storyboard.TargetProperty="GlowSize"
                From="0" To="40" Duration="0:0:0.5" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </TextBox.Triggers>
    </TextBox>

  </StackPanel>

</Page>

For the complete sample, see Exemplo da galeria Efeitos bitmap.

Consulte também

Tarefas

Como: Criar um Efeito de Brilho nas Bordas Externas de um Objeto

Como: Animate a Blur Visual Effect

Como: Animate a Drop Shadow Visual Effect

Como: Animate Multiple Visual Effects

Exemplo da galeria Efeitos bitmap

Conceitos

Visão Geral de Efeitos de Bitmap

Referência

GlowSize

OuterGlowBitmapEffect

TextBox

Outros recursos

Bitmap Effects How-to Topics

Exemplos de efeitos de bitmap