Three.js API手册

动画
AnimationAction AnimationClip AnimationMixer AnimationObjectGroup AnimationUtils KeyframeTrack PropertyBinding PropertyMixer
动画 / 轨道
BooleanKeyframeTrack ColorKeyframeTrack NumberKeyframeTrack QuaternionKeyframeTrack StringKeyframeTrack VectorKeyframeTrack
音频
Audio AudioAnalyser AudioContext AudioListener PositionalAudio
摄像机
ArrayCamera Camera CubeCamera OrthographicCamera PerspectiveCamera StereoCamera
常量
Animation Core CustomBlendingEquation DrawModes Materials Renderer Textures
核心
BufferAttribute BufferGeometry Clock DirectGeometry EventDispatcher Face3 Geometry InstancedBufferAttribute InstancedBufferGeometry InstancedInterleavedBuffer InterleavedBuffer InterleavedBufferAttribute Layers Object3D Raycaster Uniform
核心 / BufferAttributes
BufferAttribute_Types
弃用列表
DeprecatedList
附件
Earcut ShapeUtils
附件 / 核心
Curve CurvePath Font Interpolations Path Shape ShapePath
附件 / 曲线
ArcCurve CatmullRomCurve3 CubicBezierCurve CubicBezierCurve3 EllipseCurve LineCurve LineCurve3 QuadraticBezierCurve QuadraticBezierCurve3 SplineCurve
附件 / 物体
ImmediateRenderObject
几何体
BoxBufferGeometry BoxGeometry CircleBufferGeometry CircleGeometry ConeBufferGeometry ConeGeometry CylinderBufferGeometry CylinderGeometry DodecahedronBufferGeometry DodecahedronGeometry EdgesGeometry ExtrudeBufferGeometry ExtrudeGeometry IcosahedronBufferGeometry IcosahedronGeometry LatheBufferGeometry LatheGeometry OctahedronBufferGeometry OctahedronGeometry ParametricBufferGeometry ParametricGeometry PlaneBufferGeometry PlaneGeometry PolyhedronBufferGeometry PolyhedronGeometry RingBufferGeometry RingGeometry ShapeBufferGeometry ShapeGeometry SphereBufferGeometry SphereGeometry TetrahedronBufferGeometry TetrahedronGeometry TextBufferGeometry TextGeometry TorusBufferGeometry TorusGeometry TorusKnotBufferGeometry TorusKnotGeometry TubeBufferGeometry TubeGeometry WireframeGeometry
辅助对象
ArrowHelper AxesHelper BoxHelper Box3Helper CameraHelper DirectionalLightHelper FaceNormalsHelper GridHelper PolarGridHelper PositionalAudioHelper HemisphereLightHelper PlaneHelper PointLightHelper RectAreaLightHelper SkeletonHelper SpotLightHelper VertexNormalsHelper
灯光
AmbientLight DirectionalLight HemisphereLight Light PointLight RectAreaLight SpotLight
灯光 / 阴影
DirectionalLightShadow LightShadow SpotLightShadow
加载器
AnimationLoader AudioLoader BufferGeometryLoader Cache CompressedTextureLoader CubeTextureLoader DataTextureLoader FileLoader FontLoader ImageBitmapLoader ImageLoader Loader LoaderUtils MaterialLoader ObjectLoader TextureLoader
加载器 / 管理器
DefaultLoadingManager LoadingManager
材质
LineBasicMaterial LineDashedMaterial Material MeshBasicMaterial MeshDepthMaterial MeshDistanceMaterial MeshLambertMaterial MeshMatcapMaterial MeshNormalMaterial MeshPhongMaterial MeshPhysicalMaterial MeshStandardMaterial MeshToonMaterial PointsMaterial RawShaderMaterial ShaderMaterial ShadowMaterial SpriteMaterial
数学库
Box2 Box3 Color Cylindrical Euler Frustum Interpolant Line3 Math Matrix3 Matrix4 Plane Quaternion Ray Sphere Spherical Triangle Vector2 Vector3 Vector4
数学库 / 插值
CubicInterpolant DiscreteInterpolant LinearInterpolant QuaternionLinearInterpolant
物体
Bone Group Line LineLoop LineSegments LOD Mesh Points Skeleton SkinnedMesh Sprite
渲染器
WebGLMultisampleRenderTarget WebGLRenderer WebGLRenderTarget WebGLRenderTargetCube
渲染器 / 着色器
ShaderChunk ShaderLib UniformsLib UniformsUtils
场景
Fog FogExp2 Scene
纹理贴图
CanvasTexture CompressedTexture CubeTexture DataTexture DataTexture3D DepthTexture Texture VideoTexture
在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

路径(Path)

该类定义了二维路径,提供了一些类似2D Canvas API的方法来创建或者构造二维路径。

示例

var path = new THREE.Path(); 
path.lineTo( 0, 0.8 ); 
path.quadraticCurveTo( 0, 1, 0.2, 1 ); 
path.lineTo( 1, 1 ); 
var points = path.getPoints(); 
var geometry = new THREE.BufferGeometry().setFromPoints( points ); 
var material = new THREE.LineBasicMaterial( { color: 0xffffff } ); 
var line = new THREE.Line( geometry, material ); 
scene.add( line );

构造函数

Path( points : Array )

points -- (可选)Vector2s数组。

从传入的点中创建一条Path。第一个点定义了偏移量, 接下来的点作为LineCurves被添加到curves数组中。

倘若没有点被指定,一条空路径将会被创建,.currentPoint将被设置为原点。

属性

请参阅其基类CurvePath来了解共有属性。

# .currentPoint : array

路径当前的偏移量,任何新被加入的Curve将会从这里开始。

方法

请参阅其基类CurvePath来了解共有方法。

# .absarc ( x : Float, y : Float, radius : Float, startAngle : Float, endAngle : Float, clockwise : Float ) : null

x, y -- 弧线的绝对中心。
radius -- 弧线的半径。
startAngle -- 起始角,以弧度来表示。
endAngle -- 终止角,以弧度来表示。
clockwise -- 以顺时针方向创建(扫过)弧线。默认值为false

添加一条绝对定位的EllipseCurve到路径中。

# .absellipse ( x : Float, y : Float, xRadius : Float, yRadius : Float, startAngle : Float, endAngle : Float, clockwise : Float, rotation : Float ) : null

x, y -- 椭圆的绝对中心。
xRadius -- 椭圆x轴方向的半径。
yRadius -- 椭圆y轴方向的半径。
startAngle -- 起始角,以弧度来表示。
endAngle -- 终止角,以弧度来表示。
clockwise -- 以顺时针方向创建(扫过)椭圆。默认值为false
rotation -- 椭圆从X轴正方向逆时针的旋转角度(可选),以弧度表示,默认值为0

添加一条绝对定位的EllipseCurve到路径中。

# .arc ( x : Float, y : Float, radius : Float, startAngle : Float, endAngle : Float, clockwise : Float ) : null

x, y -- 弧线的中心来自上次调用后的偏移量。
radius -- 弧线的半径。
startAngle -- 起始角,以弧度来表示。
endAngle -- 终止角,以弧度来表示。
clockwise -- 以顺时针方向创建(扫过)弧线。默认值为false

添加一条EllipseCurve到路径中,位置相对于.currentPoint。

# .bezierCurveTo ( cp1X : Float, cp1Y : Float, cp2X : Float, cp2Y : Float, x : Float, y : Float ) : null

从.currentPoint创建一条贝塞尔曲线,以(cp1X, cp1Y)和(cp2X, cp2Y)作为控制点,并将.currentPoint更新到x,y。

# .ellipse ( x : Float, y : Float, xRadius : Float, yRadius : Float, startAngle : Float, endAngle : Float, clockwise : Float, rotation : Float ) : null

x, y -- 椭圆的中心来自上次调用后的偏移量。The center of the ellipse offset from the last call.
xRadius -- 椭圆x轴方向的半径。
yRadius -- 椭圆y轴方向的半径。
startAngle -- 起始角,以弧度来表示。
endAngle -- 终止角,以弧度来表示。
clockwise -- 以顺时针方向创建(扫过)椭圆。默认值为false
rotation -- 椭圆从X轴正方向逆时针的旋转角度(可选),以弧度表示,默认值为0

添加一条EllipseCurve到路径中,位置相对于.currentPoint。

# .lineTo ( x : Float, y : Float ) : null

在当前路径上,从.currentPoint连接一条直线到x,y。

# .moveTo ( x : Float, y : Float ) : null

将.currentPoint移动到x, y。

# .quadraticCurveTo ( cpX : Float, cpY : Float, x : Float, y : Float ) : null

从.currentPoint创建一条二次曲线,以(cpX,cpY)作为控制点,并将.currentPoint更新到x,y。

# .setFromPoints ( vector2s : Array ) : null

points -- Vector2数组。

点将被作为LineCurves加入到curves数组中。

# .splineThru ( points : Array ) : null

points -Vector2数组。

连接一条新的SplineCurve到路径上。

源代码

src/extras/core/Path.js