在actionscript3中分割贝塞尔曲线
我想“生长”一条带有贝塞尔曲线的路径。绘制路径后,它应该有点摇晃:类似编织的外观和感觉。 视觉示例: 编织示例 目前,我使用 TweenMax.bezier,它允许我沿着这条曲线移动一个点,同时(onEnterFrame)我将线条绘制到该点的当前位置。 不幸的是,如果帧速率下降(方形切割),这种方法会导致曲线质量较差,并且很难重新计算之间的所有点(对于编织效果); 最近的建议引导我使用曲线来解决问题,但我不知道具体如何做。 这个例子可以解决我的问题: split bezier 但没有代码片段。
有人遇到同样的问题吗? 提前致谢
I would like to "grow" a path with bezier-curves. After the path has been drawn, it should be shaking a bit: Weave-like look and feel.
visual example:
weave example
At the moment I use TweenMax.bezier, which let me move a point along this curve and at the same time (onEnterFrame) I draw lines to the current Position of the Point.
Unfortunately this approach leads to bad quality of the curve if the framerate drops(square-cut) and it is difficult to recalculate all the points in between(for the weave effect);
Recent suggestions lead me to use curves to solve the problem, but I don't know exactly how.
This example would solve my problem: split bezier
But no code-snippets.
Did anyone encounter the same problem ?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我经常使用 Tweeners
CurveModifiers._bezier_get
来轻松创建贝塞尔曲线并检索点(我已经尝试过一些,这个实际上很快)。...快速:
设置两个列出控制点的数组 (x,y)。
迭代每一帧以修改控制点的位置。
使用一些类似的代码重新绘制曲线:
编辑
在这里:
I often use Tweeners
CurveModifiers._bezier_get
to create bezier curves and retrieve points easily (I've tried a few and this one is actually fast).... Quickly :
Set up two arrays (x,y) listing the control points.
Iterate each frame to modify the positions of the control points.
Redraw your curve with some similar code :
Edit
Here you go :
您正在寻找的算法通常称为 deCastlejau 算法。开花或极性标签是同一事物的更通用方法。
What you're looking for is more commonly called the deCastlejau algorithm. Blossoming or polar labels are more general methods for the same thing.