- transition-property : 어떤 속성에 트랜지션 효과를 줄 것인지 지정
transition-property:<속성1>,<속성2>(all, none 사용)
- transition-duration: 트랜지션 효과를 몇 초 동안 실행할 것인지 지정
- transition-delay: 지정한 초만큼 기다렸다가 실행할 때 사용
- transition-timing-function: 트랜지션이 시작하면서 끝날때의 타이밍 즉 속도를 지정
linear : 트랜지션의 시작과 끝의 속도가 일정함
ease-in: 천천히 시작했다가 완료될 때 속도가 증가
ease-out: 빨리 시작했다가 완료될 때 속도가 낮아짐
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>transform</title>
<style>
body {
margin: 0;
padding: 0;
background-color: lightgrey;
}
.outline,
.box {
width: 60px;
height: 60px;
}
.outline {
border: 3px solid deepskyblue;
margin: 0 auto;
margin-top: 20px;
}
.box {
background-color: lightblue;
}
.box1 {
transform: translate(20px, 30px);
}
.box2 {
transform: scale(2, 0.5);
}
.box3 {
transform: rotate(45deg);
}
.outline-box3 {
perspective: 50px;
}
.box4 {
transform: skew(15deg, 20deg);
}
/*Transition*/
.box1 {
/* transition-property: width, height;
transition-duration: 1s;
transition-delay: 1s;
transition-timing-function: linear; */
transition: 2s 1s;
}
.box1:hover {
width: 200px;
height: 200px;
transform: rotate(180deg);
}
</style>
</head>
<body>
<div class="outline">
<div class="box box1"></div>
</div>
<div class="outline">
<div class="box box2"></div>
</div>
<div class="outline">
<div class="box box3"></div>
</div>
<div class="outline">
<div class="box box4"></div>
</div>
</body>
</html>