layerMode | |||||||
Type | property | ||||||
Dictionary | LCS | ||||||
Library | LiveCode Script | ||||||
Syntax |
| ||||||
Associations | field, button, graphic, scrollbar, player, image | ||||||
Summary | Specifies whether an object is dynamic or static. | ||||||
Introduced | 5.0 | ||||||
OS | mac, windows, linux, ios, android | ||||||
Platforms | desktop, mobile | ||||||
Example |
| ||||||
Values |
| ||||||
Related | Property: compositorTileSize, compositorType, compositorCacheLimit | ||||||
Description | Use the layerMode property to specify if an object is static or dynamic. The LiveCode engine uses this to optimize rendering performance by caching objects that are moving or changing regularly. If you specify the effective keyword, getting the layerMode returns how the engine is actually treating the layer, rather than what you requested it to be. There can be a difference for a number of reasons:
Scrolling The scrolling layerMode is pertinent to groups. It means that the engine caches the content of the group unclipped, and then renders the cached copies clipped; instead of caching the visible portion of the group. This results in fast updates when setting the scroll properties of a group. Container The container layerMode is pertinent to groups. When a group has its layerMode set to 'container', and all its ancestor groups (if any) have their layerMode set to 'container', the engine ignores the group for the purposes of accelerated rendering, allowing objects within the group to have 'static', 'dynamic' or 'scrolling' layerModes; e.g. an image with 'dynamic' layerMode inside a group will behave the same as if it were a top-level object with 'dynamic' layerMode except it will be clipped by the rect of its owning group. Static vs Dynamic There are various contexts where setting the layerMode can have a big impact on the performance of an application, in particular games or interfaces with moving/changing elements. In these cases, the layerMode should be set to 'dynamic'. A PLATFORM GAME EXAMPLE Take a platform game as an example. The main character, any animated elements and scrolling platform components should all have a layerMode of 'dynamic'. However, the background image should have a layerMode of 'static'. NON-GAME DRAG EXAMPLE Consider a drag-drop interface where a user can 'pick' something up and drop it elsewhere. While the object is being dragged across the stack the layerMode can be set to 'dynamic' (particularly important if it has graphic effects applied). Once in its final location the layerMode can be returned to 'static'
| ||||||
Tags | windowing |