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

ShapePath.moveTo()

描述

ShapePath.moveTo() 用于将当前路径的起点移动到指定点。

语法

shapePath.moveTo( x, y )

参数

  • x — 起点的 x 坐标。
  • y — 起点的 y 坐标。

示例

const shape = new THREE.Shape();
const shapePath = new THREE.ShapePath();
shape.moveTo( 0, 0 );
shape.quadraticCurveTo( 50, 50, 100, 0 );
shapePath.setFromShape( shape );
console.log( shapePath );

此示例绘制了由三个点组成的二次曲线路径。ShapePath 对象可用于将此路径转换为一组三角形,以便在场景中呈现。

使用提示

  • 在调用 moveTo() 之前,未定义任何起点。因此,第一个点必须通过 moveTo() 设置。
  • moveTo() 当前点设置,所有之前绘制的线条与曲线段用作子路径(子路径为起始点之后的绘制命令)。可以通过调用 moveTo() 来创建新的子路径,从而复合新的形状。