DEV Community

Cover image for Obfuscated Canvas Commands
Zevan Rosser
Zevan Rosser

Posted on

Obfuscated Canvas Commands

I’ve had this idea for a long time, never bothered doing it until now. I wrote it in a semi-golfed style for no reason… Anyway, this lets you write canvas code in a strange obfuscated syntax that looks like this:

c(`
  fS #ccc
  fR 0 0 400 ${innerHeight}
  fS blue
  fR 40 0 20 20
  gCl difference
  ro .25
  fR 50 0 30 30
  gCl source-over
  fS rgba(200,100,9)
  fR 100 100 40 40
  `)
Enter fullscreen mode Exit fullscreen mode

This snippet logs out some JSON that shows all the method aliases for the canvas context.

See more stuff like this over @ Snippet Zone

Top comments (0)