→ ZAKAI.COM
IDEAS
DESIGN
TECHNOLOGY
PEOPLE
MOTION
FOR A
BRIGHTER WEB
.lab-scroll-demo {
position: relative;
width: 100%;
height: 500px;
overflow: hidden;
border-radius: 24px;
background:
linear-gradient(rgba(221,165,50,.08) 1px, transparent 1px),
linear-gradient(90deg, rgba(221,165,50,.08) 1px, transparent 1px),
#f8f5ef;
background-size: 70px 70px;
}
/* DOTS */
.lab-scroll-demo__dot {
position: absolute;
display: block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #ff5a1f;
box-shadow:
0 0 12px rgba(255,90,31,.75),
0 0 30px rgba(255,90,31,.35);
}
.lab-scroll-demo .dot-1 {
top: 18%;
left: 12%;
}
.lab-scroll-demo .dot-2 {
top: 65%;
left: 48%;
}
.lab-scroll-demo .dot-3 {
top: 28%;
right: 13%;
}
/* CURVED LINES */
.lab-scroll-demo__line {
position: absolute;
width: 620px;
height: 620px;
border: 1px solid rgba(221,165,50,.32);
border-radius: 50%;
}
.lab-scroll-demo .line-1 {
left: -350px;
top: -70px;
}
.lab-scroll-demo .line-2 {
right: -400px;
bottom: -330px;
}
/* CENTER TEXT */
.lab-scroll-demo__text {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
line-height: .9;
}
.lab-scroll-demo__text span {
display: block;
font-size: clamp(38px, 5vw, 78px);
font-weight: 600;
letter-spacing: -.04em;
color: #241b19;
}
SCROLL
MOTION
BACKGROUND
EXPLORE / LEARN / REUSE / CREATE
.Costomize to fit your vision
/* MOBILE */
@media (max-width: 767px) {
.lab-code-section {
padding-top: 24px;
}
.lab-code-section .lab-code-card {
margin-bottom: 18px;
}
.lab-code-section .lab-code-widget pre {
height: 300px;
max-height: 300px;
}
}
ואם רוצים שגם התנועה תהיה קטנה יותר במובייל, זה כבר נעשה ב־JS עם gsap.matchMedia().
כיוון
פשוט מחליפים את סימן הערך.
ימינה:
x: 220
שמאלה:
x: -220
למטה:
y: 130
למעלה:
y: -130
גם סיבוב עובד באותו אופן:
rotation: 28
או לכיוון ההפוך:
rotation: -28
מרחק / עוצמה
אלה הערכים של x, y ו־scale.
לדוגמה:
.to(demo.querySelector(".dot-1"), {
x: 220,
y: 130,
scale: 2.1,
opacity: .45,
ease: "none"
}, 0)
פחות תנועה:
x: 100,
y: 60,
scale: 1.4
יותר תנועה:
x: 320,
y: 190,
scale: 2.6
אותו עיקרון עובד גם על הקווים ועל הטקסט.
מהירות
אצלנו האנימציה קשורה לגלילה, ולכן ה"מהירות" נשלטת בעיקר על ידי scrub.
כרגע:
scrub: 1.8
תגובה מהירה יותר:
scrub: 0.8
תגובה רכה ואיטית יותר:
scrub: 3
צבע הנקודות:
.lab-scroll-demo__dot {
background: #ff5a1f;
box-shadow:
0 0 12px rgba(255,90,31,.75),
0 0 30px rgba(255,90,31,.35);
}
צבע הקווים:
.lab-scroll-demo__line {
border-color: rgba(221,165,50,.32);
}
צבע הטקסט:
.lab-scroll-demo__text span {
color: #241b19;
}
גודל
לגובה אזור האנימציה:
.lab-scroll-demo {
height: 500px;
}
לדוגמה קטן יותר:
height: 380px;
גדול יותר:
height: 650px;
ולגודל הטקסט:
.lab-scroll-demo__text span {
font-size: clamp(38px, 5vw, 78px);
}
הערה חשובה 🚩
הדוגמה כאן פועלת בתוך אזור תצוגה סגור ומגיבה לגלילה באמצעות GSAP + ScrollTrigger. אפשר לשנות בקלות את כיוון התנועה, המרחק, העוצמה, הצבעים והקצב. את אותו עיקרון אפשר ליישם גם כרקע של סקשן או כשכבת תנועה רחבה יותר בעמוד.