H5小游戏开发使用createjs库画线

//画线
function connection(x,y) {
 var  canvas  =  document.createElement('canvas');
   var  shape  = new  createjs.Shape();
     graphics = shape.graphics;//起点位置
    graphics.beginStroke("blue");//线的颜色
    graphics.setStrokeStyle(5);//线的粗细
    graphics.moveTo(1000,200);//终点
    graphics.lineTo(x,y);
    canvas.addChild(shape);
}

你可能感兴趣的:(H5小游戏开发使用createjs库画线)