Skip to content

Instantly share code, notes, and snippets.

@anuraghazra
Created May 16, 2019 15:43
Show Gist options
  • Save anuraghazra/3cd42e6853c38856aac5a9e0e61251f9 to your computer and use it in GitHub Desktop.
Save anuraghazra/3cd42e6853c38856aac5a9e0e61251f9 to your computer and use it in GitHub Desktop.
let canvas = document.getElementById('c');
let ctx = canvas.getContext('2d');
let width = canvas.width = 800;
let height = canvas.height = 600;
let verly = new Verly(16);
let cloth = verly.createCloth(150, 150, 250, 250, 15, 2);
function animate() {
ctx.clearRect(0, 0, width, height);
verly.update();
cloth.tear(100); // tear threshold
requestAnimationFrame(animate);
}
animate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment