Ken Burns Effects - acceleratedRendering

Monte Goulding monte at
Tue May 28 23:58:47 EDT 2019

> On 29 May 2019, at 1:07 pm, Sannyasin Brahmanathaswami via use-livecode <use-livecode at> wrote:
> After listening to Mark Waddington presentation regarding the new container mode. It would seems that the layerMode --  container is for groups only. 

> So nothing has changed with respect to doing Ken Burn effect with large image, or  a parallax effect with images placed on top of each other, or far that matter, moving an animated gif across the screen. Setting these to a dynamic layerMode, with acceleratedRendering sent to true is still "very expensive"  and will block the engine.

It would be interesting to test the performance difference between an animated gif and locking the screen, moving a button and setting its icon. The reason being is I suspect the animated gif would re-render out of sync with your animation frames.

It may be helpful to understand exactly what the engine does with accelerated rendering true. Let’s say you have 10 static layerMode objects directly on a card then a dynamic layerMode object and then 2 static layerMode objects above that. This creates 3 layers (card with 10 static objects, dynamic object, 2 static objects).

As long as none of the static objects are changed then the bottom layer and the top layer do not need to be re-rendered. If the dynamic object is unchanged then it too does not need to be re-rendered. If the object is moved, resized, changes properties etc that require a re-render then the layer it is drawn into is re-rendered. The engine then uses the compositor (openGL, CoreGraphics, software) to merge the layers.

For scrolling layerMode it means to retain renderings outside the bounds of the currently visible controls and then clip it when the layers are merged.

For container layerMode it basically just tells the engine to look inside the group for controls with non-static layerModes and again to clip it when the layers are merged.

Now the use cases:

- Ken Burn effect - This both sizes and moves an image. It may help to use dynamic layerMode here but if it covers the entire screen I don’t think it will make much difference. At some point in the future we may support applying transformations to dynamic layerMode objects (changing size and perhaps location) which would mean Ken Burn effect would be done by the GPU. I suspect that’s a fair way off and would definitely involve some serious Mark time ;-)

- Parallax effect - This involves having multiple layers and moving them at different rates. You should be able to get good performance increases for this. Presuming a static background layer and either dynamic foreground and background objects or perhaps one or more scrolling layers which can cycle through their content at different rates.

FWIW I suspect Mark may correct me on some of what I’ve said here but hopefully I’m not too far wrong.



More information about the Use-livecode mailing list