为什么在html5中使用canvas进行动画制作?

前端之家收集整理的这篇文章主要介绍了为什么在html5中使用canvas进行动画制作?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是 html5的新手,并且一直在玩画布.我想知道画布什么时候真的有必要/有用吗?即什么时候用它?

如果我需要做简单的动画,比如移动标签,我真的需要画布,还是更好/更容易使用jquery / js?

解决方法

在画布的帮助下,您可以创建2D图形应用程序,动画,图像的简单转换(如旋转它们),GUI等.一些示例:

> Asteroids game
> jigsaw puzzle
>关于GUI,遗憾的是我无法加载网站,不知道为什么……它被称为iWidgets.com,我发现的唯一的东西是screenshot.你可以在那里看到蓝色管道,它们绑定元素.它是在画布的帮助下完成的;在移动元素的同时,管道也在重新绘制;当您更改活动元素时,其所有连接都会将颜色更改为黄色(因此您会看到依赖关系).不错的项目,我希望它暂时无法访问…

关于如何使用它的好文章here

从“An insight into the HTML5 Canvas Element”:

The canvas element is interesting and
worthy of focus because it enables,
for the first time,direct drawing of
graphics within a browser without the
use for an external plugin like Flash
or Java. The beauty of canvas is that
it’s controlled entirely via simple
JavaScript code,meaning it builds on
the powerful functionality JavaScript
already provides and doesn’t require a
crazy learning curve to use.

Choosing to experiment with canvas
over other new elements was simply
down to it’s functionality as a
graphics platform,which inherently
makes it a potentially interesting and
rich platform to play with. It was
decided that pushing the flexible
canvas element would produce the most
interesting results that we can use in
the application.

Another deciding factor for choosing
canvas was to test the animation
capabilities and the possibility of it
being a potential Flash replacement.
Now Flash obvIoUsly has features that
canvas could never emulate,however
it’s an exciting concept nonetheless
to see exactly what could be achieved
with canvas that would normally be
done by reaching for Flash.

阅读该文章以获得更多有用的信息

PS.如果您的动画是关于移动的标签(如页面的某些部分),则画布不适合. Canvas用于图形渲染.所以在这种情况下,您将使用jquery或其他JS库.

原文链接:https://www.f2er.com/html5/168400.html

猜你在找的HTML5相关文章