DEV Community

Cover image for Obfuscated Canvas Commands
Zevan Rosser
Zevan Rosser

Posted on

1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️