user2453876
user2453876

Reputation: 303

Creating animated image masking

I have a circular UIView. I want to be able to apply a mask that sits on top of it, and rotates above it so that the circular view appears gradually.

Is this even possible in iOS? I know it is in flast. But not sure where would I even start with a task like this in iOS??

Upvotes: 0

Views: 145

Answers (2)

David Rönnqvist
David Rönnqvist

Reputation: 56625

You can create a shape layer like in this answer that will look as if it is appearing gradually (like a clock making a full circle). Then you can put the circular content in another layer (or use your view's layer) and make the shape layer the mask:

CAShapeLayer *maskLayer = // see linked answer
yourCircularView.layer.mask = maskLayer;

CABasicAnimation *drawMaskAnimation = // see linked answer
[maskLayer addAnimation:drawMaskAnimation forKey:@"appear gradually"];];

Upvotes: 1

chuthan20
chuthan20

Reputation: 5409

All UIView is backed by CALayer which allows some of the properties to be animated as well as mask to be applied. You will find the tutorial in this page very helpful. www.raywenderlich.com

Upvotes: 0

Related Questions