aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJaro Camphuijsen <jjecamphuijsen@gmail.com>2015-10-16 10:43:55 +0200
committerJaro Camphuijsen <jjecamphuijsen@gmail.com>2015-10-16 10:49:33 +0200
commit5619f2b291b18030de38d8c84b7ac43c45ea8d79 (patch)
tree9f136b9835f41698910ffc9d468f07c93c992ef2
parentd8c557f3568c7605e829b2d168b88f0a62c4f4d9 (diff)
changed lighting and added menu selection colors
-rw-r--r--index.html2
-rw-r--r--style.css8
-rw-r--r--sunsistemo.es6.js25
-rw-r--r--systems.es6.js9
4 files changed, 24 insertions, 20 deletions
diff --git a/index.html b/index.html
index dfe95a0..48187ea 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r14/Stats.min.js"></script>
</head>
<body>
- <div id="gui" style="background-color: rgba(220,220,220,0); position: fixed;"></div>
+ <div id="gui" ></div>
<div id="sim"></div>
<script src="sunsistemo.js"></script>
</body>
diff --git a/style.css b/style.css
index 854d77b..2bb0d42 100644
--- a/style.css
+++ b/style.css
@@ -4,19 +4,19 @@ html, body {
overflow: hidden;
}
#gui{
- background-color: rgba(220,220,220,.8);
+ opacity:1;
position: fixed;
display: block;
z-index: 5;
}
#sim{
- background-color: rgba(220,220,220,.2);
+ opacity:1;
position: relative;
right: 0;
display: block;
z-index: 1
}
- .button{
+.button{
fill: #aaa;
opacity: .95;
cursor:pointer;
@@ -30,7 +30,7 @@ html, body {
opacity: .95;
}
.selected{
- fill: #400;
+ fill: #840;
opacity: .95;
cursor:pointer;
}
diff --git a/sunsistemo.es6.js b/sunsistemo.es6.js
index 084a839..8114662 100644
--- a/sunsistemo.es6.js
+++ b/sunsistemo.es6.js
@@ -7,7 +7,7 @@ import * as calc from "./calc.es6.js";
let bodyTexture = true;
let numBodies = 1;
-let sphereP = 16;
+let sphereP = 12;
let sunOn;
var steps;
@@ -29,8 +29,8 @@ let menuList = [
{"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":"Butterfly", "function": systems.genButterFlyOne, "args": []},
- {"label":"Solar System", "function": systems.genSolarSystem, "args": [true] }
+ {"label":"Butterfly", "function": systems.genButterFlyOne, "args": []}
+ // {"label":"Solar System", "function": systems.genSolarSystem, "args": [true] }
];
gui(menuList);
@@ -60,7 +60,7 @@ function gui(buttonList) {
.attr("class", "button");
buttons.append("rect")
- .style("fill", "#aaa")
+ // .style("fill", "#aaa")
.style("opacity",".5")
.attr("width", (buttonWidth))
.attr("height", buttonHeight - 3)
@@ -97,7 +97,7 @@ function gui(buttonList) {
function clearSimulation() {
let simDiv = document.getElementById("sim");
while (simDiv.firstChild) simDiv.removeChild(simDiv.firstChild);
- let statDiv = d3.select("#stat").remove();
+ let statDiv = d3.select("#stats").remove();
}
function simulate(sysFunc, args){
@@ -165,16 +165,19 @@ function init() {
let glowRadius = sun.geometry.boundingSphere.radius * 5;
sprite.scale.set(glowRadius, glowRadius, 1.0);
sun.add(sprite);
+
+ // overall light
+ let ambient = new THREE.AmbientLight(0x404040);
+ scene.add(ambient);
}
else {
- // sunlight
- let light = new THREE.HemisphereLight(0xfcd440, 2);
-
+ // overall light
+ let ambient = new THREE.AmbientLight(0xf0f0f0);
+ scene.add(ambient);
+
}
- // overall light
- let ambient = new THREE.AmbientLight(0x404040);
- scene.add(ambient);
+
renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0x000000);
diff --git a/systems.es6.js b/systems.es6.js
index 8194df1..429986e 100644
--- a/systems.es6.js
+++ b/systems.es6.js
@@ -192,14 +192,15 @@ export function gen2Bodies(sunOn) {
export function gen3Bodies(sunOn) {
let rot = () => Math.random() / 30;
- let s1 = new Body(1E19, new Vec3(0, 0, 0), new Vec3(0, 0, 0), 8, "mercury", new Vec3(0, 0, rot()));
+ let s1 = new Body(1E19, new Vec3(0, 0, 0), new Vec3(0, 2, 0), 8, "mercury", new Vec3(0, 0, rot()));
let s2 = new Body(1E18, new Vec3(200, 0, 0), new Vec3(0, 900, 0), 8, "venus", new Vec3(0, 0, rot()));
let s3 = new Body(1E18, new Vec3(-200, 0, 0), new Vec3(0, -900, 0), 8, "earth", new Vec3(0, 0, rot()));
let bodies = [s1, s2, s3];
return {
bodies: bodies,
- stepsize: 0.0003,
+ stepsize: 0.000003,
+ stepsPerFrame: 100,
camera: {x: 0, y: 0, z: 400},
collisions: false,
sunOn: sunOn,
@@ -228,7 +229,7 @@ export function genBodies(n, bodyTexture, sunOn, collisions) {
camera: {x: 0, y: 0, z: 400},
collisions: collisions,
sunOn: sunOn,
- sphereP: 16
+ sphereP: 12
};
}
@@ -256,7 +257,7 @@ export function genBodiesRot(n, bodyTexture, sunOn, collisions) {
camera: {x: 0, y: 0, z: 400},
collisions: collisions,
sunOn: sunOn,
- sphereP: 16
+ sphereP: 12
};
}