HTML5 Canvas shape from circle to triangle

canvas, css, html, javascript, svg

Solution

You might want to use Raphael (https://dmitrybaranovskiy.github.io/raphael/) or a similar library to take care of this for you. The raphael site contains many examples similar to the case you describe.

Problem

I've been looking around and I can't seem to find a clear way in which I can animate a shape to change from a circle to a triangle or to a rectangle or the other way around. I would assume that I could somehow store the shape and change its attributes in order to convert it. Basically what I am asking is, how can I draw a circle and then animate it to a triangle on the click of a button? Is that possible with canvas shapes? Thanks!

Original source

Related problems