WebGL (TM) Framework
 

3D Object Class

A transition of class taccgl3DObject shows or animates one or more 3D Objects that were designed with an external 3D Modelling program, such as Blender. taccgl3DObject inherits most of the methods and properties of the Transition Class. A taccgl3DObject is associated with an HTML element and takes position and size of it as basis for the position and size of the 3D object. Also optionally the HTML element can be mapped on the 3D object. taccgl3DObject works only in dddmode. In ddmode no objects are shown and such transitions are silently ignored.

For example the image above could be replaced by a Torus or a complete scence of various objects. There are various options to fit the scene in the space of the HTML element, by default it is streched to fit the replaced HTML element in every direction.

You can use all known methods of Transition Class to aminate, e.g. to, rotate, or resize. All these functions animate the complete taccgl3DObject. If you want to animate individual objects of a 3D scene, then you need to create multiple taccgl3DObjects each taking one or some objects of the scene for animating them individually.

In a first approach the HTML element that a taccgl3DObject refers to provides position information and so helps to adapt the 3D model to the (in general) dynamic positions of HTML elements on a page. You can, however, also map the HTML element on the 3D object.

In order to create a taccgl3DObject, you first need to load an 3D model file (see objFile, read, and taccglOBJFile Class) Then you can use taccglOBJFile.scene or taccglOBJFile.objs to select the complete scene from the file, or just some objects from it to form a taccgl3DObject. The result of taccglOBJFile.scene or taccglOBJFile.objs then needs to be supplied to actor or a etc.

Examples

var to=taccgl.objFile(); to.read('/objtest/taccgldoc.obj',false); to.mtl.ambientAdjust(0.4);
var a=taccgl.a("Layout",to.scene()).modFit(). to(100,500,-2500). rotateMiddle(0.7,0,0.7).dur(3).start();
RUN

taccgl3DObject has relatively few methods, because in fact it inherits most methods from Transition Class.

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:taccgl3DObject.modFit - Align scene with HTML element
Previous Page: taccglMTLFile.ambientAdjust - Ajust Ambient Color