优化入场动画

This commit is contained in:
rucky 2021-10-14 18:35:32 +08:00
parent c1d66f0e07
commit 0fb534ecca

View File

@ -308,7 +308,7 @@ export default {
// //
gsap.to(this.group.rotation, { gsap.to(this.group.rotation, {
y: -Math.PI * 2, y: -Math.PI * 2,
duration: 2, duration: 5,
// yoyo: true, // yoyo: true,
// repeat: -1, // repeat: -1,
onUpdate: () => { onUpdate: () => {
@ -316,10 +316,37 @@ export default {
// this.params.exposure, // this.params.exposure,
// 4.0 // 4.0
// ); // );
this.render(); // this.render();
// console.log(this.params.scene); // console.log(this.params.scene);
}, },
}); });
//
this.group.children.map((item, index) => {
let op = item.position;
gsap.fromTo(
item.position,
{
x: () => {
return Math.random() * 40 - 20;
},
y: () => {
return Math.random() * 20 - 10;
},
z: () => {
return Math.random() * 40 - 20;
},
},
{
x: op.x,
y: op.y,
z: op.z,
duration: 5,
onUpdate: () => {
if (index == 1) this.render();
},
}
);
});
// //
// gsap.to(this.params, { // gsap.to(this.params, {
// exposure: 1.1, // exposure: 1.1,