2026, 새로운 도약을 시작합니다.

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

· 10개월 전 · 991

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/gsap@3.12.5/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/gsap@3.12.5/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]

|

댓글 작성

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

로그인하기

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.
번호 분류 제목 글쓴이 날짜 조회
5402 MySQL 6일 전 조회 22
5401 JavaScript 3주 전 조회 117
5400 MySQL 1개월 전 조회 224
5399 PHP 2개월 전 조회 470
5398 PHP 2개월 전 조회 354
5397 PHP 2개월 전 조회 286
5396 기타 5개월 전 조회 560
5395 PHP 6개월 전 조회 1,196
5394 MySQL 7개월 전 조회 794
5393 웹서버 9개월 전 조회 986
5392 1년 전 조회 1,311
5391 11개월 전 조회 1,320
5390 11개월 전 조회 1,114
5389 10개월 전 조회 1,032
5388 10개월 전 조회 1,171
5387 9개월 전 조회 963
5386 JavaScript 9개월 전 조회 1,150
5385 웹서버 9개월 전 조회 1,170
5384 JavaScript 10개월 전 조회 992
5383 기타 11개월 전 조회 1,417
5382 기타 11개월 전 조회 661
5381 JavaScript 11개월 전 조회 1,077
5380 기타 11개월 전 조회 834
5379 JavaScript 11개월 전 조회 832
5378 1년 전 조회 1,399
5377 기타 1년 전 조회 941
5376 jQuery 1년 전 조회 640
5375 jQuery 1년 전 조회 872
5374 기타 1년 전 조회 950
5373 MySQL 1년 전 조회 982
🐛 버그신고