在 compose 中用贝塞尔曲线绘制波形

问题描述 投票:0回答:1

我尝试用画布和贝塞尔曲线绘制它,但我无法正确绘制平滑的天使。有人可以帮忙在 compose 中画这个吗?

Wave shape

我试过像这样用立方贝塞尔曲线画一条路径:

  path = Path().apply {
                moveTo(firstHandleCenter.x, firstHandleCenter.y)
                cubicTo(
                    firstCurveCenter.x,
                    firstCurveCenter.y,
                    secondCurveCenter.x,
                    secondCurveCenter.y,
                    secondHandleCenter.x,
                    secondHandleCenter.y
                )
            }
kotlin android-jetpack-compose android-jetpack bezier
1个回答
0
投票

这个在线工具帮助我解决了这个问题:http://blogs.sitepointstatic.com/examples/tech/canvas-curves/bezier-curve.html.

思路是画两条立方贝塞尔曲线。第一个将覆盖一半的波浪,第二个将被反转。

Bezier curve

© www.soinside.com 2019 - 2024. All rights reserved.