먼저 @keyFrames를 만들어줘야한다.
@keyframes change-color {
from {
background-color: red;
}
to {
background-color: blue;
border-radius: 50%;
}
}
change-color이란 이름의 애니메이션이다.
.box1 {
animation-name: change-color;
animation-duration: 1s;
animation-iteration-count: infinite;
}
그리고 적용하고 싶은 html css에 저shape라는 애니메이션을 적용하면된다.
무한하게 1초동안 change color 애니메이션이 반복되는걸 볼수있다.
@keyframes change-color {
from {
background-color: red;
}
50% {
background-color: yellow;
}
to {
background-color: blue;
border-radius: 50%;
}
}
50퍼센트 시점에서 노란색으로 변하는것도 추가할수있다
애니매이션 여러개 적용하기
.box1 {
animation-name: change-color, change-shape;
animation-duration: 1s;
animation-iteration-count: infinite;
}
단축표현
.box1 {
animation: change-color 1s infinite;
}
mdn에서 속성을 찾아보자~
'webStyling > design' 카테고리의 다른 글
CSS // transform, transition (0) | 2023.04.04 |
---|---|
이미지를 화면에 잡힐때만 로딩하고 싶을때. (loading = 'lazy') (0) | 2023.03.24 |
css우선순위, 미디어쿼리 css적용이 안될때는? (0) | 2023.02.27 |
dispaly position 복습 (0) | 2022.08.21 |
flex box 재복습 (0) | 2022.08.21 |