-->

Pulling animation on ios

2019-09-02 02:25发布

问题:

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.

回答1:

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

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;

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().