Revolute joint with motor in box2dWeb-2.1.a.3.js library
A simple example of how to make a revolute joint with motor in box2dWeb-2.1.a.3.js library.
// create revolute joint connecting the bodies bodyDef1 and bodyDef2
revoluteJoint = new b2RevoluteJointDef();
revoluteJoint.bodyA = bodyDef1;
revoluteJoint.bodyB = bodyDef2;
// connect both bodies in specific points in the local coordinate system
revoluteJoint.localAnchorA = new b2Vec2(-1, 0);
revoluteJoint.localAnchorB = new b2Vec2(0, 0);
// enable motor capabilities
revoluteJoint.enableMotor = true;
revoluteJoint.motorSpeed = 2;
revoluteJoint.maxMotorTorque = 1;
// add the revolute joint to the box2dWeb world
world.CreateJoint(revoluteJoint);