| 1 | |
| 2 | == Threejs model == |
| 3 | {{{ |
| 4 | #!html |
| 5 | <script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"></script> |
| 6 | <script type="text/javascript"> |
| 7 | var scene = new THREE.Scene(); |
| 8 | var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000); |
| 9 | var renderer = new THREE.WebGLRenderer(); |
| 10 | renderer.setSize(window.innerWidth, window.innerHeight); |
| 11 | document.body.appendChild(renderer.domElement); |
| 12 | var geometry = new THREE.CubeGeometry(1,1,1); |
| 13 | var material = new THREE.MeshBasicMaterial({color: 0x00ff00}); |
| 14 | var cube = new THREE.Mesh(geometry, material); |
| 15 | scene.add(cube); camera.position.z = 5; |
| 16 | var render = function () { |
| 17 | requestAnimationFrame(render); |
| 18 | cube.rotation.x += 0.1; |
| 19 | cube.rotation.y += 0.1; |
| 20 | renderer.render(scene, camera); |
| 21 | }; |
| 22 | render(); |
| 23 | </script> |
| 24 | }}} |
| 25 | {{{ |
| 26 | #!javascript |
| 27 | <script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"></script> |
| 28 | <script type="text/javascript"> |
| 29 | var scene = new THREE.Scene(); |
| 30 | var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000); |
| 31 | var renderer = new THREE.WebGLRenderer(); |
| 32 | renderer.setSize(window.innerWidth, window.innerHeight); |
| 33 | document.body.appendChild(renderer.domElement); |
| 34 | var geometry = new THREE.CubeGeometry(1,1,1); |
| 35 | var material = new THREE.MeshBasicMaterial({color: 0x00ff00}); |
| 36 | var cube = new THREE.Mesh(geometry, material); |
| 37 | scene.add(cube); camera.position.z = 5; |
| 38 | var render = function () { |
| 39 | requestAnimationFrame(render); |
| 40 | cube.rotation.x += 0.1; |
| 41 | cube.rotation.y += 0.1; |
| 42 | renderer.render(scene, camera); |
| 43 | }; |
| 44 | render(); |
| 45 | </script> |
| 46 | }}} |