Skip to content

Valentine's day HTML5 toy - draw a heart and then throw it around!

Notifications You must be signed in to change notification settings

harpocrates/Bouncing-Heart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bouncing-Heart

Valentine's day HTML5 toy - draw a heart and then throw it around!

Try it out in your browser now.

Calculates the relative mass and moment of the drawn heart, then animates it with Euler's method. Deals with rigid body collisions between the heart and the wall realistically.

Instructions

Draw a heart (or really any shape) by holding your mouse down as you trace the outline of the desired heart. Once done, the heart should be filled. Then, click and drag to throw it around and watch it bounce and spin off the walls. To catch it/throw it again, click on it and drag.

Pending developments

Make the heart shatter into pieces (pieces won't interact with each other, just with walls and floor) after a threshold of total impulse transferred. Challenges to face:

  • drawing cracks on the heart (variable stroke width for moving cracks - Maybe like this)
  • implementing some polygon clipping algorithm to calculate the shape of pieces. Sticking to convex pieces will allow use of the relatively simpler Sutherland–Hodgman algorithm.

About

Valentine's day HTML5 toy - draw a heart and then throw it around!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published