fillStyle
本章小结:
createLinearGradient( x1, y1, x2, y2 ) creatRadialGradient( x1, y1, r1, x2, y2, r2 ) addColorStop( 0, 'red' ) ... createPattern( image/video/Canvas, 'repeat' ) // 设置重复纹理背景
fillStyle/strokeStyle可设置
color/gradient(2种)/pattern(3种)
同理 可以将fillStyle 定义填充内容的方法应用在strokestyle上
createPattern(img,repeat-style)
createPattern(canvas,repeat-style)
createPattern(video,repeat-style)
fillStyle = color 定义颜色 gradient 渐变(createLinearGradient线性渐变 createRadialGradient径向渐变) image图片 canvas引入其他canvas video 引入视频
fillStyle可以赋予的属性值 color, gradient(渐变样式), image, canvas, video
context.createLinearGradient(xstart, ystart, xend, yend)创建线性渐变色
context.createRadialGradient(x0, y0, r0, x1, y1, r1);创建镜像的渐变色
.addColorStop(stop,color)添加关键颜色
createPattern(img/canvas/video , repeat-style)
repeat-style:no-repeat,repeat-x,repeat-y,repeat 需要指定重复样式
创建图片或者另一个canvas作为fill的填充样式