
/*
	* LayerSlider Add-On: Reveal Layer Effect
	*
	* (c) 2011-2026 George Krupa, John Gera & Kreatura Media
	*
	* LayerSlider home:		https://layerslider.com/
	* Licensing:			https://layerslider.com/licensing/
*/



;(function(a){window._layerSlider.plugins.reveal=function(b){var c=this,d=window._lsData;c.pluginData={name:"Reveal Add-On for LayerSlider",key:"reveal",version:"1.0",requiredLSVersion:"8.0.0",authorName:"Kreatura",releaseDate:"2025. 10. 30."},c.pluginDefaults={eventNamespace:"rev"},c.state={initialized:!1},c.init=function(){c.extendLayerSlider(),c.state.initialized=!0},c.settings={skipOpening:!0,animation:"l",durationFill:800,durationHide:300,wait:300,easing:"easeOutQuart",background:"",tileDelay:0,skipFillAtFirst:!1,mirrorTransition:!0,endingTransition:!1},c.data={points:{tl:"0% 0%",tc:"50% 0%",tr:"100% 0%",ml:"0% 50%",m:"50% 50%",mr:"100% 50%",bl:"0% 100%",bc:"50% 100%",br:"100% 100%"}};var e=function(){var a,b=[];for(a=0;a<arguments.length;a++)b.push(c.data.points[arguments[a]]);return b.join(", ")};c.data.effects={f:[e("tl","tr","br","bl")],l:[e("tl","tl","bl","bl"),e("tr","tr","br","br")],t:[e("tl","tr","tr","tl"),e("bl","br","br","bl")],r:[e("tr","tr","br","br"),e("tl","tl","bl","bl")],b:[e("bl","br","br","bl"),e("tl","tr","tr","tl")],tl:[e("tl","tl","tl","tl"),e("br","br","br","br")],tr:[e("tr","tr","tr","tr"),e("bl","bl","bl","bl")],br:[e("br","br","br","br"),e("tl","tl","tl","tl")],bl:[e("bl","bl","bl","bl"),e("tr","tr","tr","tr")],fml:[e("mr","mr","mr","mr"),e("tl","tl","bl","bl")],fmt:[e("bc","bc","bc","bc"),e("tl","tr","tr","tl")],fmr:[e("ml","ml","ml","ml"),e("tr","tr","br","br")],fmb:[e("tc","tc","tc","tc"),e("bl","br","br","bl")],tml:[e("tl","tl","bl","bl"),e("mr","mr","mr","mr")],tmt:[e("tl","tr","tr","tl"),e("bc","bc","bc","bc")],tmr:[e("tr","tr","br","br"),e("ml","ml","ml","ml")],tmb:[e("bl","br","br","bl"),e("tc","tc","tc","tc")],otl:[e("br","tr","br","bl"),e("tl","tr","tl","bl")],otr:[e("tl","bl","br","bl"),e("tl","tr","br","tr")],obr:[e("tl","tr","tl","bl"),e("br","tr","br","bl")],obl:[e("tl","tr","br","tr"),e("tl","bl","br","bl")]},c.data.animations={"sides-h":["t","b"],"sides-v":["l","r"],"center-h":["b","t"],"center-v":["r","l"],"mirror-h":["l","r"],"mirror-h-rev":["r","l"],"mirror-v":["t","b"],"mirror-v-rev":["b","t"],"columns-l":["l","l","l","l"],"columns-r":["r","r","r","r"],"rows-t":["t","t","t","t"],"rows-b":["b","b","b","b"],"from-middle-q":["br","bl","tl","tr"],"to-middle-q":["tl","tr","br","bl"],"from-sides-q":["l","t","r","b"],"to-sides-q":["r","b","l","t"],"from-middle-c":["fmt","fmr","fmb","fml"],"to-middle-c":["tmt","tmr","tmb","tml"],"origami-from-middle-q":["otl","otr","obr","obl"],"origami-to-middle-q":["obr","obl","otl","otr"]},c.extendLayerSlider=function(){b.plugins.addFunction("initSlidesBefore",c.pluginData.key,function(){c.$effectLayers=b.plugins.getLayersByEffect(c.pluginData.key),c.$effectLayers.each(function(b,d){a(d).data(c.pluginData.key,a.extend(!0,{},c.settings,a(d).data(c.pluginData.key)))})}),b.plugins.addFunction("wrapLayerEnd",c.pluginData.key,function(b){var d=b.$layer,e=b.layerData;if(c.$effectLayers.is(d)){var f=d.data(c.pluginData.key),g=a("<ls-reveal-wrapper></ls-reveal-wrapper>"),h=a("<ls-reveal class=\"ls-reveal-1\"></ls-reveal><ls-reveal class=\"ls-reveal-2\"></ls-reveal><ls-reveal class=\"ls-reveal-3\"></ls-reveal><ls-reveal class=\"ls-reveal-4\"></ls-reveal>");f.background&&-1!==f.background.indexOf("gradient")?h.css({backgroundImage:f.background}):(e.elements.$innerWrapper.css("color",d[0].style.color),f.background&&"currentColor"!==f.background?h.css({backgroundColor:f.background}):"text"==d[0].style.backgroundClip?h.css({backgroundImage:d[0].style.backgroundImage}):h.css({backgroundColor:"currentColor"})),(!e.in.enabled||f.skipOpening)&&(e.in.enabled=!0,e.in.duration=0),e.elements.$revWrapper=g,e.elements.$innerWrapper.append(g.append(h))}}),b.plugins.addFunction("setLayerPropertiesBeforeParsingDataLS",c.pluginData.key,function(a){var d=a.$layer,e=d.attr("data-ls"),f=d.data(c.pluginData.key);c.$effectLayers.is(d)&&f.endingTransition&&(e=b.functions.updateDataProp(e,"transitionout","true"),d.attr("data-ls",e))}),b.plugins.addFunction("afterResizeSingleLayer",c.pluginData.key,function(a){var b=a.$layer,d=a.layerData;c.$effectLayers.is(b)&&b.siblings("ls-reveal-wrapper").css({"border-radius":b.css("border-radius")||"0px"})}),b.plugins.addFunction("addLayersInBeforeTL",c.pluginData.key,function(a){var d=a.$layer,g=a.layerData;if(c.$effectLayers.is(d)){var i=d.data(c.pluginData.key),j=g.elements.$innerWrapper.find("ls-reveal-wrapper"),k=g.elements.$innerWrapper.find("ls-reveal.ls-reveal-1"),l=g.elements.$innerWrapper.find("ls-reveal.ls-reveal-2"),n=g.elements.$innerWrapper.find("ls-reveal.ls-reveal-3"),o=g.elements.$innerWrapper.find("ls-reveal.ls-reveal-4"),p=[],q="single",r=!!(b.slideshow.firstStart&&i.skipFillAtFirst),s=i.tileDelay/1e3;g.timelines._revTimeline=new b.gsap.TimelineMax({paused:!0}),g.timelines._revTimelineR=new b.gsap.TimelineMax({paused:!0}),i.skipOpening&&(g.in.duration=0);var t=r?0:i.durationFill/1e3,u=i.durationHide/1e3,v=r?0:i.wait/1e3;switch(i.animation){case"l":case"t":case"r":case"b":case"tl":case"tr":case"br":case"bl":case"otl":case"otr":case"obr":case"obl":break;case"sides-h":case"sides-v":case"center-h":case"center-h-rev":case"center-v":case"center-v-rev":case"mirror-h":case"mirror-h-rev":case"mirror-v":case"mirror-v-rev":q="duo",l.css("display","block");break;case"from-middle-q":case"to-middle-q":case"from-sides-q":case"to-sides-q":case"from-middle-c":case"to-middle-c":case"origami-from-middle-q":case"origami-to-middle-q":case"columns-l":case"columns-r":case"rows-t":case"rows-b":q="quad",l.css("display","block"),n.css("display","block"),o.css("display","block");break;default:console.warn("LayerSlider Reveal Effect: Invalid animation setting: "+i.animation),i.animation="l";}j.attr("data-reveal-anim",i.animation),"duo"==q||"quad"===q?p=c.data.animations[i.animation]:p.push(i.animation);var w,x,y=[[b.functions.convert.easing(i.easing),b.gsap.Linear.easeNone,g.timelines._revTimeline],[b.functions.convert.easing(i.easing,!0),b.gsap.Linear.easeNone,g.timelines._revTimelineR]],z=0,A=1,B=b.navigation.direction;m={single:{next:[0],prev:[0]},duo:{next:[0,1],prev:[1,0]},quad:{next:[0,1,2,3],prev:[3,2,1,0]}},i.mirrorTransition&&"prev"===B&&(z=1,A=0);for(var C=0;2>C;C++){w=s?y[C][1]:y[C][0],x=s?y[C][0]:y[C][1],y[C][2].fromTo(d[0],Number.EPSILON,{attr:{revealing:0}},{attr:{revealing:1}},0),y[C][2].to([k[0],l[0],n[0],o[0]],0,{css:{clipPath:"polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)"}},0),y[C][2].fromTo(k[0],t,{css:{clipPath:"polygon("+c.data.effects[p[0]][z]+")"}},{css:{clipPath:"polygon("+c.data.effects.f+")"},ease:x},r?0:m[q][B][0]*s),("duo"===q||"quad"===q)&&y[C][2].fromTo(l[0],t,{css:{clipPath:"polygon("+c.data.effects[p[1]][z]+")"}},{css:{clipPath:"polygon("+c.data.effects.f+")"},ease:x},r?0:m[q][B][1]*s),"quad"===q&&(y[C][2].fromTo(n[0],t,{css:{clipPath:"polygon("+c.data.effects[p[2]][z]+")"}},{css:{clipPath:"polygon("+c.data.effects.f+")"},ease:x},r?0:m[q][B][2]*s),y[C][2].fromTo(o[0],t,{css:{clipPath:"polygon("+c.data.effects[p[3]][z]+")"}},{css:{clipPath:"polygon("+c.data.effects.f+")"},ease:x},r?0:m[q][B][3]*s));var D=y[C][2].duration()+v;y[C][2].to([k[0],l[0],n[0],o[0]],0,{css:{clipPath:"polygon("+c.data.effects.f+")"}},D),y[C][2].fromTo(d[0],1e-7,{attr:{revealing:1},immediateRender:!0},{attr:{revealing:0}},D),y[C][2].fromTo(k[0],u,{css:{clipPath:"polygon("+c.data.effects.f+")"}},{css:{clipPath:"polygon("+c.data.effects[p[0]][A]+")"},immediateRender:!1,ease:x},D+m[q][B][0]*s),("duo"===q||"quad"===q)&&y[C][2].fromTo(l[0],u,{css:{clipPath:"polygon("+c.data.effects.f+")"}},{css:{clipPath:"polygon("+c.data.effects[p[1]][A]+")"},immediateRender:!1,ease:x},D+m[q][B][1]*s),"quad"===q&&(y[C][2].fromTo(n[0],u,{css:{clipPath:"polygon("+c.data.effects.f+")"}},{css:{clipPath:"polygon("+c.data.effects[p[2]][A]+")"},immediateRender:!1,ease:x},D+m[q][B][2]*s),y[C][2].fromTo(o[0],u,{css:{clipPath:"polygon("+c.data.effects.f+")"}},{css:{clipPath:"polygon("+c.data.effects[p[3]][A]+")"},immediateRender:!1,ease:x},D+m[q][B][3]*s)),0==C?g.timelines._in.add(b.gsap.TweenMax.fromTo(y[C][2],y[C][2].duration(),{progress:0},{progress:1,ease:w,immediateRender:!1}),0):i.easeFullR=w}g.timelines._reveal=g.timelines._revTimeline,g.timelines._revealR=g.timelines._revTimelineR,g.timeline.transitioninend=Math.max(g.timeline.transitioninend,g.timeline.transitioninstart+g.in.duration,g.timeline.transitioninstart+g.timelines._revTimeline.duration())}}),b.plugins.addFunction("addLayersOutBeforeTL",c.pluginData.key,function(a){var b=a.$layer,d=a.layerData,e=b.data(c.pluginData.key);c.$effectLayers.is(b)&&e.endingTransition&&(d.outLayerTo.css.opacity=1)}),b.plugins.addFunction("addLayersOutBeforeTLForced",c.pluginData.key,function(d){var e=d.$layer,f=d.layerData,g=e.data(c.pluginData.key),h=Math.min(b.o.forceLayersOutDuration,f.out.duration);if(c.$effectLayers.is(e)&&g.endingTransition){"slidechangeonly"!==f.out.startAt&&d.timelines._selectedSlideTimeline.add(b.gsap.TweenMax.fromTo(f.timelines._revealR,f.out.duration,{progress:1},{progress:0,ease:g.easeFullR,immediateRender:!1}),f.timeline.transitionoutstart);var i=f.is.static?f.timelines._out:d.timelines._forceOut,j=f.is.static?f.timelines._outMirror:d.timelines._forceOutMirror;a.each([i,j],function(a,c){c.add(b.gsap.TweenMax.fromTo(f.timelines._revealR,h,{progress:1},{progress:0,ease:g.easeFullR,immediateRender:!1}),0)})}})}}})(jQuery,void 0);