为 CABasicAnimation 应用速度和旋转数
我试图模仿中瓶子的旋转Roambie 中的可口可乐 应用程序和饼图应用程序。 。我想根据用户在该视图上的触摸和滑动来旋转视图。
我目前所做的:
- 获取触摸开始和结束的时间。 (和滑动)
- 获取所有触摸或滑动的坐标并找出总距离。
我相信可乐应用程序的旋转会根据滑动或触摸所需的距离和时间来为瓶子制作动画。但我不确定他们该怎么做。
我希望视图最初旋转得更快,然后减速并最终停止。
请分享您对如何解决这个问题的想法?
I am trying to mimic the rotation of the bottle in Spin the Coke app and pie-chart in the Roambie App. . I wanted to rotate a view as per the touches and swipes of the user on that view.
What I currently do it:
- Get the time when a touch Began and ended. (and swipe)
- Get all the coordinates of the touch or swipe and find the total distance.
I believe that the spin the coke app animates the bottles based on the distance and time taken for the swipe or touch. But I am not sure how they could have done.
I wanted the view to rotate faster initially, then slowdown and stop finally.
Please share your thoughts on how this problem could be solved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下关键帧动画:您必须手动构建动画,但您可以实现您想要的任何结果。
Take a look at keyframe animation: you have to build your animation manually but you can achieve any result you want.