参考 rotateAxisAngle()

rotateAxisAngle()

此 API 是实验性的

其行为可能在 p5.js 的未来版本中发生变化。

Turns a 3D p5.strands transform about any axis.

rotateX(), rotateY(), and rotateZ() only turn about the three main axes. rotateAxisAngle() turns about a line pointing in any direction, given as a three-component vector. The axis doesn't need to be a unit vector; it is normalized before use.

A new transform is returned and the one passed in is left untouched, so the result has to be assigned back, as in t = rotateAxisAngle(t, [1, 1, 0], PI / 4).

Angles are always measured in radians here, since angleMode() doesn't reach inside a shader.

Note: rotateAxisAngle() only works on a transform created with transform3D(), and can only be used inside a p5.strands shader callback.

示例

语法

rotateAxisAngle(transform, axis, angle)

参数

transform
a transform created with transform3D().
axis
a three-component vector pointing along the line to turn about.
angle
Number: angle to turn by, in radians.

返回值

a new transform with the turn applied.

相关参考