I am using CABasicAnimation to rotate forever an imageView and I want to change rotation speed during rotation. Can anybody help me with this? Thanks in advance!
Asked
Active
Viewed 1,934 times
2 Answers
4
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;

Yu-Lin Wang
- 131
- 2
- 5
2
You can start a new basic animation with different speed and take as the start value the one you receive from the presentation layer.

Bernd Rabe
- 790
- 6
- 23
-
How to do that? Could you write an example – imike Jul 27 '19 at 15:35