I am trying to create a mirror image transformation (and later an angled transformation) of dynamically generated group of lines in canvas. I'm attempting to do so by flipping the canvas and drawing a symmetrical line at each step, like so:
- Generate random variables
Draw line
ctx.save();
ctx.scale(-1,1);
Draw line in flipped context
ctx. restore();
I don't think the context is flipping appropriately because if I set scale values to, say, -5 and 5 they thicken my lines without flipping them.
Full attempt: http://codepen.io/RadaCodes/pen/RKQOXW?editors=1010
Please suggest what I'm doing wrong. Thank you.