Shadi Asi
Shadi Asi

Reputation: 157

How to create animation which animate repeatedly with UIViewPropertyAnimator?

with the UIView.animate: method , we can configure the options and make it [.autoreverse,.repeat]. here is a simple Animation:

@IBOutlet weak var v1: UIView!
 UIView.animate(withDuration: 3, delay: 0, options: [.autoreverse,.repeat], animations: {
                self.v1.frame = self.v1.frame.offsetBy(dx: 100, dy: 0)
            }, completion: nil)

this code will animate the v1 moving it forward and back repeatedly, how can I do it with UIViewPropertyAnimator?(I want to the the advantage of stop and pause)

Upvotes: 2

Views: 995

Answers (1)

Mojo66
Mojo66

Reputation: 1107

UIViewPropertyAnimator doesn't provide a way to do repeated animations. You need to use the old UIView animate class methods.

Upvotes: 1

Related Questions