Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

kinematics


jPhysics

This plugin gives physics properties to selected DOM elements. You set position, velocity, acceleration, apply forces and update the elements states. You also get a n-dimensional Vector class with basic vectorial operations. Specially useful for JS games.

Example:

//Applies physics properties to element with 'box' id
$('#box').physics({
position:new $.Vector(0,400),
velocity:new $.Vector(5,-10)),
maxVelocity:new $.Vector(10,10),
minVelocity:new $.Vector(-10,-10),
minPosition:new $.Vector(0,0),
maxPosition:new $.Vector(800,400)
});

//Defines 2 forces
var gravity = new $.Vector(0,0.2);
var wind = new $.Vector(-0.05,0);

//Sets a timer with 30ms interval to apply the 2 forces and update element state
//Applies 3 time steps per update
setInterval('$("#box").applyForces(gravity,wind).updatePhysics(3)',30);