Skip to content

Commit

Permalink
CSS3DRenderer: Reverting to String concats.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Dec 11, 2012
1 parent 2cbb1ea commit b29d839
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions examples/js/renderers/CSS3DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,49 +91,49 @@ THREE.CSS3DRenderer = function () {

var elements = matrix.elements;

return ['matrix3d(' ,
epsilon(elements[0]) , ',' ,
epsilon(-elements[1]) , ',' ,
epsilon(elements[2]) , ',' ,
epsilon(elements[3]) , ',' ,
epsilon(elements[4]) , ',' ,
epsilon(-elements[5]) , ',' ,
epsilon(elements[6]) , ',' ,
epsilon(elements[7]) , ',' ,
epsilon(elements[8]) , ',' ,
epsilon(-elements[9]) , ',' ,
epsilon(elements[10]) , ',' ,
epsilon(elements[11]) , ',' ,
epsilon(elements[12]) , ',' ,
epsilon(-elements[13]) , ',' ,
epsilon(elements[14]) , ',' ,
epsilon(elements[15]) ,
')'].join('');
return 'matrix3d(' +
epsilon( elements[ 0 ] ) + ',' +
epsilon( - elements[ 1 ] ) + ',' +
epsilon( elements[ 2 ] ) + ',' +
epsilon( elements[ 3 ] ) + ',' +
epsilon( elements[ 4 ] ) + ',' +
epsilon( - elements[ 5 ] ) + ',' +
epsilon( elements[ 6 ] ) + ',' +
epsilon( elements[ 7 ] ) + ',' +
epsilon( elements[ 8 ] ) + ',' +
epsilon( - elements[ 9 ] ) + ',' +
epsilon( elements[ 10 ] ) + ',' +
epsilon( elements[ 11 ] ) + ',' +
epsilon( elements[ 12 ] ) + ',' +
epsilon( - elements[ 13 ] ) + ',' +
epsilon( elements[ 14 ] ) + ',' +
epsilon( elements[ 15 ] ) +
')';

}

var getObjectCSSMatrix = function ( matrix ) {

var elements = matrix.elements;

return ['translate3d(-50%,-50%,0) matrix3d(' ,
epsilon( elements[ 0 ] ) , ',' ,
epsilon( elements[ 1 ] ) , ',' ,
epsilon( elements[ 2 ] ) , ',' ,
epsilon( elements[ 3 ] ) , ',' ,
epsilon( - elements[ 4 ] ) , ',' ,
epsilon( - elements[ 5 ] ) , ',' ,
epsilon( - elements[ 6 ] ) , ',' ,
epsilon( - elements[ 7 ] ) , ',' ,
epsilon( elements[ 8 ] ) , ',' ,
epsilon( elements[ 9 ] ) , ',' ,
epsilon( elements[ 10 ] ) , ',' ,
epsilon( elements[ 11 ] ) , ',' ,
epsilon( elements[ 12 ] ) , ',' ,
epsilon( elements[ 13 ] ) , ',' ,
epsilon( elements[ 14 ] ) , ',' ,
epsilon( elements[ 15 ] ) ,
')'].join('');
return 'translate3d(-50%,-50%,0) matrix3d(' +
epsilon( elements[ 0 ] ) + ',' +
epsilon( elements[ 1 ] ) + ',' +
epsilon( elements[ 2 ] ) + ',' +
epsilon( elements[ 3 ] ) + ',' +
epsilon( - elements[ 4 ] ) + ',' +
epsilon( - elements[ 5 ] ) + ',' +
epsilon( - elements[ 6 ] ) + ',' +
epsilon( - elements[ 7 ] ) + ',' +
epsilon( elements[ 8 ] ) + ',' +
epsilon( elements[ 9 ] ) + ',' +
epsilon( elements[ 10 ] ) + ',' +
epsilon( elements[ 11 ] ) + ',' +
epsilon( elements[ 12 ] ) + ',' +
epsilon( elements[ 13 ] ) + ',' +
epsilon( elements[ 14 ] ) + ',' +
epsilon( elements[ 15 ] ) +
')';

}

Expand All @@ -147,7 +147,7 @@ THREE.CSS3DRenderer = function () {
this.domElement.style.perspective = fov + "px";

var objects = _projector.projectScene( scene, camera, false ).objects;

var style = "translate3d(0,0," + fov + "px)" + getCameraCSSMatrix( camera.matrixWorldInverse ) + " translate3d(" + _widthHalf + "px," + _heightHalf + "px, 0)";

this.cameraElement.style.WebkitTransform = style;
Expand Down

0 comments on commit b29d839

Please sign in to comment.