Cocoa 中的高阶贝塞尔路径
有没有办法在 Cocoa 中以任意的能力创建贝塞尔路径?例如,对于我的应用程序的一部分,我需要一个起伏的单元格。因此,我想使用 10 到 50 个不同的点绘制一条曲线,形成一个循环。这些点将随机波动。我认为我可以制作一条贝塞尔曲线路径来表示循环,使用点作为指南,或根据点推断指南。
我应该使用贝塞尔路径吗?或者是否有其他算法可以产生类似的效果?
is there any way to create Bezier Paths in Cocoa with arbitrary power? For example, for one part of my app, I need an undulating cell. So, I want to draw a curve using between 10 and 50 different points, forming a loop. The points will randomly undulate. I thought I could make a bezier path to represent the loop, using the points as guides, or extrapolating guides based on the points.
Should I even be using Bezier Paths? Or is there some other algorithm that will give a similar effect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
制作更高阶的贝塞尔曲线只会使路径更平滑,不会给您带来您想要的效果。相反,尝试从许多较短的贝塞尔曲线路径中形成一个循环,并调整所有点的位置。您需要使与端点相邻的点相互镜像以保持平滑。
还有很多其他方法可以实现这种效果。
Making a higher order Bezier path will only make the path smoother, it won't give you the effect you are looking for. Instead, try making a loop out of many shorter Bezier paths and modulating the locations of all the points. You'll need to make the points adjacent to endpoints mirror each other to keep it smooth.
There are many other ways to make this kind of effect.