Code note/CSS
css transform, transition 정리
코드노트
2022. 10. 11. 01:40
transform
- 요소의 회전, 크기조절, 기울이기, 이동 효과를 부여할 수 있다.
* scale : 크기에 대비해서 크기 조절
* rotate : 방향을 회전 시킴 / deg, turn
* translate : 기준점에서 이동
* skew : 각도를 기울이는 효과
* transform-origin : 기준점을 변경할 수 있다.
/* 키워드 값 */
transform: none;
/* 함수 값 */
transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
transform: perspective(17px);
transform: rotate(0.5turn);
transform: rotate3d(1, 2.0, 3.0, 10deg);
transform: rotateX(10deg);
transform: rotateY(10deg);
transform: rotateZ(10deg);
transform: translate(12px, 50%);
transform: translate3d(12px, 50%, 3em);
transform: translateX(2em);
transform: translateY(3in);
transform: translateZ(2px);
transform: scale(2, 0.5);
transform: scale3d(2.5, 1.2, 0.3);
transform: scaleX(2);
transform: scaleY(0.5);
transform: scaleZ(0.3);
transform: skew(30deg, 20deg);
transform: skewX(30deg);
transform: skewY(1.07rad);
/* 다중 함수 값 */
transform: translateX(10px) rotate(10deg) translateY(5px);
transform: perspective(500px) translate(10px, 0, 20px) rotateY(3deg);
/* 전역 값 */
transform: inherit;
transform: initial;
transform: unset;
transition
요소를 두 가지 상태 사이에 변화를 줄 수 있는 효과
as each of the properties of the shorthand: |
transition-property
- 전환효과를 적용할 속성을 지정
transition-duration
- 시간 설정
See the Pen Untitled by beomjunkwon (@bjkwon) on CodePen.
transition-delay
- 실행하는 시간을 지연시키는 설정
transition-timing-function
- 각 주기의 지속 시간 동안 애니메이션이 진행되는 방식
/* Apply to 1 property */
/* property name | duration */
transition: margin-right 4s;
/* property name | duration | delay */
transition: margin-right 4s 1s;
/* property name | duration | easing function */
transition: margin-right 4s ease-in-out;
/* property name | duration | easing function | delay */
transition: margin-right 4s ease-in-out 1s;
/* Apply to 2 properties */
transition: margin-right 4s, color 1s;
/* Apply to all changed properties */
transition: all 0.5s ease-out;
/* Global values */
transition: inherit;
transition: initial;
transition: revert;
transition: revert-layer;
transition: unset;
See the Pen Untitled by beomjunkwon (@bjkwon) on CodePen.