PageSourceSearch

https://www.snh.cm/wp-content/themes/industrie/assets/js/interactions/rs-anim-int.js?ver=1.1.0

js snh.cm collected 2026-10-02 19:12:02 UTC 11,641 bytes, 264 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    $(window).on("load", function () {
5        gsap_rs_split_text();
6        gsap_rs_marqueeSlider();
7        gsap_rs_scrollRotate();
8        gsap_rs_MoveOnScroll();
9        gsap_rs_custom_cursor();
10        gsap_rs_image_reveal();
11    });
12
13    // Split Text
14    function gsap_rs_split_text() {
15        setTimeout(function () {
16            var splitTextElements = $(".rs-split-text-enable");
17            if (splitTextElements.length === 0) return;
18            gsap.registerPlugin(SplitText);
19            splitTextElements.each(function (index, element) {
20                var splitElement = new SplitText(element, {
21                    type: "chars, words", // "chars, words, lines"
22                });
23
24                gsap.set(element, { perspective: 400 });
25
26                if ($(element).hasClass("split-in-fade")) {
27                    gsap.set(splitElement.chars, { opacity: 0, ease: "Back.easeOut" });
28                }
29                if ($(element).hasClass("split-in-right")) {
30                    gsap.set(splitElement.chars, { opacity: 0, x: "20", ease: "Back.easeOut" });
31                }
32                if ($(element).hasClass("split-in-left")) {
33                    gsap.set(splitElement.chars, { opacity: 0, x: "-20", ease: "Back.easeOut" });
34                }
35                if ($(element).hasClass("split-in-up")) {
36                    gsap.set(splitElement.chars, { opacity: 0, y: "20", ease: "circ.out" });
37                }
38                if ($(element).hasClass("split-in-down")) {
39                    gsap.set(splitElement.chars, { opacity: 0, y: "-20", ease: "circ.out" });
40                }
41                if ($(element).hasClass("split-in-rotate")) {
42                    gsap.set(splitElement.chars, { opacity: 0, rotateX: "50deg", ease: "circ.out" });
43                }
44                if ($(element).hasClass("split-in-scale")) {
45                    gsap.set(splitElement.chars, { opacity: 0, rotateX: "50deg", ease: "circ.out" });
46                }
47                element.anim = gsap.to(splitElement.chars, {
48                    scrollTrigger: { trigger: element, toggleActions: "restart pause resume reverse", start: "top 90%" },
49                    x: "0",
50                    y: "0",
51                    rotateX: "0",
52                    scale: 1,
53                    opacity: 1,
54                    duration: 0.8,
55                    stagger: 0.02
56                });
57            });
58        }, 200);
59    }
60
61    // Marquee Slider
62    function gsap_rs_marqueeSlider() {
63        let rs_Marquee_Slider = document.getElementsByClassName('gsap-marquee');
64        if (rs_Marquee_Slider.length) {
65            gsap.registerPlugin(ScrollTrigger);
66            Array.from(rs_Marquee_Slider).forEach(element => {
67                let directionClass = element.classList.contains('left') ? 'left' : 'right';
68                let durationClass = getDurationFromClass(element.classList);
69                let moveLengthClass = getMoveLengthFromClass(element.classList);
70                let timeline = gsap.timeline();
71                if (directionClass === 'left') {
72                    timeline.to(element, {
73                        x: -moveLengthClass,
74                        duration: durationClass,
75                        repeat: -1,
76                        ease: 'linear'
77                    });
78                } else {
79                    timeline.to(element, {
80                        x: moveLengthClass,
81                        duration: durationClass,
82                        repeat: -1,
83                        ease: 'linear'
84                    });
85                }
86                timeline.to(element, {
87                    xPercent: 6,
88                    scrollTrigger: {
89                        trigger: element,
90                        scrub: 1
91                    }
92                });
93            });
94        }
95        function getDurationFromClass(classList) {
96            for (let className of classList) {
97                if (className.startsWith('speed-')) {
98                    return parseInt(className.substring(6));
99                }
100            }
101            return 50;
102        }
103        function getMoveLengthFromClass(classList) {
104            for (let className of classList) {
105                if (className.startsWith('move-to-')) {
106                    return parseInt(className.substring(8));
107                }
108            }
109            return 1000;
110        }
111    }
112
113    // Rotate on Scroll
114    function gsap_rs_scrollRotate() {
115        gsap.registerPlugin(ScrollTrigger);
116
117        document.querySelectorAll('.gsap-rotate').forEach((element, index) => {
118            let rotationSpeed = 0.2;
119            gsap.to(element, {
120                rotation: 360 * rotationSpeed,
121                scrollTrigger: {
122                    trigger: element,
123                    start: 'top 90%',
124                    end: 'bottom',
125                    scrub: 1
126                }
127            });
128        });
129        document.querySelectorAll('.gsap-rotate-anti').forEach((element, index) => {
130            let rotationSpeed = 0.2;
131            gsap.to(element, {
132                rotation: -360 * rotationSpeed,
133                scrollTrigger: {
134                    trigger: element,
135                    start: 'top 90%',
136                    end: 'bottom',
137                    scrub: 1
138                }
139            });
140        });
141    }
142
143    // Move any direction on scroll
144    function gsap_rs_MoveOnScroll() {
145        gsap.registerPlugin(ScrollTrigger);
146        document.querySelectorAll('.gsap-move').forEach((element, index) => {
147            let moveDistance = extractMoveDistanceAnadDirectionFromClass(element.className);
148            let startPercentage = extractStartPercentageFromClass(element.className, 20);
149            let moveProperties = {};
150            switch (moveDistance.direction) {
151                case 'right':
152                    moveProperties = { x: moveDistance.value };
153                    break;
154                case 'left':
155                    moveProperties = { x: -moveDistance.value };
156                    break;
157                case 'up':
158                    moveProperties = { y: -moveDistance.value };
159                    break;
160                case 'down':
161                    moveProperties = { y: moveDistance.value };
162                    break;
163                default:
164                    break;
165            }
166            gsap.to(element, {
167                x: moveProperties.x || 0,
168                y: moveProperties.y || 0,
169                scrollTrigger: {
170                    trigger: element,
171                    start: `top ${startPercentage}%`,
172                    scrub: 1.7,
173                }
174            });
175        });
176        // Passing which direction and distance value eg:left-200 will pass to left 200px
177        function extractMoveDistanceAnadDirectionFromClass(className) {
178            const regex = /(?:^|\s)(left|right|up|down)(?:-(\d+))?(?:\s|$)/;
179            const match = className.match(regex);
180            const direction = match ? match[1] : 'right';
181            const value = match && match[2] ? parseFloat(match[2]) : 0;
182            return { direction, value };
183        }
184        // Passing start from value eg:start-90 will pass 90%
185        function extractStartPercentageFromClass(className, defaultValue) {
186            const regex = /(?:^|\s)start-(\d+)(?:\s|$)/;
187            const match = className.match(regex);
188            return match !== null ? parseInt(match[1]) : defaultValue;
189        }
190    }
191
192    // Custom Cursor
193    function gsap_rs_custom_cursor() {
194        var cursorBall = document.getElementById("cursor-ball");
195        if (cursorBall) {
196            let mouse = { x: 0, y: 0 };
197            let pos = { x: 0, y: 0 };
198            let ratio = 0.99;
199            let active = false;
200            gsap.set(cursorBall, { xPercent: -50, yPercent: -50, borderWidth: "1px", width: "40px", height: "40px" });
201            document.addEventListener("mousemove", mouseMove);
202            function mouseMove(e) {
203                var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
204                mouse.x = e.pageX;
205                mouse.y = e.pageY - scrollTop;
206            }
207            gsap.ticker.add(updatePosition);
208            function updatePosition() {
209                if (!active) {
210                    pos.x += (mouse.x - pos.x) * ratio;
211                    pos.y += (mouse.y - pos.y) * ratio;
212                    gsap.to(cursorBall, { duration: 0.08, x: pos.x, y: pos.y });
213                }
214            }
215            
216            // Common Area
217            $("a, button, input[type=submit], .slick-arrow, .slick-dots li button, .player-btn-comn, .revslider-initialised rs-arrow, .search_icons i, .rs-mnt, .rs-yrs, .tp-bullet, .rsoffwrap-close, .pricing-switcher-wrapper span").on("mouseenter", function (e) {
218                gsap.to(cursorBall, { borderColor: "rgba(34, 34, 34, 0.05", scale: 1.7, opacity: 0.15, backgroundColor: "rgba(34, 34, 34, 0.2)" });
219            });
220            $("a, button, input[type=submit], .slick-arrow, .slick-dots li button, .player-btn-comn, .revslider-initialised rs-arrow, .search_icons i, .rs-mnt, .rs-yrs, .tp-bullet, .rsoffwrap-close, .pricing-switcher-wrapper span").on("mouseleave", function (e) {
221                gsap.to(cursorBall, { borderColor: "rgba(156, 156, 156, 0.5)", scale: 1, opacity: 1, backgroundColor: "transparent", width: "40px", height: "40px" });
222                gsap.ticker.add(updatePosition);
223            });
224
225            // Scroll To Top
226            $("#scrollUp i").on("mouseenter", function (e) {
227                gsap.to(cursorBall, { borderColor: "rgba(34, 34, 34, 0.05)", borderRadius: "5px", width: "40px", height: "40px", opacity: 0.35, backgroundColor: "rgba(34, 34, 34, 0.3)" });
228            });
229            $("#scrollUp i").on("mouseleave", function (e) {
230                gsap.to(cursorBall, { borderColor: "rgba(156, 156, 156, 0.5)", opacity: 1, borderRadius: "50%", backgroundColor: "transparent", width: "40px", height: "40px" });
231                gsap.ticker.add(updatePosition);
232            });
233        }
234    }
235
236    // Image Revel
237    function gsap_rs_image_reveal() {
238        gsap.registerPlugin(ScrollTrigger);
239    
240        document.querySelectorAll(".rs-image.scroll_reveal").forEach((wrapper) => {
241            let image = wrapper.querySelector(".rs-image.scroll_reveal img");
242            let directionClass = wrapper.classList.contains('reveal_left') ? 'reveal_left' : 'reveal_right';
243    
244            let reveal_trigger = gsap.timeline({
245                scrollTrigger: {
246                    trigger: wrapper,
247                    toggleActions: "restart pause resume reverse",
248                }
249            }).set(wrapper, { autoAlpha: 1 });
250    
251            // Add the class `.reveal-active`
252            wrapper.classList.add("reveal-active");
253    
254            if (directionClass === 'reveal_left') {
255                reveal_trigger.from(wrapper, 1, { xPercent: -50, ease: Power2.out })
256                    .from(image, 1, { xPercent: 50, scale: 1.3, delay: -1, ease: Power2.out });
257            } else {
258                reveal_trigger.from(wrapper, 1, { xPercent: 50, ease: Power2.out })
259                    .from(image, 1, { xPercent: -50, scale: 1.3, delay: -1, ease: Power2.out });
260            }
261        });
262    }
263    
264})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.