Lunch-time hack: Day 3 – Visualising forces between repelling particles
June 9, 2011
See demo → var WIDTH = 500, HEIGHT = 500, PARTICLES = [], STARTING_COUNT = 100, MAX_PARTICLES = 200, DAMPING = 0.05, CURRENT_FRAME = 0; var canvas = document.getElementsByTagName (‘canvas’)[0]; canvas.width = WIDTH; canvas.height = HEIGHT; var ctx = canvas.getContext (‘2d’); init (); function random (min, max) { return (Math.random() * (max – min) + […]