Material 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] |
| specularEnable | Boolean | Enable specularity? |
| specularPower | Number | Sharpness of specularity. |
| opacity | Number | Opacity of the material. |
| culling | Number | Type of culling to use. |
| specular | Color | Specularity color. |
| 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] |
| maps | Collection | (read only) Images in this material. |
| context | TimeContext | (read only) The asset's local TimeContext object. [from Asset] |
| contextType | Number | Type of the TimeContext for this asset. [from Asset] |
| diffuse | Color | Diffuse color. |
| ambient | Color | Ambient color. |
| emissivePower | Number | Intensity of emmisive power. |
| fillMode | Number | Controls solid/wireframe/point display. |
| blendMode | Number | Various ways to blend this material with the rest of the scene. |
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] |
| toString() | String | Returns a string representation of the object. [from Object] |
Description
The Material object is a type of asset that represents the surface of a model and is applied on a per-triangle basis to the geometry.
There are two types of object constructors for materials. 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 Material 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 theMaterial = new Material( "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 material will be attached.
Scripting object constructor syntax
var theMaterial = new Material( [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 material will be attached.
Material Examples
// Create the new material.
theMaterial = new Material( "library://greenSpots" );
// Create an image to use as a texture map.
theImage = new Image ( "library://shinyPlastic", "theMaterial" );
theMaterial.opacity = 0.5;
Methods that return a Material
| name | of object | description |
|---|---|---|
| swapMaterial() | Model | Use a new material in place of an existing material. |
Arguments that are a Material
| name | in method | of object | description |
|---|---|---|---|
| newMaterial | swapMaterial() | Model | A reference to a new Material< |