Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there way to convert mask image into UIBezierPath in iOS

I wanted to show animations on parts of image like a coloring apps. I achieved this with masking but that is heavy on performance.

I'm looking a way to convert a mask into UIBezierPath so I can add animations on layers on UIView instead of UIView object every-time.

I'm trying to following the exact same method of MagicWand for Mac but it has lot of Cocoa classes. Anyone can suggest me the solution of converting mask or image to UIBezierPath object according to iOS classes or any tutorial to find the clue?

Thanks in advance.

like image 560
Usman Mughal Avatar asked Mar 19 '17 20:03

Usman Mughal


1 Answers

Please have a look at PocketSVG if you are ok with using SVGs for the images. You'd get an array of bezier paths for a given svg. You could add each of these paths as separate CAShapeLayer objects and add any animations to their path and fill color as intended using CABasicAnimation.

Hope it answers your question.

like image 89
Shashikanth Avatar answered Nov 15 '22 09:11

Shashikanth