From 8bfbb336047afc70e05ba49524db7057dda5e853 Mon Sep 17 00:00:00 2001 From: Theunis Johannes Botha Date: Wed, 7 Mar 2018 17:35:13 +0100 Subject: [PATCH] Update: CC - SnailRunner - Before Render (rlley2ki2i.js) 403 bytes modified --- rlley2ki2i.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 rlley2ki2i.js diff --git a/rlley2ki2i.js b/rlley2ki2i.js new file mode 100644 index 0000000..32831c4 --- /dev/null +++ b/rlley2ki2i.js @@ -0,0 +1,38 @@ +if (!this.entityLoaded) { + return; +} + +if (!this.initialized) { + + /** + * Meshes + */ + this.road = this.entityLoaded.road; + this.cloud = this.entityLoaded.cloud; + + this.time = 0; + + this.spawnCloud = function() { + this.cloud.position.x = 5; + this.cloud.position.z = (Math.random() * 0.2) - 0.1 + this.cloud.updateInstance('position'); + } + + this.initialized = true; +} + + +this.road.rotation.z += 0.004 * data.delta; +this.road.updateInstance('rotation'); + +this.cloud.position.x -= data.delta; +this.cloud.updateInstance('position'); + +this.time += data.delta; + +if (this.time > 5) { + this.spawnCloud(); + this.time = 0; +} + +//@ sourceURL=beforeRender.js \ No newline at end of file