HOME | DD

Dediggefedde β€” Javscript/Canvas Rope Simulation

#animation #canvas #game #javascript #rope #simulation #string #physics
Published: 2023-02-22 09:24:26 +0000 UTC; Views: 1509; Favourites: 7; Downloads: 0
Redirect to original
Description

About:

Simulation of a rope mechanics in javascript.

click&drag to create the rope, press space to pull one end of the rope towards the cursor.

Live demo including code: phi.pf-control.de/KB/canvas_st…


Special:

You only exert force on one point of the rope, while the model calculates the movement of the other points.

The rectangles follow the rope tangent, showing one can add a texture/skin.

I also find it quite mesmerizing. ^^'


Background:

I saw a smartphone advertisement for "angry birds" recently.

One of those where you see a puzzle that's not actually in the game.

You had to draw a rope around gems and obstacles that a bird would reel in at both ends.

The rope would catch on the obstacles rope while the goal is to fetch all gems.

So I wondered if I could make a realistic rope and choose javascript/canvas.


Outlook:

Perhaps I actually try to make the game.

I would need to implement collision checks for gems and obstacles

Related content
Comments: 3

DraakeT [2023-02-24 14:23:50 +0000 UTC]

πŸ‘: 0 ⏩: 1

Dediggefedde In reply to DraakeT [2023-02-24 20:57:16 +0000 UTC]

πŸ‘: 2 ⏩: 1

DraakeT In reply to Dediggefedde [2023-02-24 23:21:00 +0000 UTC]

πŸ‘: 0 ⏩: 0