简体   繁体   English

HTML5中的2D交互式动画引擎

[英]2D interactive animation engine in HTML5

I'm looking for a simple JavaScript library or framework to create interactive 2D animations in the browser. 我正在寻找一个简单的JavaScript库或框架来在浏览器中创建交互式2D动画。 (Excuse the buzzword in the title, but I'm not set on any particular rendering technology like Canvas or SVG.) (请使用标题中的流行语,但我没有设置任何特定的渲染技术,例如Canvas或SVG。)

This should make it simple to draw and animate arbitrary (though not very sophisticated) shapes on a canvas screen and allow users to select and move these shapes as objects (kind of like a very basic RTS game engine). 这应该使在画布屏幕上绘制任意(尽管不是很复杂)形状和动画变得简单, 允许用户选择并移动这些形状作为对象(有点像非常基本的RTS游戏引擎)。

Ideally, the following features should be supported (directly or indirectly; I'd implement it myself if necessary): 理想情况下,应支持以下功能(直接或间接;如果需要,我会自己实现):

  • panning 平移
  • zooming 缩放
  • fisheye partial zooming 鱼眼局部变焦
  • box selection (selecting multiple objects by drawing a box around them) 框选择(通过在它们周围绘制一个框来选择多个对象)

Not being familiar with such things yet, I find it tricky to research what's out there (eg regarding search terms). 我还不熟悉这些东西,所以很难研究那里的东西(例如,关于搜索词)。 Also, I have no illusions about some magical package that doesn't require any effort on my part - indeed, I'd prefer simple and readable libraries so I can learn about the basics by reading the source. 另外,对于某些不需要我付出任何努力的不可思议的软件包,我也没有任何幻想-确实,我更喜欢简单易读的库,因此我可以通过阅读源代码来了解基础知识。

If you like simple libraries, perhaps take a look at GameJS . 如果您喜欢简单的库,也许看看GameJS It claims to be "a thin library on top of the HTML5 canvas element." 它声称是“在HTML5 canvas元素之上的瘦库”。 It's a port of PyGame to JavaScript, which in my experience is a fairly nice abstraction layer that at the same time doesn't overdo it. 它是PyGame移植到JavaScript的端口,以我的经验,这一个相当不错的抽象层,同时又不会过度使用它。

If that doesn't cut it, have a look at this list of JS game (and animation) engines . 如果还不能解决问题,请查看此JS游戏(和动画)引擎列表

You probably did make a search and found dozens of js game engines. 您可能进行了搜索,发现了数十个js游戏引擎。 I will just narrow it down for you. 我会为您缩小范围。 It is impossible to just spit out one single js game engine. 仅仅抛出一个js游戏引擎是不可能的。 Also, you might find some to be more appropriate than others based on the type of game you want to make. 此外,根据您要制作的游戏类型,您可能会发现某些游戏比其他游戏更合适。 So here they are 所以他们在这里

LimeJS LimeJS

Impact 影响力

Crafty 狡猾

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM