Skip to content

Files

Latest commit

56407f4 · Jan 22, 2017

History

History
44 lines (31 loc) · 1.68 KB

addLight.markdown

File metadata and controls

44 lines (31 loc) · 1.68 KB

shader.addLight()

 
Type function
Library shader.*
See also removeLight()
Visual Guide Visual Guide

Overview

Add an object which will act as the light source for the Dynamic Shader. The object will replace a previously added light.

Syntax

shader.addLight( object )
object (required)

object. a display object or physics object. A table with object.x and object.y values can also be used at your own risk.

NOTE

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.

Examples

local shader = require 'plugin.dynamic-shader'

shader.addLight( object )