Skip to content
Snippets Groups Projects
Commit 8f134f89 authored by Brendan Lawton's avatar Brendan Lawton
Browse files

Lottie kann jetzt pausiert werden nach man die Bauchbinde-Richtung wechselt....

Lottie kann jetzt pausiert werden nach man die Bauchbinde-Richtung wechselt. Es gibt aber noch ein Fix für die Eingabefelder zu tun. Nach man was da reintypt, muss man zuerst Lottie starten drucken bevor man wieder pausieren kann.
parent ff570e38
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ const funktionZeileZwei = ref(""); ...@@ -11,6 +11,7 @@ const funktionZeileZwei = ref("");
const BBEcke = ref(""); const BBEcke = ref("");
let playLottieStatus = ref(false); let playLottieStatus = ref(false);
let pauseLottieStatus = ref(false); let pauseLottieStatus = ref(false);
let falseLoopStatus = ref(false);
function playLottie(data: boolean) { function playLottie(data: boolean) {
playLottieStatus.value = data; playLottieStatus.value = data;
...@@ -19,6 +20,12 @@ function playLottie(data: boolean) { ...@@ -19,6 +20,12 @@ function playLottie(data: boolean) {
function pauseLottie(data: boolean) { function pauseLottie(data: boolean) {
pauseLottieStatus.value = data; pauseLottieStatus.value = data;
} }
function falseStatusLottieLoop(data: boolean) {
falseLoopStatus.value = data;
console.log("stuck status = " + falseLoopStatus.value)
}
</script> </script>
<template> <template>
...@@ -35,6 +42,7 @@ function pauseLottie(data: boolean) { ...@@ -35,6 +42,7 @@ function pauseLottie(data: boolean) {
v-model:BBEcke="BBEcke" v-model:BBEcke="BBEcke"
v-on:playLottie="playLottie" v-on:playLottie="playLottie"
v-on:pauseLottie="pauseLottie" v-on:pauseLottie="pauseLottie"
:falseLoopStatus="falseLoopStatus"
></Form> ></Form>
<Lottie <Lottie
...@@ -45,6 +53,7 @@ function pauseLottie(data: boolean) { ...@@ -45,6 +53,7 @@ function pauseLottie(data: boolean) {
:BBEcke="BBEcke" :BBEcke="BBEcke"
:playLottieStatus="playLottieStatus" :playLottieStatus="playLottieStatus"
:pauseLottieStatus="pauseLottieStatus" :pauseLottieStatus="pauseLottieStatus"
v-on:falseStatusLottieLoop="falseStatusLottieLoop"
></Lottie> ></Lottie>
</div> </div>
</template> </template>
......
...@@ -5,6 +5,8 @@ const nachname = defineModel("nachname"); ...@@ -5,6 +5,8 @@ const nachname = defineModel("nachname");
const funktionZeileEins = defineModel("funktionZeileEins"); const funktionZeileEins = defineModel("funktionZeileEins");
const funktionZeileZwei = defineModel("funktionZeileZwei"); const funktionZeileZwei = defineModel("funktionZeileZwei");
const BBEcke = defineModel("BBEcke"); const BBEcke = defineModel("BBEcke");
import { onMounted, ref, watch } from "vue";
// import { watch } from "fs";
import jsonDraft from "../assets/job.json"; import jsonDraft from "../assets/job.json";
function startAnimation() { function startAnimation() {
...@@ -17,6 +19,21 @@ function pauseAnimation() { ...@@ -17,6 +19,21 @@ function pauseAnimation() {
emit("playLottie", false); emit("playLottie", false);
} }
const props = defineProps({
falseLoopStatus: {
type: Boolean,
required: true,
},
})
watch(
() => props.falseLoopStatus,
() => {
if (props.falseLoopStatus == true) {
console.log("we gotta false loop!")
startAnimation();
}
});
function writeJson() { function writeJson() {
// BL: nützlich, um den Datenpfad vom src im template oder output in Actions zu ändern, wenn wir das machen wollen // BL: nützlich, um den Datenpfad vom src im template oder output in Actions zu ändern, wenn wir das machen wollen
// wir können ein Benutzer fragen, ob sie ihr Neutzername eingeben können und das output einfach zu seiner Downloads Ordner schicken. // wir können ein Benutzer fragen, ob sie ihr Neutzername eingeben können und das output einfach zu seiner Downloads Ordner schicken.
...@@ -62,7 +79,7 @@ function download(content: string, fileName: string, contentType: string) { ...@@ -62,7 +79,7 @@ function download(content: string, fileName: string, contentType: string) {
<label>Postion der Bauchbinde </label> <label>Postion der Bauchbinde </label>
<div class="row"> <div class="row">
<select id="bauchbindeEcke" v-model="BBEcke"> <select id="bauchbindeEcke" v-model="BBEcke">
<option value="rechts" selected>rechts</option> <option value="rechts">rechts</option>
<option value="links">links</option> <option value="links">links</option>
</select> </select>
</div> </div>
......
...@@ -4,11 +4,14 @@ import { LottieAnimation } from "lottie-web-vue"; ...@@ -4,11 +4,14 @@ import { LottieAnimation } from "lottie-web-vue";
import AnimationDataJSON from "../assets/Lottiefile_Bauchbinde_Beispiel.json"; import AnimationDataJSON from "../assets/Lottiefile_Bauchbinde_Beispiel.json";
import AnimationRechtsBB from "../assets/bbrechts_v2.json"; import AnimationRechtsBB from "../assets/bbrechts_v2.json";
import AnimationLinksBB from "../assets/bblinks_v2.json"; import AnimationLinksBB from "../assets/bblinks_v2.json";
// import { emit } from "process";
const emit = defineEmits(["falseStatusLottieLoop"]);
let anim = ref(); let anim = ref();
let animationRechts = false;
let animationLinks = false;
let BBUnselected = true; let BBUnselected = true;
let animationData = AnimationDataJSON;
let showAnimation = false;
const props = defineProps({ const props = defineProps({
vorname: { vorname: {
...@@ -41,19 +44,38 @@ const props = defineProps({ ...@@ -41,19 +44,38 @@ const props = defineProps({
}, },
}); });
function breakLottieFalseLoop() {
emit("falseStatusLottieLoop", true)
}
watch( watch(
() => props.BBEcke, () => props.BBEcke,
() => { () => {
console.log(props.BBEcke); console.log(props.BBEcke);
if (props.BBEcke === "links") { if (props.BBEcke === "links") {
animationLinks = true; animationData = AnimationLinksBB
animationRechts = false;
BBUnselected = false; BBUnselected = false;
showAnimation = true;
setMaxMustermann();
console.log("play status = " + props.playLottieStatus)
console.log("pause status = " + props.pauseLottieStatus)
if (props.playLottieStatus == false && props.pauseLottieStatus == true) {
console.log("breaking out!")
breakLottieFalseLoop();
}
} }
if (props.BBEcke === "rechts") { if (props.BBEcke === "rechts") {
animationRechts = true; animationData = AnimationRechtsBB
animationLinks = false;
BBUnselected = false; BBUnselected = false;
showAnimation = true;
setMaxMustermann();
console.log("play status = " + props.playLottieStatus)
console.log("pause status = " + props.pauseLottieStatus)
if (props.playLottieStatus == false && props.pauseLottieStatus == true) {
console.log("breaking out!")
breakLottieFalseLoop();
}
} }
} }
); );
...@@ -72,6 +94,7 @@ watch( ...@@ -72,6 +94,7 @@ watch(
watch( watch(
() => props.pauseLottieStatus, () => props.pauseLottieStatus,
() => { () => {
if (props.pauseLottieStatus) { if (props.pauseLottieStatus) {
anim.value.pause(); anim.value.pause();
} else { } else {
...@@ -87,65 +110,72 @@ const lottie = ref(0); ...@@ -87,65 +110,72 @@ const lottie = ref(0);
watch( watch(
() => props.vorname, () => props.vorname,
() => { () => {
AnimationRechtsBB.layers.filter((layer) => { animationData.layers.filter((layer) => {
return layer.nm === "VORNAME";
})[0].t.d.k[0].s.t = props.vorname.toUpperCase();
AnimationLinksBB.layers.filter((layer) => {
return layer.nm === "VORNAME"; return layer.nm === "VORNAME";
})[0].t.d.k[0].s.t = props.vorname.toUpperCase(); })[0].t.d.k[0].s.t = props.vorname.toUpperCase();
lottie.value++; lottie.value++;
if (props.playLottieStatus == false && props.pauseLottieStatus == true) {
console.log("breaking out!")
breakLottieFalseLoop();
}
} }
); );
watch( watch(
() => props.nachname, () => props.nachname,
() => { () => {
AnimationRechtsBB.layers.filter((layer) => { animationData.layers.filter((layer) => {
return layer.nm === "NACHNAME";
})[0].t.d.k[0].s.t = props.nachname.toUpperCase();
AnimationLinksBB.layers.filter((layer) => {
return layer.nm === "NACHNAME"; return layer.nm === "NACHNAME";
})[0].t.d.k[0].s.t = props.nachname.toUpperCase(); })[0].t.d.k[0].s.t = props.nachname.toUpperCase();
lottie.value++; lottie.value++;
if (props.playLottieStatus == false && props.pauseLottieStatus == true) {
console.log("breaking out!")
breakLottieFalseLoop();
}
} }
); );
watch( watch(
() => props.funktionZeileEins, () => props.funktionZeileEins,
() => { () => {
AnimationRechtsBB.layers.filter((layer) => { animationData.layers.filter((layer) => {
return layer.nm === "FUNKTION1";
})[0].t.d.k[0].s.t = props.funktionZeileEins;
AnimationLinksBB.layers.filter((layer) => {
return layer.nm === "FUNKTION1"; return layer.nm === "FUNKTION1";
})[0].t.d.k[0].s.t = props.funktionZeileEins; })[0].t.d.k[0].s.t = props.funktionZeileEins;
lottie.value++; lottie.value++;
if (props.playLottieStatus == false && props.pauseLottieStatus == true) {
console.log("breaking out!")
breakLottieFalseLoop();
}
} }
); );
watch( watch(
() => props.funktionZeileZwei, () => props.funktionZeileZwei,
() => { () => {
AnimationRechtsBB.layers.filter((layer) => { animationData.layers.filter((layer) => {
return layer.nm === "FUNKTION2";
})[0].t.d.k[0].s.t = props.funktionZeileZwei;
AnimationLinksBB.layers.filter((layer) => {
return layer.nm === "FUNKTION2"; return layer.nm === "FUNKTION2";
})[0].t.d.k[0].s.t = props.funktionZeileZwei; })[0].t.d.k[0].s.t = props.funktionZeileZwei;
lottie.value++; lottie.value++;
if (props.playLottieStatus == false && props.pauseLottieStatus == true) {
console.log("breaking out!")
breakLottieFalseLoop();
}
} }
); );
function setMaxMustermann() {
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 = "";
}
onMounted(() => { onMounted(() => {
// Added this temporarily to improve initial animation output // Added this temporarily to improve initial animation output
AnimationRechtsBB.layers[1].t.d.k[0].s.t = "MAX"; // animationData.layers[1].t.d.k[0].s.t = "MAX";
AnimationLinksBB.layers[1].t.d.k[0].s.t = "MAX"; // animationData.layers[3].t.d.k[0].s.t = "MUSTERMANN";
AnimationRechtsBB.layers[3].t.d.k[0].s.t = "MUSTERMANN"; // animationData.layers[5].t.d.k[0].s.t = "Testperson";
AnimationLinksBB.layers[3].t.d.k[0].s.t = "MUSTERMANN"; // animationData.layers[7].t.d.k[0].s.t = "";
AnimationRechtsBB.layers[5].t.d.k[0].s.t = "Testperson";
AnimationLinksBB.layers[5].t.d.k[0].s.t = "Testperson";
AnimationRechtsBB.layers[7].t.d.k[0].s.t = "";
AnimationLinksBB.layers[7].t.d.k[0].s.t = "";
setTimeout(() => { setTimeout(() => {
// console.log(anim.value.goToAndPlay(150, true)); // console.log(anim.value.goToAndPlay(150, true));
...@@ -158,35 +188,10 @@ onMounted(() => { ...@@ -158,35 +188,10 @@ onMounted(() => {
Bitte eine Position für<br /> Bitte eine Position für<br />
die Bauchbinde auswählen die Bauchbinde auswählen
</h2> </h2>
<div class="animation"> <div class="animation" v-if="showAnimation">
<LottieAnimation <LottieAnimation :key="lottie" ref="anim" :animation-data="animationData" :loop="true" :auto-play="true" :speed="1"
:key="lottie" @loopComplete="loopComplete" @complete="complete" @enterFrame="enterFrame" @segmentStart="segmentStart"
ref="anim" @stopped="stopped" />
:animation-data="AnimationRechtsBB"
:loop="true"
:auto-play="true"
:speed="1"
@loopComplete="loopComplete"
@complete="complete"
@enterFrame="enterFrame"
@segmentStart="segmentStart"
@stopped="stopped"
v-if="animationRechts"
/>
<LottieAnimation
:key="lottie"
ref="anim"
:animation-data="AnimationLinksBB"
:loop="true"
:auto-play="true"
:speed="1"
@loopComplete="loopComplete"
@complete="complete"
@enterFrame="enterFrame"
@segmentStart="segmentStart"
@stopped="stopped"
v-if="animationLinks"
/>
</div> </div>
</template> </template>
...@@ -194,6 +199,7 @@ onMounted(() => { ...@@ -194,6 +199,7 @@ onMounted(() => {
.animation { .animation {
background-color: #000; background-color: #000;
} }
.hinweis { .hinweis {
text-align: center; text-align: center;
margin: auto; margin: auto;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment