这儿介绍canvas的ccreatePattern函数,
context.createPattern(Image,"repeat"),还可以repeat-x,reapter-y
还可以context.createPattern(vedio,"repeat");
context.createPattern(canvas,"repeat");
var image=new Image();
image.src="a.jpg";
image.οnlοad=function(){
//var pattern=context.createPattern(image,"repeat");
var canvas=createbackgroundCanvas();
var pattern=context.createPattern(canvas,"repeat");
context.fillStyle=pattern;
context.fillRect(0,0,800,800);
}
function createbackgroundCanvas()
{
........
}
当然,以上所说的除了适用于fillStyle,还适用于strokeStyle