Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="BlinkingEyeAnimation.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="Blinking Eye Animation" Width="300" Height="300">
- <Window.Resources>
- <!-- Eye Blink Animation -->
- <Storyboard x:Key="BlinkAnimation" AutoReverse="True" RepeatBehavior="Forever">
- <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
- <EasingDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
- <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
- <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </Window.Resources>
- <Grid>
- <!-- Eye -->
- <Ellipse Width="100" Height="100" Fill="White" Stroke="Black" StrokeThickness="2">
- <!-- Apply Blink Animation to the Eye -->
- <Ellipse.Triggers>
- <EventTrigger RoutedEvent="Ellipse.Loaded">
- <BeginStoryboard Storyboard="{StaticResource BlinkAnimation}"/>
- </EventTrigger>
- </Ellipse.Triggers>
- </Ellipse>
- </Grid>
- </Window>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement