summaryrefslogtreecommitdiff
path: root/2d/softbody/softbody_1.html
diff options
context:
space:
mode:
Diffstat (limited to '2d/softbody/softbody_1.html')
-rw-r--r--2d/softbody/softbody_1.html18
1 files changed, 14 insertions, 4 deletions
diff --git a/2d/softbody/softbody_1.html b/2d/softbody/softbody_1.html
index 3f0fc40..ae4b743 100644
--- a/2d/softbody/softbody_1.html
+++ b/2d/softbody/softbody_1.html
@@ -86,6 +86,7 @@
document.getElementById('damped_spring_length'),
document.getElementById('damped_start_position'),
document.getElementById('damped_spring_constant'),
+ document.getElementById('damped_viscous_constant'),
document.getElementById('damped_spring_mass')
]);
@@ -118,6 +119,7 @@
Damped_SetDisplacement = Module.cwrap('Damped_SetDisplacement', 'void', ['number']),
Damped_SetK = Module.cwrap('Damped_SetK', 'void', ['number']),
Damped_SetMass = Module.cwrap('Damped_SetMass', 'void', ['number']),
+ Damped_SetC = Module.cwrap('Damped_SetC', 'void', ['number']),
Undamped_lengthSlider = document.getElementById('undamped_spring_length'),
Undamped_displacementSlider = document.getElementById('undamped_start_position'),
@@ -128,6 +130,7 @@
Damped_displacementSlider = document.getElementById('damped_start_position'),
Damped_kSlider = document.getElementById('damped_spring_constant'),
Damped_massSlider = document.getElementById('damped_spring_mass'),
+ Damped_cSlider = document.getElementById('damped_viscous_constant'),
undampedSetLength = function(value) {
value = Number(value);
@@ -171,6 +174,7 @@
Damped_displacementSlider.addEventListener('change', function(event) { Damped_SetDisplacement(Number(event.target.value)); });
Damped_kSlider.addEventListener('change', function(event) { Damped_SetK(Number(event.target.value)); });
Damped_massSlider.addEventListener('change', function(event) { Damped_SetMass(Number(event.target.value)); });
+ Damped_cSlider.addEventListener('change', function(event) { Damped_SetC(Number(event.target.value)); });
};
}
@@ -234,25 +238,31 @@
</h2>
<p>
<span class='widget_container'>
- <label for='undamped_spring_length'>Spring Length (m)</label>
+ <label for='damped_spring_length'>Spring Length (m)</label>
<input type='range' id='damped_spring_length' min="50" max="300" value="150"/>
<span></span>
</span>
<span class='widget_container'>
- <label for='undamped_start_position'>Start Displacement (m)</label>
+ <label for='damped_start_position'>Start Displacement (m)</label>
<input type='range' id='damped_start_position' min='-150' max='150' value='0'/>
<span></span>
</span>
<span class='widget_container'>
- <label for='undamped_spring_constant'>Spring Constant (N / m)</label>
+ <label for='damped_spring_constant'>Spring Constant (N / m)</label>
<input type='range' id='damped_spring_constant' min='0.1' max='20.0' value='1.0' step='0.1'/>
<span></span>
</span>
+ <span class='widget_container'>
+ <label for='damped_viscous_constant'>Viscous Damping Constant (N / m)</label>
+ <input type='range' id='damped_viscous_constant' min='0.1' max='50.0' value='1.0' step='0.1'/>
+ <span></span>
+ </span>
+
<span class='widget_container'>
- <label for='undamped_spring_mass'>Mass (kg)</label>
+ <label for='damped_spring_mass'>Mass (kg)</label>
<input type='range' id='damped_spring_mass' min='0.1' max='10.0' value='1.0' step='0.1'/>
<span></span>
</span>