Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by rmetzler on Tuesday March 13, 2018 @02:57AM
(#16574269)
This is the vehicle I programmed together with my 5 year old: https://jsfiddle.net/k1g6533y/13/
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by 4lejandrito on Tuesday March 13, 2018 @05:40AM
(#16574780)
Very nice!
I changed it a little bit to optimise rendering just in case you don't know about 'requestAnimationFrame()' (https://developer.mozilla.org/en-US/docs/Web/API/window/requ...):
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by DiThi on Tuesday March 13, 2018 @06:42AM
(#16575033)
It's using setInterval on purpose, because with requestAnimationFrame the effect is a bit too fast.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by reacweb on Tuesday March 13, 2018 @06:22AM
(#16574932)
Works fine on chrome, but it seems too fast on firefox.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by hanoz on Tuesday March 13, 2018 @06:28AM
(#16574977)
What do all the context transformation lines do in this example? It seems to work just as well with clearRect on its own.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by ygra on Tuesday March 13, 2018 @06:44AM
(#16575043)
There's only one such line. In general it's a good idea to reset the transform before clearing as the (0, 0, w, h) rectangle may not cover the whole canvas anymore. In this toy example there obviously isn't another transform so it's without function.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by thomasfl on Tuesday March 13, 2018 @05:36AM
(#16574764)
Wonderfurl! It makes the kid see how a small algorithm saves time AND produces almost the same results as hand drawn animation. I have to try this myself with my own kids.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by jjeaff on Tuesday March 13, 2018 @10:18PM
(#16581744)
Absolutely! Assuming your 5 year old is some kind of savant. Otherwise, I can't imagine a kid actually understanding what is going on with a script like this.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by stuntkite on Tuesday March 13, 2018 @12:04AM
(#16573827)
This is great. Thank you both for these fiddles. I've been doing a lot of SVG DOM stuff. Mostly tied to maps. I'm excited to try this out.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by shihn on Monday March 12, 2018 @07:47PM
(#16572728)
That's true. There's so much randomness in there that every render will likely be unique - every so slightly different from the previous frame.
Re:Show HN: RoughJS – Create hand-drawn graphics using JavaS...
by wickedjust on Tuesday March 13, 2018 @02:18AM
(#16574161)
Reminds me of the art used in yoshi story. Awesome!
EDIT: If folks want to play with a JSFiddle: https://jsfiddle.net/49g2Leqw/9/