Minimalistic collisions simulation using TypeScript and HTML Canvas
Minimalistic collisions simulation using TypeScript and HTML Canvas
Hey HN, @atan2 submitted a great post 4 days ago about 2D rigid body collisions ( https://news.ycombinator.com/item?id=40463764 ). For what it's worth, here is a minimalistic simulation that I coded last year using TypeScript and HTML Canvas: - Code: https://github.com/vandrieu/canvas-bouncing-ball - Demo/Result: https://vandrieu.github.io/canvas-bouncing-ball The main challenge was how to determine the angle and speed of each ball after a collision at a given angle. I found the relevant theoretical material in the 2009 paper titled "2-Dimensional Elastic Collisions without Trigonometry" by Chad Berchek: https://www.vobarian.com/collisions/2dcollisions2.pdf Please feel free to copy and use the code any way you wish.
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Incorrect prediction on native model
Similar products
WebGPU + TypeScript Slime Mold Simulation
ssr-sample – a sample of SSR and SPA using typescript
TypeScript implementation of X3DH using Libsodium
A simulation of the WWV/WWVH broadcast using python3 and SoX and espeak
Lemmings in HTML in Canvas
Boids in HTML canvas
Using Unicode in HTML
An interactive n-body simulation using the Canvas API
Teen Patti game simulation using clojure
DuoCode 1.0 bridges the gap between C# and TypeScript