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.

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 node

  • fieldName (str) – name of the field

  • value (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 node

  • fieldName (str) – name of the field

Examples

Modify a field in the composer per frame
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