我目前在应用程序设置中遇到了一个问题,关于动画移动背景图片。基本上,我想让我的静止背景图片无限地从左向右滚动,但我很难把所有东西都拼凑在一起。通过各种其他来源,我编写了这个目前不起作用的函数,但我真的想不出如何或为什么会这样。
func animate(_ image: UIImageView) {
UIView.animate(withDuration: 5, delay: 0, options: .curveLinear, animations: {
image.transform = CGAffineTransform(translationX: -100, y: 0)
}) { (success: Bool) in
image.transform = CGAffineTransform.identity
self.animate(image)
}
}
非常感谢您的帮助和协助!