好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html5中canvas标签中2d上下文globalCompositeOperation属性-Myt

定义和用法

globalCompositeOperation 属性设置或返回如何将一个源(新的)图像绘制到目标(已有)的图像上。

例:

  1   var  c=document.getElementById("myCanvas" );
   2   var  ctx=c.getContext("2d" );
   3  
  4  ctx.fillStyle="red" ;
   5  ctx.fillRect(20,20,75,50 );
   6   ctx.globalCompositeOperation="source-over";
   7  ctx.fillStyle="blue" ;
   8  ctx.fillRect(50,50,75,50 );
   9  
 10  ctx.fillStyle="red" ;
  11  ctx.fillRect(150,20,75,50 );
  12   ctx.globalCompositeOperation="destination-over";
  13  ctx.fillStyle="blue" ;
  14  ctx.fillRect(180,50,75,50); 

查看更多关于html5中canvas标签中2d上下文globalCompositeOperation属性-Myt的详细内容...

  阅读:34次