11). VUE.JS - Animation and Transition
VueJS provides various ways to apply transition to the HTML elements when they are added/updated in the DOM.
Using Transition tag we do animation in our application. Here example of Transition.
There are various list of classes are available in VueJs.
Using Transition tag we do animation in our application. Here example of Transition.
- v-enter: Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
- v-enter-active: Active state for enter. Applied during the entire entering phase. Added before element is inserted, removed when transition/animation finishes.
- v-enter-to: Ending state for enter. Added one frame after element is inserted (at the same time v-enter is removed), removed when transition/animation finishes.
- v-leave: Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
- v-leave-active: Active state for leave. Applied during the entire leaving phase. Added immediately when leave transition is triggered, removed when the transition/animation finishes.
- v-leave-to: Ending state for leave. Added one frame after a leaving transition is triggered (at the same time v-leave is removed), removed when the transition/animation finishes.
Custom Transition Classes
You can also specify custom transition classes by providing the following attributes:
- enter-class
- enter-active-class
- enter-to-class (2.1.8+)
- leave-class
- leave-active-class
- leave-to-class (2.1.8+)
Explicit Transition Durations
We can also specify separate values for enter and leave durations:
<transition :duration="{ enter: 500, leave: 800 }">...</transition>
List Move Transition
The <transition-group> component has another trick up its sleeve. It can not only animate entering and leaving, but also changes in position. The only new concept you need to know to use this feature is the addition of the v-move class.
Here is example of Transition Group
Comments
Post a Comment