How to realize Animation effect with Vue
This article mainly explains "how to use Vue to achieve animation effects", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use Vue to achieve animation effects" bar!
1. Which elements / components are suitable for animation under those conditions
Conditional rendering (using v-if)
Conditional display (using v-show)
Dynamic component
Component root node
Simple classic example: (text hidden to display effect)
Show toggle / / fade Custom name hello
.fade-enter-active {transition: opacity .5s; / / class name: time needed to hide to the display process} .fade {/ / class name: initialization state opacity: 0;}
Css animation
Show toggle / / fade Custom name hello
.fade-enter-active {/ / class name: time required to hide to the display process animation: bounce-in .5s;} .fade-leave-active {/ / class name: time required to show to the hidden process animation: bounce-in .5s reverse; / / reverse represents and hides to show animation opposite} @ keyframes bounce-in {0% {transform: scale (0);} 50% {transform: scale (1.5) } 100% {transform: scale (1);}}
We can also customize the class name
Show toggle / / fade Custom name hello
.fadeActive {transition: opacity .5s; / / Class name: the time required to hide to the display process} .fadeActive {/ / Class name: initialization status opacity: 0;}
At this point, we can actually use third-party libraries to achieve this effect, Animate.css
/ / introduce Animate.css// in the index.html file to show toggle hello in the component
Thank you for your reading, the above is the content of "how to use Vue to achieve animation effects". After the study of this article, I believe you have a deeper understanding of how to use Vue to achieve animation effects, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!