-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.01.html
45 lines (36 loc) · 1.24 KB
/
test.01.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
<title>My first Three.js app</title>
<style>canvas { width: 100%; height: 100% }</style>
</head>
<body>
<script src="js/three.min.js"></script>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var wireframe = false;
var geometry = new THREE.CubeGeometry(1,1,1);
//var material = new THREE.MeshBasicMaterial({color: 0x00ff00, wireframe: wireframe});
var material = new THREE.MeshLambertMaterial({color: 0x55B663});
var cube = new THREE.Mesh(geometry, material);
scene.add(cube);
var light = new THREE.AmbientLight( 0x404040 ); // soft white light
scene.add( light );
// Create a light, set its position, and add it to the scene.
light = new THREE.PointLight(0xffffff);
light.position.set(-100,200,100);
scene.add(light);
camera.position.z = 5;
var render = function () {
requestAnimationFrame(render);
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
};
render();
</script>
</body>
</html>