Animate GradientStop : Color Animation « Windows Presentation Foundation « VB.Net Tutorial






<Window x:Class="Animation.ImageWipe"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ImageWipe" Height="300" Width="300">

  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition></RowDefinition>
      <RowDefinition Height="Auto"></RowDefinition>

    </Grid.RowDefinitions>
    <Grid>
      <Image Source="c:\image.jpg"></Image>
      <Image Source="c:\image.jpg" Name="imgDay">
        <Image.OpacityMask>
          <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
            <GradientStop Offset="0" Color="Transparent" x:Name="transparentStop" />
            <GradientStop Offset="0" Color="Black" x:Name="visibleStop" />
          </LinearGradientBrush>
        </Image.OpacityMask>
      </Image>
    </Grid>
    
      <Button Name="cmdStart" Grid.Row="1" Padding="5" Margin="5">
        Start
        <Button.Triggers>
          <EventTrigger SourceName="cmdStart" RoutedEvent="Button.Click">
            <BeginStoryboard> 
              <Storyboard>
                <DoubleAnimation
                    Storyboard.TargetName="transparentStop"
                    Storyboard.TargetProperty="Offset" BeginTime="0:0:0.2" 
                    From="0" To="1" Duration="0:0:1" ></DoubleAnimation>
                <DoubleAnimation
                    Storyboard.TargetName="visibleStop"
                    Storyboard.TargetProperty="Offset"
                    From="0" To="1.2" Duration="0:0:1.2" ></DoubleAnimation>
              </Storyboard>
            </BeginStoryboard>
          </EventTrigger>
        </Button.Triggers>
      </Button>
  </Grid>
</Window>
WPF Animate Gradient Stop








16.108.Color Animation
16.108.1.Animated GradientStop Offset with DoubleAnimationAnimated GradientStop Offset with DoubleAnimation
16.108.2.Animated GradientStop Color with ColorAnimationAnimated GradientStop Color with ColorAnimation
16.108.3.Animated GradientStop Opacity ColorAnimation.ByAnimated GradientStop Opacity ColorAnimation.By
16.108.4.Animated GradientOriginAnimated GradientOrigin
16.108.5.Animating ColorAnimating Color
16.108.6.Animating Gradient OffsetAnimating Gradient Offset
16.108.7.Animate GradientStopAnimate GradientStop
16.108.8.Opacity AnimationOpacity Animation
16.108.9.Animation LinearGradientBrushAnimation LinearGradientBrush
16.108.10.Use ColorAnimation to animate backgroundUse ColorAnimation to animate background