CABasic Duration of change / rate of change during rotation

I use CABasicAnimation to rotate the imageView permanently, and I want to change the rotation speed during rotation. Can someone help me with this? Thanks in advance!

+7
source share
2 answers

You can see https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/AdvancedAnimationTricks/AdvancedAnimationTricks.html#//apple_ref/doc/uid/TP40004514-CH8-SW2

And I use this code.

Objective-c

self.layer.timeOffset = [self.layer convertTime:CACurrentMediaTime() fromLayer:nil]; self.layer.beginTime = CACurrentMediaTime(); self.layer.speed= theSpeedYouWant; 

Swift

 self.layer.timeOffset = self.layer.convertTime(CACurrentMediaTime(), fromLayer: nil) self.layer.beginTime = CACurrentMediaTime(); self.layer.speed = speed; 
+4
source

You can start a new basic animation at different speeds and take as the initial value the one that you get from the presentation level.

+2
source

All Articles