Slide 29
Slide 29 text
CSS Painting API
registerPaint(
'boxbg',
class {
static get contextOptions() {
return { alpha: true };
}
static get inputProperties() {
return ['--boxColor'];
}
paint(ctx, size, props) {
ctx.fillStyle = props.get('--boxColor');
ctx.fillRect(0, 0, size.width, size.height);
}
}
);
li {
background-image: paint(boxbg);
--boxColor: blue;
}