Advertisement
szdani96

Untitled

Oct 16th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4. <head>
  5. <meta charset=utf-8>
  6. <title>Three.js Canvas app</title>
  7. <style>
  8. body{margin:0;overflow:hidden;}
  9. canvas{width:100%;height:100%}
  10. </style>
  11.  
  12. </head>
  13. <body onload="init()">
  14. <script src="ThreeJsPeldatar/js-r87/three.js"></script>
  15. <script>
  16.  
  17. var WIDTH,HEIGHT,aspectRatio;
  18. var renderer;
  19. var scene,camera;
  20. var geometry,material,mesh;
  21. function init() {
  22. HEIGHT = window.innerHeight;
  23. WIDTH = window.innerWidth;
  24. console.log(HEIGHT + " " + WIDTH);
  25. aspectRatio = WIDTH / HEIGHT;
  26. console.log(aspectRatio);
  27. renderer = new THREE.WebGLRenderer({antialias: true});
  28. renderer.setSize(WIDTH, HEIGHT);
  29. renderer.setClearColor(0x000000);
  30. document.body.appendChild(renderer.domElement);
  31. scene = new THREE.Scene();
  32. camera = new THREE.PerspectiveCamera(75, aspectRatio, 0.1, 1000);
  33. camera.position.z = 15;
  34. camera.lookAt(scene.position);
  35. geometry = new THREE.SphereGeometry(8, 50, 30);
  36. material = new THREE.MeshBasicMaterial({color: 0x00f00, wireframe: true});
  37. mesh = new THREE.Mesh(geometry, material);
  38. mesh.rotation.z = 0.2;
  39. scene.add(mesh);
  40. window.addEventListener('resize',handleWindowResize,false);
  41. render();
  42. }
  43.  
  44. var render=function(){
  45. requestAnimationFrame(render);
  46. mesh.rotation.x+=0.01;
  47. mesh.rotation.y+=0.01;
  48. renderer.render(scene,camera);
  49. };
  50.  
  51. </script>
  52.  
  53. <h1>Fejléc</h1>
  54.  
  55. Szöveg elhelyezése paragrafusban.
  56.  
  57.  
  58.  
  59.  
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement