Type | function |
Library | shader.* |
See also | removeLight() |
Visual Guide | Visual Guide |
Add an object which will act as the light source for the Dynamic Shader. The object will replace a previously added light.
shader.addLight( object )
object. a display object or physics object. A table with object.x and object.y values can also be used at your own risk.
The Dynamic Shader will attach a table named shaderInfo to the object. The table can be ignored if you plan to move the light source using only one method. However, you might find the object.shaderInfo.available value helpful as an on-off toggle if you plan to move the light source with more than one method, e.g. following a touch event, following a touchjoint or moving with a transistion or translate command.
-- The Dynamic Shader adds shaderInfo table
object.shaderInfo = {
name = "I am the light source!", -- gives the the light source a name and
available = true
}
-- creates an "available" value. This will be helpful if you plan to move
-- the light source with more than one method, e.g. following a touch event, following a touchjoint
-- or moving with a transistion or translate command.
local shader = require 'plugin.dynamic-shader'
shader.addLight( object )