当前位置: 首页 > news >正文

基于vs和C#的WPF应用之动画3

注:1、在内部和外部使用缓动函数


<Grid.Resources>
<PowerEase x:Key="powerease" Power="3" EasingMode="EaseInOut"/>
</Grid.Resources>
<DoubleAnimation EasingFunction="{StaticResource powerease}"/><DoubleAnimation.EasingFunction><PowerEase EasingMode="EaseInOut" Power="3"/></DoubleAnimation.EasingFunction>

一、画布

<Canvas x:Name="canvas3" Width="200" Height="200" Grid.Row="0" Grid.Column="1"><Canvas.Triggers><EventTrigger RoutedEvent="Loaded"><BeginStoryboard Storyboard="{StaticResource third_sb}"/></EventTrigger></Canvas.Triggers><!--背景--><Ellipse Width="100" Height="100" Fill="#f2f4f6" Margin="50"/><Label Content="Loading"FontSize="16"Margin="50"FontFamily="Times New Roman"Foreground="#6b48ff"FontWeight="Bold"Width="100" Height="100"VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/><Ellipse Name="third_e1" Style="{StaticResource thirdStyle_Ellipse}" ><Ellipse.RenderTransform><RotateTransform Angle="0"/></Ellipse.RenderTransform></Ellipse><Ellipse Name="third_e2" Style="{StaticResource thirdStyle_Ellipse}"><Ellipse.RenderTransform><RotateTransform Angle="0"/></Ellipse.RenderTransform></Ellipse><Ellipse Name="third_e3" Style="{StaticResource thirdStyle_Ellipse}"><Ellipse.RenderTransform><RotateTransform Angle="0"/></Ellipse.RenderTransform></Ellipse><Ellipse Name="third_e4" Style="{StaticResource thirdStyle_Ellipse}" ><Ellipse.RenderTransform><RotateTransform Angle="0"/></Ellipse.RenderTransform></Ellipse><Ellipse Name="third_e5" Style="{StaticResource thirdStyle_Ellipse}"><Ellipse.RenderTransform><RotateTransform Angle="0"/></Ellipse.RenderTransform></Ellipse></Canvas>

二、动画故事板

 <Storyboard x:Key="third_sb" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" RepeatBehavior="Forever"><DoubleAnimation Storyboard.TargetName="third_e1" To="360" Duration="0:0:2"  EasingFunction="{StaticResource powerease}" AccelerationRatio="0.1" DecelerationRatio="0.9"/><!--加速比 减速比--><DoubleAnimation Storyboard.TargetName="third_e2" To="360" Duration="0:0:2" EasingFunction="{StaticResource powerease}" AccelerationRatio="0.3" DecelerationRatio="0.7"/><DoubleAnimation Storyboard.TargetName="third_e3" To="360" Duration="0:0:2" EasingFunction="{StaticResource powerease}" AccelerationRatio="0.5" DecelerationRatio="0.5"/><DoubleAnimation Storyboard.TargetName="third_e4" To="360" Duration="0:0:2" EasingFunction="{StaticResource powerease}" AccelerationRatio="0.7" DecelerationRatio="0.3"/><DoubleAnimation Storyboard.TargetName="third_e5" To="360" Duration="0:0:2" EasingFunction="{StaticResource powerease}" AccelerationRatio="0.9" DecelerationRatio="0.1"/></Storyboard>

三、外部样式

 <!--第三个动画圆的样式--><Style x:Key="thirdStyle_Ellipse" TargetType="Ellipse"><Setter Property="Width" Value="25"/><Setter Property="Height" Value="25"/><Setter Property="Canvas.Left" Value="87.5"/><Setter Property="Canvas.Top" Value="50"/><Setter Property="Fill" Value="#0d3f67"/><Setter Property="RenderTransformOrigin" Value="0.5,2"/></Style>

http://www.lryc.cn/news/344925.html

相关文章:

  • Python import 必看技巧:打造干净利落的代码结构
  • 计算机视觉(CV)(Computer Vision)
  • python:画折线图
  • Spring Data JPA 与 MyBatisPlus的比较
  • 【C++】STL-list的使用
  • 进度条(小程序)
  • PyCharm安装教程(超详细图文教程)
  • 金蝶BI应收分析报表:关于应收,这样分析
  • salmon使用体验
  • Ubuntu 20.04 安装 Ansible
  • TypeScript学习笔记:强类型JavaScript的优雅之旅
  • 监控异地组网怎么组网?
  • 将本地托管模型与 Elastic AI Assistant 结合使用的好处
  • Linux的内核态和用户态
  • springboot利用Redis的Geo数据类型,获取附近店铺的坐标位置和距离列表
  • Vitis HLS 学习笔记--理解串流Stream(2)
  • Golang | Leetcode Golang题解之第80题删除有序数组中的重复项II
  • uniapp自定义websocket类实现socket通信、心跳检测、连接检测、重连机制
  • Hive UDTF之explode函数、Lateral View侧视图
  • 智慧公厕打造智慧城市新标杆
  • 字节发布文生图模型PuLID:高效身份ID特征定制,单张图像克隆AI虚拟分身
  • SpringBoot启动流程分析之创建SpringApplication对象(一)
  • SSH简介 特点以及作用
  • MQTT服务搭建及python使用示例
  • Ubuntu如何设置中文输入法
  • PostgreSQL的pg_dump和 pg_dumpall 异同点
  • 【Ping】Windows 网络延迟测试 ping 、telnet、tcping 工具
  • DuDuTalk:4G桌面拾音设备在银行网点服务场景的应用价值
  • QT 设置窗口不透明度
  • 如何在Python中实现文本相似度比较?