From d634f362c304109d2652e15992d4d5603eb83a0e Mon Sep 17 00:00:00 2001 From: riqo Date: Thu, 12 Nov 2020 16:55:47 -0600 Subject: [PATCH] thinking animation v1 --- src/components/AI/index.vue | 49 ++++++++++++++----------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/src/components/AI/index.vue b/src/components/AI/index.vue index f03f7b1..d81a08f 100644 --- a/src/components/AI/index.vue +++ b/src/components/AI/index.vue @@ -3,7 +3,7 @@ { gradient = document.getElementById("radial-gradient"); - // anime({ - // targets: gradient, - // cy: "1.3", - // loop: true, - // direction: "alternate", - // easing: "easeInOutCirc", - // }); + thinkAnimation = anime({ + targets: gradient, + loop: true, + cy: "1.3", + direction: "alternate", + easing: "easeInOutCirc", + }); }); function convertBlock(buffer) { @@ -76,10 +77,6 @@ export default defineComponent({ return outputData; // return the Float32Array } - window.ipcRenderer.on("think", (event, think) => { - console.log("think", think); - }); - window.ipcRenderer.on("render-audio", (event, payload) => { const floatArray = convertBlock(payload.audio.buffer); const buffer = audioCtx.createBuffer(1, floatArray.length, sampleRate); @@ -105,34 +102,24 @@ export default defineComponent({ } }); - watch(think, (think, prevThink) => { + watch(think, async (think, prevThink) => { if (think) { - aiOffset.value = 0.7; + console.log("think", think); anime({ targets: gradient, cy: "0.7", - complete: function () { - anime({ - targets: gradient, - cy: "1.3", - loop: true, - direction: "alternate", - easing: "easeInOutCirc", - }); - }, - // loop: true, - // direction: "alternate", - // easing: "easeInOutCirc", }); + thinkAnimation.play(); } else { - aiOffset.value = 1; + console.log("stop think"); + thinkAnimation.pause(); + // thinkAnimation.reset(); anime({ targets: gradient, cy: "1", - loop: false, - easing: "easeInOutCirc", - offset: "-=100", }); + + // thinkAnimation.reset(); } }); return { -- 2.43.0