JSFiddle - React, Tailwind, and code Playground
by kurotanshi
HTML
<script src="https://unpkg.com/vue@next"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
<div id="app">
<div class="wrap">
<label v-for="c in animateClasses">
<input type="radio"
@change="noActivated = true"
v-model="currentClass" :value="c">
{{ c }}
</label>
</div>
<div ref="block" class="block"
:class="{ [animatedClassNamme]: noActivated }">Block</div>
</div>
SCSS
#app {
position: relative;
display: block;
padding: 1rem;
font-size: 1rem;
}
button {
font-size: 1rem;
}
.block {
display: block;
width: 120px;
height: 80px;
line-height: 80px;
text-align: center;
font-size: 1.2rem;
margin-top: 1rem;
background-color: #3eaf7c;
color: #fff;
}
.wrap {
display: block;
margin-bottom: 1rem;
label {
display: block;
margin-bottom: 1rem;
}
}
JavaScript
const app = Vue.createApp({
data() {
return {
animateClasses: [
'animate__bounce',
'animate__rubberBand',
'animate__tada',
'animate__shakeY',
'animate__shakeX',
],
currentClass: 'animate__bounce',
noActivated: false
}
},
computed: {
animatedClassNamme(){
return `animate__animated ${this.currentClass}`;
}
}
});
app.mount('#app');