HTML5画布从圆形到三角形 [英] HTML5 Canvas shape from circle to triangle
问题描述
我一直在环顾四周,我似乎没有找到一个明确的方法,我可以动画的形状,从一个圆形变成一个三角形或矩形或其他方式。我会假设我可以以某种方式存储形状并改变其属性以便转换它。
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?
谢谢!
推荐答案
可能需要使用Raphael( https://dmitrybaranovskiy.github.io/raphael/ )或类似网站图书馆为您照顾这一点。 Raphael网站包含许多类似于您描述的示例。
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.
这篇关于HTML5画布从圆形到三角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!