terrain-map
ARCHIVED - repo for blog post http://www.vogt.world/writing/procedural-terrain-generation/
git clone https://git.vogt.world/terrain-map.git
Log | Files | README.md
← Commit log
commit
message
working on spinner
author
Ben Vogt <[email protected]>
date
2016-05-14 04:11:36
stats
2 file(s) changed, 48 insertions(+), 26 deletions(-)
files
main.js
style.css
  1diff --git a/main.js b/main.js
  2index ed07e05..5026d9d 100644
  3--- a/main.js
  4+++ b/main.js
  5@@ -476,6 +476,11 @@ $(document).ready(function() {
  6     }
  7   };
  8 
  9+  LandMap.prototype.spinner = function() {
 10+    var spinner = '<img class="spinner" width="24" height="24" src="data:image/gif;base64,R0lGODlhGAAYAKUAAAwODJSSlMzKzExOTKyurOTm5GxubCwuLLy+vKSipNza3GRmZPT29Dw+PFRWVLS2tHx+fDQ2NCQmJJyanNTW1Ozu7MTGxKyqrOTi5Pz+/BwaHMzOzFRSVLSytHx6fDQyNMTCxKSmpNze3GxqbPz6/ExKTFxaXLy6vISGhDw6PJyenPTy9P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBQAsACwAAAAAGAAYAAAG/kCWcEjMeCDEpJK1Oq2EDIeDJKwknkshYjERkjhToedzyVZHCwUrGt58GhWz8LFAkb7TjOmjWjIEWAweCxYkIwYkBB8DVCwFKnEsIBAoIFQCHhtEJwMgawESGl1rFxAQARQZDEoMJA8RGhoLkUIiE6erSysfGiUWSyQCFHIdIY1DGSQZyXJQJK2rHSrTKgTNLAcA2gAl0gkqCWXN2dslLHd3GdfPJCvHQxgFchgYWRUgBAjvRCQIHSC0zgno0AGBvH3nHJ0guKGRiA4PFKgrYJAIxYMUHnQQAUVELhILMWQAgSADhoKNGIhAyELBv3MPHlAB0UGNHAYa47g6QaUCHQGZch5qYpEhpjoWGzbKIaGgkasHR5myNGNBQLMgACH5BAkFADAALAAAAAAYABgAhQQCBISChMTCxER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ouhJHEbAiKCaCGLaAiQAUFbCImgKDTYlYhNAgRZtZBMOGCEJnRXqAoVUcECkg9VSStQKElNg7o6gQBACH5BAkFADAALAAAAAAYABgAhQQCBISChMTCxERGROTi5KSipGRmZCQiJNTS1PTy9LSytJSSlHRydDQ2NMzKzFRWVOzq7KyqrNza3Pz6/Ly6vJyanBwaHIyOjGxubDw+PAwODISGhMTGxExOTOTm5KSmpGxqbCQmJNTW1PT29LS2tJSWlHx6fDw6PMzOzFxeXOzu7KyurNze3Pz+/Ly+vJyenP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSGyBQMSkEpZYJYSjU2YihJRUy+Gqc4FKqTCD5ZUVqh4dESw6hQksIUhZGOkwJqPMadIaWBZLCS5PTAYdFBMPDxMFFg0jQh4LWDAUBiAkVAIGHEQkDRRrARoAXUwlBgYmKHhKCS0RIQAAKXJDEgGqkIEWAA0uSxMCKHMRLy1JE8p8c0J8zzAFARvTJc1uJNkkDi/U1NbNAiQUCtsweMrIzcstYEMtIixzBARZHhEVH+7JLgoClFBcVCjxgUU7JVQ89FPASgiCEi8QJKTggYjCihNEkFAgbw0CQhPIEWghwEULAgpcgBnBYt+tlDBaZNOkQEKzERuxTBhHBcIdikxzWDAUIhMoDBQc50yQAGYnImcSdl0TwqHTnCAAOw==" />';
 11+    document.getElementById(this.containerId).innerHTML = spinner;
 12+  }
 13+
 14   LandMap.prototype.draw = function() {
 15     var html = '<div class="row">';
 16     var featureCount = 0;
 17@@ -589,39 +594,43 @@ $(document).ready(function() {
 18     var terrain = new LandMap({
 19       containerId: "container-5"
 20     });
 21-    terrain.generate(0.75, "standard");
 22-    terrain.complexErosion({
 23-      carryingCapacity: 1.5,
 24-      depositionSpeed: 0.03,
 25-      iterations: 10,
 26-      drops: 1000000,
 27-      one: "standard",
 28-      two: "complexErosion-1000000-10ipd"
 29-    });
 30-    terrain.complexErosion({
 31-      carryingCapacity: 1.5,
 32-      depositionSpeed: 0.03,
 33-      iterations: 20,
 34-      drops: 1000000,
 35-      one: "standard",
 36-      two: "complexErosion-1000000-20ipd"
 37-    });
 38-    terrain.complexErosion({
 39-      carryingCapacity: 1.5,
 40-      depositionSpeed: 0.03,
 41-      iterations: 3,
 42-      drops: 4000000,
 43-      one: "standard",
 44-      two: "complexErosion-4000000-3ipd"
 45-    });
 46-    terrain.complexErosion({
 47-      carryingCapacity: 1.5,
 48-      depositionSpeed: 0.03,
 49-      iterations: 3,
 50-      drops: 8000000,
 51-      one: "standard",
 52-      two: "complexErosion-8000000-3ipd"
 53-    });
 54-    terrain.draw();
 55+    terrain.spinner();
 56+    setTimeout(function() {
 57+      terrain.generate(0.75, "standard");
 58+      // terrain.complexErosion({
 59+      //   carryingCapacity: 1.5,
 60+      //   depositionSpeed: 0.03,
 61+      //   iterations: 10,
 62+      //   drops: 1000000,
 63+      //   one: "standard",
 64+      //   two: "complexErosion-1000000-10ipd"
 65+      // });
 66+      // terrain.complexErosion({
 67+      //   carryingCapacity: 1.5,
 68+      //   depositionSpeed: 0.03,
 69+      //   iterations: 20,
 70+      //   drops: 1000000,
 71+      //   one: "standard",
 72+      //   two: "complexErosion-1000000-20ipd"
 73+      // });
 74+      // terrain.complexErosion({
 75+      //   carryingCapacity: 1.5,
 76+      //   depositionSpeed: 0.03,
 77+      //   iterations: 3,
 78+      //   drops: 4000000,
 79+      //   one: "standard",
 80+      //   two: "complexErosion-4000000-3ipd"
 81+      // });
 82+      terrain.complexErosion({
 83+        carryingCapacity: 1.0,
 84+        depositionSpeed: 0.1,
 85+        iterations: 3,
 86+        drops: 2000000,
 87+        one: "standard",
 88+        two: "complexErosion-8000000-3ipd"
 89+      });
 90+      terrain.draw();
 91+    }, 1000);
 92+
 93   });
 94 })
 95diff --git a/style.css b/style.css
 96index 401b7b2..aca9bee 100644
 97--- a/style.css
 98+++ b/style.css
 99@@ -27,6 +27,11 @@ div.set-of:empty:before {
100   content: 'Press GENERATE to create maps.';
101 }
102 
103+div.set-of .spinner {
104+  margin-left: 50%;
105+  padding-top: 100px;
106+}
107+
108 .run {
109   float: right;
110 }