使用 CGLayers 创建自定义动画?
基本上,我想制作一个缩小的圆圈的动画。我已经通过在 CGLayer 上绘制逐渐变小的圆圈,然后使用
if(index < 30){
[self PerformSelector:@selector(showNextLayer) withObject:nil afterDelay:(NSTimeInterval)0.02]; 索引++;
在
我的 showNextLayer 方法中。这适用于我的简单目标,但总的来说,这是绘制自定义动画的或多或少合理的方式吗?
Apple 有很多关于动画的文档 - 足以让我困惑 - 但据我 - 最终 - 理解:
- UIView 提供的动画服务非常适合对一些基本视图属性、视图转换等进行动画处理,
- 这些属性由以下类提供:继承自 CAAnimation,适用于对颜色变化、3d 变换等属性进行动画处理。
- UIViewImage 适合对自定义位图图像进行动画处理(当您只能在 CGLayer 中绘制圆圈时,创建位图图像并不是一个好主意)。
在我看来,还支持显示 CGLayer 序列的内容,我是否遗漏了什么?
预先感谢您的任何澄清..
Basically, I want to animate a shrinking circle. I've already done this by drawing progressively smaller circles onto CGLayer's, and then using
if(index < 30){
[self performSelector:@selector(showNextLayer) withObject:nil afterDelay:(NSTimeInterval)0.02];
index++;
}
in my showNextLayer method. This works for my simple goal, but in general is this a more or less sensible way to draw a custom animation?
Apple has a lot of documentation on animation -enough to confuse me-, but as far as I -finally- understand:
- The animation services provided by UIView is good for animating some basic view properties, view transitions etc.,
- those provided by classes that inherit from CAAnimation, are good for animating properties like color change, 3d transformations etc.
- UIViewImage is good for animating custom bitmap images (and it is not a good idea to create bitmap images when you can just draw circles into a CGLayer instead).
It seems to me that displaying the contents of a sequence of CGLayer 's would also be supported, am I missing something?
Thanks in advance for any clarification..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论