We have seen independent 3D objects in the previous recipes. Here is an example of a 3D object, a snowman:
The HTML code:
<html> <head> <title>Snowman</title> <script src="../threeLib/build/three.min.js"></script> <script src="newSnowMan.js"> </script> </head> <body onload="init()"> <center> <canvas width="1000" height="600" id="MyCanvasArea" style="border:2px solid blue;"> Canvas tag is not supported by your browser </canvas> <h1>Snowman</h1> </center> </body> </html>
var can; var scene; var camera; var renderer; var snowman; var particleSystem; var particleGeometry; var rotX=0; var rotY=0; var clock; function init() { clock=new THREE.Clock(); can=document.getElementById("MyCanvasArea"); renderer = new THREE.WebGLRenderer({ canvas: can, antialias: true //for smooth effect }); scene ...