【问题标题】:CoreAnimation CATransform3DScale hides a UIViewCoreAnimation CATransform3DScale 隐藏了一个 UIView
【发布时间】:2021-12-05 22:26:42
【问题描述】:

我正在尝试使视图具有弹出屏幕的效果。但是,每次我尝试使用 CATransform3DScale 时,视图都会消失。我尝试使用 zPosition 进行调整,但没有奏效。我正在使用 cocoapods 的“TheAnimation”。我似乎找不到解决这个问题的方法。

private func setupAnimation(){
        var transform = CATransform3DIdentity
        transform.m34 = -1.0/500.0
        //containerViews[0].layer.anchorPoint = CGPoint(x: 0.0, y: 0.0)
        containerViews[0].layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)
        transform = CATransform3DScale(transform, 0, 0, 1)
        let animation = BasicAnimation(keyPath: .transform)
        animation.fromValue = CATransform3DIdentity
        animation.toValue = transform
        animation.duration = 3.0
        animation.setAnimationDidStop { _ in
            print("hello")
            self.containerViews[0].layer.zPosition = 0
        }
        animation.animate(in: containerViews[0].layer)
    }

视图消失,然后在动画持续时间后重新出现。

【问题讨论】:

  • 试着给我们一个更好的描述“跳出屏幕” ...您是否试图从一个非常小的视图开始并让它“成长”?
  • transform = CATransform3DScale(transform, 0, 0, 1) 应该从 1 增加。这是我的错误,不理解转换应该做什么
  • 您能回答您自己的问题并将其标记为已解决吗?

标签: ios swift core-animation


【解决方案1】:

transform = CATransform3DScale(transform, 0, 0, 1) 应该从 1 增加。这是我的一个错误,不了解转换应该做什么

同样来自价值不应该是身份

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-19
    • 2017-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多