Home  >  Article  >  Web Front-end  >  What properties does css3 animation have?

What properties does css3 animation have?

青灯夜游
青灯夜游Original
2021-04-08 18:11:583090browse

css3 animation attributes include: "@keyframes", animation, animation-name, animation-duration, animation-delay, animation-direction, etc.

What properties does css3 animation have?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

css3 animation properties:

  • @keyframes specifies animation.

  • animation Shorthand property for all animation properties, except the animation-play-state property.

  • animation-name specifies the name of the @keyframes animation.

  • animation-duration specifies the seconds or milliseconds it takes for the animation to complete one cycle. The default is 0.

  • animation-timing-function specifies the speed curve of animation. The default is "ease".

  • animation-delay specifies when the animation starts. The default is 0.

  • animation-iteration-count specifies the number of times the animation is played. The default is 1.

  • animation-direction specifies whether the animation plays in reverse in the next cycle. The default is "normal".

  • animation-play-state specifies whether the animation is running or paused. The default is "running".

  • animation-fill-mode specifies the state of the object outside of the animation time.

Example: Use css3 animation properties to create simple animations

body {
  background-color: #fff;
  color: #555;
  font-size: 1.1em;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.container {
  margin: 50px auto;
  min-width: 320px;
  max-width: 500px;
}

.element {
  margin: 0 auto;
  width: 100px;
  height: 100px;
  background-color: #0099cc;
  border-radius: 50%;
  position: relative;
  top: 0;
  -webkit-animation: bounce 2s infinite;
  animation: bounce 2s infinite;
}

@-webkit-keyframes bounce {
  from {
    top: 100px;
    -webkit-animation-timing-function: ease-out;
    animation-timing-function: ease-out;
  }
  25% {
    top: 50px;
    -webkit-animation-timing-function: ease-in;
    animation-timing-function: ease-in;
  }
  50% {
    top: 150px;
    -webkit-animation-timing-function: ease-out;
    animation-timing-function: ease-out;
  }
  75% {
    top: 75px;
    -webkit-animation-timing-function: ease-in;
    animation-timing-function: ease-in;
  }
  to {
    top: 100px;
  }
}

@keyframes bounce {
  from {
    top: 100px;
    -webkit-animation-timing-function: ease-out;
    animation-timing-function: ease-out;
  }
  25% {
    top: 50px;
    -webkit-animation-timing-function: ease-in;
    animation-timing-function: ease-in;
  }
  50% {
    top: 150px;
    -webkit-animation-timing-function: ease-out;
    animation-timing-function: ease-out;
  }
  75% {
    top: 75px;
    -webkit-animation-timing-function: ease-in;
    animation-timing-function: ease-in;
  }
  to {
    top: 100px;
  }
}

3. Running effect

What properties does css3 animation have?

(Learning video sharing: css video tutorial)

The above is the detailed content of What properties does css3 animation have?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is css cascadeNext article:what is css cascade