trAvis - MANAGER
Edit File: theplus-shape-morph.min.js
(function(a){"use strict";a(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/tp-morphing-layouts.default",b)}),a(window).on("load resize",function(){var b=window.innerWidth,c=a(".plus-morphing-svg-wrapper");if(0<c.length)for(var d=document.querySelectorAll(".plus-morphing-svg-wrapper"),e=0;e<d.length;e++){var f=d[e],g=f.getAttribute("data-morph-width"),h=f.getAttribute("data-morph-wt"),j=f.getAttribute("data-morph-wm"),k=f.getAttribute("data-morph-height"),l=f.getAttribute("data-morph-ht"),m=f.getAttribute("data-morph-hm"),n=f.getAttribute("data-viewbox-width"),o=f.getAttribute("data-viewbox-wt"),p=f.getAttribute("data-viewbox-wm"),q=f.getAttribute("data-viewbox-height"),r=f.getAttribute("data-viewbox-ht"),s=f.getAttribute("data-viewbox-hm"),t=f.children[0];1025<=b&&(t.setAttribute("width",g),t.setAttribute("height",k),t.setAttribute("viewBox","0 0 "+n+" "+q)),1024>=b&&768<=b&&(""!=h&&null!=h?t.setAttribute("width",h):t.setAttribute("width",g),""!=l&&null!=l?t.setAttribute("height",l):t.setAttribute("height",k),""!=o&&null!=o&&""!=r&&null!=r?t.setAttribute("viewBox","0 0 "+o+" "+r):t.setAttribute("viewBox","0 0 "+n+" "+q)),767>=b&&(""!=j&&null!=j?t.setAttribute("width",j):""!=h&&null!=h?t.setAttribute("width",h):t.setAttribute("width",g),""!=m&&null!=m?t.setAttribute("height",m):""!=l&&null!=l?t.setAttribute("height",l):t.setAttribute("height",k),""!=p&&null!=p&&""!=s&&null!=s?t.setAttribute("viewBox","0 0 "+p+" "+s):""!=o&&null!=o&&""!=r&&null!=r?t.setAttribute("viewBox","0 0 "+o+" "+r):t.setAttribute("viewBox","0 0 "+n+" "+q))}});var b=function(a,b){var c=a.find(".plus-morphing-svg-wrapper"),d=a.find(".plus-morph-fixed-scroll-bg"),e=d.data("morph-fixed"),f=c.data("morphfixed"),g=c.data("morphrow"),h=c.data("morphcolumn"),i=c.data("id"),j=c.data("morph-id");const k=c.data("morph"),l=c.data("morphimage");var m=a.closest("section.elementor-element");if(m.length){if(0<a.closest(".elementor").find("> [data-morph-id=\""+j+"\"]").length){var n=a.closest(".elementor").find("> .plus-morphing-svg-wrapper");n.remove()}if(0<a.closest(".elementor").find("> [data-morph-fixed=\""+e+"\"]").length){var n=a.closest(".elementor").find("> .plus-morph-fixed-scroll-bg");n.remove()}if(0<a.closest("section.elementor-element").find("> [data-morph-id=\""+j+"\"]").length){var n=a.closest("section.elementor-element").find("> .plus-morphing-svg-wrapper");n.remove()}if(0<a.closest(".elementor-column").find("> [data-morph-id=\""+j+"\"]").length){var n=a.closest(".elementor-column").find("> .plus-morphing-svg-wrapper");n.remove()}}"yes"==f&&f!=null&&(c.closest(".elementor").prepend(c),0<d.length&&(d.closest(".elementor").prepend(d),d.closest(".elementor").css("position","inherit"))),"yes"==g&&g!=null&&c.closest("section.elementor-element").prepend(c),"yes"==h&&h!=null&&c.closest(".elementor-column").prepend(c);class o{constructor(a){if(this.DOM={},this.DOM.el=a,this.DOM.svg=this.DOM.el.querySelector(".morph"),this.DOM.path=this.DOM.svg.querySelector("path"),this.DOM.morph=this.DOM.el.dataset.morph,this.DOM.morph=JSON.parse(this.DOM.morph),this.DOM.fixed=this.DOM.el.dataset.morphfixed,this.DOM.parent_id=this.DOM.el.parentNode.getAttribute("data-elementor-id"),this.DOM.contentElems=b(".elementor .elementor-inner").length?Array.from(document.querySelectorAll(".elementor-"+this.DOM.parent_id+">.elementor-inner > .elementor-section-wrap > .elementor-element")):Array.from(document.querySelectorAll(".elementor-"+this.DOM.parent_id+"> .elementor-section-wrap > .elementor-element")),this.DOM.contentElemsTotal=this.DOM.contentElems.length,this.DOM.PathAltData=[],this.DOM.AnimationData=[],"yes"==this.DOM.fixed&&null!=this.DOM.morph.pathAlt){for(var c=0;c<this.DOM.morph.pathAlt.length;++c)if(null!=this.DOM.morph.pathAlt[c]&&""!=this.DOM.morph.pathAlt[c]){var d={value:this.DOM.morph.pathAlt[c],duration:this.DOM.morph.animation.path.duration[c]};this.DOM.PathAltData.push(d)}this.DOM.contentAlt=[Object.values(this.DOM.PathAltData)]}else this.DOM.contentAlt="";this.DOM.myData=[];for(var c=0;c<this.DOM.morph.path.length;++c)if(null!=this.DOM.morph.path[c]&&""!=this.DOM.morph.path[c]){var d={value:this.DOM.morph.path[c],duration:this.DOM.morph.duration};this.DOM.myData.push(d)}this.DOM.content_arr=[Object.values(this.DOM.myData)],this.DOM.image=this.DOM.svg.querySelector("image"),this.DOM.image?(this.DOM.imageJSON=this.DOM.el.dataset.morphimage,this.DOM.imageJSON=JSON.parse(this.DOM.imageJSON)):this.DOM.imageJSON="",this.CONFIG={animation:{path:{duration:this.DOM.morph.duration||3500,delay:this.DOM.morph.delay||0,easing:this.DOM.morph.easing||"linear",elasticity:this.DOM.morph.elasticity||300},svg:{duration:1,delay:this.DOM.morph.delay||0,easing:this.DOM.morph.easing||"linear",scaleX:this.DOM.morph.scaleX||1,scaleY:this.DOM.morph.scaleY||1,translateX:this.DOM.morph.tx||0,translateY:this.DOM.morph.ty||0,rotate:this.DOM.morph.rotate||0},image:{duration:this.DOM.imageJSON.duration||800,delay:this.DOM.imageJSON.delay||0,easing:this.DOM.morph.easing||"linear",elasticity:this.DOM.imageJSON.elasticity||300,scaleX:this.DOM.imageJSON.scaleX||1,scaleY:this.DOM.imageJSON.scaleY||1,translateX:this.DOM.imageJSON.trans_x||0,translateY:this.DOM.imageJSON.trans_y||0,rotate:this.DOM.imageJSON.rotate||0,hover_scaleX:this.DOM.imageJSON.hover_scaleX||1,hover_scaleY:this.DOM.imageJSON.hover_scaleY||1,hover_translateX:this.DOM.imageJSON.hover_trans_x||0,hover_translateY:this.DOM.imageJSON.hover_trans_y||0,hover_rotate:this.DOM.imageJSON.hover_rotate||0}}},"yes"==this.DOM.fixed?this.createScrollWatchers():this.initEvents()}initEvents(){this.mouseenterFn=()=>{this.mouseTimeout=setTimeout(()=>{this.isActive=!0,this.animate()},75)},this.mouseleaveFn=()=>{clearTimeout(this.mouseTimeout),this.isActive&&(this.isActive=!1,this.animate())},this.isActive=!1,this.animate(),("yes"==this.DOM.imageJSON.image_hover||"yes"==this.DOM.morph.hover_path)&&(this.DOM.el.addEventListener("mouseenter",this.mouseenterFn),this.DOM.el.addEventListener("mouseleave",this.mouseleaveFn),this.DOM.el.addEventListener("touchstart",this.mouseenterFn),this.DOM.el.addEventListener("touchend",this.mouseleaveFn))}getAnimeObj(a){const b=this.DOM[a];let c={targets:b,duration:this.CONFIG.animation[a].duration,delay:this.CONFIG.animation[a].delay,easing:this.CONFIG.animation[a].easing};return"path"===a&&(c.d="yes"==this.DOM.morph.hover_path?this.isActive?this.DOM.content_arr[0][0]:this.DOM.content_arr[0][1]:this.isActive?this.DOM.content_arr[0]:this.DOM.content_arr[0],"yes"!=this.DOM.morph.hover_path&&(c.loop=!0,c.fill={value:this.DOM.morph.fill.color,duration:500,easing:this.DOM.morph.fill.easing},c.direction="alternate")),("svg"===a||"image"===a)&&(c.elasticity=this.CONFIG.animation[a].elasticity,c.scaleX=this.isActive?this.CONFIG.animation[a].hover_scaleX:this.CONFIG.animation[a].scaleX,c.scaleY=this.isActive?this.CONFIG.animation[a].hover_scaleY:this.CONFIG.animation[a].scaleY,c.translateX=this.isActive?this.CONFIG.animation[a].hover_translateX:this.CONFIG.animation[a].translateX,c.translateY=this.isActive?this.CONFIG.animation[a].hover_translateY:this.CONFIG.animation[a].translateY,c.rotate=this.isActive?this.CONFIG.animation[a].hover_rotate:this.CONFIG.animation[a].rotate),anime.remove(b),c}initShapeLoop(a,b,c,d){a=a||0,anime.remove(b),anime({targets:b,easing:"linear",d:[d[0][a],c[0][a]],loop:!0,fill:{value:this.DOM.morph.animation.fill.color[a],duration:this.DOM.morph.animation.fill.duration[a],easing:this.DOM.morph.animation.fill.easing[a]},direction:"alternate"})}initShapeEl(){anime.remove(this.DOM.svg),anime({targets:this.DOM.svg,duration:1,easing:"linear",scaleX:this.DOM.morph.animation.scaleX[0],scaleY:this.DOM.morph.animation.scaleY[0],translateX:this.DOM.morph.animation.tx[0]+"px",translateY:this.DOM.morph.animation.ty[0]+"px",rotate:this.DOM.morph.animation.rotate[0]+"deg"})}createScrollWatchers(){var a=0,b=this.DOM.contentElemsTotal,c=this.DOM.svg,d=this.DOM.path;const e=this.DOM.content_arr,f=this.DOM.contentAlt;var g=this.DOM.morph.animation,h=document.querySelector(".theoutset-footer-main"),i=this.DOM.morph.fill.color,j=this.DOM.morph.fill.easing;this.initShapeEl(),this.initShapeLoop(0,d,e,f,i,500,j);var k;this.DOM.contentElems.forEach((h,i)=>{const j=i?this.DOM.contentElems[i]:this.DOM.contentElems[i];i=i?i:b;const l=scrollMonitor.create(j,-300);l.enterViewport(function(){a=i,k=b>=e[0].length&&i+1>e[0].length?0:i,anime.remove(d),anime({targets:d,duration:g.path.duration[k]||2500,easing:g.path.easing[k]||"linear",elasticity:g.path.elasticity[k]||0,d:e[0][k],fill:{value:g.fill.color[k],duration:g.fill.duration[k]||500,easing:g.fill.easing[k]||"linear"},complete:function(){k=k||0,anime.remove(d),anime({targets:d,easing:"linear",d:[f[0][k],e[0][k]],loop:!0,fill:{value:g.fill.color[k],duration:g.fill.duration[k],easing:g.fill.easing[k]},direction:"alternate"})}}),anime.remove(c),anime({targets:c,duration:g.svg.duration[k],easing:g.svg.easing[k],elasticity:0,scaleX:g.scaleX[k],scaleY:g.scaleY[k],translateX:g.tx[k]+"px",translateY:g.ty[k]+"px",rotate:g.rotate[k]+"deg"})}),l.exitViewport(function(){var h=l.isAboveViewport?i+1:i-1;h<=b&&a!==h&&(a=h,k=b>e[0].length&&h+1>e[0].length?0:h,anime.remove(d),anime({targets:d,duration:g.path.duration[k]||2500,easing:g.path.easing[k]||"linear",elasticity:g.path.elasticity[k]||0,d:e[0][k],fill:{value:g.fill.color[k],duration:g.fill.duration[k],easing:g.fill.easing[k]},complete:function(){k=k||0,anime.remove(d),anime({targets:d,easing:"linear",d:[f[0][k],e[0][k]],loop:!0,fill:{value:g.fill.color[k],duration:g.fill.duration[k],easing:g.fill.easing[k]},direction:"alternate"})}}),anime.remove(c),anime({targets:c,duration:g.svg.duration[k],easing:g.svg.easing[k],elasticity:0,scaleX:g.scaleX[k],scaleY:g.scaleY[k],translateX:g.tx[k]+"px",translateY:g.ty[k]+"px",rotate:g.rotate[k]+"deg"}))})})}animate(){anime(this.getAnimeObj("path")),anime(this.getAnimeObj("svg")),anime(this.getAnimeObj("image"))}}const p=Array.from(document.querySelectorAll("."+i)),q=(()=>p.forEach(a=>new o(a)))()}})(jQuery);