@hortonstudio/main 1.1.25 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animations/hero.js +16 -9
- package/package.json +1 -1
package/animations/hero.js
CHANGED
@@ -248,7 +248,7 @@ export async function init() {
|
|
248
248
|
headingSplits = [];
|
249
249
|
|
250
250
|
if (heading.length > 0) {
|
251
|
-
//
|
251
|
+
// Use ScrollTrigger approach exactly like text.js
|
252
252
|
const freshHeadings = document.querySelectorAll('[data-hs-hero="heading"] > *:first-child');
|
253
253
|
|
254
254
|
freshHeadings.forEach((textElement, index) => {
|
@@ -281,14 +281,21 @@ export async function init() {
|
|
281
281
|
elementsClass = 'words';
|
282
282
|
}
|
283
283
|
|
284
|
-
//
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
284
|
+
// Copy text.js approach exactly - use ScrollTrigger
|
285
|
+
ScrollTrigger.create({
|
286
|
+
trigger: textElement,
|
287
|
+
start: "top 99%", // Very early trigger
|
288
|
+
once: true,
|
289
|
+
onEnter: () => {
|
290
|
+
const split = SplitText.create(textElement, splitConfig);
|
291
|
+
split.elementsClass = elementsClass;
|
292
|
+
headingSplits.push(split);
|
293
|
+
textElement.splitTextInstance = split;
|
294
|
+
|
295
|
+
gsap.set(split[elementsClass], { yPercent: config.headingSplit.yPercent });
|
296
|
+
gsap.set(textElement, { autoAlpha: 1 });
|
297
|
+
}
|
298
|
+
});
|
292
299
|
});
|
293
300
|
}
|
294
301
|
|