Ball physics written in JS