-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebgl.js
More file actions
51 lines (33 loc) · 700 Bytes
/
Copy pathwebgl.js
File metadata and controls
51 lines (33 loc) · 700 Bytes
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
const scene=new THREE.Scene()
const camera=new THREE.PerspectiveCamera(
75,400/400,0.1,1000
)
const renderer=new THREE.WebGLRenderer()
renderer.setSize(400,400)
document.getElementById("webgl")
.appendChild(renderer.domElement)
const geometry=new THREE.TorusKnotGeometry(
1,
0.3,
128,
16,
2,
8
)
const material=new THREE.MeshStandardMaterial({
color:0x00ffd5,
wireframe:true
})
const mesh=new THREE.Mesh(geometry,material)
scene.add(mesh)
const light=new THREE.PointLight(0xffffff)
light.position.set(5,5,5)
scene.add(light)
camera.position.z=4
function animate(){
requestAnimationFrame(animate)
mesh.rotation.x+=0.01
mesh.rotation.y+=0.01
renderer.render(scene,camera)
}
animate()