CABasicAnimation resets to initial value after animation completes

后端 未结 15 2532
闹比i
闹比i 2020-12-04 05:44

I am rotating a CALayer and trying to stop it at its final position after animation is completed.

But after animation completes it resets to its initial position.

15条回答
  •  借酒劲吻你
    2020-12-04 06:16

    It seems that removedOnCompletion flag set to false and fillMode set to kCAFillModeForwards doesn't work for me either.

    After I apply new animation on a layer, an animating object resets to its initial state and then animates from that state. What has to be done additionally is to set the model layer's desired property according to its presentation layer's property before setting new animation like so:

    someLayer.path = ((CAShapeLayer *)[someLayer presentationLayer]).path;
    [someLayer addAnimation:someAnimation forKey:@"someAnimation"];
    

提交回复
热议问题