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

DirectionalLight.copy()

语法

copy(source: DirectionalLight): DirectionalLight

描述

DirectionalLight.copy() 方法从另一个 DirectionalLight 对象中复制属性值。

参数

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

返回值

返回值为 DirectionalLight 对象。

示例

const light1 = new THREE.DirectionalLight(0xffffff, 1);
light1.position.set(2, 2, 2);

const light2 = new THREE.DirectionalLight();
light2.copy(light1);

上述示例中的 light2 对象将从 light1 对象中复制属性值,包括灯光颜色和位置。

注意事项

  • copy() 方法不会复制原来灯光的阴影映射相关的属性值。如果需要复制这些属性值,需要在使用 copy() 方法之前先设置这些属性。
  • 在使用 copy() 方法复制属性值后,如果需要更改新的灯光的属性值,需要直接在新的对象上修改,而不是在原来的对象上修改。因为原来的对象和新的对象是相互独立的。