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

RectAreaLight.copy()

RectAreaLight.copy() 方法用于创建一个 RectAreaLight 对象的副本。这个方法返回一个新的 RectAreaLight 对象。

语法

newRectAreaLight = rectAreaLight.copy( source );

参数

  • source:需要复制的 RectAreaLight 对象。

返回值

返回一个新的复制对象。

用法

// 创建一个矩形区域光源
const rectLight = new THREE.RectAreaLight( 0xffffff, 1, 10, 10 );
rectLight.position.set( 0, 5, 0 );

// 复制矩形区域光源
const rectLight2 = rectLight.copy( rectLight );

源码

function copy( source ) {

    Light.prototype.copy.call( this, source );

    this.width = source.width;
    this.height = source.height;

    return this;

}

注意事项

  • copy 方法只会复制源对象的属性,而不包括其子对象和事件列表等内容。
  • 原对象和复制对象是两个独立的对象实例,可以分别修改它们的属性和方法。