在动画的 UIView 上获取点的颜色

Get a point's colour on a UIView that is animating

我可以按照@jack-song 在 中提出的观点获取颜色。但是,当我为视图设置动画时

let scaledAndTranslatedTransform = imageViewShape.transform.translatedBy(x: -imageViewShape.bounds.width * 2 - 200, y: 0.0)

UIView.animate(withDuration: TimeInterval(duration), animations: {
            self.imageViewShape.transform = scaledAndTranslatedTransform
        }, completion: { _ in

})

随着视图的移动,我无法获取点的颜色。 如何在视图移动时获取点?

使用视图层的 presentationLayer 属性,因为如果我们在 MVC 模式中看到,您将在动画之前和动画之后拥有模型作为核心动画 类 是 MVC 模式中的模型,因此如果您想要获取动画使用表示层之间的值