>  기사  >  웹 프론트엔드  >  CSS3 애니메이션에는 어떤 속성이 있습니까?

CSS3 애니메이션에는 어떤 속성이 있습니까?

青灯夜游
青灯夜游원래의
2021-04-08 18:11:583085검색

css3 애니메이션 속성에는 "@keyframes", 애니메이션, 애니메이션 이름, 애니메이션 지속 시간, 애니메이션 지연, 애니메이션 방향 등이 포함됩니다.

CSS3 애니메이션에는 어떤 속성이 있습니까?

이 튜토리얼의 운영 환경: Windows7 시스템, CSS3&&HTML5 버전, Dell G3 컴퓨터.

css3 애니메이션 속성:

  • @keyframes는 애니메이션을 지정합니다.

  • animation animation-play-state 속성을 제외한 모든 애니메이션 속성에 대한 약식 속성입니다.

  • animation-name은 @keyframes 애니메이션의 이름을 지정합니다.

  • animation-duration은 애니메이션이 한 주기를 완료하는 데 걸리는 시간(초 또는 밀리초)을 지정합니다. 기본값은 0입니다.

  • animation-timing-function은 애니메이션의 속도 곡선을 지정합니다. 기본값은 "쉽게"입니다.

  • animation-delay는 애니메이션이 시작되는 시기를 지정합니다. 기본값은 0입니다.

  • animation-iteration-count는 애니메이션이 재생되는 횟수를 지정합니다. 기본값은 1입니다.

  • animation-direction은 다음 주기에서 애니메이션이 역방향으로 재생되는지 여부를 지정합니다. 기본값은 "정상"입니다.

  • animation-play-state는 애니메이션이 실행 중인지 일시 중지되었는지 지정합니다. 기본값은 "실행 중"입니다.

  • animation-fill-mode는 애니메이션 시간 이외의 객체 상태를 지정합니다.

예: CSS3 애니메이션 속성을 사용하여 간단한 애니메이션 만들기

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. 실행 효과

CSS3 애니메이션에는 어떤 속성이 있습니까?

(동영상 공유 학습: css 동영상 튜토리얼)

위 내용은 CSS3 애니메이션에는 어떤 속성이 있습니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.