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

滨海网站建设找哪家好做一个自己的网站

滨海网站建设找哪家好,做一个自己的网站,洛阳做网站哪家好,莱芜营销型网站制作一、WPF动画基础 1、动画本质 通过随时间改变依赖属性值实现视觉效果(如位置、透明度、颜色等)。 依赖属性必须支持 DependencyProperty,且需是可动画的(如 Double, Color, Point 等)。 2、动画三要素 起始值 (Fr…

一、WPF动画基础

1、动画本质

通过随时间改变依赖属性值实现视觉效果(如位置、透明度、颜色等)。

依赖属性必须支持 DependencyProperty,且需是可动画的(如 Double, Color, Point 等)。

2、动画三要素

  1. 起始值 (From)
  2. 结束值 (To)
  3. 持续时间 (Duration)

3、基本动画类型

类型

描述

示例属性

对应动画类

线性动画

线性插值变化

WidthOpacity

DoubleAnimation

颜色动画

颜色渐变

Background

ColorAnimation

/路径动画

沿路径或坐标点移动

Canvas.Left/Top

PointAnimation

旋转/缩放动画

变换效果

RenderTransform

RotateTransform + 动画

二、WPF动画基础类型

1、线性插值动画

  1. 原理:通过起始值和结束值的线性过渡实现平滑动画(如DoubleAnimation控制宽度变化)
  2. 适用场景:简单属性变化(如透明度渐变、位置移动)
  3. 关键属性:
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:1"/>

2、关键帧动画

  1. 原理:定义多个关键时间点的属性值,支持多种插值方式(线性、离散、样条)
  2. 示例:实现中间停顿的移动效果
<DoubleAnimationUsingKeyFrames><LinearDoubleKeyFrame Value="0" KeyTime="0:0:0"/><EasingDoubleKeyFrame Value="42.5" KeyTime="0:0:1" EasingFunction="{StaticResource CubicEase}"/><DiscreteDoubleKeyFrame Value="42.5" KeyTime="0:0:2"/><EasingDoubleKeyFrame Value="85" KeyTime="0:0:3"/></DoubleAnimationUsingKeyFrames>

   3.关键帧类型: 

    <LinearDoubleKeyFrame Value="100" KeyTime="0:0:1" />       <!-- 线性过渡 --><DiscreteDoubleKeyFrame Value="200" KeyTime="0:0:2" />     <!-- 直接跳变 --><SplineDoubleKeyFrame Value="300" KeyTime="0:0:3"KeySpline="0.5,0 0.5,1" />           <!-- 贝塞尔曲线控制速率 -->

    3、路径动画

    1. 原理:元素沿 PathGeometry定义的路径运动(如 DoubleAnimationUsingPath)
    2. 适用场景:复杂轨迹运动(如曲线飞行)
    <PathGeometry x:Key="MotionPath" Figures="M0,0 L100,100 C200,50 300,150 400,0"/><DoubleAnimationUsingPath Storyboard.TargetProperty="X"PathGeometry="{StaticResource MotionPath}"/>

    三、动画核心元素

    1、动画类

    1. 继承自 Timeline,如ColorAnimation(颜色渐变)、ThicknessAnimation(边距动画)
    2. 命名规则:DataTypeAnimation(如DoubleAnimation)

    2、故事板 (Storyboard)

    1. 作用:管理多个动画的播放顺序和同步
    2. 常用方法
    Storyboard.Begin();     // 开始动画Storyboard.Stop();      // 停止Storyboard.Pause();     // 暂停Storyboard.Seek(TimeSpan); // 跳转到指定时间

          3.代码控制: 

      Storyboard sb = new Storyboard();sb.Children.Add(animation1);sb.Begin(element);

         4.事件触发器 (EventTrigger) 

        <Button Content="Click"><Button.Triggers><EventTrigger RoutedEvent="Button.Click"><BeginStoryboard><Storyboard>...</Storyboard></BeginStoryboard></EventTrigger></Button.Triggers></Button>

          5.数据触发器 (DataTrigger) / 属性触发器 (Trigger) 

          <Style TargetType="Rectangle"><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Trigger.EnterActions><BeginStoryboard>...</BeginStoryboard></Trigger.EnterActions></Trigger></Style.Triggers></Style>

          3、依赖属性与接口

                  动画仅作用于依赖属性,且目标对象需实现 IAnimatable 接口(所有 UI 元素均支持)

          四、缓动函数 (Easing Functions)

          1、作用

          改变动画速度曲线,实现自然过渡(如加速、弹跳)

          2、常见类型
          1. 线性:LinearEase
          2. 物理模拟:BounceEase(弹跳)、ElasticEase(弹性)
          3. 自定义曲线:CubicEase(三次方缓动)
          <DoubleAnimation From="0" To="300" Duration="0:0:2"><DoubleAnimation.EasingFunction><BounceEase Bounces="2" EasingMode="EaseOut"/></DoubleAnimation.EasingFunction></DoubleAnimation>

          五、动画实现方式

          1、XAML 声明式

          1. 优点:直观易维护,适合简单动画
          2. 示例:按钮点击缩放
          <Button.Triggers><EventTrigger RoutedEvent="Button.Click"><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetProperty="Width" To="200" Duration="0:0:0.5"/></Storyboard></BeginStoryboard></EventTrigger></Button.Triggers>
          2、C# 动态生成
          1. 适用场景:复杂逻辑控制(如根据用户输入生成动画)
          2. 代码示例:
          var animation = new DoubleAnimation{From = 0,To = 100,Duration = TimeSpan.FromSeconds(1),EasingFunction = new CubicEase { EasingMode = EasingMode.EaseInOut }};element.BeginAnimation(WidthProperty, animation);

          六、高级动画技巧

          1、动画组 (Animation Groups)

          同时运行多个动画(如旋转 + 缩放)

          <Storyboard><DoubleAnimation TargetProperty="Width" To="150"/><DoubleAnimation TargetProperty="Height" To="150"/></Storyboard>

          2、动画复用 (Resource + x:Key)

          定义动画资源,全局复用:

          <Window.Resources><Storyboard x:Key="FadeInAnimation"><DoubleAnimation Storyboard.TargetProperty="Opacity"From="0" To="1" Duration="0:0:1"/></Storyboard></Window.Resources>

          3、组合动画 (Parallel vs Sequence)

          • ParallelTimeline:并行执行多个动画。
          • SequenceTimeline:按顺序执行动画。

          4、路径动画优化

          使用 PathGeometry的Simplify() 方法减少路径节点,提升性能

          5、性能优化

          1)启用硬件加速
          1. 设置 RenderOptions.BitmapScalingMode="HighQuality"
          2. 对复杂动画使用 CacheMode="BitmapCache"
          2)减少实时渲染开销
          1. 优先使用 Opacity 替代 Visibility 做淡入淡出
          2. 避免频繁触发布局计算(如动画中修改 Width/Height)
          3. 避免高指数缓动函数(如 PowerEase 的 Power >5)
          3)合理使用 FillBehavior
          1. FillBehavior="HoldEnd":动画结束后保持最终值(默认)
          2. FillBehavior="Stop":动画结束后恢复初始值

          七、调试与常见问题

          1. 动画不生效的排查步骤

          1. 确认目标属性是依赖属性(Dependency Property)
          2. 检查Storyboard.TargetName和TargetProperty是否正确
          3. 确保动画的 From/To 值在合理范围内
          4. 验证触发器是否被正确触发(如事件名称是否拼写错误)

          2、其它

          1. 调试工具:WPF Performance Suite 分析动画帧率
          2. 设计工具:Blend for Visual Studio 可视化编辑动画路径
          3. 学习资源:微软官方动画指南.

          八、示例

          让圆点从左至右的动画效果 中间停顿 即先从左至中间 再从中间至右 的动画效果

              <Grid><Grid.Resources><Style x:Key="ellipse" TargetType="Ellipse"><Setter Property="Width" Value="10" /><Setter Property="Height" Value="10" /><Setter Property="Canvas.Left" Value="0" /><Setter Property="Fill" Value="Gray" /><!--<Setter Property="RenderTransformOrigin" Value="0.5,3.33" />--></Style><PowerEasex:Key="MidPauseEase"EasingMode="EaseInOut"Power="5" /></Grid.Resources><Canvas Height="100"><Canvas.Triggers><EventTrigger RoutedEvent="Loaded"><BeginStoryboard><Storyboard RepeatBehavior="Forever" Storyboard.TargetProperty="(Canvas.Left)"><!--  e1 动画  --><DoubleAnimationUsingKeyFrames Storyboard.TargetName="e1"><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:1.5"Value="400" /><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:3"Value="780" /></DoubleAnimationUsingKeyFrames><!--  e2 动画  --><DoubleAnimationUsingKeyFrames Storyboard.TargetName="e2"><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:1.7"Value="388" /><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:3.2"Value="780" /></DoubleAnimationUsingKeyFrames><!--  e3 动画  --><DoubleAnimationUsingKeyFrames Storyboard.TargetName="e3"><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:1.9"Value="376" /><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:3.4"Value="780" /></DoubleAnimationUsingKeyFrames><!--  e4 动画  --><DoubleAnimationUsingKeyFrames Storyboard.TargetName="e4"><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:2.1"Value="364" /><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:3.6"Value="780" /></DoubleAnimationUsingKeyFrames><!--  e5动画  --><DoubleAnimationUsingKeyFrames Storyboard.TargetName="e5"><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:2.3"Value="352" /><EasingDoubleKeyFrameEasingFunction="{StaticResource MidPauseEase}"KeyTime="0:0:3.8"Value="780" /></DoubleAnimationUsingKeyFrames></Storyboard></BeginStoryboard></EventTrigger></Canvas.Triggers><!--  背景  --><Ellipse Width="100" Height="100" /><LabelWidth="100"Height="100"HorizontalContentAlignment="Center"VerticalContentAlignment="Center"Content="Loading"FontFamily="Times New Roman"FontSize="16"FontWeight="Bold"Foreground="#6b48ff" /><Ellipse Name="e1" Style="{StaticResource ellipse}" /><Ellipse Name="e2" Style="{StaticResource ellipse}" /><Ellipse Name="e3" Style="{StaticResource ellipse}" /><Ellipse Name="e4" Style="{StaticResource ellipse}" /><Ellipse Name="e5" Style="{StaticResource ellipse}" /></Canvas></Grid>

          http://www.dtcms.com/wzjs/203980.html

          相关文章:

        1. 第一次找人做网站简述获得友情链接的途径
        2. 咸阳市建设局网站网络软文怎么写
        3. 临沧市网站建设数字营销课程
        4. 网站ftp用户名和密码沈阳今日新闻头条
        5. 网站的客服怎么做会计培训班推荐
        6. 小型企业网站设计教程深圳网络营销全网推广
        7. 家装公司名字优化师助理
        8. 做网站需要买网址吗360安全浏览器
        9. wordpress子目录 多站点卖友情链接赚钱
        10. 开个网络公司要多少钱湖南关键词优化排名推广
        11. 深圳外贸英文网站设计联系电话百度网络营销中心
        12. 做商城网站需要办理什么网络推广都有什么方式
        13. 企业网站开发需要多钱东营网站建设费用
        14. 网站制作怎么自己做百度竞价排名正确解释
        15. 安陆网站建设推广普通话手抄报内容
        16. 手机商城建站系统网站建设企业网络规划设计方案
        17. 如何做电商网站 昆明电商网站设计论文
        18. 大学网站群建设方案百度宣传推广
        19. 小说网站如何做书源注册推广赚钱一个40元
        20. 投资建设项目管理师报名网站长沙网站优化培训
        21. wordpress手机版论坛网页优化方法
        22. 做新得网站可以换到原来得域名嘛网络推广都是收费
        23. 西安的网站制作公司建一个网站大概需要多少钱
        24. 不备案的网站可以做竞价吗百度推广管家
        25. 绍兴市网站建设今晚比分足球预测
        26. 成都大型的做网站的公司腾讯云1元域名
        27. 制作网站的方法有哪些内容关键词诊断优化全部关键词
        28. 2016年做网站能赚钱网络优化
        29. 昆山开发区网站制作百度seo公司哪家强一点
        30. 高端网站建设设计公司2023年8月份新冠症状