@widelab-nc/widehue 1.0.46 → 1.0.47
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 +107 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2665,6 +2665,109 @@ window.heroAnimation2026 = function(e) {
|
|
|
2665
2665
|
});
|
|
2666
2666
|
};
|
|
2667
2667
|
|
|
2668
|
+
// Case Hero Animation - navbar letters on scroll
|
|
2669
|
+
window.CaseHeroAnimation = function(e) {
|
|
2670
|
+
// Page load animation timeline (starts after 200ms)
|
|
2671
|
+
const pageLoadTimeline = gsap.timeline({ delay: 0.2 });
|
|
2672
|
+
|
|
2673
|
+
// All animations start at the same time with 0.2s stagger between them
|
|
2674
|
+
// 1. .navbar and .button_small.is-navbar - slide down from top with stagger
|
|
2675
|
+
const navbar = document.querySelector('.navbar');
|
|
2676
|
+
const navButtons = document.querySelectorAll('.button_small.is-navbar');
|
|
2677
|
+
if (navbar || navButtons.length > 0) {
|
|
2678
|
+
const navbarElements = navbar ? [navbar, ...Array.from(navButtons)] : Array.from(navButtons);
|
|
2679
|
+
pageLoadTimeline.from(navbarElements, {
|
|
2680
|
+
y: '-100%',
|
|
2681
|
+
duration: 1.2,
|
|
2682
|
+
ease: 'loader',
|
|
2683
|
+
stagger: 0.15,
|
|
2684
|
+
}, 0);
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
// 2. .hero_headline - SplitText animation (like gsapTitleAnimation but play in timeline)
|
|
2688
|
+
const heroHeadline = document.querySelector('.hero_headline');
|
|
2689
|
+
let heroLines = [];
|
|
2690
|
+
if (heroHeadline) {
|
|
2691
|
+
const splitTitle = new SplitText(heroHeadline, {
|
|
2692
|
+
type: 'lines',
|
|
2693
|
+
linesClass: 'gsap-title-line',
|
|
2694
|
+
});
|
|
2695
|
+
// Create mask wrapper for each line (like gsapTitleAnimation)
|
|
2696
|
+
const splitTitleMask = new SplitText(heroHeadline, {
|
|
2697
|
+
type: 'lines',
|
|
2698
|
+
linesClass: 'gsap-title-line-mask',
|
|
2699
|
+
});
|
|
2700
|
+
heroLines = heroHeadline.querySelectorAll('.gsap-title-line');
|
|
2701
|
+
if (heroLines.length > 0) {
|
|
2702
|
+
gsap.set(heroLines, { y: '100%' });
|
|
2703
|
+
pageLoadTimeline.to(heroLines, {
|
|
2704
|
+
y: '0%',
|
|
2705
|
+
duration: 1.2,
|
|
2706
|
+
stagger: 0.2,
|
|
2707
|
+
ease: 'loader',
|
|
2708
|
+
}, 0.2);
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
// 3. Direct children of .cs-tags - slide down from bottom with opacity, stagger
|
|
2713
|
+
const csTags = document.querySelector('.cs-tags');
|
|
2714
|
+
if (csTags && csTags.children.length > 0) {
|
|
2715
|
+
pageLoadTimeline.from(Array.from(csTags.children), {
|
|
2716
|
+
y: '100%',
|
|
2717
|
+
opacity: 0,
|
|
2718
|
+
duration: 1.2,
|
|
2719
|
+
ease: 'loader',
|
|
2720
|
+
stagger: 0.15,
|
|
2721
|
+
}, 0.4);
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
// Scroll animation for wideletters
|
|
2725
|
+
const wideletters = document.querySelectorAll('.wideletter');
|
|
2726
|
+
const isCshero = document.querySelector('.is-cshero');
|
|
2727
|
+
|
|
2728
|
+
if (wideletters.length === 0 && !isCshero) return;
|
|
2729
|
+
|
|
2730
|
+
// Timeline for letters OUT
|
|
2731
|
+
const lettersOutTimeline = gsap.timeline({ paused: true });
|
|
2732
|
+
if (wideletters.length > 0) {
|
|
2733
|
+
lettersOutTimeline.fromTo(wideletters,
|
|
2734
|
+
{ y: '0%', opacity: 1 },
|
|
2735
|
+
{
|
|
2736
|
+
y: '-150%',
|
|
2737
|
+
opacity: 0,
|
|
2738
|
+
duration: 0.6,
|
|
2739
|
+
ease: 'power2.in',
|
|
2740
|
+
stagger: 0.03,
|
|
2741
|
+
}
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
// Fade out .is-cshero on same timeline
|
|
2746
|
+
if (isCshero) {
|
|
2747
|
+
lettersOutTimeline.to(isCshero,
|
|
2748
|
+
{
|
|
2749
|
+
opacity: 0,
|
|
2750
|
+
duration: 0.6,
|
|
2751
|
+
ease: 'power2.in',
|
|
2752
|
+
},
|
|
2753
|
+
0
|
|
2754
|
+
);
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
// Trigger: .first-after-sticky top reaches 80% viewport → letters OUT, scroll back → reverse
|
|
2758
|
+
// End: when trigger top reaches top of viewport
|
|
2759
|
+
const firstAfterSticky = document.querySelector('.first-after-sticky');
|
|
2760
|
+
if (!firstAfterSticky) return;
|
|
2761
|
+
|
|
2762
|
+
ScrollTrigger.create({
|
|
2763
|
+
trigger: firstAfterSticky,
|
|
2764
|
+
start: 'top 80%',
|
|
2765
|
+
end: 'top top',
|
|
2766
|
+
onEnter: () => lettersOutTimeline.play(),
|
|
2767
|
+
onLeaveBack: () => lettersOutTimeline.reverse(),
|
|
2768
|
+
});
|
|
2769
|
+
};
|
|
2770
|
+
|
|
2668
2771
|
// Intro animation on page load
|
|
2669
2772
|
window.introAnimation = function(e) {
|
|
2670
2773
|
const introBrand = e.querySelector('[intro-brand]');
|
|
@@ -2911,6 +3014,10 @@ window.Webflow.push(() => {
|
|
|
2911
3014
|
gsapTitleAnimation();
|
|
2912
3015
|
gsapContainerAnimation();
|
|
2913
3016
|
gsapFadeAnimation();
|
|
3017
|
+
// Case Hero Animation - only if .first-after-sticky exists
|
|
3018
|
+
if (document.querySelector('.first-after-sticky')) {
|
|
3019
|
+
window.CaseHeroAnimation();
|
|
3020
|
+
}
|
|
2914
3021
|
// Refresh ScrollTrigger after creating all triggers to sync with Lenis
|
|
2915
3022
|
ScrollTrigger.refresh();
|
|
2916
3023
|
}, 200);
|