abouttreesummaryrefslogcommitdiff
path: root/Scripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/main.js')
-rw-r--r--Scripts/main.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/Scripts/main.js b/Scripts/main.js
index a0387ac..5ed1866 100644
--- a/Scripts/main.js
+++ b/Scripts/main.js
@@ -57,7 +57,8 @@ document.body.onload = init;
function init() {
let mousePos = new Point();
-
+ let previousClothSimulation;
+
/**
* Space left empty under canvas
* for UI elements
@@ -74,6 +75,11 @@ function init() {
const material = new THREE.MeshBasicMaterial({ color: 0x0000ff });
const mesh = new THREE.Mesh(cloth.geometry, material);
+ //const mesh = new THREE.WireframeGeometry(cloth.geometry);
+ //const line = new THREE.LineSegments(mesh);
+ //line.material.depthTest = false;
+ //line.material.opacity = 0.25;
+ //line.material.transparent = true;
scene.add(mesh);
/**
@@ -81,7 +87,12 @@ function init() {
* @param {number} dt - time passed since last frame
*/
function animate(dt) {
- requestAnimationFrame(animate);
+
+ cloth.simulate(dt);
+
+ setTimeout(() => {
+ animate(2000);
+ }, 2000);
renderer.render(scene, camera);
}