动画 CALayer ShadowOffset
我想使用 CATransaction 为图层的 ShadowOffset 制作动画。但影子却出现了 没有动画:
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:1.2]forKey:kCATransactionAnimationDuration];
[CATransaction setValue:[NSNumber numberWithBool:NO] forKey:kCATransactionDisableActions];
logoIndex.layer.shadowOpacity = 0.2;
[logoIndex.layer setShadowOffset:CGSizeMake(10, 30)];
[logoIndex.layer setShadowRadius:5];
[CA事务提交];
感谢您的帮助
I want to animate the ShadowOffset of my layer with CATransaction. But the shadow appears
without animation:
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:1.2]forKey:kCATransactionAnimationDuration];
[CATransaction setValue:[NSNumber numberWithBool:NO] forKey:kCATransactionDisableActions];
logoIndex.layer.shadowOpacity = 0.2;
[logoIndex.layer setShadowOffset:CGSizeMake(10, 30)];
[logoIndex.layer setShadowRadius:5];
[CATransaction commit];
Thank you for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用 CATransaction 的任何具体原因是什么?如果您使用直接属性动画并将动画添加到图层中,您可能会有更好的时间。
我知道这已经有几个月了,但我想我会加两分钱,以防你回来看它或其他人发现它。
Any particular reason why you're using CATransaction? You may have a better time if you use direct property animation and add the animation to the layer.
I know this is several months old but figured I'd add my two cents in case you ever come back to it or someone else finds it.