Are offshore animations ignored by the rendering and processor?

It’s just interesting how Cocos controls the CPU cycle and graphics engine for CCSprites that are off-screen, including in the middle of the animation. If you have a lot of animated sprites going on and off, I can check and stop each animation when it is turned off, and then restart it when it is about to return, but I wonder if it is necessary?

Suppose you have a layer with a bunch of them, and you make the layer invisible, but do not stop the sprite animation. Will they use CPU time?

+6
source share
1 answer

I just did a quick test (good question :)), in a game where I can slide across the screen on a large map containing images of soldiers performing an animation of "idle". They continue to work when the screen is off (I pressed CCCallFunc in sequence, repeating forever, on a simple selector that registers).

I suspect that they will also start when the object is not visible. This makes sense, especially for animations. If you look at my use case, if the animation is stopped, it can lead to cognitive shutdown if the user put a soldier in and out of sight, especially when a soldier takes a walk on the map - he could actually walk through the view without using any interaction with the screen .

+1
source

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


All Articles