[GSAP] nghiên cứu dự án gsap sử dụng js thuần full (ok)
Trang reactjs https://app.gitbook.com/o/-LZtQgrzulP3oOTKQpDc/s/Aw7vXOIz8393b9JtKw5i/cach-khai-bao-cac-kieu-chung-global-cho-cac-du-an-react-typescript-ok
✅ 1. HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SplitText Example</title>
<style>
body {
background: #111;
color: white;
font-size: 40px;
text-align: center;
margin-top: 20vh;
font-family: sans-serif;
}
.text {
display: inline-block;
}
.char {
display: inline-block;
}
</style>
</head>
<body>
<div class="text">Hello SplitText Animation</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.13.0/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.13.0/SplitText.min.js"></script>
<script>
// Split text into chars
const split = new SplitText(".text", { type: "chars" });
const chars = split.chars;
// Animate each char
gsap.from(chars, {
opacity: 0,
y: 50,
stagger: 0.05,
ease: "back.out(1.7)",
duration: 1
});
</script>
</body>
</html>⚠️ 2. Lưu ý
🚀 3. Kết quả
✅ 1. HTML
⚠️ 2. Lưu ý
🚀 3. Ý tưởng mở rộng
✅ 1. HTML
⚠️ 2. Giải thích
🚀 3. Mở rộng
✅ 1. HTML
⚠️ 2. Giải thích
🚀 3. Mở rộng
🔧 Giải pháp chuẩn:
✅ 3. Example HTML đầy đủ
🔑 4. Kết luận
✅ 1. Example HTML
⚠️ 2. Giải thích
🔧 3. Nếu muốn từng block trigger riêng lẻ
🚀 4. Kết hợp stagger + SplitText effect
✅ 1. Example HTML – Nhiều nhóm
⚠️ 2. Giải thích
🔧 3. Tùy chỉnh
🚀 4. Kết hợp SplitText + block stagger + group stagger
PreviousMột cách lấy dữ liệu kiểu url string sang object rất hay (ok)NextGiải thích dễ hiểu onEnter, onLeave, sử dụng start, end như nào FULL Phần 1 (ok)
Last updated