forked from unconed/threestrap
/
controls_orbit_cube.html
40 lines (36 loc) · 1 KB
/
controls_orbit_cube.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Threestrap - Camera Orbit Controls</title>
<script type="text/javascript" src="../vendor/three.js"></script>
<script type="text/javascript" src="../vendor/controls/OrbitControls.js"></script>
<script type="text/javascript" src="../build/threestrap.js"></script>
</head>
<body>
<style type="text/css" media="screen">
#three {
width: 500px;
height: 500px;
cursor: move;
}
</style>
<h1>Drag/Zoom Controls</h1>
<div id="three"></div>
<script>
// Bootstrap core + controls plugin into element
var three = THREE.Bootstrap({
element: document.querySelector('#three'),
plugins: ['core', 'controls'],
controls: {
klass: THREE.OrbitControls
},
});
// Insert a cube
var mesh = new THREE.Mesh(new THREE.CubeGeometry(.5, .5, .5), new THREE.MeshNormalMaterial());
three.scene.add(mesh);
// Place camera
three.camera.position.set(1, .5, .6);
</script>
</body>
</html>