gpt4 book ai didi

ios7 - AVPlayerLayer收缩动画

转载 作者:行者123 更新时间:2023-12-04 18:33:03 25 4
gpt4 key购买 nike

我正在尝试在 AVPlayerLayer 上制作“收缩”动画,但一旦我这样做,视频内容就会从屏幕上消失。为持有 AVPlayerLayer 的 UIView 设置动画但 AVPlayerLayer 无效。制作动画的正确方法是什么?

 CGRect oldBounds = playerLayer.bounds;
CGRect newBounds = oldBounds;
newBounds.size = CGSizeZero;
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"bounds"];
animation.duration = 5.f;
animation.beginTime = CACurrentMediaTime();
animation.fromValue = [NSValue valueWithCGRect:oldBounds];
animation.toValue = [NSValue valueWithCGRect:newBounds];


[playerLayer addAnimation:animation forKey:@"shrink"];

最佳答案

当图层被 View 控制时,iOS 默认关闭图层的动画。但是,当您为 UIView 上的属性设置动画时,它会短暂地打开图层的动画功能,并将动画参数发送到图层以执行,然后关闭图层上的动画功能。那就是:在它控制 UIView 而不是层上做动画。

就是说,我也不知道如何让我的 AVPlayerLayer 通过我的 UIView 进行动画处理。我上面所说的是它应该如何工作,但我现在也无法让它工作。呵呵。

关于ios7 - AVPlayerLayer收缩动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24709607/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com