transformation 2D

  1. rotate()
  2. scale(_)
  3. skew()
  4. translate()
.box{
  display:flex;
  width:100px;
  height:100px;
  background:#d9d4e7;
}
.box:hover{
  transform:rotate(-15deg) scale(1.2) skew(15deg) translate(10px,10px);
}
顺序是有影响的

transformation 3D

.box{
  width:200px;
  height:200px;
  background: #d9d4e7;
}
.box:hover {
  transform:  perspective(220px) translateZ(50px);
  transform:  perspective(220px) rotateY(deg50);
  transform-origin:0 50;
}

transitions

cubic-bezier.com

.box{
  width:200px;
  height:200px;
  background: #d9d4e7;
  transition:transform 0.5s,background 0.5s linear 1s;
}
.box:hover {
  transform: rotate(45deg);
  background:#a786df;
}

animation

.box{
  width:200px;
  height:200px;
  background: #d9d4e7;
  animation-name: pop;
  animation-duration: 4s;
  animation-delay: 0s;
  animation-iteration-count: 100;
  animation-timing-function: ease-in;
  animation-direction: alternate;
  animation: name duration timing-function delay iteration-count direction fill-mode;
}

@keyframes pop {
  0% {
    transform:scale(1);
  }
  25%{
    transform: scale(1.3);
  }
  50%{
    transform: rotate(45deg);
    background:#a786df;
  }
  100%{
  transform: rotate(0);
  }
}

reusable animations

.animation-pop{
  animation-name:pop;
  animation-duration: 4s;
  animation-delay: 0s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in;
  animation-direction: alternate;
}

@keyframes pop {
  0% {
    transform:scale(1);
  }
  25%{
    transform: scale(1.3);
  }
  50%{
    transform: rotate(45deg);
    background:#a786df;
  }
  100%{
  transform: rotate(0);
  }
}

<div class="box animation-pop">
        Lorem ipsum dolor sit amet consectetu
      </div>

Animate.css | A cross-browser library of CSS animations.

<head>
  <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
  />
</head>
<h1 class="animate__animated animate__bounce">An animated element</h1>