Light.copy() 方法用于复制属于该光源的属性值到另一个光源中。这种复制操作包括高光颜色、强度、位置坐标、方向向量以及其他任何相关属性。
注意:该方法只能在three.js中的Light对象上调用。
light.copy(source);
source
(必填):被复制的Light对象。使用copy()
方法从一个点光源复制属性值到另一个点光源中。
const pointLight1 = new THREE.PointLight(0xffffff, 1, 0);
pointLight1.position.set(1, 2, 3);
const pointLight2 = new THREE.PointLight(0xffffff, 1, 0.5);
pointLight2.position.set(5, 3, 1);
pointLight2.copy(pointLight1);
console.log(pointLight2.color); // Color {r: 1, g: 1, b: 1}
console.log(pointLight2.intensity);// 1
console.log(pointLight2.position); // Vector3 {x: 1, y: 2, z: 3}