@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.
Files changed (2) hide show
  1. package/animations/hero.js +16 -9
  2. package/package.json +1 -1
@@ -248,7 +248,7 @@ export async function init() {
248
248
  headingSplits = [];
249
249
 
250
250
  if (heading.length > 0) {
251
- // Fresh DOM selection like text.js does
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
- // Match text.js element state exactly - set autoAlpha before splitting
285
- gsap.set(textElement, { autoAlpha: 1 });
286
-
287
- const split = SplitText.create(textElement, splitConfig);
288
- split.elementsClass = elementsClass;
289
- headingSplits.push(split);
290
-
291
- gsap.set(split[elementsClass], { yPercent: config.headingSplit.yPercent });
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortonstudio/main",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {