etchASketch!
Think using HTML5 Canvas is too confusing? Yearning for the good ol' days of "don't shake it" ? If so, this module is for YOU!
var Etch = require('etch-a-sketch');
Etch()
.shake()
.twistLeft(45)
.twistRight(-10)
.twistLeft(10)
.twistRight(-90)
.twistLeft(-10)
.twistRight(-10)
.twistLeft(-90)
.twistRight(10)
.twistLeft(-10)
.twistRight(90)
.twistLeft(10)
.twistRight(10)
.twistLeft(40)
.print('./circle.png');
Numbers are in degrees counter-clockwise. This example shows off, basically, the entire API! Text feedback looks like this:
Shake shake shake...
Twisted left knob 45 degrees!
Moved pen to (320, 210)!
Twisted right knob -10 degrees!
Moved pen to (329, 210)!
Twisted left knob 10 degrees!
Moved pen to (329, 203)!
Twisted right knob -90 degrees!
Moved pen to (409, 203)!
Twisted left knob -10 degrees!
Moved pen to (409, 210)!
Twisted right knob -10 degrees!
Moved pen to (418, 210)!
Twisted left knob -90 degrees!
Moved pen to (418, 270)!
Twisted right knob 10 degrees!
Moved pen to (409, 270)!
Twisted left knob -10 degrees!
Moved pen to (409, 277)!
Twisted right knob 90 degrees!
Moved pen to (329, 277)!
Twisted left knob 10 degrees!
Moved pen to (329, 270)!
Twisted right knob 10 degrees!
Moved pen to (320, 270)!
Twisted left knob 40 degrees!
Moved pen to (320, 243)!
Outputting file to ./circle.png !
and the resulting png looks like this:
Beautiful.
How can I get this hotness??
Easy!
npm install etch-a-sketch
License
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.