Created
June 19, 2017 19:22
-
-
Save rye761/aa4f8b9d5b0266d5fae3c2d8749d5abc to your computer and use it in GitHub Desktop.
Vue.js Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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