示例#1
0
  pause:function()
  {
    if (this._paused === ture)
    {
      debug.warning("pause paused animation");
    }

    this._paused = true;
  },
示例#2
0
  resume:function()
  {
    if (this._paused === false)
    {
      debug.warning("resume a unpaused animation");
    }

    this._paused = false; 
  },
示例#3
0
function viewPhysicsShape(viewer, shape, r, g, b)
{
  switch(shape.GetType())
  {
    /*
      Box2D.Collision.Shapes.b2Shape.e_circleShape = 0;
      Box2D.Collision.Shapes.b2Shape.e_polygonShape = 1;
      Box2D.Collision.Shapes.b2Shape.e_edgeShape = 2;
      Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount = 3;
    */
    case 0:
      var radius = shape.GetRadius()
        , pos = shape.GetLocalPosition();
        
      viewer.fill(r, g, b);
      viewer.arc(pos.x, pos.y, radius*2, radius*2, 0, 2*Math.PI);
      break;
    case 1:
      viewer.fill(r, g, b);
      viewer.beginShape();
      util.each(shape.GetVertices(), function(vectex, i){
        viewer.vertex(vectex.x, vectex.y);
      });
      viewer.endShape(viewer.CLOSE);
      break;
    case 2:
      viewer.stroke(r, g ,b);
      
      var vectex1 = shape.GetVertex1()
        , vectex2 = shape.GetVertex2();
        
      viewer.line(vectex1.x, vectex1.y, vectex2.x, vectex2.y);
      break;
    case 3:
    default:
      debug.warning('cannot draw this shape:'+shape.GetType());
      break;
  }
}