1

I have a UIImageView. I'd like to use a specific UIImage as an alpha mask to this UIImageView so that the UIImageView's image takes on the alpha component of the UIImage. The tricky part is that the UIImage should be rotating so that the alpha component of the UIImageView's image is animating.

I've never done this sort of thing. Could someone help me get started?

Thank you.

citizenCode
  • 85
  • 2
  • 7
  • could this get you started? http://stackoverflow.com/a/25894507/294884 – Fattie Apr 30 '15 at 16:09
  • in general search on "mask iOS" .. what about this one http://stackoverflow.com/questions/5757386/how-to-mask-an-uiimageview – Fattie Apr 30 '15 at 16:18

1 Answers1

1

You should be able to do this by installing your mask image into a CALayer and then installing that layer as the mask on your image view's layer.

Finally you'd create a CABasicAnimation that would animate the rotation.z of the mask layer's transform.

I don't know for absolutely certain that rotating a mask layer animates the masking action, but I'm pretty sure it would work.

Duncan C
  • 128,072
  • 22
  • 173
  • 272