PageSourceSearch

https://www.uzakrota.com/wp-content/plugins/evenex-essential/modules//parallax/assets/js/magician.js?ver=1.5.9

js uzakrota.com collected 2026-10-03 22:16:43 UTC 9,454 bytes, 271 lines download raw bytes

1/*
2 * magician.js v1.0.0
3 * (c) 2019 Oxaim
4 * Released under the MIT license
5 * http://oxa.im
6 */
7
8(function( $ ) {
9    "use strict";
10    $.fn.magician = function( options ) {
11
12        const debug = false;
13        const scriptName = 'magicianJS';
14        const scriptVersion = '1.0';
15 
16        var settings = $.extend({
17            // These are the defaults.
18            container: $(window),
19            uniqueKey: '',
20            type: 'scroll',
21            offsetTop: 0,
22            duration: 1000,
23            offsetBottom: 0,
24            animation: {}
25        }, options );
26
27        var $container,
28            $target,
29
30            docViewHeight,
31            docViewTop,
32            docViewBottom,
33            eHeight,
34            eTop,
35            eBottom,
36            animationObject,
37            
38            scrollPosPrev,
39            scrollPos;
40        
41         
42        
43        
44
45
46        // helpers
47        var setPosition = function(){
48            docViewHeight = $container.height() - (settings.offsetTop + settings.offsetBottom);
49            docViewTop = $container.scrollTop() + settings.offsetTop;
50            docViewBottom = docViewTop + docViewHeight;
51            eHeight = $target.outerHeight();
52            eTop = $target.offset().top;
53            eBottom = eTop + eHeight;
54            return;
55        }
56        
57        var isInView = function(){
58            return ((eTop <= docViewBottom) && (eBottom >= docViewTop));
59        }
60        
61        var log = function($var, $indentifier){
62            if(debug == true){
63                if($indentifier !== undefined){
64                }
65            }
66        }
67
68
69        // machalisms
70        var scrollMachalism = function(){
71            setPosition();
72            if(isInView($target) == true){
73                scrollPos = (docViewTop - eTop) + (docViewHeight);
74            }else{
75                if(eTop <= docViewBottom){
76                    scrollPos = docViewHeight + eHeight;
77                }
78                if(eBottom >= docViewTop){
79                    scrollPos = 0;
80                }
81            }
82            scrollPos = Math.floor((scrollPos / (docViewHeight + eHeight)) * 1000);
83
84            $({ n: scrollPosPrev }).animate({ n: scrollPos}, {
85                duration: settings.duration,
86                easing: 'easeOutQuad',
87                step: function(now, fx) {
88                    animationObject.seek(now);
89                },
90            });
91            scrollPosPrev = scrollPos;
92
93        }
94
95
96
97        // constructor
98        this.each(function() {
99            $target = $(this);
100            $container = (typeof settings.container == 'object') ? settings.container : $target.parents(settings.container).eq(0);
101
102            switch(settings.type){
103                case 'scroll':
104                    var animation = $.extend(settings.animation, {
105                        targets: $target.get(),
106                        duration: 1000,
107                        elasticity: 0,
108                        easing: 'linear',
109                        autoplay: false
110                    });
111
112                    log(animation);
113                    animationObject = anime(animation);
114                    
115                    scrollMachalism();
116
117                    $container.on('scroll.magicianscrolleffect' + settings.uniqueKey, scrollMachalism);
118                    break;
119
120                case 'mousemove':
121                        var relX = e.pageX - $target.offset().left;
122                        var relY = e.pageY - $target.offset().top;
123        
124                        TweenMax.to($target.find('.elementor-repeater-item-' + obj._id), 1, {
125                            x: (relX - $target.width() / 2) / $target.width() * obj.parallax_speed,
126                            y: (relY - $target.height() / 2) / $target.height() * obj.parallax_speed,
127                            ease: Power2.ease
128                        });
129                    break;
130            }
131        });
132        return this;
133    };
134
135
136jQuery.easing['jswing'] = jQuery.easing['swing'];
137
138jQuery.extend( jQuery.easing,
139{
140    def: 'easeOutQuad',
141    swing: function (x, t, b, c, d) {
142        //alert(jQuery.easing.default);
143        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
144    },
145    easeInQuad: function (x, t, b, c, d) {
146        return c*(t/=d)*t + b;
147    },
148    easeOutQuad: function (x, t, b, c, d) {
149        return -c *(t/=d)*(t-2) + b;
150    },
151    easeInOutQuad: function (x, t, b, c, d) {
152        if ((t/=d/2) < 1) return c/2*t*t + b;
153        return -c/2 * ((--t)*(t-2) - 1) + b;
154    },
155    easeInCubic: function (x, t, b, c, d) {
156        return c*(t/=d)*t*t + b;
157    },
158    easeOutCubic: function (x, t, b, c, d) {
159        return c*((t=t/d-1)*t*t + 1) + b;
160    },
161    easeInOutCubic: function (x, t, b, c, d) {
162        if ((t/=d/2) < 1) return c/2*t*t*t + b;
163        return c/2*((t-=2)*t*t + 2) + b;
164    },
165    easeInQuart: function (x, t, b, c, d) {
166        return c*(t/=d)*t*t*t + b;
167    },
168    easeOutQuart: function (x, t, b, c, d) {
169        return -c * ((t=t/d-1)*t*t*t - 1) + b;
170    },
171    easeInOutQuart: function (x, t, b, c, d) {
172        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
173        return -c/2 * ((t-=2)*t*t*t - 2) + b;
174    },
175    easeInQuint: function (x, t, b, c, d) {
176        return c*(t/=d)*t*t*t*t + b;
177    },
178    easeOutQuint: function (x, t, b, c, d) {
179        return c*((t=t/d-1)*t*t*t*t + 1) + b;
180    },
181    easeInOutQuint: function (x, t, b, c, d) {
182        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
183        return c/2*((t-=2)*t*t*t*t + 2) + b;
184    },
185    easeInSine: function (x, t, b, c, d) {
186        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
187    },
188    easeOutSine: function (x, t, b, c, d) {
189        return c * Math.sin(t/d * (Math.PI/2)) + b;
190    },
191    easeInOutSine: function (x, t, b, c, d) {
192        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
193    },
194    easeInExpo: function (x, t, b, c, d) {
195        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
196    },
197    easeOutExpo: function (x, t, b, c, d) {
198        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
199    },
200    easeInOutExpo: function (x, t, b, c, d) {
201        if (t==0) return b;
202        if (t==d) return b+c;
203        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
204        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
205    },
206    easeInCirc: function (x, t, b, c, d) {
207        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
208    },
209    easeOutCirc: function (x, t, b, c, d) {
210        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
211    },
212    easeInOutCirc: function (x, t, b, c, d) {
vendor: 2,645 bytes, lines 213-271
213        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
214        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
215    },
216    easeInElastic: function (x, t, b, c, d) {
217        var s=1.70158;var p=0;var a=c;
218        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
219        if (a < Math.abs(c)) { a=c; var s=p/4; }
220        else var s = p/(2*Math.PI) * Math.asin (c/a);
221        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
222    },
223    easeOutElastic: function (x, t, b, c, d) {
224        var s=1.70158;var p=0;var a=c;
225        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
226        if (a < Math.abs(c)) { a=c; var s=p/4; }
227        else var s = p/(2*Math.PI) * Math.asin (c/a);
228        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
229    },
230    easeInOutElastic: function (x, t, b, c, d) {
231        var s=1.70158;var p=0;var a=c;
232        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
233        if (a < Math.abs(c)) { a=c; var s=p/4; }
234        else var s = p/(2*Math.PI) * Math.asin (c/a);
235        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
236        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
237    },
238    easeInBack: function (x, t, b, c, d, s) {
239        if (s == undefined) s = 1.70158;
240        return c*(t/=d)*t*((s+1)*t - s) + b;
241    },
242    easeOutBack: function (x, t, b, c, d, s) {
243        if (s == undefined) s = 1.70158;
244        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
245    },
246    easeInOutBack: function (x, t, b, c, d, s) {
247        if (s == undefined) s = 1.70158; 
248        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
249        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
250    },
251    easeInBounce: function (x, t, b, c, d) {
252        return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
253    },
254    easeOutBounce: function (x, t, b, c, d) {
255        if ((t/=d) < (1/2.75)) {
256            return c*(7.5625*t*t) + b;
257        } else if (t < (2/2.75)) {
258            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
259        } else if (t < (2.5/2.75)) {
260            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
261        } else {
262            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
263        }
264    },
265    easeInOutBounce: function (x, t, b, c, d) {
266        if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
267        return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
268    }
269});
270
271}( 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.