动画路径? [英] Animate a path?

查看:93
本文介绍了动画路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组坐标。我想借,例如,第5和绘制pre-确定时间后然后连接1〜2〜3〜4〜5行,我想删除第一个点,并添加6点。在这样做时,我想以这样的方式进行动画的开端的线从点1移动到POINT2,而线的端部从点5移动到第6点的行。

I have a set of coordinates. I would like to take, for instance, the first 5 and draw a line connecting 1 to 2 to 3 to 4 to 5. Then after a pre-determined duration, I'd like to remove the first point and add the 6th point. In doing that, I'd like the line to animate in such a way as the "beginning" of the line moves from point 1 to point2, while the end of the line moves from point 5 to point 6.

在这里的影响看起来很像老游戏贪吃蛇与绕着吃东西蛇。

The effect here would look a lot like the old game Nibbles with the snake that moves around eating stuff.

什么是WPF中解决这个最有效的方法是什么?

What would be the most efficient way to approach this in WPF?

在此先感谢!

推荐答案

要在这里发布我的解决方案的粗略轮廓。其实我最终使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimationusingpath.pathgeometry.aspx\"相对=nofollow>的PathGeometry 对象和一组的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimationusingpath.aspx\"相对=nofollow> DoubleAnimationUsingPath 动画得到我想要的东西。折线(由Damokles建议)让我在正确的方向前进,但它不是,直到我找到的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimationusingpath.aspx\"相对=nofollow> DoubleAnimationUsingPath 类,我能够把它在那里我想去的地方。

Going to post a rough outline of my solution here. I actually ended up using a PathGeometry object and a set of DoubleAnimationUsingPath animations to get what I wanted. Polyline (suggested by Damokles) got me going in the right direction, but it wasn't until I found the DoubleAnimationUsingPath class that I was able to take it where I wanted to go.

这篇关于动画路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆