Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset=utf-8>
- <title>Three.js Canvas app</title>
- <style>
- body{margin:0;overflow:hidden;}
- canvas{width:100%;height:100%}
- </style>
- </head>
- <body onload="init()">
- <script src="ThreeJsPeldatar/js-r87/three.js"></script>
- <script>
- var WIDTH,HEIGHT,aspectRatio;
- var renderer;
- var scene,camera;
- var geometry,material,mesh;
- function init() {
- HEIGHT = window.innerHeight;
- WIDTH = window.innerWidth;
- console.log(HEIGHT + " " + WIDTH);
- aspectRatio = WIDTH / HEIGHT;
- console.log(aspectRatio);
- renderer = new THREE.WebGLRenderer({antialias: true});
- renderer.setSize(WIDTH, HEIGHT);
- renderer.setClearColor(0x000000);
- document.body.appendChild(renderer.domElement);
- scene = new THREE.Scene();
- camera = new THREE.PerspectiveCamera(75, aspectRatio, 0.1, 1000);
- camera.position.z = 15;
- camera.lookAt(scene.position);
- geometry = new THREE.SphereGeometry(8, 50, 30);
- material = new THREE.MeshBasicMaterial({color: 0x00f00, wireframe: true});
- mesh = new THREE.Mesh(geometry, material);
- mesh.rotation.z = 0.2;
- scene.add(mesh);
- window.addEventListener('resize',handleWindowResize,false);
- render();
- }
- var render=function(){
- requestAnimationFrame(render);
- mesh.rotation.x+=0.01;
- mesh.rotation.y+=0.01;
- renderer.render(scene,camera);
- };
- </script>
- <h1>Fejléc</h1>
- Szöveg elhelyezése paragrafusban.
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement