在AndEngine中绘制曲线

发布于 2024-12-16 10:54:58 字数 313 浏览 2 评论 0原文

我是 AndEngine 的新手,很高兴这是一件非常简单且令人兴奋的事情。不幸的是我无法在 AndEngine 中绘制曲线。

实际上我的场景是我有一个动画精灵说对象。我想用 onToucing 给出的点在一条线上移动这个对象并拖动它。现在的问题是,我找不到任何方法以不产生角的方式在点上画线。我想要一条平滑的线条,没有棱角。

假设我触摸该对象并将其拖动到屏幕上,并带有方形区域的点。但我不想要其中的角落。我想要曲线。以前我是通过使用android的quadTo(..)函数来做到这一点的。我想要的只是 AndEngine 中的 Quadto 函数的完整替代方案,但具有相同的功能。

I am new to AndEngine and very happy that it's very easy and exciting thing to do. Unfortunately I am unable to draw a curved line in AndEngine.

Actually my scenario is that I have an animated sprite say Object. I want to move this object on a Line with the points given onToucing and dragging it. Now the problem is that I can't find any method to draw a line on points in a way that it does not produce corners. I want a smooth line with no corners.

Suppose I touch the object and drag it on the screen with the points of a square type region. But I don't want the corners in it. I want curves. Previously I am doing this by using quadTo(..) function of android to do this. All I want is a complete alternative to quadto function in AndEngine but with same functionality.

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

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

发布评论

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

评论(1

花想c 2024-12-23 10:54:58

你必须将许多小直线缝合在一起形成曲线。

不过,沿直线移动物体是一项非常不同的任务。您需要查看 CubicBezierMoveModifier 和 QuadraticBezierMoveModifier 来了解这些。

也许您实际上可以使用这些修饰符中的代码来创建“平滑”线条。

You have to stitch together the curved line from many many small straight lines.

Moving an object along a line is a very different task though. You'd want to have a look at CubicBezierMoveModifier and QuadraticBezierMoveModifier for those.

Maybe you can actually use the code in those modifiers to create your 'smooth' line.

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