在iOS中为UIImageView的圆形蒙版设置动画 [英] Animate circular mask of UIImageView in iOS

查看:386
本文介绍了在iOS中为UIImageView的圆形蒙版设置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在uiimageview上为蒙版的比例设置动画。附加示例图像。灰色框是我的uiviewcontroller的图像背景,不是问题的一部分。

I am wondering how to animate the scale of a mask on a uiimageview. Example images attached. The gray boxes are the image background of my uiviewcontroller and is not part of the issue.

我假设创建了一个uiview子类,我传递了一个图像,一个半径和一个中心点。然后(?)创建一个面具,然后来回动画它?

I assume creation of a uiview subclass that I pass an image, a radius and a center point. And then (?) create a mask, and then animate it back and forth?

有人能指出我正确的方向吗?圆圈可以放在任何地方,任何尺寸,但要显示的图像始终是全屏。

Can anyone point me in the right direction? The circle can be placed anywhere, at any size, but the image to be revealed is always full screen.

最后我将添加一种方法来缩小圆圈。但是一步一步。

Eventually I will add a method to shrink the circle back down. But one step at a time.

感谢您的指示,

-e

推荐答案

一种可能是使用CAShapeLayer绘制蒙版。原因是CAShapeLayer的路径是可动画的。

One possibility might be drawing the mask with a CAShapeLayer. The reason is that the path of a CAShapeLayer is animatable.

这篇关于在iOS中为UIImageView的圆形蒙版设置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆