BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Path.bezierCurveTo()

Path.bezierCurveTo()是three.js中Path对象的方法之一,它用来创建一条二次贝塞尔曲线。

语法

Path.bezierCurveTo(cx1, cy1, cx2, cy2, x, y)

参数

  • cx1:控制点1的x坐标。
  • cy1:控制点1的y坐标。
  • cx2:控制点2的x坐标。
  • cy2:控制点2的y坐标。
  • x:结束点的x坐标。
  • y:结束点的y坐标。

用法示例

const path = new THREE.Path();
path.moveTo(0, 0);
path.bezierCurveTo(50, 50, 75, 25, 100, 0);

const geometry = path.createPointsGeometry(50);
const material = new THREE.LineBasicMaterial({ color: 0xff0000 });

const curveObject = new THREE.Line(geometry, material);
scene.add(curveObject);

以上示例创建了一条起点为(0,0),终点为(100,0),两个控制点分别为(50,50)和(75,25)的贝塞尔曲线,并将其作为一条红色的直线添加到了场景中。

参考文献