Skip to content

Commit a64a461

Browse files
Show Numbers On Sliders
1 parent 07fe2be commit a64a461

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

JS/MainLoop.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function mainLoop(particlesLeft, particlesRight, translation) {
3030
}
3131
});
3232

33-
$('#tempLeft').html(average(leftTemps));
33+
$('#tempLeft').html(Math.round(average(leftTemps)));
3434

3535
particlesRight.forEach(function (particle, i) {
3636
rightTemps.push(particle.vel.r);
@@ -49,7 +49,7 @@ function mainLoop(particlesLeft, particlesRight, translation) {
4949
}
5050
});
5151

52-
$('#tempRight').html(average(rightTemps));
52+
$('#tempRight').html(Math.round(average(rightTemps)));
5353

5454
if(!allowCrossOver){
5555
c.beginPath()

JS/Start.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ function printInputs() {
137137

138138
settingContainer.append(varName + ': ');
139139
settingContainer.append(settingInput);
140+
settingContainer.append('<p></p>');
140141
var initValue = window[varName];
141142
if (settingInput.attr('type') == 'checkbox') {
142143
settingInput.attr('checked', initValue);
@@ -145,6 +146,10 @@ function printInputs() {
145146
}
146147

147148
});
149+
$('[type="range"]').change(function(e){
150+
let target = $(this);
151+
target.parent().children('p').html(target.val())
152+
});
148153
}
149154

150155
function refreshSize() {

index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#settings{
2121
display: inline-block;
2222
}
23+
p{
24+
display: inline;
25+
}
2326
</style>
2427
</head>
2528
<body>
@@ -32,8 +35,8 @@
3235
<span class='setting' type='color' var='barrierColor'></span><br/>
3336
<span class='setting' type='checkbox' var='allowCrossOver'></span><br/>
3437
<hr/>
35-
<span class='setting' type='range' var='initTempLeft' max='30' min='5'></span><br/>
36-
<span class='setting' type='range' var='initTempRight' max='30' min='5'></span><br/>
38+
<span class='setting' type='range' var='initTempLeft' max='30' min='1'></span><br/>
39+
<span class='setting' type='range' var='initTempRight' max='30' min='1'></span><br/>
3740
<span class='setting' type='range' var='numberOfParticlesLeft' max='200' min='50'></span><br/>
3841
<span class='setting' type='range' var='numberOfParticlesRight' max='200' min='50'></span><br/>
3942
<button onclick="resetLoop()">Reset</button>

0 commit comments

Comments
 (0)