---JS canvas学习笔记

context的fillStyle属性

fillStyle=color | gradient | image | canvas |video

strokeStyle也有上述属性。

1、color:#ffffff | #362 | rgba(100,100,100,0.8) | red

css可以使用的格式在此都可以使用

2、gradient

Linear Gradient

var grd=context.createLinearGradient(xstart,ystart,xend,yend);

Radial Gradient

var grd=context.createRadialGradient(x0,y0,r0,x1,y1,r1);

grd.addColorStop(stop,color);

3、image | canvas | video

createPattern(img,repeat-style)

createPattern(canvas,repeat-style)

createPattern(videa,repeat-style)

repeat-style:no-repeat | repeat-x | repeat-y | repeat

原文地址:https://www.cnblogs.com/beast-king/p/6235545.html