Composer¶
The composer module is giving access to the main composition and its nodes and fields. It allows to read and write any field’s value on the fly.
Usage¶
To use this module, add the following require at the top of your script:
local Composer = require 'engine/composer'
Reference¶
- composer.setValue(nodeName, fieldName, value)¶
Set the value of a composer node’s field. This works only on the main composition and only
if the composer node has a name. If multiple nodes have the same name, the first one will be used
- Parameters:
nodeName (
str
) – name of the composer nodefieldName (
str
) – name of the fieldvalue (
any
) – new value for the field
- composer.getValue(nodeName, fieldName)¶
Get the value of a composer node’s field. This works only on the main composition and only
if the composer node has a name. If multiple nodes have the same name, the first one will be used
- Parameters:
nodeName (
str
) – name of the composer nodefieldName (
str
) – name of the field
Examples¶
local Composer = require 'engine/composer'
local System = require 'engine/system'
function prerender()
local blur = math.sin(System.getTime() / 1000) * 0.5 + 0.5
Composer.setValue("RadialBlur", "Amount", blur)
end