-
Notifications
You must be signed in to change notification settings - Fork 0
/
simpleLine.html
35 lines (31 loc) · 1.08 KB
/
simpleLine.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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>My first three.js app</title>
<style>
body { margin: 0; padding: 0; overflow: hidden;}
canvas { width: 100vw; height: 100vh }
</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/99/three.js"></script>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 45, window.innerWidth/window.innerHeight, 1, 500 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3( -10, 0, 0) );
geometry.vertices.push(new THREE.Vector3( 0, 10, 0) );
geometry.vertices.push(new THREE.Vector3( 10, 0, 0) );
var material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
var line = new THREE.Line( geometry, material );
scene.add( line );
camera.position.set( 0, 0, 100 );
camera.lookAt( 0, 0, 0 );
renderer.render( scene, camera );
</script>
</body>
</html>