How to convert (rotate) an existing CALayer / animation?

I added CALayer to the UIView of my application:

    CATransition *animation = [CATransition animation];
    [animation setDelegate:self];
    [animation setDuration:0.35];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
        animation.type = @"pageCurl";
        animation.fillMode = kCAFillModeForwards;
        animation.endProgress = 0.58;
    [animation setRemovedOnCompletion:NO];
    [[self.view layer] addAnimation:animation forKey:@"pageCurlAnimation"];

Now, when the user rotates the device, the layer always remains in the same position on the screen (in accordance with the button on the main screen). Is it possible to rotate an animation / layer? I tried

self.view.layer.transform = CGAffineTransformMakeRotation (angle);

but this code just rotates the UIView, not the animation / layer I set.

+3
source share
1 answer

The error is because the type of the CALayer transform property is CATransform3D, and you give it CGAffineTransform. using CATransform3D CATransform3DMakeRotation (angle CGFloat, CGFloat x, CGFloat y, CGFloat z); instead of this.

+4

Source: https://habr.com/ru/post/1739249/


All Articles