如何快速从左向右移动图像?

Rod*_*ado 0 animation uiimageview swift

我做到了

屏幕截图

ivImageLoadingInside.center = CGPoint(x: 25, y: 0)
   UIView.animate(withDuration: 2, delay: 0, options: .repeat, animations: {
   self.ivImageLoadingInside.center = CGPoint(x: 80, y: 0)
}, completion: nil)
Run Code Online (Sandbox Code Playgroud)

但是总是停在中间。

这是带有动画的图像

屏幕截图

Gia*_*ang 7

private func animation(viewAnimation: UIView) {
    UIView.animate(withDuration: 2, animations: {
        viewAnimation.frame.origin.x = +viewAnimation.frame.width
    }) { (_) in
        UIView.animate(withDuration: 2, delay: 1, options: [.curveEaseIn], animations: {
            viewAnimation.frame.origin.x -= viewAnimation.frame.width
        })

    }
}
Run Code Online (Sandbox Code Playgroud)