Plugins

User login
Can't find a Plugin?

Can't find a Plugin you are looking for? Check out the jQuery Wiki page.

Are you a plugin developer? Please move your plugin over to this site.

Website Bug or Feature Request?

Found a bug on the new jQuery Plugin website? Have a feature request?

Submit it to the jQuery Plugin website issue queue to ensure it is noticed!

jPhysics


Average rating
(2 votes)

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);

Releases

Official releasesDateSizeLinksStatus
0.32008-Nov-027.5 KBRecommended for 1.2.xThis is currently the recommended release for 1.2.x.