@widelab-nc/widehue 1.0.11 → 1.0.13
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 +2 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +100 -39
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -20,6 +20,10 @@ function customGsapEasing() {
|
|
|
20
20
|
|
|
21
21
|
// Contact form open animation
|
|
22
22
|
let contactFormOpen;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
23
27
|
function contactFormOpenAnimation() {
|
|
24
28
|
const contactFormWrapper = document.querySelector('.contact-modal_main-wrapper');
|
|
25
29
|
const contactForm = document.querySelector('.contact-modal_content-wrapper');
|
|
@@ -28,14 +32,41 @@ function contactFormOpenAnimation() {
|
|
|
28
32
|
autoAlpha: 1,
|
|
29
33
|
duration: 0.3,
|
|
30
34
|
ease: 'loader2',
|
|
31
|
-
})
|
|
35
|
+
});
|
|
32
36
|
contactFormOpen.from(contactForm, {
|
|
33
37
|
x: '100%',
|
|
34
38
|
duration: 0.4,
|
|
35
39
|
ease: 'loader2',
|
|
36
|
-
}, '-=0.2')
|
|
40
|
+
}, '-=0.2');
|
|
41
|
+
|
|
42
|
+
// Nested function to handle project category clicks
|
|
43
|
+
function handleProjectCategoryClick() {
|
|
44
|
+
// Find all elements with [project-category]
|
|
45
|
+
const projectCategoryElements = document.querySelectorAll('[project-category]');
|
|
46
|
+
|
|
47
|
+
// Add click event listener to each [project-category] element
|
|
48
|
+
projectCategoryElements.forEach(projectCategoryElement => {
|
|
49
|
+
projectCategoryElement.addEventListener('click', () => {
|
|
50
|
+
const projectCategoryValue = projectCategoryElement.textContent.trim().toLowerCase(); // Convert to lowercase
|
|
51
|
+
|
|
52
|
+
// Find the matching checkbox element with data-name attribute (case insensitive)
|
|
53
|
+
const checkboxElement = document.querySelector(`.contact-modal_main-wrapper input[type="checkbox"][data-name="${projectCategoryValue}"]`);
|
|
54
|
+
|
|
55
|
+
if (checkboxElement) {
|
|
56
|
+
checkboxElement.click(); // Click on the checkbox element
|
|
57
|
+
console.log(`Clicked on checkbox for ${projectCategoryValue}`);
|
|
58
|
+
} else {
|
|
59
|
+
console.log(`No checkbox found for ${projectCategoryValue}`);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Call the function to initialize handling of project category clicks
|
|
66
|
+
handleProjectCategoryClick();
|
|
37
67
|
}
|
|
38
68
|
|
|
69
|
+
|
|
39
70
|
//Smooth scroll init
|
|
40
71
|
const lenis = new Lenis({
|
|
41
72
|
duration: 1.2,
|
|
@@ -423,18 +454,7 @@ window.briefContact = function(e) {
|
|
|
423
454
|
|
|
424
455
|
|
|
425
456
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
457
|
window.textScroll = function(e) {
|
|
429
|
-
// Ensure GSAP and ScrollTrigger are available
|
|
430
|
-
if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') {
|
|
431
|
-
console.error('GSAP or ScrollTrigger is not available.');
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// Register ScrollTrigger plugin with GSAP
|
|
436
|
-
gsap.registerPlugin(ScrollTrigger);
|
|
437
|
-
|
|
438
458
|
// Create a GSAP timeline for the reveal animation
|
|
439
459
|
const revealTimeline = gsap.timeline({
|
|
440
460
|
scrollTrigger: {
|
|
@@ -443,6 +463,27 @@ window.textScroll = function(e) {
|
|
|
443
463
|
}
|
|
444
464
|
});
|
|
445
465
|
|
|
466
|
+
// Initialize SplitText for the target text
|
|
467
|
+
const homeHeroHeading = new SplitText('#heroHeading', {
|
|
468
|
+
type: 'lines',
|
|
469
|
+
linesClass: 'hero-line',
|
|
470
|
+
});
|
|
471
|
+
const homeHeroHeadingMask = new SplitText('#heroHeading', {
|
|
472
|
+
type: 'lines',
|
|
473
|
+
linesClass: 'hero-line-mask',
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// Ensure .hero-line elements are created
|
|
477
|
+
const heroLines = document.querySelectorAll('.hero-line');
|
|
478
|
+
if (heroLines.length === 0) {
|
|
479
|
+
console.error('GSAP target .hero-line not found.');
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// Set initial state for hero lines and masks
|
|
484
|
+
gsap.set('.hero-line', { y: '100%' });
|
|
485
|
+
gsap.set('.hero-line-mask', { y: '100%' });
|
|
486
|
+
|
|
446
487
|
// Select all .reveal-scroll elements
|
|
447
488
|
const revealScrollElements = document.querySelectorAll('.reveal-scroll');
|
|
448
489
|
|
|
@@ -467,41 +508,61 @@ window.textScroll = function(e) {
|
|
|
467
508
|
stagger: 0.2,
|
|
468
509
|
ease: 'loader2',
|
|
469
510
|
}, '<'); // Sync with the opacity change of #heroHeading
|
|
511
|
+
|
|
512
|
+
// Sync the hero-line-mask animation with the hero-line animation
|
|
513
|
+
revealTimeline.fromTo('.hero-line-mask', {
|
|
514
|
+
y: '100%'
|
|
515
|
+
}, {
|
|
516
|
+
duration: 1.2,
|
|
517
|
+
y: '0%',
|
|
518
|
+
stagger: 0.2,
|
|
519
|
+
ease: 'loader2',
|
|
520
|
+
}, '<'); // Sync with the hero-line animation
|
|
470
521
|
};
|
|
471
522
|
|
|
472
523
|
|
|
473
524
|
|
|
474
|
-
window.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
525
|
+
window.HoverMaskVideo = function(e) {
|
|
526
|
+
const hoverTitles = $(".hover-title");
|
|
527
|
+
const hoverMasks = $(".hover-mask");
|
|
528
|
+
const hoverListItems = $(".hover-list-item");
|
|
478
529
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
530
|
+
hoverTitles.each(function(index) {
|
|
531
|
+
const animation = gsap.fromTo(
|
|
532
|
+
hoverMasks[index],
|
|
533
|
+
{ height: '0vh' }, // Start from 0vh
|
|
534
|
+
{
|
|
535
|
+
height: '73vh', // Go to 73vh
|
|
536
|
+
ease: 'loader',
|
|
537
|
+
duration: 1.5,
|
|
538
|
+
paused: true // Animation starts in reverse
|
|
539
|
+
}
|
|
540
|
+
);
|
|
541
|
+
|
|
542
|
+
$(this).on("mouseenter", () => {
|
|
543
|
+
animation.duration(1.5).play(); // Set duration to 1.5s and play
|
|
544
|
+
const closestListItem = $(this).closest(".hover-list-item")[0];
|
|
545
|
+
if (closestListItem) {
|
|
546
|
+
closestListItem.style.zIndex = 10;
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
$(this).on("mouseleave", () => {
|
|
551
|
+
animation.duration(0).reverse(); // Set duration to 0s and reverse
|
|
552
|
+
const closestListItem = $(this).closest(".hover-list-item")[0];
|
|
553
|
+
if (closestListItem) {
|
|
554
|
+
closestListItem.style.zIndex = ''; // Remove inline style
|
|
555
|
+
}
|
|
487
556
|
});
|
|
488
557
|
});
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
489
564
|
|
|
490
|
-
// Adding fade out effect for .cover-bg element
|
|
491
|
-
let coverBg = document.querySelector('.cover-bg');
|
|
492
565
|
|
|
493
|
-
if (coverBg) {
|
|
494
|
-
ScrollTrigger.create({
|
|
495
|
-
trigger: '.cover-bg',
|
|
496
|
-
start: "bottom center+=300", // Define the start point with an offset
|
|
497
|
-
end: "bottom top+=400", // Define the end point
|
|
498
|
-
scrub: true, // Smoothly scrub the animation based on the scroll position
|
|
499
|
-
onUpdate: self => {
|
|
500
|
-
gsap.to(coverBg, {opacity: self.progress, overwrite: true});
|
|
501
|
-
},
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
566
|
// Case study mask animation
|
|
506
567
|
window.caseStudyInteraction = function(e) {
|
|
507
568
|
// Video mask animation
|