Reputation: 689
I have this code that rotates my imageview but when I press my pause button I want the rotation speed to be 0. How would I do that?
@IBAction func playButtonL(sender: AnyObject) {
rotation.toValue = NSNumber(double: M_PI * 2)
rotation.duration = 2
rotation.cumulative = true
rotation.repeatCount = FLT_MAX
self.leftCircleImageView.layer.addAnimation(rotation, forKey: "rotationAnimation")
}
@IBAction func pauseButtonR(sender: AnyObject) {
}
Upvotes: 0
Views: 239
Reputation: 697
To Reduce time of animation you can use
rotation.duration = 2
To stop reset it's state default you can use
cabasicanimation.removedOnCompletion = NO;
cabasicanimation.fillMode = kCAFillModeForwards;
Answer credits and reference :
CABasicAnimation resets to initial value after animation completes
Hope it helps! let me know if you need any further help.
Upvotes: 1