在具有一定半径的圆形路径上移动ImageView

问题描述 投票:3回答:1

我一直在阅读所有与动画有关的帖子,但我无法找到实现我所要求的方法。

我被要求在一个具有一定半径的圆形路径上移动图像,就像这里的http://www.4shared.com/photo/RtYILTLO/circularpath.html一样

我得到了动画的基础知识,但那是关于它的。任何类型的教程或提示都将受到热烈欢迎。

谢谢

更新1:

我正在浏览寻找一个示例,该示例将围绕某个路径制作动画并找到这个http://code.google.com/p/android-path-animation/

这个代码在一个复杂的curvey路径周围移动一个按钮,我试着用它做一个圆但是徒劳,有人会帮我修改一下这个代码所以按钮在圆形路径中移动吗?

谢谢

android animation android-animation
1个回答
0
投票

首先请更新this link它不起作用!

要为lolliPop创建圆形动画路径,请将此代码用作google suggested

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  Path path = new Path();
  path.arcTo(0f, 0f, 1000f, 1000f, 0f, 359f, true); //with first four parameters you determine four edge of a rectangle by pixel , and fifth parameter is the path'es start point from circle 360 degree and sixth parameter is end point of path in that circle
  ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.X, View.Y, path); //at first parameter (view) put the target view
  animator.setDuration(2000);
  animator.start();
}
© www.soinside.com 2019 - 2024. All rights reserved.