1 | const randomColor = () => {
|
2 | return `rgb(${Math.random()*255}, ${Math.random()*255}, ${Math.random()*255})`
|
3 | }
|
4 |
|
5 | if (typeof registerPaint !== 'undefined') {
|
6 | class RandomBg {
|
7 | paint(ctx, size) {
|
8 | ctx.fillStyle = randomColor()
|
9 | ctx.fillRect(0, 0, size.width, size.height)
|
10 | }
|
11 | }
|
12 |
|
13 | registerPaint('extra-randomBg', RandomBg)
|
14 | } |
\ | No newline at end of file |