HTML5 Canvas 3D WebGL (TM) javaScript Library
 

newFace Library Method

Short Description: Add new face

Signature: f.newFace (xtl,ytl,ztl,xtr,ytr,ztr,xbl,ybl,zbl,xbr,ybr,zbr)
Class: taccglMultiFace Class
 

Adds a new face to a MultiFace object. (xtl,ytl,ztl) denote the coordinates of the top-left corner of the face; (xtr,ytr,ztr) the coordinates of the top-right corner; (xbl,ybl,zbl) the coordinates of the bottom-left corner; and (xbr,ybr,zbr) the coordinates of the bottom-right corner. All coordinates are relative to the position of the object. Coordinate values are usually in the range 0.0..1.0 and are given in units of the width, heigth, and depth vector of the object.

The created face is selected and subsequent blend, color, ... and map operations work on the selected face.

Examples

var a=taccgl.actor("testimg",taccgl.multiFace); a.depth(a.h);
a.newFace(0,0,0, 1,0,0, 0,1,0, 1,1,0);
a.newFace(0,0,0, 1,0,0, 0,0,1, 1,0,1);
a.rotateMiddle(0,0,1).dur(5).start(). cont().rotateMiddle(0,1,0).start(). cont().rotateMiddle(1,0,0).start();
RUN
var a=taccgl.actor("testimg",taccgl.multiFace); a.depth(a.h);
a.newFace(0,0,1, 1,0,1, 0,1,1, 1,1,1);
a.newFace(0,0,0, 1,0,0, 0,0,1, 1,0,1);
a.rotateMiddle(0,0,1).start(). cont().rotateMiddle(0,1,0).start(). cont().rotateMiddle(1,0,0).start();
RUN
var a=taccgl.actor("pgMiddleColumnTable").showAfter().start();
var a=taccgl.actor("LeftcolumnDown",taccgl.multiFace); a.depth(a.w);
a.newFace(0,0,0, 1,0,0, 0,1,0, 1,1,0);
a.newFace(1,0,0, 1,0,1, 1,1,0, 1,1,1);a.color("yellow");
a.newFace(0,0,0, 0,0,1, 0,1,0, 0,1,1);a.color("brown");
a.to({rz:-1}).dur(5).start();
a.cont().rotateMiddle(0,0,1).dur(5).start(). cont().rotateMiddle(0,1,0).dur(5).start(). cont().rotateMiddle(1,0,0).dur(5).start()
.cont().flyHome().start();
RUN

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:taccglMultiFace.selFace - Select a face
Previous Page: taccglMultiFace Class