diff --git a/94xi7aitax.js b/94xi7aitax.js index 4824c9e..5d04268 100644 --- a/94xi7aitax.js +++ b/94xi7aitax.js @@ -34,21 +34,28 @@ if (!this.initialized) { var diff = data.delta * this.speed; -var deadClouds = this.clouds.reduce( +var cloudInfo = this.clouds.reduce( function(result, cloud) { cloud.position.x += diff; cloud.updateInstance('position'); if (cloud.position.x > 50) { - result.push(cloud); + result.dead.push(cloud); + } else { + result.alive.push(cloud); } return result; }, - [] + { + alive : [], + dead : [] + } ); -deadClouds.map( +this.clouds = cloudInfo.alive; + +cloudInfo.dead.map( function(deadCloud) { deadCloud.geometry = null; deadCloud.materials = null;