canvas嵌套

[code]
/**
* …canvas嵌套
* @author amyflash.com
*/

(function() {
var ctx = document.getElementById(“canvas”).getContext(“2d”);

var canvas2 = document.createElement(“canvas”);

canvas2.width =200;
canvas2.height =200;
var ctx2 = canvas2.getContext(“2d”);
ctx2.fillStyle=”#0000FF”;
ctx2.strokeStyle=”#000000″;
ctx2.lineWidth =10;
ctx2.fillRect(0,0,200,200);
ctx2.strokeRect(0,0,200,200);

ctx.drawImage(canvas2,10,10);
})();
[/code]

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>