diff --git a/src/App.vue b/src/App.vue index 8ec06a44ea69be303702c8a3b5aaa20a526007bd..3ec14a2719f19c0111a897d49fe1c62c68f0db94 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,21 +9,24 @@ const nachname = ref(""); const funktionZeileEins = ref(""); const funktionZeileZwei = ref(""); const BBEcke = ref(""); -let playLottieStatus = ref(false); +let playLottieStatus = ref(true); let pauseLottieStatus = ref(false); let falseLoopStatus = ref(false); function playLottie(data: boolean) { playLottieStatus.value = data; + console.log( "play status shows:" + playLottieStatus.value); + falseLoopStatus.value = false; } function pauseLottie(data: boolean) { pauseLottieStatus.value = data; + console.log( "pause shows:" + pauseLottieStatus.value); } function falseStatusLottieLoop(data: boolean) { falseLoopStatus.value = data; - console.log("stuck status = " + falseLoopStatus.value) + console.log("stuck status = " + falseLoopStatus.value); } </script> diff --git a/src/components/Form.vue b/src/components/Form.vue index 87d1494fd3300447d897e530016a5b05ac5bb075..af4b1a69351144a5cd001a16769b0480be0fc804 100644 --- a/src/components/Form.vue +++ b/src/components/Form.vue @@ -29,10 +29,10 @@ watch( () => props.falseLoopStatus, () => { if (props.falseLoopStatus == true) { - console.log("we gotta false loop!") - startAnimation(); - } -}); + console.log("we gotta false loop!") + startAnimation() + } + }); function writeJson() { // BL: nützlich, um den Datenpfad vom src im template oder output in Actions zu ändern, wenn wir das machen wollen @@ -179,6 +179,7 @@ function download(content: string, fileName: string, contentType: string) { color: #266ca3; border: 1px solid #266ca3; } + .inputField { width: 98%; } diff --git a/src/components/Lottie.vue b/src/components/Lottie.vue index 34c5f8f3c183b4aa9a45cde83dfbb6915ecaa5b9..3ef6c1bffafbd7f09341aa3ba9558f27260c99b1 100644 --- a/src/components/Lottie.vue +++ b/src/components/Lottie.vue @@ -1,5 +1,5 @@ <script setup> -import { onMounted, ref, watch } from "vue"; +import { onMounted, ref, watch, nextTick } from "vue"; import { LottieAnimation } from "lottie-web-vue"; import AnimationDataJSON from "../assets/Lottiefile_Bauchbinde_Beispiel.json"; import AnimationRechtsBB from "../assets/bbrechts_v2.json"; @@ -8,10 +8,11 @@ import AnimationLinksBB from "../assets/bblinks_v2.json"; const emit = defineEmits(["falseStatusLottieLoop"]); -let anim = ref(); +let anim = ref(null); let BBUnselected = true; let animationData = AnimationDataJSON; let showAnimation = false; +const lottie = ref(0); const props = defineProps({ vorname: { @@ -48,139 +49,174 @@ function breakLottieFalseLoop() { emit("falseStatusLottieLoop", true) } - watch( () => props.BBEcke, - () => { - console.log(props.BBEcke); + async () => { if (props.BBEcke === "links") { - animationData = AnimationLinksBB + animationData = AnimationLinksBB; BBUnselected = false; showAnimation = true; - setMaxMustermann(); - console.log("play status = " + props.playLottieStatus) - console.log("pause status = " + props.pauseLottieStatus) + lottie.value++; + await nextTick(); if (props.playLottieStatus == false && props.pauseLottieStatus == true) { - console.log("breaking out!") breakLottieFalseLoop(); } } if (props.BBEcke === "rechts") { - animationData = AnimationRechtsBB + animationData = AnimationRechtsBB; BBUnselected = false; showAnimation = true; - setMaxMustermann(); - console.log("play status = " + props.playLottieStatus) - console.log("pause status = " + props.pauseLottieStatus) + lottie.value++; + await nextTick(); if (props.playLottieStatus == false && props.pauseLottieStatus == true) { - console.log("breaking out!") breakLottieFalseLoop(); } } } ); - watch( () => props.playLottieStatus, () => { if (props.playLottieStatus) { anim.value.play(); - } else { - anim.value.pause(); } } ); - watch( () => props.pauseLottieStatus, () => { - if (props.pauseLottieStatus) { anim.value.pause(); - } else { - anim.value.play(); } } ); -const lottie = ref(0); // Added array.filter to improve adaptability to different lottie files watch( () => props.vorname, - () => { + async () => { animationData.layers.filter((layer) => { return layer.nm === "VORNAME"; })[0].t.d.k[0].s.t = props.vorname.toUpperCase(); + + if (props.BBEcke == "links"){ + AnimationRechtsBB.layers.filter((layer) => { + return layer.nm === "VORNAME"; + })[0].t.d.k[0].s.t = props.vorname.toUpperCase(); + } else if (props.BBEcke == "rechts") { + AnimationLinksBB.layers.filter((layer) => { + return layer.nm === "VORNAME"; + })[0].t.d.k[0].s.t = props.vorname.toUpperCase(); + } + lottie.value++; + await nextTick(); if (props.playLottieStatus == false && props.pauseLottieStatus == true) { - console.log("breaking out!") - breakLottieFalseLoop(); - } + breakLottieFalseLoop(); + } } ); watch( () => props.nachname, - () => { + async () => { animationData.layers.filter((layer) => { return layer.nm === "NACHNAME"; })[0].t.d.k[0].s.t = props.nachname.toUpperCase(); + + if (props.BBEcke == "links"){ + AnimationRechtsBB.layers.filter((layer) => { + return layer.nm === "NACHNAME"; + })[0].t.d.k[0].s.t = props.nachname.toUpperCase(); + } else if (props.BBEcke == "rechts") { + AnimationLinksBB.layers.filter((layer) => { + return layer.nm === "NACHNAME"; + })[0].t.d.k[0].s.t = props.nachname.toUpperCase(); + } + lottie.value++; + await nextTick(); if (props.playLottieStatus == false && props.pauseLottieStatus == true) { - console.log("breaking out!") - breakLottieFalseLoop(); - } + breakLottieFalseLoop(); + } } ); watch( () => props.funktionZeileEins, - () => { + async () => { animationData.layers.filter((layer) => { return layer.nm === "FUNKTION1"; })[0].t.d.k[0].s.t = props.funktionZeileEins; + if (props.BBEcke == "links") + { + AnimationRechtsBB.layers.filter((layer) => { + return layer.nm === "FUNKTION1"; + })[0].t.d.k[0].s.t = props.funktionZeileEins; + } else if (props.BBEcke == "rechts") { + AnimationLinksBB.layers.filter((layer) => { + return layer.nm === "FUNKTION1"; + })[0].t.d.k[0].s.t = props.funktionZeileEins; + } lottie.value++; + await nextTick(); if (props.playLottieStatus == false && props.pauseLottieStatus == true) { - console.log("breaking out!") - breakLottieFalseLoop(); - } + breakLottieFalseLoop(); + } } ); watch( () => props.funktionZeileZwei, - () => { + async () => { animationData.layers.filter((layer) => { return layer.nm === "FUNKTION2"; })[0].t.d.k[0].s.t = props.funktionZeileZwei; + + if (props.BBEcke == "links") + { + AnimationRechtsBB.layers.filter((layer) => { + return layer.nm === "FUNKTION2"; + })[0].t.d.k[0].s.t = props.funktionZeileZwei; + } else if (props.BBEcke == "rechts") { + AnimationLinksBB.layers.filter((layer) => { + return layer.nm === "FUNKTION2"; + })[0].t.d.k[0].s.t = props.funktionZeileZwei; + } + lottie.value++; + await nextTick(); if (props.playLottieStatus == false && props.pauseLottieStatus == true) { - console.log("breaking out!") - breakLottieFalseLoop(); - } + breakLottieFalseLoop(); + } } ); function setMaxMustermann() { + animationData = AnimationRechtsBB; animationData.layers[1].t.d.k[0].s.t = "MAX"; animationData.layers[3].t.d.k[0].s.t = "MUSTERMANN"; animationData.layers[5].t.d.k[0].s.t = "Testperson"; animationData.layers[7].t.d.k[0].s.t = ""; + animationData = AnimationLinksBB; + animationData.layers[1].t.d.k[0].s.t = "MAX"; + animationData.layers[3].t.d.k[0].s.t = "MUSTERMANN"; + animationData.layers[5].t.d.k[0].s.t = "Testperson"; + animationData.layers[7].t.d.k[0].s.t = ""; + +} + +function updateValues () { + // animationData.layers[1].t.d.k[0].s.t = props.vorname; + // animationData.layers[3].t.d.k[0].s.t = props.nachname; + // animationData.layers[5].t.d.k[0].s.t = props.funktionZeileEins; + // animationData.layers[7].t.d.k[0].s.t = props.funktionZeileZwei; } onMounted(() => { - // Added this temporarily to improve initial animation output - // animationData.layers[1].t.d.k[0].s.t = "MAX"; - // animationData.layers[3].t.d.k[0].s.t = "MUSTERMANN"; - // animationData.layers[5].t.d.k[0].s.t = "Testperson"; - // animationData.layers[7].t.d.k[0].s.t = ""; - - setTimeout(() => { - // console.log(anim.value.goToAndPlay(150, true)); - anim.value; - }, 500); + setMaxMustermann(); }); </script> <template> @@ -188,8 +224,8 @@ onMounted(() => { Bitte eine Position für<br /> die Bauchbinde auswählen </h2> - <div class="animation" v-if="showAnimation"> - <LottieAnimation :key="lottie" ref="anim" :animation-data="animationData" :loop="true" :auto-play="true" :speed="1" + <div class="animation" v-if="showAnimation" :key="lottie"> + <LottieAnimation ref="anim" :animation-data="animationData" :loop="true" :auto-play="true" :speed="1" @loopComplete="loopComplete" @complete="complete" @enterFrame="enterFrame" @segmentStart="segmentStart" @stopped="stopped" /> </div> diff --git a/tsconfig.json b/tsconfig.json index 9e03e60496f0cac6b13bd09c380b52f8ef9fac54..074938259917e0b9e3b0379937e320fc96638480 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,14 @@ "target": "ES2020", "useDefineForClassFields": true, "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": [ + "ES2020", + "DOM", + "DOM.Iterable" + ], "skipLibCheck": true, - + "noImplicitAny": false, + "allowJs": true, /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, @@ -13,13 +18,20 @@ "isolatedModules": true, "noEmit": true, "jsx": "preserve", - /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], - "references": [{ "path": "./tsconfig.node.json" }] -} + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.vue" + ], + "references": [ + { + "path": "./tsconfig.node.json" + } + ] +} \ No newline at end of file