Skip to content

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

setValue

static 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 (string): name of the composer node
  • fieldName (string): name of the field
  • value (any): new value for the field

getValue

static 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 (string): name of the composer node
  • fieldName (string): 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