html5 fill怎么设置随机颜色

html-css015

html5 fill怎么设置随机颜色,第1张

<div id="rand"></div>

var n=document.getElementById('rand')

n.style.background(rand(0,255),rand(0,255),rand(0,255))

fillSytle:为当前环境设置填充颜色,支持RGB值、RGBA值,十六进制值,HSL和HSLA值,默认为黑色。推荐你一个视频吧啊,比我讲的清楚,搜一下“HTML5 矢量绘图新功能- Canvas 基本用法”