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

Curve.copy()

Curve.copy()方法允许用户将现有的Three.js曲线对象的所有属性复制到另一个新的曲线对象中。

语法

curve.copy(sourceCurve);

参数

  • sourceCurve: 需要复制属性的源曲线对象。

描述

curve.copy()方法可以将源曲线对象的所有属性包括控制点和曲线类型复制到另一个新的曲线对象上。sourceCurve参数必须是一个有效的Three.js曲线对象,例如CatmullRomCurve3或其它曲线对象子类。

注意:由于是复制操作,新的曲线对象将与源曲线对象完全相同。如果您想克隆一份类似而不是完全相同的曲线对象,可以使用Object3D.clone() or Object3D.copy()方法。

示例

var sourceCurve = new THREE.CatmullRomCurve3( [
    new THREE.Vector3( -10, 0, 10 ),
    new THREE.Vector3( -5, 5, 5 ),
    new THREE.Vector3( 0, 0, 0 ),
    new THREE.Vector3( 5, -5, 5 ),
    new THREE.Vector3( 10, 0, 10 )
] );

var newCurve = new THREE.CatmullRomCurve3();
newCurve.copy( sourceCurve );

console.log( newCurve.controlPoints.length ); // Output: 5
console.log( newCurve.type ); // Output: "catmullrom"

以上示例代码展示了如何将一个Catmull-Rom曲线对象的属性复制到另一个Catmull-Rom曲线对象中。在复制完成后,新的曲线将拥有与源曲线相同的控制点数量和曲线类型。

参考链接