/* * @author ThemePunch * @link http://www.themepunch.com/ * @copyright 2018 ThemePunch */ ;(function(){function n(a,b,d,c,e,k,t,u,g,l){this.pause=!0;this.options=b;this.slide=d;this.img=c;this.slot=e;this.levels=k;this.widths=t;this.slider=a;this.fixEdges=u;this.edgeFix=g;l&&(b=document.createElement("style"),b.type="text/css",document.head.appendChild(b),this.blurstyle={sheet:b,css:"."+l+" .tp-bgimg, ."+l+" .slot {filter: blur({{blur}}px);}"},this.resizeBlur(),a.on("revolution.slide.afterdraw",this.blurSizer.bind(this)))}jQuery("li[data-revaddonpaintbrush]").each(function(){var a=jQuery(this); a.children("img").attr({"data-bgposition":"center center","data-kenburns":"off"}).data({bgposition:"center center",kenburns:"off"});a.attr("data-revaddonpaintbrushedges")&&a.attr("data-transition","fade").data("transition","fade")});jQuery("li[data-revaddonpaintbrushfallback]").each(function(){var a=jQuery(this),b=a.children("img");a=a.attr("data-revaddonpaintbrushfallback");var d=b.attr("data-lazyload");b.attr(d?"data-lazyload":"src",a);d&&b.data("lazyload",a)});var p,v="ontouchend"in document;window.RevSliderPaintBrush= function(a,b){if(p=a)b.on("revolution.slide.onloaded",function(){var a="",c=b[0].opt,e=c.responsiveLevels,k=c.gridwidth;Array.isArray(e)||(e=[e]);Array.isArray(k)||(k=[k]);b.find(".tp-revslider-slidesli[data-revaddonpaintbrush]").each(function(){var c,d=new Image,g=p(this).addClass("revaddon-paintbrush"),l=g.attr("data-index"),q=g.find(".slotholder"),f=JSON.parse(this.getAttribute("data-revaddonpaintbrush"));if(f.blur){var h="revaddonblurfilter_"+l;f.scaleblur?c=h:a+="."+h+" .tp-bgimg, ."+h+" .slot {filter: blur("+ f.blurAmount+"px);}";g.addClass(h)}if(f.fixedges&&f.edgefix){var r=1+.01*f.edgefix;var m=r.toFixed(2);m="scale("+m+", "+m+")";q.find(".tp-bgimg").css("transform",m);h="revaddonblurfilterfix_"+l;a+="."+h+" .tp-bgimg {transform: "+m+" !important}";g.addClass(h)}d.onload=function(){f.width=this.naturalWidth;f.height=this.naturalHeight;var a=new n(b,f,g,d,q[0],e,k,m,r,c);g.data("revaddonbrush",a);!a.pause&&a.ready&&(a.pause=!1,a.inited||a.init())};d.onerror=function(){console.log("PaintBrush Addon: background image could not be loaded")}; d.src=f.image});a&&(c=document.createElement("style"),c.type="text/css",c.innerHTML=a,document.head.appendChild(c))}).on("revolution.slide.onbeforeswap",function(a,c){var b=c.currentslide.data("revaddonbrush");b&&b.canvas&&(b.canvas.className="revaddonpaintbrush swapping")}).on("revolution.slide.onafterswap",function(a,c){var b;c.prevslide&&(b=c.prevslide.data("revaddonbrush"))&&(b.pause=!0,b.reset(),b.canvas&&(b.canvas.className="revaddonpaintbrush"));if(b=c.currentslide.data("revaddonbrush"))b.pause= !1,b.ready=!0,b.inited||b.init()})};n.prototype={init:function(){this.canvas=document.createElement("canvas");this.brush=document.createElement("canvas");this.canvas.className="revaddonpaintbrush";this.context=this.canvas.getContext("2d");this.ctx=this.brush.getContext("2d");this.slot.parentNode.insertBefore(this.canvas,this.slot.nextSibling);this.inited=!0;this.steps=[];this.options.carousel?setTimeout(this.start.bind(this),100):this.start()},start:function(){if(this.options.carousel)this.slide.on("mousemove touchmove", this.onMove.bind(this));else this.slider.on("mousemove touchmove",this.onMove.bind(this));this.slider.on("revolution.slide.afterdraw",this.sizer.bind(this));this.resize()},onMove:function(a){if(!this.pause){v&&(a=a.originalEvent,a.preventDefault(),a.touches&&(a=a.touches[0]));var b=this.canvas.getBoundingClientRect();this.steps.unshift({time:Date.now(),x:a.clientX-b.left,y:a.clientY-b.top});this.draw()}},updateSteps:function(){for(var a=Date.now(),b=0;b this.options.fade&&(this.steps.length=b)},paint:function(){for(var a=this.steps.length,b=Date.now(),d,c=1;cMath.abs(e-1)&&c