Camera in Anark Studio 2.5

Represents a camera rendering a layer.

Inherits from:

Instance Properties

name type description
active Boolean Should this asset be drawn? [from Asset]
behaviors Collection (read only) All Behavior objects attached under this asset. [from Asset]
cameras Collection (read only) All cameras attached to this object. [from Node]
clickable Boolean Can this object be clicked on? [from Node]
clipFar Number Rear clipping plane distance.
clipNear Number Front clipping plane distance.
constructor Object A reference to the constructor class for the current object instance. [from Object]
context TimeContext (read only) The asset's local TimeContext object. [from Asset]
contextType Number Type of the TimeContext for this asset. [from Asset]
endLifeTime Number Ending time of the asset. [from Asset]
fogColor Color Color of the fog.
fogEnable Boolean Use fog?
fogFar Number Distance to fog 'white-out'.
fogNear Number Distance to start of fog.
fov Number Field of view.
groups Collection (read only) All groups attached to this object. [from Node]
id Number (read only) Unique ID for the asset. [from Asset]
lastGlobalTransform Matrix (read only) Cumulative transformation applied to this object. [from Node]
lights Collection (read only) All lights attached to this node. [from Node]
lookAtLock Boolean Always look at the same point?
lookAtPoint Vector Location for the camera to look at.
models Collection (read only) All models attached to this node. [from Node]
music Collection (read only) All Music objects attached under this asset. [from Asset]
name String User-defined name for the asset. [from Asset]
opacity Number Opacity of the object. [from Node]
orthographic Boolean Use orthographic rendering?
parent Object (read only) Parent object of this asset. [from Asset]
pivot Vector Pivot point location. [from Node]
position Vector Location of the object. [from Node]
prototype Object The prototype for a class. [from Object]
rotation Rotation Rotation of the object. [from Node]
scale Vector Scale of the object. [from Node]
sounds Collection (read only) All Sounds objects attached under this asset. [from Asset]
startLifeTime Number Starting time of the asset. [from Asset]
type String (read only) Type of the asset. [from Asset]

Instance Methods

name returns description
attach(assetObject) (none) Attach the argument underneath the asset. [from Asset]
copy() Asset Create a copy of the asset. [from Asset]
detach(assetObject) (none) Remove an asset from this asset. [from Asset]
hasOwnProperty(propertyOrMethodName) Boolean Determines if the object/instance itself has the named property or method. [from Object]
isPrototypeOf(instanceToTest) Boolean Determines if the calling object prototype is in the inheritance chain for the supplied argument. [from Object]
propertyIsEnumerable(propertyOrMethodName) 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]
removeChildren() (none) Remove all children from this node. [from Node]
toLocaleString() String For most objects, the same as toString() unless explicitly overridden. [from Object]
toString() String Returns a string representation of the object. [from Object]
valueOf() String Returns the internal this value of the object. [from Object]

Description

The Camera object may be attached to any node, and forms the view through which a particular layer is rendered. Each camera is associated with a specific layer, and can be made active by setting the active property to true. When a layer is rendered as part of a scene, the active camera that is a part of the layer is automatically used as the viewpoint. Only one camera in a given layer may be active at a time.

There are two types of object constructors for cameras. 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 Camera 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 theCamera = new Camera( "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 camera will be attached. The camera 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 theCamera = new Camera( [sceneGraphName] [, objectToAttachTo] );
sceneGraphName
optional — A String with the name for the new material in the scene graph.
objectToAttachTo
optional — The String name of the object to which the camera will be attached. The camera must be attached to an object in the scene either now or later in order to appear in the scene during playback.

Camera Examples

// Create a new camera.  
this.theCamera = new Camera( "BackgroundCamera" );

//Attach the camera to an existing layer.  
scene.BackgroundLayer.attach( this.theCamera );  

// Set the camera to have white fog.  
this.theCamera.fogColor.r = 255;  
this.theCamera.fogColor.g = 255;  
this.theCamera.fogColor.b = 255;  
this.theCamera.fogEnable = true;  

// Set this to be the active camera.  
this.theCamera.active = true;