mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 13:06:01 +10:00
Code style fixes
Example was still using ColorMaterial
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user