In-depth understanding of Vue transition and animation

In-depth understanding of Vue transition and animation

1. When inserting, updating, or removing DOM elements, add style class names to the elements when appropriate

2. The element has an entry process: Enter and a leaving process: Leave.

Both processes have an initial state () and a terminal state (-to) and a transition effect (activate) between the two states.

3. Writing

Animation : Write v-enter-active(替換come這個名字)和v-leave-active(替換go)(這兩個是vue的工作) and動畫atguigu(這個是css3的效果) . Just wrap the animation elements with <transition>. appear is to execute v-enter-activate once the element is loaded

Transition : The starting point and end point here are the role of Vue.

or

<style scoped>
/* .todo-enter-active{
    animation: myAnamite 1s;
}
.todo-leave-active{
    animation: myAnamite 1s reverse;
}
@keyframes myAnamite {
    from{
        transform: translateX(-100%);
    }
    to{
        transform: translateX(0);
    }
} */
.todo-enter,.todo-leave-to{
    transform: translateX(-100%);
}
.todo-leave,.todo-enter-to{
    transform: translateX(0);
}
.todo-enter-active, .todo-leave-active {
    transition: 1s linear;
}
</style>

Multiple elements overload:

Third-party animation library: anamite.css庫

Install:

Import: import 'animate.css' in script

Summarize

This article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of Vue transition effects and animation transition usage examples
  • Detailed explanation of the application of transition animation effects in Vue
  • Vue learning notes advanced chapter single element transition
  • Vue handwriting loading animation project
  • Vue implements carousel animation

<<:  Using CSS3 to achieve transition and animation effects

>>:  LinkedIn revamps to simplify website browsing

Recommend

vue-table implements adding and deleting

This article example shares the specific code for...

In-depth analysis of MySQL lock blocking

In daily maintenance, threads are often blocked, ...

Example usage of Linux compression file command zip

The ".zip" format is used to compress f...

How to completely uninstall Docker Toolbox

Docker Toolbox is a solution for installing Docke...

Vue implements the function of calling the mobile phone camera and album

This article shares the specific code of Vue to a...

Build Maven projects faster in Docker

Table of contents I. Overview 2. Conventional mul...

JavaScript implementation of the Game of Life

Table of contents Concept Introduction Logical ru...

How to expand the disk partition for centos system

Problem/failure/scenario/requirement The hard dis...

IIS7~IIS8.5 delete or modify the server protocol header Server

Requirements: Remove HTTP response headers in IIS...

Understanding of CSS selector weight (personal test)

Copy code The code is as follows: <style type=...

Several commonly used methods for centering CSS boxes (summary)

The first one: Using the CSS position property &l...

Brief analysis of mysql scheduled backup tasks

Introduction In a production environment, in orde...

How to implement draggable components in Vue

This article shares with you how to implement dra...

Docker installation and configuration steps for Redis image

Table of contents Preface environment Install Cre...