参考 curveTangent()

curveTangent()

计算沿着与样条曲线相切的直线的坐标。

切线与曲线表面相切。切线的斜率等于它与曲线相交点处的曲线斜率。

curveTangent() 使用样条曲线的锚点和控制点计算切线上的坐标。它期望的点的顺序与 curve() 函数相同。 curveTangent() 每次只在一个轴上工作。锚点和控制点的 x 坐标可以用于计算切线点的 x 坐标。锚点和控制点的 y 坐标可以用于计算切线点的 y 坐标。

第一个参数 a 是第一个控制点的坐标。

第二个和第三个参数 bc 是锚点的坐标。

第四个参数 d 是最后一个控制点的坐标。

第五个参数 t 是沿着曲线进行插值的量。0 是第一个锚点,1 是第二个锚点,0.5 是它们之间的中间点。

示例

语法

curveTangent(a, b, c, d, t)

参数

a

coordinate of first control point.

b

coordinate of first anchor point.

c

coordinate of second anchor point.

d

coordinate of second control point.

t

amount to interpolate between 0 and 1.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/shape/curves.js and open a pull request!

相关参考