Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Created March 5, 2018 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonekorean/1b08cd66fed0875679be4e39fb57f302 to your computer and use it in GitHub Desktop.
Save lonekorean/1b08cd66fed0875679be4e39fb57f302 to your computer and use it in GitHub Desktop.
Solid color paint worklet
class SolidColorPainter {
static get inputArguments() {
return ['<color>'];
}
paint(ctx, size, props, args) {
ctx.fillStyle = args[0].toString();
ctx.fillRect(0, 0, size.width, size.height);
}
}
registerPaint('solid-color', SolidColorPainter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment