Kaan.js

a 2D physics simulation library for JavaScript

click here for examples

Getting Started

Download the library
To use this library, all you need is jQuery, and this library itself, no other external js or css file is required. Here are some code snippets showing some basic library functionality:

API

Enviroment(name, height, width, color, temparature, gravity)

Simulates a real environment, with properties such as temparature, gravity, etc. Objects (Matter) can be placed inside an environment, and the objects will interact with the features of the environment. Objects can be added, and removed from environment, but objects can't leave an environment, i.e. all interactions will take place in an objects assigned environment.
Constructor Parameters:
Functions:

Matter(enviroment, width, height, x, y, color="White", mass=0, movable=true, displayItem=true, name = "")

Constructor Parameters:
Functions:

EnviromentController(enviroment)

Constructor Parameters:
  • enviroment: This is the environment that the controller controls.
Functions:
  • create(): Creates the EnviromentController.