@widelab-nc/widehue 1.0.43 → 1.0.44
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/dist/index.js +4 -4
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +53 -32
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -24,6 +24,7 @@ function customGsapEasing() {
|
|
|
24
24
|
// Contact form open animation
|
|
25
25
|
let contactFormOpen;
|
|
26
26
|
|
|
27
|
+
|
|
27
28
|
function refreshScrollTriggersAfterLoad() {
|
|
28
29
|
window.addEventListener('load', () => {
|
|
29
30
|
console.log('[ScrollTrigger] Page fully loaded — refreshing all triggers');
|
|
@@ -489,16 +490,12 @@ window.customCursorText = function(e) {
|
|
|
489
490
|
});
|
|
490
491
|
}
|
|
491
492
|
|
|
493
|
+
|
|
494
|
+
|
|
492
495
|
window.heroAnimationOnLoad = function(e) {
|
|
493
496
|
console.log('heroAnimationOnLoad function started');
|
|
494
497
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
if (performance.navigation.type === 1) {
|
|
498
|
-
sessionStorage.removeItem('hasPlayedHeroAnimation');
|
|
499
|
-
hasPlayedAnimation = null;
|
|
500
|
-
console.log('Page reloaded; session flag cleared.');
|
|
501
|
-
}
|
|
498
|
+
const hasPlayedAnimation = window.name.includes('heroPlayed');
|
|
502
499
|
|
|
503
500
|
gsap.set('.wideletter', { y: '-150%', scale: 1 });
|
|
504
501
|
|
|
@@ -530,7 +527,6 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
530
527
|
return;
|
|
531
528
|
}
|
|
532
529
|
|
|
533
|
-
// Handle video source replacement based on viewport width
|
|
534
530
|
function updateVideoSources() {
|
|
535
531
|
const isMobile = window.innerWidth < 992;
|
|
536
532
|
const mobileMp4 = video.getAttribute('mobile-mp4');
|
|
@@ -539,31 +535,22 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
539
535
|
const webmSource = video.querySelector('source[type="video/webm"]');
|
|
540
536
|
|
|
541
537
|
if (isMobile) {
|
|
542
|
-
if (mobileMp4)
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
if (mobileWebm) {
|
|
546
|
-
webmSource.setAttribute('data-src', mobileWebm);
|
|
547
|
-
}
|
|
538
|
+
if (mobileMp4) mp4Source.setAttribute('data-src', mobileMp4);
|
|
539
|
+
if (mobileWebm) webmSource.setAttribute('data-src', mobileWebm);
|
|
548
540
|
} else {
|
|
549
|
-
// Revert to desktop sources if necessary
|
|
550
541
|
mp4Source.setAttribute('data-src', mp4Source.getAttribute('data-src').replace('mobile-', ''));
|
|
551
542
|
webmSource.setAttribute('data-src', webmSource.getAttribute('data-src').replace('mobile-', ''));
|
|
552
543
|
}
|
|
553
544
|
}
|
|
554
545
|
|
|
555
|
-
// Initial call to update video sources
|
|
556
546
|
updateVideoSources();
|
|
557
|
-
|
|
558
|
-
// Add event listener for window resize to update video sources
|
|
559
547
|
window.addEventListener('resize', updateVideoSources);
|
|
560
548
|
|
|
561
549
|
if (video) {
|
|
562
|
-
// Prevent the video from autoplaying when lazy-loaded
|
|
563
550
|
video.setAttribute('data-no-autoplay', 'true');
|
|
564
551
|
video.addEventListener('loadeddata', () => {
|
|
565
552
|
if (video.hasAttribute('data-no-autoplay')) {
|
|
566
|
-
video.pause();
|
|
553
|
+
video.pause();
|
|
567
554
|
}
|
|
568
555
|
});
|
|
569
556
|
}
|
|
@@ -577,7 +564,6 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
577
564
|
|
|
578
565
|
heroAnimation.to('.navbar_brand_lottie', {
|
|
579
566
|
duration: 1.5,
|
|
580
|
-
// Usuń progress: 1 całkowicie
|
|
581
567
|
onComplete: function() {
|
|
582
568
|
console.log('Lottie animation completed');
|
|
583
569
|
gsap.to('.navbar_brand_lottie', { opacity: 0, duration: 0.25 });
|
|
@@ -605,7 +591,7 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
605
591
|
ease: 'loader2',
|
|
606
592
|
}, '+=1');
|
|
607
593
|
|
|
608
|
-
|
|
594
|
+
window.name += 'heroPlayed;';
|
|
609
595
|
} else {
|
|
610
596
|
console.log('Skipping initial hero line animations as they have already been played in this session');
|
|
611
597
|
}
|
|
@@ -635,7 +621,11 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
635
621
|
}, '>-0.4');
|
|
636
622
|
|
|
637
623
|
console.log('Animation timeline setup completed');
|
|
638
|
-
}
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
639
629
|
|
|
640
630
|
|
|
641
631
|
window.briefContact = function(e) {
|
|
@@ -1358,18 +1348,15 @@ window.animationTest3 = function(root) {
|
|
|
1358
1348
|
});
|
|
1359
1349
|
};
|
|
1360
1350
|
|
|
1361
|
-
|
|
1362
1351
|
window.animationTest4 = function(root) {
|
|
1363
1352
|
const hoverWrappers = root.querySelectorAll('.h-wrapper');
|
|
1364
1353
|
const hoverMasks = root.querySelectorAll('.hover-mask');
|
|
1365
1354
|
const hoverTitles = root.querySelectorAll('.h-title');
|
|
1366
1355
|
|
|
1367
|
-
// Stałe rozmiary bg-video
|
|
1368
1356
|
const VIDEO_WIDTH = 380;
|
|
1369
1357
|
const VIDEO_HEIGHT = 280;
|
|
1370
1358
|
const VISIBLE_RATIO = 0.7;
|
|
1371
1359
|
|
|
1372
|
-
// Ukryj wszystkie maski na starcie
|
|
1373
1360
|
hoverMasks.forEach(mask => {
|
|
1374
1361
|
mask.style.display = 'none';
|
|
1375
1362
|
mask.style.position = 'fixed';
|
|
@@ -1378,7 +1365,7 @@ window.animationTest4 = function(root) {
|
|
|
1378
1365
|
mask.style.width = '100vw';
|
|
1379
1366
|
mask.style.height = '100vh';
|
|
1380
1367
|
mask.style.zIndex = '999';
|
|
1381
|
-
mask.style.pointerEvents = 'none';
|
|
1368
|
+
mask.style.pointerEvents = 'none';
|
|
1382
1369
|
});
|
|
1383
1370
|
|
|
1384
1371
|
function resetOpacity() {
|
|
@@ -1394,6 +1381,7 @@ window.animationTest4 = function(root) {
|
|
|
1394
1381
|
video.style.left = '';
|
|
1395
1382
|
video.style.top = '';
|
|
1396
1383
|
video.style.position = '';
|
|
1384
|
+
video.style.zIndex = '';
|
|
1397
1385
|
});
|
|
1398
1386
|
}
|
|
1399
1387
|
|
|
@@ -1418,7 +1406,6 @@ window.animationTest4 = function(root) {
|
|
|
1418
1406
|
el.style.position = 'absolute';
|
|
1419
1407
|
el.style.width = `${VIDEO_WIDTH}px`;
|
|
1420
1408
|
el.style.height = `${VIDEO_HEIGHT}px`;
|
|
1421
|
-
el.style.zIndex = '1001';
|
|
1422
1409
|
el.style.pointerEvents = 'none';
|
|
1423
1410
|
}
|
|
1424
1411
|
|
|
@@ -1434,7 +1421,6 @@ window.animationTest4 = function(root) {
|
|
|
1434
1421
|
video.style.width = `${VIDEO_WIDTH}px`;
|
|
1435
1422
|
video.style.height = `${VIDEO_HEIGHT}px`;
|
|
1436
1423
|
video.style.position = 'absolute';
|
|
1437
|
-
video.style.zIndex = '1001';
|
|
1438
1424
|
video.style.pointerEvents = 'none';
|
|
1439
1425
|
});
|
|
1440
1426
|
|
|
@@ -1451,8 +1437,7 @@ window.animationTest4 = function(root) {
|
|
|
1451
1437
|
|
|
1452
1438
|
videoTimeline = gsap.timeline();
|
|
1453
1439
|
|
|
1454
|
-
|
|
1455
|
-
const videoIndexes = Array.from({length: videos.length}, (_, i) => i);
|
|
1440
|
+
const videoIndexes = Array.from({ length: videos.length }, (_, i) => i);
|
|
1456
1441
|
const shuffledIndexes = videoIndexes.sort(() => Math.random() - 0.5);
|
|
1457
1442
|
|
|
1458
1443
|
shuffledIndexes.forEach((videoIndex, timeIndex) => {
|
|
@@ -1460,6 +1445,7 @@ window.animationTest4 = function(root) {
|
|
|
1460
1445
|
|
|
1461
1446
|
videoTimeline.add(() => {
|
|
1462
1447
|
placeElementAtRandomVisiblePosition(video, mask);
|
|
1448
|
+
video.style.zIndex = 1001 + timeIndex; // <-- z-index rośnie
|
|
1463
1449
|
}, timeIndex * 0.75);
|
|
1464
1450
|
|
|
1465
1451
|
videoTimeline.to(video, {
|
|
@@ -1492,7 +1478,6 @@ window.animationTest4 = function(root) {
|
|
|
1492
1478
|
|
|
1493
1479
|
|
|
1494
1480
|
|
|
1495
|
-
|
|
1496
1481
|
window.pricingInteraction = function(e) {
|
|
1497
1482
|
// Check if the screen width is 992px or wider
|
|
1498
1483
|
if (window.innerWidth >= 992) {
|
|
@@ -1993,6 +1978,42 @@ window.clientLogosAnimation = function(e) {
|
|
|
1993
1978
|
});
|
|
1994
1979
|
}
|
|
1995
1980
|
|
|
1981
|
+
// Hue Awards animation with individual ScrollTriggers
|
|
1982
|
+
window.hueAwardsAnimation = function(e) {
|
|
1983
|
+
const logoItems = e.querySelectorAll('.clients_collection_item_mask.is-3');
|
|
1984
|
+
|
|
1985
|
+
logoItems.forEach((maskEl) => {
|
|
1986
|
+
const imgEl = maskEl.querySelector('.skills-item_img');
|
|
1987
|
+
|
|
1988
|
+
// Set initial height of mask to 100%
|
|
1989
|
+
gsap.set(maskEl, { height: '100%' });
|
|
1990
|
+
|
|
1991
|
+
// Animate mask height to 0% when it enters viewport
|
|
1992
|
+
gsap.to(maskEl, {
|
|
1993
|
+
scrollTrigger: {
|
|
1994
|
+
trigger: maskEl,
|
|
1995
|
+
start: 'top bottom-=25%',
|
|
1996
|
+
},
|
|
1997
|
+
height: '0%',
|
|
1998
|
+
duration: 0.7,
|
|
1999
|
+
ease: 'loader2',
|
|
2000
|
+
});
|
|
2001
|
+
|
|
2002
|
+
// Animate logo opacity (fade in)
|
|
2003
|
+
gsap.from(imgEl, {
|
|
2004
|
+
scrollTrigger: {
|
|
2005
|
+
trigger: maskEl,
|
|
2006
|
+
start: 'top bottom-=25%',
|
|
2007
|
+
},
|
|
2008
|
+
opacity: 0,
|
|
2009
|
+
delay: 0.4,
|
|
2010
|
+
duration: 0.45,
|
|
2011
|
+
ease: 'loader2',
|
|
2012
|
+
});
|
|
2013
|
+
});
|
|
2014
|
+
};
|
|
2015
|
+
|
|
2016
|
+
|
|
1996
2017
|
// Hero span video on hover
|
|
1997
2018
|
window.heroSpanVideoOnHover = function(e) {
|
|
1998
2019
|
window.customCursorText(e);
|