Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Created March 2, 2018 21:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonekorean/6d923f269e2ff48ceef936e1e10bee0f to your computer and use it in GitHub Desktop.
Save lonekorean/6d923f269e2ff48ceef936e1e10bee0f to your computer and use it in GitHub Desktop.
Placeholder box paint worklet
class PlaceholderBoxPainter {
paint(ctx, size) {
ctx.lineWidth = 2;
ctx.strokeStyle = '#666';
// draw line from top left to bottom right
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(size.width, size.height);
ctx.stroke();
// draw line from top right to bottom left
ctx.beginPath();
ctx.moveTo(size.width, 0);
ctx.lineTo(0, size.height);
ctx.stroke();
}
}
registerPaint('placeholder-box', PlaceholderBoxPainter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment