-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
64 lines (50 loc) · 1.46 KB
/
script.js
File metadata and controls
64 lines (50 loc) · 1.46 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Set Scene
const scene = new THREE.Scene();
// Set Camera
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.01,
1000
);
camera.position.z = 4;
camera.position.y = 0.5;
camera.position.x = 0.5;
// Set Render
const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
// Axes
const axesHelper = new THREE.AxesHelper(5);
scene.add(axesHelper);
// Box
{
// Object
//const boxGeometry = new THREE.BoxGeometry();
//const boxMaterial = new THREE.MeshBasicMaterial({color: 0x00FF00});
// Change Color
// 1
//boxMaterial.color.r = 1.0; // Float type
//boxMaterial.color.g = 0.0; // Float type
//boxMaterial.color.b = 0.0; // Float type
// 2
//boxMaterial.color.setRGB(0.972, 0,749, 0.141);
// 3
//boxMaterial.color.setHex(0x1208FF);
//const box = new THREE.Mesh(boxGeometry, boxMaterial);
//scene.add(box);
}
// Triangle
const geometry = new THREE.
geometry
var color1 = new THREE.Color( 0xF08000 ); // orange
var color2 = new THREE.Color( 0x808000 ); // olive
var color3 = new THREE.Color( 0x0982FF ); // bright blue
const material = new THREE.MeshBasicMaterial({color : 0x00ff00});
const triangle = new THREE.Mesh(geometry,material);
scene.add(triangle);
function animate() {
requestAnimationFrame(animate);
renderer.render( scene, camera );
}
animate();