实现曲线动画的问题 [英] Problem to achieve curved animation

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

问题描述

可能的重复:
Android,沿路径移动位图?

我想通过弯曲的路径移动图像.在android中可以吗?我搜索了很多,但我只能找到有关缩放、旋转和翻译动画的信息.所以有人有任何想法请帮忙.在 android 中可以吗?

I want to move an image through a curved path.Is it possible in android ? I searched a lot but i can only find about scale,rotate and translate animation.So anyone have any idea please help.Is it possible in android?

推荐答案

您可以制作逐帧动画.您可以逐步定位对象以创建曲线.这将是有限的重用,但你可以做到.

You can do a Frame by Frame animation. You can position the object step by step to create a curve. That will be of limited reuse, but you can do it.

或者您可以编写自己的动画来创建 TweenAnimation 的子类,该子类可以沿曲线设置动画.如果您擅长数学并且可以理解贝塞尔曲线,那么这可能是一个直接的选择.拥有该课程后,您可以轻松地在任何弯曲路径上制作动画,但需要做更多的工作.

Or you can write your own animation to create a subclass of TweenAnimation that can animate along a curve. If you're good with math and can understand bezier curves then that might be a straight forward option. Once you have that class you could easily animate across any curved path, but it's more work.

http://en.wikipedia.org/wiki/B%C3%A9zier_curve

这是一些 Java 代码:

Here's some Java code:

http://www.math.ubc.ca/~cass/gfx/bezier.html

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

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