/react-dom-box2d

Wrap react dom elements with Box2d physics engine

Primary LanguageJavaScript

Use 2d Physics Simulation for your react-dom elements.

Box2d Physics Engine integrated with react-dom

see it in action

https://codesandbox.io/s/xpv3ypv06q

Install

npm i react-dom-box2d

documentation

Documentation

Demos

shapes demo

https://1466m84mxl.codesandbox.io/

source for the demo Edit 1466m84mxl

Force Demo

https://q8l48rwk49.codesandbox.io/

Edit react-dom-box2d force demo

Collision detection demo

https://wsknn.codesandbox.io/

Edit react-dom-box2d force demo

Rationale

  1. Writing games is more fun
  2. Writing games should be simpler
  3. Physics simulations are cool

FAQs

1.Why dom ?

Dom is definitely slower compared to Canvas/WebGL. But there is a good reason for it. Dom does a lot of things , that would be not easy to implement ourselves (event handling, accessibility, layout,style,...etc)

And also this would lower the barrier of entry for majority of Web Developers (use css for styling)