Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 103 lines (73 sloc) 2.312 kb
71c2df1 @mrdoob Updated HTML of some examples.
mrdoob authored
1 <!doctype html>
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
2 <html lang="en">
3 <head>
5aa43cd @mrdoob All canvas examples are now using RequestAnimationFrame.js
mrdoob authored
4 <title>three.js canvas - spherical reflection</title>
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
5 <meta charset="utf-8">
71c2df1 @mrdoob Updated HTML of some examples.
mrdoob authored
6 <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
19d8261 @mrdoob More examples clean up.
mrdoob authored
7 <style>
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
8 body {
9 background-color: #000000;
10 margin: 0px;
11 overflow: hidden;
12 }
13
14 #info {
15 position: absolute;
16 top: 0px; width: 100%;
17 color: #ffffff;
18 padding: 5px;
19 font-family: Monospace;
20 font-size: 13px;
21 text-align: center;
22 }
23
24 a {
25 color: #ffffff;
26 }
27
28 a:hover {
29 color: #0080ff;
30 }
31 </style>
32 </head>
33 <body>
34
35 <div id="container"></div>
36 <div id="info">
37 <a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - spherical reflection demo.<br />
c91aac5 @alteredq Synced with mrdoob's branch.
alteredq authored
38 Walt Disney head by <a href="http://www.davidoreilly.com/2009/01/walt-disneys-head-on-a-plate" target="_blank">David OReilly</a>. Reflection texture by <a href="http://kewlers.scene.org/" target="_blank">Kewlers</a>.
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
39 </div>
40
19d8261 @mrdoob More examples clean up.
mrdoob authored
41 <script src="../build/Three.js"></script>
42 <script src="../src/extras/ImageUtils.js"></script>
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
43
19d8261 @mrdoob More examples clean up.
mrdoob authored
44 <script src="obj/WaltHead.js"></script>
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
45
19d8261 @mrdoob More examples clean up.
mrdoob authored
46 <script src="js/RequestAnimationFrame.js"></script>
5aa43cd @mrdoob All canvas examples are now using RequestAnimationFrame.js
mrdoob authored
47
19d8261 @mrdoob More examples clean up.
mrdoob authored
48 <script>
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
49
50 var camera, scene, renderer,
51 particle1, particle2, particle2,
52 light1, light2, light3,
53 geometry, mesh;
54
55 init();
5aa43cd @mrdoob All canvas examples are now using RequestAnimationFrame.js
mrdoob authored
56 animate();
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
57
58 function init() {
59
60 var container = document.getElementById( 'container' );
61
309c484 @mrdoob Updated some examples to the new camera setup.
mrdoob authored
62 camera = new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 1, 1000 );
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
63 camera.position.z = 100;
64
65 scene = new THREE.Scene();
66
67 geometry = new WaltHead();
68 geometry.computeVertexNormals();
69
76e7ea3 @mrdoob Added namespace to all the objects that missed it (geometries, unifor…
mrdoob authored
70 mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
71 mesh.overdraw = true;
a940f05 @mrdoob Updated examples with the new `.add`/`.remove` methods.
mrdoob authored
72 scene.add( mesh );
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
73
74 renderer = new THREE.CanvasRenderer();
75 renderer.setSize( window.innerWidth, window.innerHeight );
76 container.appendChild( renderer.domElement );
77
78 }
79
5aa43cd @mrdoob All canvas examples are now using RequestAnimationFrame.js
mrdoob authored
80 //
81
82 function animate() {
83
84 requestAnimationFrame( animate );
85
86 render();
87
88 }
89
90 function render() {
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
91
92 var time = new Date().getTime() * 0.0005;
93
94 mesh.rotation.y -= 0.01;
95
5aa43cd @mrdoob All canvas examples are now using RequestAnimationFrame.js
mrdoob authored
96 renderer.render( scene, camera );
69f3072 @mrdoob Added canvas spherical reflection demo.
mrdoob authored
97
98 }
99
100 </script>
101 </body>
102 </html>
Something went wrong with that request. Please try again.