@hortonstudio/main 1.1.26 → 1.1.27

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 +13 -30
  2. package/package.json +1 -1
@@ -24,7 +24,7 @@ let heroTimeout = null; // Track the setTimeout
24
24
 
25
25
  const config = {
26
26
  global: {
27
- animationDelay: 0.3
27
+ animationDelay: 0.2
28
28
  },
29
29
  headingSplit: {
30
30
  duration: 1.5,
@@ -248,11 +248,8 @@ export async function init() {
248
248
  headingSplits = [];
249
249
 
250
250
  if (heading.length > 0) {
251
- // Use ScrollTrigger approach exactly like text.js
252
- const freshHeadings = document.querySelectorAll('[data-hs-hero="heading"] > *:first-child');
253
-
254
- freshHeadings.forEach((textElement, index) => {
255
- const parent = textElement.parentElement;
251
+ headingSplitElements.forEach((parent, index) => {
252
+ const textElement = heading[index];
256
253
  const splitType = parent.getAttribute('data-hs-heroconfig') || 'word';
257
254
 
258
255
  let splitConfig = {};
@@ -281,31 +278,19 @@ export async function init() {
281
278
  elementsClass = 'words';
282
279
  }
283
280
 
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
- });
281
+ const split = new SplitText(textElement, splitConfig);
282
+ split.elementsClass = elementsClass;
283
+ headingSplits.push(split);
284
+
285
+ gsap.set(split[elementsClass], { yPercent: config.headingSplit.yPercent });
286
+ gsap.set(textElement, { autoAlpha: 1 });
299
287
  });
300
288
  }
301
289
 
302
290
  // Split text setup for subheadings
303
291
  if (subheading.length > 0) {
304
- // Fresh DOM selection like text.js does
305
- const freshSubheadings = document.querySelectorAll('[data-hs-hero="subheading"] > *:first-child');
306
-
307
- freshSubheadings.forEach((textElement, index) => {
308
- const parent = textElement.parentElement;
292
+ subheadingSplitElements.forEach((parent, index) => {
293
+ const textElement = subheading[index];
309
294
  const splitType = parent.getAttribute('data-hs-heroconfig') || 'word';
310
295
 
311
296
  let splitConfig = {};
@@ -334,14 +319,12 @@ export async function init() {
334
319
  elementsClass = 'words';
335
320
  }
336
321
 
337
- // Match text.js element state exactly - set autoAlpha before splitting
338
- gsap.set(textElement, { autoAlpha: 1 });
339
-
340
- const split = SplitText.create(textElement, splitConfig);
322
+ const split = new SplitText(textElement, splitConfig);
341
323
  split.elementsClass = elementsClass;
342
324
  subheadingSplits.push(split);
343
325
 
344
326
  gsap.set(split[elementsClass], { yPercent: config.subheadingSplit.yPercent });
327
+ gsap.set(textElement, { autoAlpha: 1 });
345
328
  });
346
329
  }
347
330
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortonstudio/main",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {