Slide 26
Slide 26 text
Paint Worklet
paint(ctx, geom, properties) {
const img = properties.get('--image');
switch (img.state) {
case 'ready':
ctx.drawImage(img, 0, 0, geom.width, geom.height);
break;
case 'pending':
drawMountains(ctx);
break;
case 'invalid':
default:
drawSadFace(ctx);
}
}
Experimental