Update: CC - SnailRunner - Before Render (94xi7aitax.js) 254 bytes modified

beta.r3js.org
-=yb4f310 2018-03-09 02:37:49 +01:00
parent ce12baec6b
commit 9b4a268286
1 changed files with 19 additions and 7 deletions

View File

@ -7,13 +7,15 @@ if (!this.initialized) {
/**
* Meshes
*/
this.road = this.entityLoaded.road;
this.cloud = this.entityLoaded.cloud;
this.sections = this.entityLoaded.sections;
this.cloud = this.entityLoaded.cloud;
this.time = 0;
this.speed = 50;
this.spawnCloud = function() {
this.cloud.position.x = 20;
this.cloud.position.x = -155;
this.cloud.position.z = (Math.random() * 10) - 5;
this.cloud.updateInstance('position');
}
@ -21,13 +23,23 @@ if (!this.initialized) {
this.initialized = true;
}
//this.road.rotation.z += 0.004 * data.delta;
//this.road.updateInstance('rotation');
var diff = data.delta * this.speed;
this.cloud.position.x += data.delta * 2;
this.cloud.position.x += diff;
this.cloud.updateInstance('position');
this.sections.map(
function(section) {
section.left.position.x += diff;
section.road.position.x += diff;
section.right.position.x += diff;
section.left.updateInstance('position');
section.road.updateInstance('position');
section.right.updateInstance('position');
}
);
this.time += data.delta;
if (this.time > 5) {