Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions src/Textra.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="textra">
<div class="mainTextra" v-html="currentWord" :style="mainStyleComputed"></div>
<div class="mainTextra" v-text="currentWord" :style="mainStyleComputed"></div>
</div>
</template>

Expand All @@ -23,12 +23,15 @@
infinite: {
type: Boolean,
default: false,

}
},
sequence:{
type:Boolean,
default:false
}
},
data() {
return {
defaultStyle: 'transition: ' + this.timer + 's;',
defaultStyle: `transition: ${this.timer}s;`,
currentWord: this.data[0],
liStl: null,
dataCounter: 0,
Expand All @@ -43,7 +46,7 @@
'scale': ["transform:scaleY(1.4);opacity:0;", "opacity:1;"],
'flash': ["transform:skewX(-70deg);opacity:0;", "transform:skewX(0deg);opacity:1;"],
'flip': ["transform:rotateX(-180deg);opacity:0;", "transform:rotate(0deg);opacity:1;"],
}
},
}
},
computed: {
Expand All @@ -52,28 +55,42 @@
}
},
created() {
var theInterval = setInterval(() => {
let
index = 0,
animations = [],
filter = this.filters[this.filter]

if(this.sequence){
animations = Object.keys(this.filters)
filter = this.filters[animations[index]]
}
const theInterval = setInterval(() => {
if (this.displayState === 'shown') {
this.liStl = this.filters[this.filter][0];
this.liStl = filter[0];
this.displayState = 'hidden';

} else {
this.liStl = this.filters[this.filter][1];
this.liStl = filter[1];
this.displayState = 'shown';
this.dataCounter++;
this.currentWord = this.data[this.dataCounter];
}


if(this.sequence){
++index === animations.length && (index = 0)
filter = this.filters[animations[index]]
}

if (this.dataCounter === this.data.length) {
if (this.infinite) {
// Changing 0 to -1 for temporary bug fix of #2
this.dataCounter = -1;
} else {
clearInterval(theInterval);

}
}

}, (+this.timer) * 1000);
}
}
Expand All @@ -86,6 +103,3 @@
display: block
}
</style>