使用插值计算样条曲线上的坐标。
curvePoint()
使用锚点和控制点计算样条曲线上的坐标。它期望的点的顺序与 curve() 函数相同。curvePoint()
每次只在一个轴上工作。传递锚点和控制点的 x 坐标将计算曲线上一点的 x 坐标。传递锚点和控制点的 y 坐标将计算曲线上一点的 y 坐标。
第一个参数 a
是第一个控制点的坐标。
第二个和第三个参数 b
和 c
是锚点的坐标。
第四个参数 d
是最后一个控制点的坐标。
第五个参数 t
是沿着曲线进行插值的量。0 是第一个锚点,1 是第二个锚点,0.5 是它们之间的中间点。
示例
语法
curvePoint(a, b, c, d, t)
参数
a
Number:
coordinate of first anchor point.
b
Number:
coordinate of first control point.
c
Number:
coordinate of second control point.
d
Number:
coordinate of second anchor point.
t
Number:
amount to interpolate between 0 and 1.
返回值
Number: coordinate of a point on the curve.
This page is generated from the comments in src/core/shape/curves.js . Please feel free to edit it and submit a pull request!