PageSourceSearch

https://mevren.ai/wp-content/themes/ainus/elements/assets/js/text-animate.js?ver=1.0.1

js mevren.ai collected 2026-10-05 13:36:48 UTC 5,868 bytes, 149 lines download raw bytes

1( function( $ ) {
2
3    function gsapTextAnimate($scope) {
4        let elements = $scope.find('.text-animate');
5        if(!elements.length) return;    
6        const applyEffects = (el) => {
7            let text = $(el).find('> .pxl-title-text, > .pxl-subtitle-text, > p, > .pxl-post-title');
8            let splitType = $(el).attr('data-split-text');
9            let elClass = $(el).attr('class');
10            let attrs = {
11                type: splitType?? 'lines',
12                linesClass: 'line',
13                wordsClass: 'word',
14                charsClass: 'char',
15                tag       : 'div',
16            };
17            if (splitType === 'words') {
18                attrs = { ...attrs, type: 'words' };
19            } else if (splitType === 'chars') {
20                attrs = { ...attrs, type: 'words, chars', wordsClass: 'word'};
21            }
22
23            if (el.splitTextInstance) {
24                el.splitTextInstance.revert();
25            }
26            $(el).css('visibility', 'visible');
27            let splitText;
28            if (!$(el).hasClass('text-splitted')) {
29                splitText = new SplitText(text[0], attrs);
30                $(el).addClass('text-splitted');
31                el.splitTextInstance = splitText;
32            } else {
33                splitText = el.splitTextInstance;
34            }
35            
36
37            let animateTarget = [];
38            let stagger = 0.015;
39            if (splitType === 'chars') {
40                animateTarget = splitText.chars;
41            } else if (splitType === 'words') {
42                animateTarget = splitText.words;
43                stagger = stagger * 3;
44            } else {
45                animateTarget = splitText.lines;
46                stagger = stagger * 5;
47            }
48
49
50            let gsapParams = {
51                x: 0,
52                y: 0,
53                opacity: 1,
54                rotation: 0,
55                rotateX : 0,
56                duration: 0.5,
57                delay: 0,
58                stagger: stagger,
59                force3D: true,
60                scrollTrigger: {
61                    trigger: el,
62                    start: "top 85%", 
63                    end  : "top 45%",
64                    toggleActions: `play none none none`,
65                    scrub: false,
66                    // stagger: stagger,
67                },
68            }
69            if(elClass.includes('text-fade-in')) {
70                gsapParams.opacity = 0;
71                if(elClass.includes('text-fade-in-right')) 
72                    gsapParams.x = 30;
73                else if(elClass.includes('text-fade-in-left'))
74                    gsapParams.x = -30;
75                else if(elClass.includes('text-fade-in-up'))
76                    gsapParams.y = 30;
77                else if(elClass.includes('text-fade-in-down'))
78                    gsapParams.y = -30;
79            }else if(elClass.includes('text-explosion')) {
80                gsapParams.x = () => gsap.utils.random(-1000, 1000)
81                gsapParams.y = () => gsap.utils.random(-1000, 1000)
82                gsapParams.rotation = () => gsap.utils.random(-90, 90)
83                gsapParams.scale = () => gsap.utils.random(0.5, 1.5)
84                gsapParams.opacity = 0
85            }else if(elClass.includes('text-zigzag-zoom')) {
86                animateTarget.forEach((target, i) => {
87                    gsap.from(target, {
88                        scale: (i % 2 === 0) ? 0 : 2,
89                        opacity: 0,
90                        duration: 0.75,
91                        stagger: 0,
92                        scrollTrigger: {
93                            trigger: el,
94                            start: "top 90%", 
95                            end: "top 60%",
96                            toggleActions: `play none none none`,
97                            scrub: false,
98                        }
99                    });
100                });
101                return; 
102            }else if(elClass.includes('text-flip-x')) {
103                gsap.set(el, {perspective: '50px'})
104                gsapParams.rotateX = 90;
105                gsapParams.opacity = 0;
106            }else if(elClass.includes('text-flip-y')) {
107                gsap.set(el, {perspective: '50px'})
108                gsapParams.rotateY = 90;
109                gsapParams.opacity = 0;
110            }
111            if(elClass.includes('text-reveal')) {
112                gsapParams.scrollTrigger.scrub = true;
113            }            
114            gsap.from(animateTarget, gsapParams);
115        };
116
117        elements.each(function (i, el) {
118            applyEffects(el);
119        });
120        
121        let resizeTimeout;
122        $(window).on('resize', function () {
123            clearTimeout(resizeTimeout);
124            resizeTimeout = setTimeout(function () {
125                elements.each(function (i, el) {
126                    if (el.splitTextInstance) {
127                        el.splitTextInstance.revert();
128                        el.splitTextInstance = null;
129                    }
130                    $(el).removeClass('text-splitted');
131                    applyEffects(el); 
132                });
133            }, 300);
134        });
135    }
136
137    $( window ).on( 'elementor/frontend/init', function() {
138        elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_heading.default`, function( $scope ) {
139            gsapTextAnimate($scope);
140        });
141        elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_text_editor.default`, function( $scope ) {
142            gsapTextAnimate($scope);
143        });
144        elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_post_title.default`, function( $scope ) {
145            gsapTextAnimate($scope);
146        });
147    });
148
149})( 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.