Konvajs中的线,路径和形状类别的区别是什么?

发布于 2025-01-25 10:06:22 字数 399 浏览 3 评论 0 原文

我是Paperjs的忠实拥护者,但是,图书馆没有看到很多活动,因此我们正在寻找其他工具,例如Konvajs,Fabric和Pixi。我们想在此处复制示例:

http://prapejs.org/examples/path-samples/path-simplificition /

在Konvajs中,但我们不确定哪个类最合适?我们是否应该使用该行,该行被描述为具有张力的点集合,即我们在纸张中使用的路径工具或形状类别? Konvajs在上述纸张示例中是否提供了对Bezier曲线工具和形状边框(蓝线)的相同类型的访问?

I'm a big fan of PaperJS, however, the library doesn't see much activity so we're looking at other tools, like KonvaJS, Fabric, and Pixi. We'd like to replicate the example here:

http://paperjs.org/examples/path-simplification/

in KonvaJS but we're not sure which class is the most appropriate? Should we use the line, which is described as a collection of points with tension, the path tool which is what we use in Paper, or the shape class? Does KonvaJS offer the same type of access to the bezier curve tools and shape border, blue line, found in the above-mentioned paper example?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿嘿嘿 2025-02-01 10:06:22

konva.line需要X& y以简单的数组传递到其点属性,然后绘制连接这些点的直线。张力属性可用于使直线加入更弯曲。

Konva.Path期望您提供更像SVG绘图指令列表的数据属性,因此请移动,LINETO,ARC等(请参阅Konva.path.data中的Konva Docs中的支持指令列表。Data在这里))

没有与您链接到的演示中的那些内置的等效路径编辑功能 -因此,路径控制点上没有自动锚点,也没有更偏重的手柄。您将不得不做那些。话虽如此,这都是可以实现的 - 我的意思是绘制控制锚和线的绘制,侦听鼠标和拖动事件以及SVG的最后传递绘制数据绘制到konva.path。编辑模式的末端在KONVA中都得到了很好的支持。

截至截至2022年5月,Konva Lib得到了很好的支持,并经常经常(正如Goldilocks想要的 - 不是太多,也不是太少),没有犯错的破坏变化,问题回应,因此帖子回复了和帖子。有一个繁忙的不和谐频道。

Konva.Line requires a list of x & y passed into its points property as a simple array, then draws straight lines connecting those points. The tension property can be used to make the straight line joins more curvy.

Konva.Path expects you to provide a data property that is more like a list of SVG drawing instructions, so move, lineto, arc, etc. (See supported instructions list in Konva docs for Konva.Path.data here)

There is no built-in equivalent path-editing features to those in the demo you linked to - so no automatic anchors on the path control points and no Bezier handles. You would have to DIY those. Having said that, it would all be achievable - what I mean is the drawing of the control anchors and lines, the listening for mouse and drag events, and the final passing back of the SVG drawing data to the Konva.Path shape when the path's edit mode ends are all well supported in Konva.

As at May 2022, the Konva lib is well supported, with appropriately frequent (as Goldilocks would want - not too many and not too few), no ill-thought-out breaking changes, issues are responded to, SO posts replied to, and there is a busy Discord channel.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文