All Projects → shakiba → Planck.js

shakiba / Planck.js

Licence: mit
2D JavaScript Physics Engine

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Planck.js

Icon Machine
Web application for randomly generating pixel art icons.
Stars: ✭ 73 (-98.24%)
Mutual labels:  game-development, html5, canvas
Melonjs
a fresh & lightweight javascript game engine
Stars: ✭ 3,721 (-10.32%)
Mutual labels:  game-development, html5, canvas
Micro Racing
🚗 🏎️ 🎮 online 3D multiplayer neural networks based racing game
Stars: ✭ 100 (-97.59%)
Mutual labels:  physics-engine, html5, canvas
Zrender
A lightweight graphic library providing 2d draw for Apache ECharts
Stars: ✭ 5,122 (+23.45%)
Mutual labels:  2d, html5, canvas
Black
World's fastest HTML5 2D game engine   🛸
Stars: ✭ 174 (-95.81%)
Mutual labels:  2d, html5, canvas
Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (-96.34%)
Mutual labels:  2d, html5, canvas
Matter Js
a 2D rigid body physics engine for the web ▲● ■
Stars: ✭ 12,522 (+201.81%)
Mutual labels:  physics-engine, canvas, rigid-bodies
Html5 Animation
Foundation HTML5 Animation with JavaScript example code and book exercises.
Stars: ✭ 667 (-83.92%)
Mutual labels:  game-development, html5, canvas
Kaetram Open
An open-source 2D HTML5 adventure based off BrowserQuest (BQ).
Stars: ✭ 138 (-96.67%)
Mutual labels:  game-development, 2d, html5
okeevis-render
a fast lightweight 2d graphic library
Stars: ✭ 22 (-99.47%)
Mutual labels:  canvas, 2d
awesome-canvas
Canvas资源库大全中文版。An awesome Canvas packages and resources.
Stars: ✭ 288 (-93.06%)
Mutual labels:  canvas, 2d
Windfield
Physics module for LÖVE
Stars: ✭ 254 (-93.88%)
Mutual labels:  game-development, box2d
Canvas Nest.js
♋ Interactive Particle / Nest System With JavaScript and Canvas, no jQuery.
Stars: ✭ 3,966 (-4.41%)
Mutual labels:  html5, canvas
Box2DSwift
Box2DSwift is a Swift port of Box2D Physics Engine.
Stars: ✭ 38 (-99.08%)
Mutual labels:  physics-engine, box2d
repeat-editor
editor for live coding graphics
Stars: ✭ 17 (-99.59%)
Mutual labels:  canvas, 2d
Playground
A playground for android developers
Stars: ✭ 41 (-99.01%)
Mutual labels:  physics-engine, box2d
Py3ODE
Port of PyODE for Python 3
Stars: ✭ 29 (-99.3%)
Mutual labels:  physics-engine, 2d
Front Ui
😄 🎨 Collect some front-end special effects (收集一些前端特效)
Stars: ✭ 259 (-93.76%)
Mutual labels:  html5, canvas
Dynamic effect
平时练习的一些前端动效,基于HTML5,CSS3,Canvas,Svg
Stars: ✭ 264 (-93.64%)
Mutual labels:  html5, canvas
Hstardoc
My blogs write with markdown.
Stars: ✭ 297 (-92.84%)
Mutual labels:  html5, canvas

Planck.js

Planck.js is JavaScript (TypeScript) rewrite of Box2D physics engine for cross-platform HTML5 game development.

Motivations

  • Taking advantage of Box2D's efforts and achievements
  • Developing readable and maintainable JavaScript code
  • Optimizing the library for web and mobile platforms
  • Providing a JavaScript-friendly API

Documentation

Community

API and Architecture

Planck.js includes Box2D algorithms without modification and its architecture is very similar to Box2D. However some internal changes and refactoring are made during rewrite to address differences between C++ and JavaScript.

Planck.js public API closely follows Box2D API, with the following differences:

  • b2 prefix is dropped from class names, for example b2World is now available as planck.World.
  • Method names are converted from UpperCamelCase to lowerCamelCase.
  • Definition classes/objects (BodyDef, FixtureDef, etc.) are replaced by inline JavaScript objects ({}).
  • Shapes are considered immutable and are not cloned when used to create fixtures.
  • Contact filtering can be customized by overriding shouldCollide method of Fixture.
  • Listener classes are replaced with simple functions.
  • World#on(eventName, listenerFn) and World#off(eventName, listenerFn) are added to add and remove event listeners. Currently supported events are: 'begin-contact', 'end-contact', 'pre-solve', 'post-solve', 'remove-joint', 'remove-fixture', 'remove-body'

Updates

v1.0-alpha

  • Source code is migrated to TypeScript, to improves library usability, documentation and maintenance.

  • Package name for v1.0+ is changed to planck. Package name for releases before v1.0 is planck-js.

  • planck.internal namespace is deprecated and everything is directly available under main namesapce (except planck.internal.stats).

  • Source files are moved to /src directory (from /lib) and directory layout is updated to match Box2D.

  • Rollup is used to build the project.

Install

v0.3 (stable release)

To install [email protected] (stable release) see v0.3 branch.

v1.0 (alpha)

Staring from v1.0 package name is changed to planck. Releases and updates before v1.0 will remain available under planck-js.

CDN

Planck.js is available on jsDelivr.

NPM

Install npm package.

npm install planck

Import it in your code.

import * as planck from 'planck';
Testbed

Use CDN in a web page.

<html><body>
  <script src="//cdn.jsdelivr.net/npm/planck@latest/dist/planck-with-testbed.min.js"></script>
  <script>
    planck.testbed(function(testbed) {
      // Your testbed code
    });
  </script>
</body></html>

Use NPM package in Node.

const planck = require('planck/dist/planck-with-testbed');

planck.testbed(function() {
  // ...
});

Projects

Games

Dynamic Visualization

Science and AI

Game Development

Credits

Box2D is a popular C++ 2D rigid-body physics engine created by Erin Catto. Box2D is used in several popular games, such as Angry Birds, Limbo and Crayon Physics, as well as game development tools and libraries such as Apple's SpriteKit.

Planck.js is developed and maintained by Ali Shakiba.

TypeScript definitions for planck.js are developed by Oliver Zell.

License

Planck.js is available under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].