@hortonstudio/main 1.1.25 → 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 +9 -19
  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
- // Fresh DOM selection like text.js does
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,24 +278,19 @@ export async function init() {
281
278
  elementsClass = 'words';
282
279
  }
283
280
 
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);
281
+ const split = new SplitText(textElement, splitConfig);
288
282
  split.elementsClass = elementsClass;
289
283
  headingSplits.push(split);
290
284
 
291
285
  gsap.set(split[elementsClass], { yPercent: config.headingSplit.yPercent });
286
+ gsap.set(textElement, { autoAlpha: 1 });
292
287
  });
293
288
  }
294
289
 
295
290
  // Split text setup for subheadings
296
291
  if (subheading.length > 0) {
297
- // Fresh DOM selection like text.js does
298
- const freshSubheadings = document.querySelectorAll('[data-hs-hero="subheading"] > *:first-child');
299
-
300
- freshSubheadings.forEach((textElement, index) => {
301
- const parent = textElement.parentElement;
292
+ subheadingSplitElements.forEach((parent, index) => {
293
+ const textElement = subheading[index];
302
294
  const splitType = parent.getAttribute('data-hs-heroconfig') || 'word';
303
295
 
304
296
  let splitConfig = {};
@@ -327,14 +319,12 @@ export async function init() {
327
319
  elementsClass = 'words';
328
320
  }
329
321
 
330
- // Match text.js element state exactly - set autoAlpha before splitting
331
- gsap.set(textElement, { autoAlpha: 1 });
332
-
333
- const split = SplitText.create(textElement, splitConfig);
322
+ const split = new SplitText(textElement, splitConfig);
334
323
  split.elementsClass = elementsClass;
335
324
  subheadingSplits.push(split);
336
325
 
337
326
  gsap.set(split[elementsClass], { yPercent: config.subheadingSplit.yPercent });
327
+ gsap.set(textElement, { autoAlpha: 1 });
338
328
  });
339
329
  }
340
330
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortonstudio/main",
3
- "version": "1.1.25",
3
+ "version": "1.1.27",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {