@hortonstudio/main 1.1.24 → 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 +19 -8
- 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,12 +281,21 @@ export async function init() {
|
|
281
281
|
elementsClass = 'words';
|
282
282
|
}
|
283
283
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
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
|
+
});
|
290
299
|
});
|
291
300
|
}
|
292
301
|
|
@@ -325,12 +334,14 @@ export async function init() {
|
|
325
334
|
elementsClass = 'words';
|
326
335
|
}
|
327
336
|
|
337
|
+
// Match text.js element state exactly - set autoAlpha before splitting
|
338
|
+
gsap.set(textElement, { autoAlpha: 1 });
|
339
|
+
|
328
340
|
const split = SplitText.create(textElement, splitConfig);
|
329
341
|
split.elementsClass = elementsClass;
|
330
342
|
subheadingSplits.push(split);
|
331
343
|
|
332
344
|
gsap.set(split[elementsClass], { yPercent: config.subheadingSplit.yPercent });
|
333
|
-
gsap.set(textElement, { autoAlpha: 1 });
|
334
345
|
});
|
335
346
|
}
|
336
347
|
|