Notice
Recent Posts
Recent Comments
Link
ยซ   2026/05   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
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 28 29 30
31
Tags
more
Archives
Today
Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

็„ก์ œ

transition ์†์„ฑ ๋ณธ๋ฌธ

<style>

transition ์†์„ฑ

yo-u-loo 2026. 3. 27. 14:13

 

๐ŸŸข transition

์š”์†Œ์˜ ์Šคํƒ€์ผ์ด ๋ณ€ํ•  ๋•Œ, ๋ณ€ํ™” ๊ณผ์ •์„ ์ผ์ • ์‹œ๊ฐ„ ๋™์•ˆ ์ ์ง„์ ์œผ๋กœ ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ์ฒ˜๋Ÿผ ๋ณด์—ฌ์ฃผ๋Š” ์†์„ฑ.

 

๐ŸŽฏ ํ•ต์‹ฌ ์†์„ฑ 4๊ฐ€์ง€ ๐ŸŽฏ

๐Ÿ”น transition-property

๋ณ€ํ™” ์ค„ ๋Œ€์ƒ ์†์„ฑ ์ง€์ •.

.prop-box {
  width: 100px;
  height: 100px;
  background-color: #e74c3c;
  /* ๋ฐฐ๊ฒฝ์ƒ‰(background-color) ๋ณ€ํ™”์—๋งŒ 1์ดˆ๊ฐ„ ํšจ๊ณผ๋ฅผ ์ค๋‹ˆ๋‹ค. */
  /* ๋„ˆ๋น„(width) ๋ณ€ํ™”๋Š” ์ฆ‰์‹œ ์ผ์–ด๋‚ฉ๋‹ˆ๋‹ค. */
  transition-property: background-color;
  transition-duration: 1s;
}

.prop-box:hover {
  background-color: #8e44ad;
  width: 200px;
}
  • ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๊ฐ’: all (์ „์ฒด), background-color, width, height, transform, opacity ๋“ฑ

 

๐Ÿ”น transition-duration [ํ•„์ˆ˜]

๋ณ€ํ™”๊ฐ€ ์ผ์–ด๋‚  ์ง€์† ์‹œ๊ฐ„ ์„ค์ •. (๋‹จ์œ„: s ๋˜๋Š” ms)

.dur-box {
  width: 100px;
  height: 100px;
  background-color: #3498db;
  transition-property: transform;
}

.fast { transition-duration: 0.2s; } /* ์•„์ฃผ ๋น ๋ฅด๊ฒŒ */
.slow { transition-duration: 2s; }   /* ์•„์ฃผ ๋А๋ฆฌ๊ฒŒ */

.dur-box:hover {
  transform: rotate(180deg);
}
  • ์œ„ ์†์„ฑ์ด ์—†์œผ๋ฉด ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์•ˆ ๋ณด์ž„.

 

๐Ÿ”น transition-timing-function

๋ณ€ํ™”์˜ ์†๋„ ๊ณก์„  ์ง€์ •.

.time-box {
  width: 100px;
  height: 50px;
  margin-bottom: 10px;
  background-color: #2ecc71;
  transition: width 1s; /* ๋‹จ์ถ• ์†์„ฑ ์‚ฌ์šฉ */
}

.linear { transition-timing-function: linear; } /* ์ผ์ •ํ•œ ์†๋„ */
.ease-in { transition-timing-function: ease-in; } /* ์‹œ์ž‘์€ ๋А๋ฆฌ๊ฒŒ, ๋์€ ๋น ๋ฅด๊ฒŒ */
.out { transition-timing-function: cubic-bezier(0, 0.5, 0.5, 1); } /* ์ปค์Šคํ…€ ๊ณก์„  */

.container:hover .time-box {
  width: 300px;
}
  • ์†๋„์˜ ๋ณ€ํ™” ๋ฐฉ์‹ (๋А๋‚Œ)
    • linear: ์ผ์ •ํ•œ ์†๋„๋กœ ๋ณ€ํ™”.
    • ease: ๋А๋ฆฌ๊ฒŒ ์‹œ์ž‘ → ๋น ๋ฅด๊ฒŒ ์ง„ํ–‰ → ๋А๋ฆฌ๊ฒŒ ๋๋‚จ. (๊ธฐ๋ณธ๊ฐ’)
    • ease-in: ๋А๋ฆฌ๊ฒŒ ์‹œ์ž‘ → ๋น ๋ฅด๊ฒŒ ๋๋‚จ.
    • ease-out: ๋น ๋ฅด๊ฒŒ ์‹œ์ž‘ → ๋А๋ฆฌ๊ฒŒ ๋๋‚จ.
    • ease-in-out: ๋А๋ฆฌ๊ฒŒ ์‹œ์ž‘ → ๋น ๋ฅด๊ฒŒ ์ง„ํ–‰ → ๋А๋ฆฌ๊ฒŒ ๋๋‚จ.
    • cubic-bezier(x1, y1, x2, y2): ์‚ฌ์šฉ์ž ์ •์˜ ์†๋„ ๊ณก์„ .

 

๐Ÿ”น transition-delay

๋ณ€ํ™”๊ฐ€ ์‹œ์ž‘๋˜๊ธฐ ์ „ ๋Œ€๊ธฐ ์‹œ๊ฐ„ ์„ค์ •. (๋‹จ์œ„: s)

.delay-box {
  width: 100px;
  height: 100px;
  background-color: #f1c40f;
  /* 1์ดˆ๋ฅผ ๊ธฐ๋‹ค๋ฆฐ ํ›„์— 0.5์ดˆ ๋™์•ˆ ๋ณ€ํ™”๊ฐ€ ์ผ์–ด๋‚ฉ๋‹ˆ๋‹ค. */
  transition-duration: 0.5s;
  transition-delay: 1s;
}

.delay-box:hover {
  border-radius: 50%;
  background-color: #f39c12;
}โ€‹
  • ์„ ํƒ์‚ฌํ•ญ (์ž์ฃผ ์“ฐ์ง€ ์•Š์Œ)

 

 

๐Ÿ”จ ๋‹จ์ถ• ์†์„ฑ(Shorthand)

selector {
  transition: [property] [duration] [timing-function] [delay];
}
  • ๋ฌธ๋ฒ•: transition: ์†์„ฑ ์‹œ๊ฐ„ ํƒ€์ด๋ฐํ•จ์ˆ˜ ๋Œ€๊ธฐ์‹œ๊ฐ„;
    • ์ฃผ์˜: ์†์„ฑ ํ•˜๋‚˜ ์•ˆ์—์„œ๋Š” ๊ณต๋ฐฑ, ์—ฌ๋Ÿฌ ๊ฐœ์˜ transition์„ ๋‚˜์—ดํ•  ๋•Œ๋Š” ์ฝค๋งˆ(,)

 

 

๐Ÿ”ฅ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋Š” ์ค‘์š” ์†์„ฑ ๐Ÿ”ฅ

๐Ÿ”น transform-origin

๋ณ€ํ˜•(transform)์˜ ๊ธฐ์ค€์ (์ค‘์‹ฌ์ ), ๋ฐฉ์‹์„ ์ •ํ•˜๋Š” ์†์„ฑ

.box {
  /* ์™ผ์ชฝ ์œ„ ๊ผญ์ง“์ ์„ ๊ธฐ์ค€์œผ๋กœ ํšŒ์ „ */
  transform-origin: left top;
  transform: rotate(45deg);
}
  • ๊ธฐ๋ณธ๊ฐ’์€ ์ •์ค‘์•™(50% 50%)์ด์ง€๋งŒ, ์™ผ์ชฝ ์œ„๋‚˜ ์˜ค๋ฅธ์ชฝ ์•„๋ž˜ ๋“ฑ์œผ๋กœ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋‹ค.

 

 

๐Ÿ“โ€Š POINT ๐Ÿ“โ€Š

โœ”๏ธ duration ์ด ์„ค์ •๋˜์ง€ ์•Š์œผ๋ฉด ๊ธฐ๋ณธ๊ฐ’์ด 0์ด๋ฏ€๋กœ ์•„๋ฌด๋Ÿฐ ํšจ๊ณผ๊ฐ€ ๋‚˜ํƒ€๋‚˜์ง€ ์•Š๋Š”๋‹ค. โœ”๏ธ

โœ”๏ธ all ํ‚ค์›Œ๋“œ๋ฅผ ์“ฐ๋ฉด ํ•ด๋‹น ์š”์†Œ์˜ ๋ชจ๋“  ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•œ ์†์„ฑ์— ์ž๋™์œผ๋กœ ํšจ๊ณผ๊ฐ€ ์ ์šฉ๋œ๋‹ค. โœ”๏ธ

โœ”๏ธ ๋งˆ์šฐ์Šค ํ˜ธ๋ฒ„(:hover)๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€/์ œ๊ฑฐํ•  ๋•Œ๋„ transition์€ ์ž‘๋™ํ•œ๋‹ค. โœ”๏ธ

โœ”๏ธ cursor: pointer; ์™€ ๊ฐ™์ด ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ€๋…์„ฑ์ด ์ข‹๋‹ค. โœ”๏ธ

 

 

๐Ÿ“‹ ์†์„ฑ๋ณ„ ์ƒ์„ธ ์š”์•ฝํ‘œ ๐Ÿ“‹

์„ธ๋ถ€ ์†์„ฑ ์„ค๋ช… ์˜ˆ์‹œ
property ๋ณ€ํ™”๋ฅผ ๊ฐ์‹œํ•  CSS ์†์„ฑ opacity, width, all
duration ์• ๋‹ˆ๋ฉ”์ด์…˜ ์žฌ์ƒ ์‹œ๊ฐ„ 0.3s, 500ms
timing-function ์†๋„์˜ ํ๋ฆ„ (๊ฐ€์†๋„) linear, ease-in
delay ์‹ค์ œ ์‹œ์ž‘๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์‹œ๊ฐ„ 1s (1์ดˆ ํ›„ ์‹œ์ž‘)

 


 

โš™๏ธ ์‹ค์ „ ์˜ˆ์ œ ์ฝ”๋“œ โš™๏ธ

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Transition ํ•ต์‹ฌ ์˜ˆ์ œ</title>
<style>
  body {
    font-family: Arial, sans-serif;
    padding: 40px;
  }

  /* ๋ฒ„ํŠผ */
  .button {
    width: 150px;
    height: 50px;
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    margin-bottom: 50px;
    /* ๋ชจ๋“  ์†์„ฑ์„(all) 0.5์ดˆ ๋™์•ˆ(0.5s) ๋ถ€๋“œ๋Ÿฝ๊ฒŒ(ease-in-out) ๋ณ€ํ™” */
    transition: all 0.5s ease-in-out;
  }

   /* ๋งˆ์šฐ์Šค๋ฅผ ์˜ฌ๋ ธ์„ ๋•Œ์˜ ๋ณ€ํ™” */
  .button:hover {
    background-color: #2ecc71;
    width: 200px;
    border-radius: 25px;
    transform: scale(1.1);
  }

  .container {
    border: 1px solid #ddd;
    padding: 20px;
  }  

  /* ๋ฐ•์Šค */
  .box {
    width: 150px;
    height: 50px;
    margin: 10px 0;
    background-color: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 2์ดˆ ๋™์•ˆ ์œ„์น˜ ์ด๋™ */
    transition: transform 2s;
  }
  
  /* hover ์‹œ ์ด๋™ */
  .container:hover .box { transform: translateX(300px); }

  /* ์ด์ง• ์ฐจ์ด */
  .linear { transition-timing-function: linear; }

  .ease-in { transition-timing-function: ease-in; }

  .ease-out { transition-timing-function: ease-out; }
</style>
</head>
<body>
  <h2>๋ฒ„ํŠผ ์• ๋‹ˆ๋ฉ”์ด์…˜</h2>
  <button class="button">Hover Me</button>
  <h2>์ด์ง• ํ•จ์ˆ˜ ๋น„๊ต (๋งˆ์šฐ์Šค ์˜ฌ๋ ค๋ณด์„ธ์š”)</h2>
  <div class="container">
    <div class="box linear">Linear (์ผ์ •ํ•˜๊ฒŒ)</div>
    <div class="box ease-in">Ease-In (๊ฐ€์†)</div>
    <div class="box ease-out">Ease-Out (๊ฐ์†)</div>
  </div>
</body>
</html>

 


 

๐Ÿ”— cubic-bezier ( ์‚ฌ์šฉ์ž ์ •์˜ ์†๋„ ๊ณก์„ ) ๐Ÿ”—

 

https://cubic-bezier.com/#.17,.67,.83,.67

 

cubic-bezier.com

 

cubic-bezier.com

 

https://easings.net/ko#

 

Easing Functions Cheat Sheet

Easing functions specify the speed of animation to make the movement more natural. Real objects don’t just move at a constant speed, and do not start and stop in an instant. This page helps you choose the right easing function.

easings.net

 

https://matthewlein.com/tools/ceaser

 

Ceaser - CSS Easing Animation Tool - Matthew Lein

Choose an easing type and test it out with a few effects. If you don’t quite like the easing, grab a handle and fix it. When you’re happy, snag your code and off you go. Now that we can use CSS transitions in all the modern browsers, let’s make them

matthewlein.com

 

'<style>' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

perspective  (0) 2026.03.27
CSS์˜ Animation๊ณผ @keyframes  (0) 2026.03.27
Functions์˜ filter์†์„ฑ๊ณผ ํ•จ์ˆ˜  (0) 2026.03.27
transform ์†์„ฑ๊ณผ functions (ํ•จ์ˆ˜)  (0) 2026.03.26
Pseudo-elements (์˜์‚ฌ ์š”์†Œ)  (0) 2026.03.26