FreeCodeCamp

Learn CSS Animation by Building a Ferris

김솜뭉치 2022. 9. 13. 23:34

transform element

요소에 회전, 크기 조절, 기울이기, 이동 효과를 부여 / 좌표 공간을 변경

transform: matrix(1, 2, 3, 4, 5, 6);

transform: translate(120px, 50%);

transform: scale(2, 0.5);

transform: rotate(0.5turn);

transform: skew(30deg, 20deg);

transform: scale(0.5) translate(-100%, -100%);

https://developer.mozilla.org/ko/docs/Web/CSS/transform

 

transform - CSS: Cascading Style Sheets | MDN

CSS transform 속성으로 요소에 회전, 크기 조절, 기울이기, 이동 효과를 부여할 수 있습니다. transform은 CSS 시각적 서식 모델의 좌표 공간을 변경합니다.

developer.mozilla.org

transform-origin element 

요소 변형의 원점을 설정

 

https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin

 

transform-origin - CSS: Cascading Style Sheets | MDN

The transform-origin CSS property sets the origin for an element's transformations.

developer.mozilla.org

 

@keyframes

CSS 애니메이션에서 구간을 정하고 각 구간별로 어떤 스타일을 적용시킬지 정하는 문법

 

@keyframes를 사용하기 위한 조건

  • animation-name : 사용자가 지정한 이름. @keyframes가 적용될 애니메이션의 이름
  • 스테이지 : from -to로 0~100%의 구간
  • CSS 스타일 : 각 스테이지(구간)에 적용시킬 스타일 
@keyframes wheel {
          --------- 이름 지정   
   0% {
     transform: rotate(0deg);        ---- 0% 0deg : 움직이지 않음
   }
  100%{
    transform: rotate(360deg);       ----- 100% 360deg 움직임
    }
}

@keyframes wheel {
	from {
     transform: rotate(0deg);     
   }
  to{
    transform: rotate(360deg);       
    }
}

https://developer.mozilla.org/ko/docs/Web/CSS/@keyframes

 

@keyframes - CSS: Cascading Style Sheets | MDN

@keyframes @규칙은 개발자가 애니메이션 중간중간의 특정 지점들을 거칠 수 있는 키프레임들을 설정함으로써 CSS 애니메이션 과정의 중간 절차를 제어할 수 있게 합니다. 이 룰은 브라우저가 자동

developer.mozilla.org

 

Animation

속성의 이름을 지정하거나, 지속시간/속도 조절 등을 지정할 수 있음

  • animation-name : @keyframes 이름
  • animation-duration : 타임 프레임의 길이, 키프레임이 동작하는 시간 설정
  • animation-timing-function : 애니메이션 속도 조절 / 그래프 (linear / ease / ease-in / ease-out / ease-in-out / cubic-bezier)
  • animation-delay : 애니메이션을 시작하기 전 지연시간 설정
  • animation-iteration-count : 반복 횟수 지정
  • animation-direction : 반복 방향 설정 (정방향 / 역방향 / 번갈아가며)
  • animation-fill-mode : 애니메이션 시작 / 끝 상태제어 (none / forwords / backwords / both)  
animation  속성

animation: cabins 10s linear infinite;
        name  / duration / timing-function / iteration-count

https://pro-self-studier.tistory.com/108

 

CSS 애니메이션 구현 - @keyframes 와 animation 속성을 이용하여

안녕하세요, 프로독학러 입니다. 이번 포스팅에서는 CSS 애니메이션과 @keyframes 에 대해서 알아보도록 하겠습니다. 1. @keyframes @keyframes 는 CSS 애니메이션에서 구간을 정하고 각 구간별로 어떤 스타

pro-self-studier.tistory.com