Newton.js

Physics on the web







Hunter Loftis
April 2014




Physics will soon become an integral, expected part of the common User Experience.



... built by amateurs like you and me.

(don't be afraid, it's not that hard!)




Common interfaces have been chasing game interfaces for decades.


Grand Theft Auto IV (2008)


Google Maps Web (2014)

Portable Touch


Nintendo DS (touch) (2004) - iPod Touch (2007)

Playful Drag-and-Drop


Baldies (1996) - Google Maps (2014)

Parallax Scrolling


Moon Patrol (1986) - Costa Coffee (2014)

Menus with Full Video Backgrounds


Halo: Combat Evolved (2001) - Positive Advertising (2014)

Today:

 

If you want to preview the user interface of tomorrow, look to the games of today.




Newton.js


  • Particle-based
  • Soft bodies
  • Verlet integrator
  • Iterative solver
  • Time accumulator


Demos


How it works


  1. Define particles as { position, lastPosition }
  2. Simulate:
    1. Apply forces (position += force)
    2. Integrate (position += position - lastPosition)
    3. Loop N times:
      1. Constrain (if (isInvalid(position) correct(position))


That's really it!





What's next?



Newton.js

By hunterloftis

Newton.js

  • 1,967