daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest May 24th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2.  
  3. <html lang="en">
  4. <head>
  5.    
  6.     <script src="https://three.js/examples/js/renderers/CanvasRenderer.js"></script>
  7.    
  8.  
  9.     <title>HTML5 Example</title>
  10.  
  11.  
  12.     <script type="text/javascript" src="three3.js"></script>
  13.  
  14.  
  15.  
  16.     <script type="text/javascript">
  17.  
  18.         var camera, scene, renderer, cube, material, mesh;
  19.         function init() {
  20.             scene = new THREE.Scene();
  21.  
  22.             camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight,
  23.                                                     1, 1000);
  24.             camera.position.z = 1000;
  25.             scene.add(camera);
  26.  
  27.             cube = new THREE.CubeGeometry(300, 300, 300);
  28.  
  29.             material = new THREE.MeshBasicMaterial({color:0x0000FF, wireframe: false});
  30.  
  31.             mesh = new THREE.Mesh(cube, material);
  32.  
  33.             scene.add(mesh);
  34.  
  35.             renderer = new THREE.CanvasRenderer();
  36.             renderer.setSize(window.innerWidth, window.innerHeight);
  37.  
  38.             document.body.appendChild(renderer.domElement);
  39.  
  40.             animate();
  41.  
  42.  
  43.         }
  44.  
  45.         function animate() {
  46.             requestAnimationFrame(animate);
  47.  
  48.             mesh.rotation.x += 0.02;
  49.             mesh.rotation.y += 0.02;
  50.  
  51.             renderer.render(scene, camera);
  52.         }
  53.  
  54.     </script>
  55. </head>
  56. <body onload="init()">
  57.  
  58. </body>
  59. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top