Infineon Labs
Infineon Labs

Reputation: 91

How do I animate and move a circle across a bezier path?

Hey so I'm pretty new to ObjC and coding in general. Essentially I want to make a circle move across a UIBezier path (close to a sin function) one 'unit' every hour and make its shadow small and yellow, then brigger and white, then small and dim again as it moves up and then down the curve. The crest of the sin function should be midday (noon), and the 'tails' of the curve should midnight on both sides. Is this even possible? And where can I find the resources to help me? Couldn't seem to find anything online to help me since I don't know what I need to achieve this. Thanks!

Upvotes: 0

Views: 279

Answers (1)

rdelmar
rdelmar

Reputation: 104092

You use the CAKeyFrameAnimation class to move the view along a path. You create a path, and animate the position property of the view's layer. An example of this is in Apple's Core Animation documentation in the "Using a Keyframe Animation to Change Layer Properties" section. The other things you want to do with the shadow, can be done with CABasicAnimation. You can animate a shadow's color, offset, radius, path, and opacity.

Upvotes: 2

Related Questions