HTML5 Canvas 2D Library
 

objs Library Method

Short Description: Select objects to create transition

Signature: x.objs (regex)
Class: taccglOBJFile Class
 
Placeholder for OBJ

<div id="placeholder" style="width:200px; height:200px; float:right; border:1px solid; padding:30px">

The objs method returns an taccgl3DObject Class object representing a transition displaying one or more 3D objects stored in the OBJ file. The result of objs must be passed as second argument to a or actor in order to attach it to the animation.

regex must be a regular expression. All 3D objects that match the regular expression are selected. Typically simple regular expressions are "cube" for all objects whose name contain the character sequence "cube", "^cube$" for the object named "cube", or "^cube$|^sphere$" for the object named cube and the object named sphere.

Per default the scene is interpreted to be in element coordinates, i.e. (0,0,0) denotes the top left of the HTML element, (1,0,0) the top right, (0,1,0) the bottom left and (1,1,0) the bottom right. The initial depth of the HTML is set identical to the height of the element. Coordintate (0,0,1) of the scene so refer to the top, left, back point of the HTML element, which is depth pixels behind the top left of the HTML element.

If the proportions of the HTML element do not exaclty match the proportions of the scene, the scene is stretched differently for each axis, so that sphere or a cube appear deformed. Other ways of adjustment can be selected using modFit.

Examples

var to=taccgl.objFile(); to.read('/objtest/taccgldoc.obj',false);
to.mtl.ambientAdjust(0.6);
var a=taccgl.actor("placeholder",to.objs("Cone")).modFit(). rotateMiddle(0.7,0,0.7). dur(3).start();
RUN
var to=taccgl.objFile(); to.read('/objtest/taccgldoc.obj',false);
to.mtl.ambientAdjust(0.4);
var a=taccgl.actor("placeholder",to.objs("Sphere|Torus")).modFit(). to(0,1000,0).dur(3).start();
RUN

objs works properly only when and if the OBJ file has been succefully downloaded, i.e. taccglOBJFile.ready returns "ready". However, if the file was not downloaded because of an error or because of ddmode then scene makes an empty transition, that does nothing. So if in ddmode transitions that in dddmode show 3DObjects should just be left out, nothing special needs to be programmed.

Next Page:OBJ File Creation
Previous Page: taccglOBJFile.scene - Take complete scene to create transition