Show HN: A resource for drawing complex primitives in JavaScript
1–10 of 12 posts
Re: Show HN: A resource for drawing complex primitives in JavaScript
#2Use rotate(), translate(), and scale() instead of doing your own math.
Re: Show HN: A resource for drawing complex primitives in JavaScript
#3Re: Show HN: A resource for drawing complex primitives in JavaScript
#4Is the author aware of https://developer.mozilla.org/en-US/docs/Web/API/CanvasRende... ? Use rotate(), translate(), and scale() instead of doing your own math.
I'm more excited about Path2D[0] becoming adopted by more browsers.
Re: Show HN: A resource for drawing complex primitives in JavaScript
#5Re: Show HN: A resource for drawing complex primitives in JavaScript
#6Re: Show HN: A resource for drawing complex primitives in JavaScript
#7Re: Show HN: A resource for drawing complex primitives in JavaScript
#8Is it reliable to add methods to a built-in object like CanvasRenderingContext2D? I avoid it, but perhaps just out of superstition.
See String.prototype.contains → String.prototype.includes because mootools extended the String prototype[1]
[1] - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: Show HN: A resource for drawing complex primitives in JavaScript
#9Is it reliable to add methods to a built-in object like CanvasRenderingContext2D? I avoid it, but perhaps just out of superstition.
You can rearrange the code to accept a context as the first argument if you are worried.
Re: Show HN: A resource for drawing complex primitives in JavaScript
#10It's a library I use when I teach kids JavaScript. It provides simple global functions to let them get started before they have to deal with ideas such as canvas context objects.
A Wiki page showing the functions they get to use is at http://fingswotidun.com/code/index.php/API
The functions you show here are exactly the sort of thing that would be useful for beginners.