donaricano-btn

CSS3 애니메이션 속도 제어


1. 정의

- transition : css속성을 변경할 때 애니메이션 속도를 지정한다. 

- transition을 사용하지 않을 경우 순간적으로 변화가 일어나지만, 속도를 지정하면 부드러운 화면 변화가 생긴다


2. 구현

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
 
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        <!--
           #box{
               border-style:solid;
               border-width: 1px;;
               height: 200px;
               width: 200px;
               background-color: brown;
               transition:width 2s, height 2s, background-color 2s;
           }
 
        #box:hover{
            width:400px;
            height:400px;
            background-color: blue;
        }
        -->
    </style>
</head>
 
<div id="box">
</div>

- #box:hover 속성은 마우스가 박스위에 올라 갔을 때 이벤트를 말한다

- transition을 2s으로 조정하여 2초의 시간 동안 변화가 일어남

블로그 이미지

리딩리드

,