canvas合成

来源:互联网 发布:c语言读取字符串 编辑:程序博客网 时间:2024/06/11 21:57
<canvas id="canvas" width="200px" height="200px" ></canvas>
<script type="text/javascript">
  var drawing = document.getElementById("canvas");
if(drawing.getContext){
var context=drawing.getContext("2d");
context.fillStyle="#ff0000";
context.fillRect(10,10,50,50);
context.globalCompositeOperation="destination-over";
context.fillStyle="rgba(0,0,255,1)";
    context.fillRect(30,30,50,50);

}
0 0