aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJaro Camphuijsen <jjecamphuijsen@gmail.com>2015-10-16 13:06:29 +0200
committerJaro Camphuijsen <jjecamphuijsen@gmail.com>2015-10-16 13:06:29 +0200
commit477937fb7eab788bcb72f4a73494f2afbd81ff09 (patch)
tree5fad4455e55b39f0062fe7dfb50de686a50743d3
parent4bf3ae461640b8e62fc37441dfe3428f3c8b35a0 (diff)
changed texture of the bouncy visualization
-rw-r--r--sunsistemo.es6.js4
-rw-r--r--systems.es6.js21
2 files changed, 15 insertions, 10 deletions
diff --git a/sunsistemo.es6.js b/sunsistemo.es6.js
index 8114662..731e96f 100644
--- a/sunsistemo.es6.js
+++ b/sunsistemo.es6.js
@@ -27,8 +27,8 @@ let menuList = [
{"label":"Two Bodies", "function": systems.gen2Bodies, "args": [true]},
{"label":"Three Bodies", "function": systems.gen3Bodies, "args": [true]},
{"label":"Random Bodies", "function": systems.genBodies, "args": [200, true, false]},
- {"label":"Angular Momentum", "function": systems.genBodiesRot, "args": [200, true, true, false]},
- {"label":"Angular with Bounce", "function": systems.genBodiesRot, "args": [200, true, true, true]},
+ {"label":"Angular Momentum", "function": systems.genBodiesRot, "args": [200, "planets", true, false]},
+ {"label":"Angular with Bounce", "function": systems.genBodiesRot, "args": [200,"balls", true, true, true]},
{"label":"Butterfly", "function": systems.genButterFlyOne, "args": []}
// {"label":"Solar System", "function": systems.genSolarSystem, "args": [true] }
diff --git a/systems.es6.js b/systems.es6.js
index 283df0f..6a8d14e 100644
--- a/systems.es6.js
+++ b/systems.es6.js
@@ -1,11 +1,16 @@
import * as calc from "./calc.es6.js";
let Vec3 = THREE.Vector3;
-let planets = ["earth", "jupiter", "mars", "mercury", "moon", "neptune",
- "pluto", "saturn", "uranus", "venus"];
-let balls = ["tennisball", "softball"];
-let textures = ["sun", "earth", "jupiter", "mars", "mercury", "moon", "neptune",
- "pluto", "saturn", "uranus", "venus", "clouds", "tennisball"];
+let textureSets = {
+ planets: ["earth", "jupiter", "mars", "mercury", "moon", "neptune",
+ "pluto", "saturn", "uranus", "venus"],
+ balls: ["tennisball", "softball"],
+ all: ["sun", "earth", "jupiter", "mars", "mercury", "moon", "neptune",
+ "pluto", "saturn", "uranus", "venus", "clouds", "tennisball"]
+ }
+
+// let textures = ["sun", "earth", "jupiter", "mars", "mercury", "moon", "neptune",
+// "pluto", "saturn", "uranus", "venus", "clouds", "tennisball"];
// let allTextures = {};
class Body {
@@ -220,7 +225,7 @@ export function genBodies(n, bodyTexture, sunOn, collisions) {
let rot = () => Math.random() / 30;
let rotation = new Vec3(0, rot(), 0);
- bodies.push(new Body(1E16, posVec, velVec, 8, getRandomFromList(planets), rotation));
+ bodies.push(new Body(1E16, posVec, velVec, 8, getRandomFromList(textureSets.planets), rotation));
}
return {
@@ -235,7 +240,7 @@ export function genBodies(n, bodyTexture, sunOn, collisions) {
}
export function genBodiesRot(n, bodyTexture, sunOn, collisions) {
- if (!bodyTexture){allTextures = [];}
+ let textureSet = textureSets[bodyTexture];
let bodies = [];
let angMomVec = new Vec3(0,4,0);
@@ -248,7 +253,7 @@ export function genBodiesRot(n, bodyTexture, sunOn, collisions) {
let rot = () => Math.random() / 30;
let rotation = new Vec3(0, rot(), 0);
velVec.crossVectors(posVec, angMomVec).multiplyScalar(Math.random() + .1);
- bodies.push(new Body(1E14, posVec, velVec, 8, getRandomFromList(planets), rotation));
+ bodies.push(new Body(1E14, posVec, velVec, 8, getRandomFromList(textureSet), rotation));
}
return {