Jerky / juttery (core-) animation in the splash screen?

I created a screensaver for Leopard that uses core-animation. He does nothing overly complicated; uses the CALayers and CATextLayers tree to create a โ€œtableโ€ of data in the following structure:

- root โ€บ maincontainer โ€บ subcontainer โ€บ row [multiple] โ€บ cell [multiple] โ€บ text layer 

At best, 50 CALayers are displayed on the screen.

Once I have built the โ€œtableโ€, I add the animation of the โ€œsubcontainerโ€ to the field of view using CABasicAnimation. Again, I am not doing anything unusual - just ironing.

The problem is that although the animation is really painful to watch. This is jerky on my development machine, which is an iMac 3.06 GHz with 4 GB of RAM and seems to slice the animation in 10 steps, rather than showing a gradual change.

On mac-mini ppc worse, a screen saver is for; he refuses to even play the animation, usually "tweening" from the start of the animation (opacity 0%) halfway (50%), and then ends.

I am relatively new to ObjectiveC, and my experience is based on using garbage-collected environments, but I cannot believe that I have enough memory at the very moment the screen saver starts to cause such problems.

In addition, I am sure that this is not a hardware problem. I tested the built-in screensavers that use core-animation, and downloaded several free CA-based ones for comparison, and they run without problems on both machines.

The information is pretty thin on Google regarding the use of CA in screensavers or the use of CA in general in this regard, and the tips / guides for profiling / alarming screens seem to be non-existent. Therefore, any help that the community can provide will be welcome!

--- UPDATE ---

Implicit animations seem to help smooth things out a bit. Still disgusting, but not as bad as trying to animate everything with explicit animation, as in my solution.

+4
source share
1 answer

The screen saver has no special meaning. I assume you started with the Core Animation Programming Guide ? Running through the tools will give you a lot of information about where you take too much time.

The code you use to do the fade-in would be helpful. For what you are describing, you do not even need CABasicAnimation; you can simply set the animated properties of the layers, and they expect by default. Make sure you read Implicit Animations . The rest of this page is probably also used.

Most of your work at CoreAnimation gets out of the way. I generally know what he is doing, and most of the problems come from the second assumption that it is too hard to say.

+1
source

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


All Articles