在iOS上拉动画 [英] Pulling animation on ios

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

问题描述

请我需要知道如何使用多张图像来拉动效果。

Please i need to know how can i do pulling effect using multiple image.

这些图像必须遵循特定的路径,每个图像都像火车一样在另一个图像旁边。

Those images must follow a specific path each image beside another one like a train.

除了循环还有什么解决方法。

is there any solution than looping.

我想确切地说这些图像同时移动。

what i wanna exactly is those image move simultaneously.

推荐答案

您要使用CAKeyFrameAnimation,并使用CGPath来描述对象要遵循的路径。

You want to use a CAKeyFrameAnimation, using a CGPath to describe the path you want your objects to follow.

您将创建一系列动画,每个动画使用相同的路径,但具有不同的beginTimes。棘手的是如何使用beginTime。您想使用以下代码将每个动画设置为将来的某个时间:

You would create a series of animations, each using the same path, but with different beginTimes. The tricky bit is how to use beginTime. You want to set each animation to a time in the future using code like this:

anAnimation.beginTime = CACurrentMediaTime()+ delay;

anAnimation.beginTime = CACurrentMediaTime()+delay;

当动画是组的一部分时,beginTime表示为从组动画开始的秒数。不过,您无法将动画分组到不同的图层上,因此您需要独立启动每个动画。为此,您可以将beginTime设置为从CACurrentMediaTime()开始的时间。

When an animation is part of a group, beginTime is expressed as a number of seconds from the start of the group animation. You can't group animations on different layers, though, so you need to start each animation independently. To do that, you set beginTime to a time starting from CACurrentMediaTime().

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

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