UIView animateKeyFrames 未按预期工作

2 core-animation ios

我正在尝试为飞机起飞场景制作动画。在这里,我使用 UIView animatekeyFrames 方法并提供所需的关键帧,但最后一个关键帧没有动画,我附上了一个 GIF,您可以在其中看到最终翻译中的故障。

这是它目前的样子

这是我的整个动画代码,有人能帮我解决这里出了什么问题吗?

UIView.animateKeyframes(withDuration: 1.5, delay: 4.0, animations: {
    UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 1.0, animations: {
        self.plane.center.x += 300
        self.plane.center.y -= 60
    })
    UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.5, animations: {
        self.plane.transform = CGAffineTransform(rotationAngle: -.pi/16)
    })
    UIView.addKeyframe(withRelativeStartTime: 1.01, relativeDuration: 0.49, animations: {
        self.plane.center.x += 300
        self.plane.center.y -= 60
    })
}, completion: nil)
Run Code Online (Sandbox Code Playgroud)

And*_*tta 5

relativeStartTime并且relativeDuration必须在01的范围内。

请参阅https://developer.apple.com/documentation/uikit/uiview/1622554-addkeyframe