New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eirikb/trolley

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eirikb/trolley

Kickstart your Box2D experience for web

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Kickstart your Box2D JavaScript experience!

See the builder demos for examples.

Trolley aims to find the currently best direct port of Box2D and make it easier to use.

  • Easy install for browser, nodejs and bundler (e.g., webpack).
  • Helper function for debug draw to a given canvas.
  • Helper function for looping/running/stepping.
  • Get-started builder interface for world building.

Trolley have used several ports, the current one is kripken/box2d.js, which is an emscripten-based direct port. This is the first time Trolley use a direct port from the original code.

Install

npm install @eirikb/trolley

Include

// From nodejs:
const trolley = require('@eirikb/trolley');

// From bundler (e.g., webpack):
import trolley from '@eirikb/trolley';

// From direct reference (e.g., CDN):
const trolley = window.trolley;

The installed script includes Box2D.

Builder

The world builder interface is available from trolley.world. See the builder demos for examples.

const world = trolley.world();
const body = world.body({ x: 10, y: 10, static: true });
body.box({ width: 2, height: 2 });
body.create();

There are several 2D physics libraries for JavaScript today; PhysicsJS, p2.js, matter-js and pas lanck.js to mention some.
Of these planck.js is the most related one, as it's a from-scratch JavaScript rewrite of Box2D.

License

zlib, same as box2d.js and Box2D.

FAQs

Package last updated on 10 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc