UIView.animateWithDuration swift loop animation

前端 未结 2 1967
悲哀的现实
悲哀的现实 2020-12-13 12:54

In ViewController.Swift I managed to make a box animate from one point to another. I thought it would be easy to loop this so the box will animate to one point and then anim

2条回答
  •  一个人的身影
    2020-12-13 13:14

    UIView.animate(withDuration: 3.0,
                               delay: 0.0,
                               options: [.curveLinear, .repeat],
                               animations: { () -> Void in
                               coloredSquare.frame = CGRect(x: 120, y: 220, width: 100, height: 100)
    
    }, completion: { (finished: Bool) -> Void in
    
    })
    

提交回复
热议问题