我正在尝试使用 html 5 canvas 开发绘图工具。当我搜索一个好的 HTML 5 javascript 库时,他们中的大多数只专注于生成静态图像或动画。 我正在寻找的是绘制矩形、圆形等原始形状并向它们添加点击事件的能力。我还应该能够使用 handle 变换形状。
我知道我可能需要自定义一些框架,但仍然.. 如果有一个具有这些功能的现有框架,那将是很好的了解。谢谢
[编辑] 感谢您的回复。顺便说一句,我在某些地方读到 SVG 对于我计划做的所有交互式内容都比 canvas 更有用。现在我完全糊涂了:(
最佳答案
Paper.js
根据他们的网站:
Paper.JS is an open source vector graphics scripting framework that runs on top of the HTML5 Canvas.
和
offers mouse handlers for the different actions you can perform with a mouse (or touch screen).
three.js
javascript 中的另一个图形库是 three.js .根据他们的网站:
The aim of the project is to create a lightweight 3D library with a very low level of complexity — in other words, for dummies. The library provides canvas, svg and WebGL renderers.
我不确定库中处理鼠标事件的支持有多好。以下 SO 问题处理了一个示例:Event handling for geometries in Three.js?
关于javascript - 哪个 HTML 5 Canvas Javascript 用于制作交互式绘图工具?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11265863/