From 0fb534ecca7c7649f8e6681bd4319d08556910a6 Mon Sep 17 00:00:00 2001 From: rucky Date: Thu, 14 Oct 2021 18:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=A5=E5=9C=BA=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/color/index.vue | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/color/index.vue b/src/components/color/index.vue index 5ce4006..3ef4c56 100644 --- a/src/components/color/index.vue +++ b/src/components/color/index.vue @@ -308,7 +308,7 @@ export default { // 自旋转 gsap.to(this.group.rotation, { y: -Math.PI * 2, - duration: 2, + duration: 5, // yoyo: true, // repeat: -1, onUpdate: () => { @@ -316,10 +316,37 @@ export default { // this.params.exposure, // 4.0 // ); - this.render(); + // this.render(); // 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, { // exposure: 1.1,