Skip to content

Instantly share code, notes, and snippets.

@rye761
Created June 19, 2017 19:22
Show Gist options
  • Save rye761/aa4f8b9d5b0266d5fae3c2d8749d5abc to your computer and use it in GitHub Desktop.
Save rye761/aa4f8b9d5b0266d5fae3c2d8749d5abc to your computer and use it in GitHub Desktop.
Vue.js Animation
<html>
<head>
<title>Vue.js Animations</title>
<script src="https://unpkg.com/vue"></script>
<style>
* {
font-family: sans-serif;
}
h1 {
display: inline-block;
}
@keyframes bounce {
0% {
transform: scale(0);
}
80% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
.bounce-enter-active{
animation: bounce .5s;
}
.bounce-leave-active {
animation: bounce .5s reverse;
}
</style>
</head>
<body>
<div id="app">
<button @click="show = !show">Toggle Visibility</button><br/>
<transition name="bounce">
<h1 v-show="show">{{ text }}</h1>
</transition>
</div>
<script>
new Vue({
el: '#app',
data: { text: 'Hello, World!', show: false }
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment