PathAnimation
使用Blend制作PathAnimation
1:选中Path转换为运动路径
2:选择目标对象
PathAnimation使用动态的Path
PathAnimation动画在播放的时候,PahtGeometry是已经确定的,不会改变,不会实时的根据Path的改变动画进行调整,所以是不能进行绑定
只有在每一次需要播放动画之前读取相关的Path的Data,读取当前的PathGeometry然后开始动画
<Path x:Name="path" Stroke="DarkGray" StrokeThickness="3">
<Path.Data>
<PathGeometry>
<PathFigure
StartPoint="{Binding Center, ElementName=ptStart}">
<BezierSegment
Point1="{Binding Center, ElementName=ptCtrl1}"
Point2="{Binding Center, ElementName=ptCtrl2}"
Point3="{Binding Center, ElementName=ptEnd}"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
private void Button_Click(object sender, RoutedEventArgs e)
{
Canvas.SetLeft(this.truck, -this.truck.ActualWidth / );
Canvas.SetTop(this.truck, -this.truck.ActualHeight / );
this.truck.RenderTransformOrigin = new Point(0.5, 0.5); MatrixTransform matrix = new MatrixTransform();
this.truck.RenderTransform = matrix; NameScope.SetNameScope(this, new NameScope());
this.RegisterName("matrix", matrix); MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath();
matrixAnimation.PathGeometry = this.path.Data.GetFlattenedPathGeometry();
matrixAnimation.Duration = new Duration(TimeSpan.FromSeconds()); //matrixAnimation.AutoReverse = true; //重复
//matrixAnimation.IsOffsetCumulative = !matrixAnimation.AutoReverse;
//matrixAnimation.RepeatBehavior = RepeatBehavior.Forever;
matrixAnimation.DoesRotateWithTangent = false; //旋转 Storyboard story = new Storyboard();
story.Children.Add(matrixAnimation);
Storyboard.SetTargetName(matrixAnimation, "matrix");
Storyboard.SetTargetProperty(matrixAnimation, new PropertyPath(MatrixTransform.MatrixProperty));
story.Begin(this);
}
PathAnimation的更多相关文章
- WPF中的PathAnimation(路径动画)
原文:WPF中的PathAnimation(路径动画) WPF中的PathAnimation(路径动画) ...
- 26.Qt Quick QML-RotationAnimation、PathAnimation、SmoothedAnimation、Behavior、PauseAnimation、SequentialAnimation和ParallelAnimation
1.RotationAnimationRotationAnimation也是继承于PropertyAnimation组件,但是它有点特殊,它只需要指定taget目标对象,并且不需要指定property ...
- iOS CoreAnimation详解(一) 有关Layer的动画
以前由于项目需要 也写了一些动画 ,但是知识不系统,很散.这段时间趁着项目完成的空袭,来跟着大神的脚步系统的总结一下iOS中Core Animation的知识点. 原博客地址:http://blog. ...
- 利用layer的mask属性实现逐渐揭示的动画效果
github上又看到个不错的动画(https://github.com/rounak/RJImageLoader),如图: 所以就想来自己实现以下 不试不知道,这个动画还真不是看上去那么简单,我自己想 ...
- iOS 动画绘制线条颜色渐变的折线图
效果图 .................... 概述 现状 折线图的应用比较广泛,为了增强用户体验,很多应用中都嵌入了折线图.折线图可以更加直观的表示数据的变化.网络上有很多绘制折线图的demo,有 ...
- pyqt官方示例
文件夹 PATH 列表 卷序列号为 00000058 F027:7BEC C:. ├─activeqt │ └─webbrowser │ ├─icons │ └─pycache ├─animation ...
- iOS 动画组
其实早在一个多月以前就已经实现了动作组播放的功能,不过当时感觉好像没有什么难度并没有放在心上,今天突然要用到动画组,发现已经忘记了,所以又将原来的代码翻出来看了下.最后决定还是写下来,以备不时之需.动 ...
- CAShapeLayer(持续更新)
CAShapeLayer 之前讲过CALayer动画相关知识,再来看看更加复杂的CAShapeLayer相关的动画知识. 普通CALayer在被初始化时是需要给一个frame值的,这个frame值一般 ...
- iOS简易柱状图(带动画)--新手入门篇
叨逼叨 好久没更新博客了,才几个月,发生了好多事情,处理了好多事情.不变的是写代码依然在继续. 做点啥子 看看objective-c的书,学着写了个柱状图,只是练习的demo而已,iOS上的图表控件已 ...
随机推荐
- 第二百一十九天 how can I 坚持
今天好冷,白天在家待了一天,晚上,老贾生日,生日快乐,去海底捞吃了个火锅,没感觉呢. 今天还发现了个好游戏,纪念碑谷,挺新颖,就是难度有点大了. 好累.睡觉,明天想去爬山啊,可是该死的天气.
- xcode报错:Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/b
今天使用xcode编译工程发现一个问题,这里记录一下防止忘记 xcode报错: Command /Applications/Xcode.app/Contents/Developer/Toolchain ...
- C++11用于元编程的类别属性
[C++11用于元编程的类别属性] 许多算法能作用在不同的数据类别; C++ 模板支持泛型,这使得代码能更紧凑和有用.然而,算法经常会需要目前作用的数据类别的信息.这种信息可以通过类别属性 (type ...
- 购买咏南中间件送客户端C/S和B/S开发框架
购买咏南DATASNAP中间件送CS插件开发框架和BS开发框架,CS.BS开发框架共享同一个中间件.价格从优! 中间件可供DELPHI6~DELPHI XE8开发的客户端调用! CS开发框架截图: B ...
- shell常见语法
#!/bin/bashecho "**********argument**********"echo script name: $0echo first argument $1ec ...
- 使用多个Worker的时候Odoo的系统日志配置
当我们开启Wokrer来启动Odoo的时候,用默认的日志会出现日志丢失的问题,这个是logger的问题:多个进程对单个文件写入日志.有一个简单的解决办法:配置openerp-server.conf,开 ...
- IIS7 “拒绝访问临时目录”
创建 BlogConfigurationSettings 的配置节处理程序时出错: 拒绝访问临时目录.以其运行 XmlSerializer 的身份“IIS APPPOOL\5656qp.com.rmi ...
- 5分钟内使用React、Webpack与ES6构建应用
http://blog.leapoahead.com/2015/09/12/react-es6-webpack-in-5-minutes/
- Ceph Jewel 10.2.3 环境部署
Ceph 测试环境部署 本文档内容概要 测试环境ceph集群部署规划 测试环境ceph集群部署过程及块设备使用流程 mon节点扩容及osd节点扩容方法 常见问题及解决方法 由于暂时没有用到对象存储,所 ...
- Emit Mapper官方文档
概述 优点 快速指导 类型转换 用户配置