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.arc()

Path.arc() 方法可以创建一个圆弧路径段。

语法

path.arc(centerX, centerY, radius, startAngle, endAngle, counterclockwise);

参数

  • centerX:圆心的 x 坐标。
  • centerY:圆心的 y 坐标。
  • radius:圆的半径。
  • startAngle:起始角度,以弧度表示。从 x 轴正方向逆时针方向为正方向。
  • endAngle:结束角度,以弧度表示。
  • counterclockwise:是否按逆时针方向绘制圆弧。默认为 false,即按顺时针方向绘制圆弧。

返回值

无返回值。

示例

// 创建一个画布
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

// 创建一个场景
const scene = new THREE.Scene();

// 创建一个线条材质
const material = new THREE.LineBasicMaterial({ color: 0x00ff00 });

// 创建一个路径对象
const path = new THREE.Path();

// 添加一段圆弧路径
path.arc(0, 0, 50, 0, Math.PI, true);

// 使用路径创建线条几何体
const geometry = path.createPointsGeometry(50);

// 创建线条对象
const line = new THREE.Line(geometry, material);

// 将线条对象添加到场景中
scene.add(line);

// 创建一个相机
const camera = new THREE.PerspectiveCamera(75, canvas.width / canvas.height, 0.1, 1000);
camera.position.z = 100;

// 创建一个渲染器
const renderer = new THREE.WebGLRenderer({ canvas });

// 渲染场景
renderer.render(scene, camera);

参考链接