לאיזה תוכןתמונה אחת שחוזרת בסקשן הבא (hero לאודות) / מסגרת ריקה שם / מלל רגיל סביב
השאלהיש תמונה מסקשן אחד שחוזרת בסקשן הבא (ה-hero באודות)?
Fit to Target
תמונה שעוברת מסקשן לסקשן: גוללים, והתמונה הגדולה של ההירו "עפה" למטה, מתכווצת ונוחתת בתוך מסגרת ריקה בסקשן הבא (למשל התמונה של "אודות"). זה לא שתי תמונות, זו אותה תמונה שעוברת ממקום למקום.
An image flies out of its section while it scrolls away and lands in an empty frame further down, filling it: the hero picture becomes the about picture.data-fit-to="about" on the image's wrapper (it keeps the place; give it a size), data-fit-target="about" on the empty frame (give it a size too); the name pairs them. The flight runs while the wrapper's <section> scrolls away, and the picture ends at the frame's width and height with object-fit: cover, whatever the two proportions. A different picture on arrival: make the first child a box of two images and mark the second data-fit-end; it fades in over the last part of the flight (example 2). Every screen. On a phone the picture holds a line near the top while the frame comes up under it, so put the frame right after the picture there (max-[959px]:-order-1): copy in between would pass under it. Nothing positioned with a z-index above 2 in between, or the picture passes under it.
<section>
<div data-fit-to="about" class="aspect-21/9"><img src="…" /></div>
</section>
<section>
<div data-fit-target="about" class="aspect-4/5 rounded-2xl"></div>
</section>כל פרויקט מתחיל בתמונה אחת.
והתמונה נוחתת כאן.
המסגרת בצד השני ריקה: התמונה מהסקשן הקודם נכנסת אליה תוך כדי גלילה, וממלאת אותה. מתאים למעבר מ-hero לסקשן "אודות".
דוגמה 2: צילום מסך רחב שנוחת במסך של טלפון, ובנחיתה מתחלף ב-fade לתצוגת המובייל של אותו אתר (data-fit-end על תמונה שנייה). היחס משתנה מ-16:10 לטלפון, הפינות לפינות של המסך, והמטרה יושבת בתוך גוף הטלפון.
<div data-fit-to="phone" class="aspect-16/10">
<div> <!-- what flies: a box of two pictures -->
<img src="desktop.webp" /> <!-- the one you see on the way -->
<img data-fit-end src="mobile.webp" /> <!-- the second: fades in as it lands -->
</div>
</div>
<div data-fit-target="phone" class="aspect-9/19 rounded-[2rem]"></div>האתר, ישר לכיס.


ונראה מעולה גם בטלפון.
המסך ריק עד שהאתר נוחת בו. אותו אטריביוט בדיוק, רק מטרה אחרת: המסגרת קובעת את הגודל, את היחס ואת הפינות.
דוגמה 3: תמונה רחבה של הבניין שנוחתת בעיגול ליד פרטי ההגעה. המטרה rounded-full, והתמונה מתעגלת בדיוק כשהיא נוחתת.
