修改color 入场动画等

This commit is contained in:
rucky 2021-10-13 18:44:25 +08:00
parent 7908cb3baa
commit 59d1d4c62c

View File

@ -193,11 +193,15 @@ export default {
this.raycaster.setFromCamera(this.mouse, this.camera);
this.intersects = this.raycaster.intersectObjects(
this.scene.children,
this.group.children,
false
);
if (this.intersects.length > 0) {
const object = this.intersects[0].object;
// gsap.to(object.material, {
// opacity: 0,
// onUpdate: () => {},
// });
object.layers.toggle(this.BLOOM_SCENE);
this.render();
}
@ -221,16 +225,16 @@ export default {
this.scene.children.length = 0;
const geometry = new THREE.IcosahedronGeometry(1, 15);
this.group = new THREE.Group();
for (let i = 0; i < 50; i++) {
const color = new THREE.Color();
color.setHSL(Math.random(), 0.7, Math.random() * 0.2 + 0.05);
const material = new THREE.MeshBasicMaterial({ color: color });
const sphere = new THREE.Mesh(geometry, material);
sphere.position.x = Math.random() * 10 - 5;
sphere.position.y = Math.random() * 10 - 5;
sphere.position.z = Math.random() * 10 - 5;
sphere.position.x = Math.random() * 100 - 50;
sphere.position.y = Math.random() * 100 - 50;
sphere.position.z = Math.random() * 100 - 50;
sphere.position
.normalize()
.multiplyScalar(Math.random() * 4.0 + 2.0);
@ -239,8 +243,10 @@ export default {
if (Math.random() < 0.25)
sphere.layers.enable(this.BLOOM_SCENE);
}
this.group.add(sphere);
}
this.scene.add(this.group);
this.render();
},
disposeMaterial(obj) {
@ -295,13 +301,34 @@ export default {
}
},
addAnimation() {
//
gsap.to(this.group.rotation, {
y: -Math.PI * 2,
duration: 2,
// yoyo: true,
// repeat: -1,
onUpdate: () => {
// this.renderer.toneMappingExposure = Math.pow(
// this.params.exposure,
// 4.0
// );
this.render();
// console.log(this.params.scene);
},
});
//
gsap.to(this.params, {
exposure: 1.2,
duration: 2,
yoyo: true,
repeat: -1,
onUpdate: () => {
this.renderer.toneMappingExposure = Math.pow(
this.params.exposure,
4.0
);
this.render();
// console.log(this.params.scene);
},
});
},