summaryrefslogtreecommitdiff
path: root/2d/softbody/softbody_1.html.content
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-01-09 20:04:51 -0500
committermattkae <mattkae@protonmail.com>2022-01-09 20:04:51 -0500
commitdce6e971023d6c4bc849641c10db5d65ce5fad55 (patch)
treeef4a1eee79bfe03034fb3acb55a024cf14cc8209 /2d/softbody/softbody_1.html.content
parentaeb4fc2aec4378aa0742f71324baa76fd5891316 (diff)
(mkosarek) Completed simulations for all damped motion
Diffstat (limited to '2d/softbody/softbody_1.html.content')
-rw-r--r--2d/softbody/softbody_1.html.content18
1 files changed, 14 insertions, 4 deletions
diff --git a/2d/softbody/softbody_1.html.content b/2d/softbody/softbody_1.html.content
index bef14d8..c5fb3cc 100644
--- a/2d/softbody/softbody_1.html.content
+++ b/2d/softbody/softbody_1.html.content
@@ -33,6 +33,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')
]);
@@ -65,6 +66,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'),
@@ -75,6 +77,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);
@@ -118,6 +121,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)); });
};
}
@@ -181,25 +185,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>