Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move uiview on circle trajectory?

Is there any way to animate uiview moving with cicle trajectory?enter image description here

like image 922
B.S. Avatar asked Apr 09 '12 12:04

B.S.


2 Answers

You will have to create a circular path and animate your view on the path. You can use UIBezierPath to create a circular path . Here is an example that does what exactly you want.

like image 96
Vignesh Avatar answered Nov 13 '22 14:11

Vignesh


There are a couple of options. Probably the simplest is to place your view on a parent view, and then animate rotating the parent view around its Z axis.

I guess you could also build a transform that shifts your view, then rotates it, and animate the transform to different rotation values. I'd have to tinker with that. I know the first approach would be quick and easy to set up.

As the other poster said, you could also create a keyframe animation that uses a CGPath to animate your view along a curve that approximated the shape of a circle, but that would be much more work.

like image 4
Duncan C Avatar answered Nov 13 '22 15:11

Duncan C