수평선1203

위에서 아래로 내려오는 효과 6가지

· 2025-03-03 (월) 21:24:13 · 4391

1.gsap

[code]

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>gsap 사용</title>
<style>
.sample{background-color:yellow;}
</style>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script></head>
<body>
  <div class="sample">
    위에서 내려옵니다.
  </div>
<script>
gsap.from(".sample", {y: -100,opacity:0, duration: 1});
</script>
</body>
</html>

[/code]

 

2.gsap and timeline

[code]

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>gsap timeline 사용</title>
<style>
.sample{background-color:yellow;}
</style>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script></head>
<body>
  <div class="sample">
    위에서 내려옵니다.
  </div>
<script>
const tl = gsap.timeline();
tl.from(".sample", {y: -100,opacity:0, duration: 1});
</script>
</body>
</html>

[/code]

 

3.pure css

[code]

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <title>순수 CSS 애니메이션</title>
    <style>
        .sample {
            background-color: yellow;
            /* 애니메이션 설정 */
            animation: slideDown 1s ease forwards;
        }

        /* 키프레임 정의 */
        @keyframes slideDown {
            from {
                transform: translateY(-100px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }
    </style>
</head>
<body>
    <div class="sample">
        위에서 내려옵니다.
    </div>
</body>
</html>

[/code]

 

4.jquery animate

[code]

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>top 사용</title>
<style>
.sample{background-color:yellow;}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>
  <div class="sample">
    위에서 내려옵니다.
  </div>
<script>
$(".sample")
  .css({ position: "relative", top: "-100px", opacity: 0 })
  .animate({ top: "0px", opacity: 1 }, 1000);
</script>
</body>
</html>

[/code]

 

5.jquery.transit

[code]

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>jquery.transit 사용 https://github.com/rstacruz/jquery.transit</title>
<style>
.sample{background-color:yellow;}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.transit/0.9.12/jquery.transit.min.js"></script>
</head>
<body>
  <div class="sample">
    위에서 내려옵니다.
  </div>
<script>
$(".sample")
  .css({ position: "relative", translate: ['0','-100px'], opacity: 0 })
  .transition({ translate: ['0','0'], opacity: 1 }, 1000);
</script>
</body>
</html>

[/code]

 

6.Velocity

[code]

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Velocity 사용 https://github.com/julianshapiro/velocity</title>
<style>
.sample{background-color:yellow;}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.5.2/velocity.min.js"></script>
</head>
<body>
  <div class="sample">
    위에서 내려옵니다.
  </div>
<script>
$(".sample")
  .css({ position: "relative", top: "-100px", opacity: 0 })
  .velocity({ top: "0px", opacity: 1 }, {duration: 1000});
</script>
</body>
</html>

[/code]

|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
기타 05-15 조회 2,142
MySQL 01-06 조회 3,951
JavaScript 25-12-22 조회 1,021
MySQL 25-11-20 조회 1,928
PHP 25-10-21 조회 4,778
PHP 25-10-21 조회 3,057
PHP 25-10-18 조회 4,486
기타 25-08-02 조회 1,321
PHP 25-06-17 조회 5,111
MySQL 25-06-06 조회 4,204
웹서버 25-04-01 조회 1,743
24-10-26 조회 5,171
25-01-25 조회 2,088
25-02-01 조회 4,954
25-02-22 조회 1,763
25-03-08 조회 1,944
25-03-30 조회 1,695
JavaScript 25-03-21 조회 1,892
웹서버 25-03-21 조회 1,988
JavaScript 25-03-03 조회 4,392
기타 25-02-01 조회 2,476
기타 25-01-29 조회 1,359
JavaScript 25-01-28 조회 3,766
기타 25-01-22 조회 1,673
JavaScript 25-01-19 조회 1,575
25-01-10 조회 2,160
기타 25-01-05 조회 1,625
jQuery 25-01-05 조회 1,325
jQuery 25-01-04 조회 1,742
기타 24-12-30 조회 1,800