Advertisement
programusy

Untitled

Sep 11th, 2023
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <Window x:Class="BlinkingEyeAnimation.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="Blinking Eye Animation" Width="300" Height="300">
  5.  
  6. <Window.Resources>
  7. <!-- Eye Blink Animation -->
  8. <Storyboard x:Key="BlinkAnimation" AutoReverse="True" RepeatBehavior="Forever">
  9. <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
  10. <EasingDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
  11. <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
  12. <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
  13. </DoubleAnimationUsingKeyFrames>
  14. </Storyboard>
  15. </Window.Resources>
  16.  
  17. <Grid>
  18. <!-- Eye -->
  19. <Ellipse Width="100" Height="100" Fill="White" Stroke="Black" StrokeThickness="2">
  20. <!-- Apply Blink Animation to the Eye -->
  21. <Ellipse.Triggers>
  22. <EventTrigger RoutedEvent="Ellipse.Loaded">
  23. <BeginStoryboard Storyboard="{StaticResource BlinkAnimation}"/>
  24. </EventTrigger>
  25. </Ellipse.Triggers>
  26. </Ellipse>
  27. </Grid>
  28. </Window>
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement