beaugunderson / cat-snacks

🐦😻 a bot that tweets adorable cat faces!
https://twitter.com/catsnacks
42 stars 5 forks source link

de-duplicate some code #9

Open beaugunderson opened 8 years ago

beaugunderson commented 8 years ago

almost every drawing function has an identical ctx.save/ctx.translate/ctx.restore now; probably best to just do that once in the outer loop?

(the majority of functions now expect drawing to happen from centerX/centerY so it's easier to translate there first; the exceptions are the head shape (which is easily changed) and the background fills, which need to fill the whole canvas so (0, 0, width, height) becomes (-centerX, -centerY, width, height) like in head-markings