Does Core Animation scale weirdly slowly?

As part of the game for the iPhone, I have buttons that grow a little when you press them, and shrink when you release them (as a way to respond to user input). The response code looks like this:

-(void) magnifyButton: (CALayer *) button
{
 button.transform = CATransform3DScale(button.transform, buttonPressScale, buttonPressScale, 1.0);
}

-(void) reduceButton: (CALayer *) button
{
 button.transform = CATransform3DScale(button.transform, 1.0 / buttonPressScale, 1.0 / buttonPressScale, 1.0);
}

This works great. But if I press the button several times (each of which is a small image on CALayer), the animation running in the background (in the OpenGL view) slows down to 10 FPS. It seems absurd to me. I found a similar problem here , but since I use implicit animations, I'm not sure how I would decide to optimize in this case.

If anyone can offer a suggestion on how to make this run at a more reasonable speed, I would be very obliged. Thank you in advance

+3
2

, CALayer , :

button.shouldRasterize = YES;

, NO.

+2

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


All Articles