From fa9d346f504d8035f3b3a31f648cbfbeef28aefd Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Sun, 16 May 2010 05:42:46 +0100 Subject: [PATCH] Code style fixes Example was still using ColorMaterial --- README.md | 2 +- examples/particles/floor.html | 36 +++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cea025f5..4d62512c 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ This code creates a camera, then creates a scene object, adds a bunch of random for (var i = 0; i < 1000; i++) { - var particle = new THREE.Particle( new THREE.ColorMaterial(Math.random() * 0x808008 + 0x808080, 1) ); + var particle = new THREE.Particle( new THREE.ColorFillMaterial(Math.random() * 0x808008 + 0x808080, 1) ); particle.size = Math.random() * 10 + 5; particle.position.x = Math.random() * 2000 - 1000; particle.position.y = Math.random() * 2000 - 1000; diff --git a/examples/particles/floor.html b/examples/particles/floor.html index 234fbb6c..274803c6 100644 --- a/examples/particles/floor.html +++ b/examples/particles/floor.html @@ -49,8 +49,8 @@ init(); setInterval(loop, 1000 / 60); - function init() - { + function init() { + container = document.createElement('div'); document.body.appendChild(container); @@ -66,10 +66,10 @@ var material = new THREE.ColorFillMaterial(0xffffff, 1); - for (var ix = 0; ix < AMOUNTX; ix++) - { - for(var iy = 0; iy < AMOUNTY; iy++) - { + for (var ix = 0; ix < AMOUNTX; ix++) { + + for(var iy = 0; iy < AMOUNTY; iy++) { + particle = new THREE.Particle( material ); particle.position.x = ix * SEPARATION - ((AMOUNTX * SEPARATION) / 2); particle.position.z = iy * SEPARATION - ((AMOUNTY * SEPARATION) / 2); @@ -92,16 +92,16 @@ // - function onDocumentMouseMove(event) - { + function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; mouseY = event.clientY - windowHalfY; } - function onDocumentTouchStart( event ) - { - if(event.touches.length > 1) - { + function onDocumentTouchStart( event ) { + + if(event.touches.length > 1) { + event.preventDefault(); mouseX = event.touches[0].pageX - windowHalfX; @@ -109,10 +109,10 @@ } } - function onDocumentTouchMove( event ) - { - if(event.touches.length == 1) - { + function onDocumentTouchMove( event ) { + + if(event.touches.length == 1) { + event.preventDefault(); mouseX = event.touches[0].pageX - windowHalfX; @@ -122,8 +122,8 @@ // - function loop() - { + function loop() { + camera.position.x += (mouseX - camera.position.x) * .05; camera.position.y += (-mouseY - camera.position.y) * .05; camera.updateMatrix();