위에서 아래로 내려오는 효과 6가지
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에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5096 | PHP | 3년 전 | 1504 | ||
| 5095 | JavaScript | 3년 전 | 2133 | ||
| 5094 | JavaScript | 3년 전 | 2054 | ||
| 5093 | 기타 | 3년 전 | 1418 | ||
| 5092 | JavaScript | 3년 전 | 1965 | ||
| 5091 | 기타 |
|
3년 전 | 1323 | |
| 5090 | 기타 |
|
3년 전 | 2260 | |
| 5089 | 웹서버 |
|
3년 전 | 3337 | |
| 5088 | JavaScript | 3년 전 | 2068 | ||
| 5087 | 기타 | 3년 전 | 1667 | ||
| 5086 | 웹서버 |
|
3년 전 | 1712 | |
| 5085 | node.js | 3년 전 | 1657 | ||
| 5084 | JavaScript |
DogFoot개발
|
3년 전 | 1457 | |
| 5083 | 웹서버 |
DogFoot개발
|
3년 전 | 2995 | |
| 5082 | JavaScript |
DogFoot개발
|
3년 전 | 4034 | |
| 5081 | JavaScript |
DogFoot개발
|
3년 전 | 2103 | |
| 5080 | JavaScript |
DogFoot개발
|
3년 전 | 2446 | |
| 5079 | 기타 |
DogFoot개발
|
3년 전 | 2497 | |
| 5078 | OS | 3년 전 | 1656 | ||
| 5077 | 웹서버 |
DogFoot개발
|
3년 전 | 1730 | |
| 5076 | 기타 |
DogFoot개발
|
3년 전 | 1537 | |
| 5075 | 기타 |
DogFoot개발
|
3년 전 | 1681 | |
| 5074 | 기타 | 4년 전 | 2291 | ||
| 5073 | 기타 | 4년 전 | 2563 | ||
| 5072 | 웹서버 |
|
4년 전 | 2242 | |
| 5071 | 웹서버 | 4년 전 | 3240 | ||
| 5070 | PHP | 4년 전 | 3201 | ||
| 5069 | 웹서버 | 4년 전 | 2436 | ||
| 5068 | 기타 |
|
4년 전 | 3019 | |
| 5067 | 기타 |
DogFoot개발
|
4년 전 | 2689 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기