Thursday, October 29, 2026
HomeiOS Developmentios - know when animation does 360

ios – know when animation does 360

[ad_1]

I’ve animation, UIImageView does animation, it strikes round orbit infinitely, does 360, I ponder is it attainable to know when my animation does 360 ?

        let orbit = CAKeyframeAnimation(keyPath: "place")
        var affineTransform = CGAffineTransform(rotationAngle: 0.0)
        affineTransform = affineTransform.rotated(by: CGFloat(Double.pi))
        let circlePath = UIBezierPath(arcCenter: CGPoint(x: 0,y: 0), radius:  CGFloat(1), startAngle: CGFloat(0), endAngle:CGFloat(Double.pi * 2), clockwise: true)
        orbit.path = circlePath.cgPath
        orbit.length = 4
        orbit.isAdditive = true
        //orbit.repeatCount = 50000 * 50000
        orbit.repeatCount = .infinity
        orbit.calculationMode = CAAnimationCalculationMode.paced
        orbit.rotationMode = CAAnimationRotationMode.rotateAuto

        bigCookie.layer.add(orbit, forKey: "orbit")

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments