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

The clone() method creates a clone of the curve. It returns a new instance of the same class with the same properties and values as the original curve.

clone(): Curve

Description

The clone() method creates a new instance of the same class with the same properties and values as the original curve. The cloned curve is an independent copy of the original curve, and any changes to the cloned curve do not affect the original.

The clone() method is inherited by all curve classes that extend the Curve base class.

Parameters

None.

Returns

A new instance of the same curve class with the same properties and values as the original curve.

Example

// Create a quadratic curve
var curve = new THREE.QuadraticBezierCurve(
    new THREE.Vector2(0, 0),
    new THREE.Vector2(0.5, 1),
    new THREE.Vector2(1, 0)
);

// Clone the curve
var clonedCurve = curve.clone();

// Modify the cloned curve
clonedCurve.v1 = new THREE.Vector2(0.5, 0);

// Verify that the original curve is unchanged
console.log(curve);
// QuadraticBezierCurve {_v0: Vector2, v1: Vector2, v2: Vector2}

// Verify that the cloned curve has been modified
console.log(clonedCurve);
// QuadraticBezierCurve {_v0: Vector2, v1: Vector2, v2: Vector2}

In this example, we create a quadratic curve and then clone it. We then modify the cloned curve by setting its v1 property to a new value. Finally, we verify that the original curve was not modified, and that the cloned curve was modified as expected.

See Also

Note

  • The clone() method is a shallow clone, meaning that if any of the curve's properties are themselves objects, those objects are not cloned. Instead, the clone of the curve will reference the same objects as the original. If you need a deep clone, you must create a custom clone method that recursively clones any child objects.