Light in Anark Studio 2.5
Instance Properties
| name | type | description |
|---|---|---|
| prototype | Object | The prototype for a class. [from Object] |
| constructor | Object | A reference to the constructor class for the current object instance. [from Object] |
| id | Number | (read only) Unique ID for the asset. [from Asset] |
| type | String | (read only) Type of the asset. [from Asset] |
| name | String | User-defined name for the asset. [from Asset] |
| parent | Object | (read only) Parent object of this asset. [from Asset] |
| active | Boolean | Should this asset be drawn? [from Asset] |
| startLifeTime | Number | Starting time of the asset. [from Asset] |
| endLifeTime | Number | Ending time of the asset. [from Asset] |
| behaviors | Collection | (read only) All Behavior objects attached under this asset. [from Asset] |
| sounds | Collection | (read only) All Sounds objects attached under this asset. [from Asset] |
| music | Collection | (read only) All Music objects attached under this asset. [from Asset] |
| context | TimeContext | (read only) The asset's local TimeContext object. [from Asset] |
| contextType | Number | Type of the TimeContext for this asset. [from Asset] |
| position | Vector | Location of the object. [from Node] |
| rotation | Rotation | Rotation of the object. [from Node] |
| scale | Vector | Scale of the object. [from Node] |
| pivot | Vector | Pivot point location. [from Node] |
| lastGlobalTransform | Matrix | (read only) Cumulative transformation applied to this object. [from Node] |
| opacity | Number | Opacity of the object. [from Node] |
| cameras | Collection | (read only) All cameras attached to this object. [from Node] |
| groups | Collection | (read only) All groups attached to this object. [from Node] |
| lights | Collection | (read only) All lights attached to this node. [from Node] |
| models | Collection | (read only) All models attached to this node. [from Node] |
| source | Number | Type of light. |
| brightness | Number | Maximum light level. |
| expFade | Number | Exponential fade-off speed. |
| specular | Color | Highlight color. |
| diffuse | Color | Light color. |
| ambient | Color | Ambient scene color. |
| clickable | Boolean | Can this object be clicked on? [from Node] |
| linearFade | Number | Fade-off speed. |
Instance Methods
| name | returns | description |
|---|---|---|
| toLocaleString() | String |
For most objects, the same as toString() unless explicitly overridden.
[from Object]
|
| valueOf() | String |
Returns the internal this value of the object.
[from Object]
|
| hasOwnProperty() | Boolean | Determines if the object/instance itself has the named property or method. [from Object] |
| isPrototypeOf() | Boolean | Determines if the calling object prototype is in the inheritance chain for the supplied argument. [from Object] |
| propertyIsEnumerable() | Boolean |
Determines if the object/instance itself has a property or method of the supplied name which will appear in a for (prop in obj) enumeration.
[from Object]
|
| attach() | (none) | Attach the argument underneath the asset. [from Asset] |
| detach() | (none) | Remove an asset from this asset. [from Asset] |
| copy() | Asset | Create a copy of the asset. [from Asset] |
| removeChildren() | (none) | Remove all children from this node. [from Node] |
| toString() | String | Returns a string representation of the object. [from Object] |
Description
The Light object is a type of node, and as such can be added as a child to any other node such as a group or a camera. Lights are added to nodes contained within a layer, and when they are active they illuminate the scene in a variety of ways depending on the settings of their properties. There may be up to 8 simultaneously active lights for each layer.
Lights are sophisticated objects and support many advanced capabilities. Because they are nodes, they have location and rotation properties, and may be dynamically animated to produce stunning effects.
There are two types of object constructors for lights. The Library asset constructor creates a new instance of the object from a resource in the Anark Studio Library. The scripting object constructor creates an empty Light object. Objects created via scripting are not available to the Anark Studio interface, but they do appear in the finished project.
Library asset constructor syntax
var theLight = new Light( "library://libraryAssetName" [, objectToAttachTo] );
libraryAssetName- required — A String with the name of the asset in the Anark Studio Library from which to create this object.
objectToAttachTo- optional — The String name of the object to which the light will be attached. The light must be attached to an object in the scene either now or later in order to appear in the scene during playback.
Scripting object constructor syntax
var theLight = new Light( [sceneGraphName] [, objectToAttachTo] );
sceneGraphName- optional — A String with the name for the new layer in the scene graph.
objectToAttachTo- optional — The String name of the object to which the light will be attached. The light must be attached to an object in the scene either now or later in order to appear in the scene during playback.
Light Examples
// Create a light.
this.theLight = new Light( "KeyLight" );
// Attach the light to an existing layer.
scene.BackgroundLayer.attach( this.theLight );
// Set the light's diffuse color to green and turn it on.
this.theLight.diffuse.r = 0;
this.theLight.diffuse.g = 255;
this.theLight.diffuse.b = 0;
this.theLight.active = true;