revolution.extension.layeranimation.js 92 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520
  1. /************************************************
  2. * REVOLUTION 5.4.2 EXTENSION - LAYER ANIMATION
  3. * @version: 3.6.3 (17.05.2017)
  4. * @requires jquery.themepunch.revolution.js
  5. * @author ThemePunch
  6. ************************************************/
  7. (function($) {
  8. "use strict";
  9. var _R = jQuery.fn.revolution,
  10. _ISM = _R.is_mobile(),
  11. _ANDROID = _R.is_android(),
  12. extension = { alias:"LayerAnimation Min JS",
  13. name:"revolution.extensions.layeranimation.min.js",
  14. min_core: "5.4.5",
  15. version:"3.6.3"
  16. };
  17. ///////////////////////////////////////////
  18. // EXTENDED FUNCTIONS AVAILABLE GLOBAL //
  19. ///////////////////////////////////////////
  20. jQuery.extend(true,_R, {
  21. updateMarkup : function(layer,o) {
  22. var d = jQuery(layer).data();
  23. if (d.start!==undefined && !d.frames_added && d.frames===undefined) {
  24. var frames = new Array(),
  25. oin = getAnimDatas(newAnimObject(),d.transform_in,undefined, false),
  26. oout = getAnimDatas(newAnimObject(),d.transform_out,undefined, false),
  27. oh = getAnimDatas(newAnimObject(),d.transform_hover,undefined, false);
  28. if (jQuery.isNumeric(d.end) && jQuery.isNumeric(d.start) && jQuery.isNumeric(oin.speed)) {
  29. d.end = (parseInt(d.end,0) - (parseInt(d.start,0)+parseFloat(oin.speed,0)));
  30. }
  31. frames.push({frame:"0", delay:d.start, from:d.transform_in, to:d.transform_idle, split:d.splitin, speed:oin.speed, ease:oin.anim.ease, mask:d.mask_in, splitdelay:d.elementdelay});
  32. frames.push({frame:"5", delay:d.end, to:d.transform_out, split:d.splitout, speed:oout.speed, ease:oout.anim.ease, mask:d.mask_out, splitdelay:d.elementdelay});
  33. if (d.transform_hover)
  34. frames.push({frame:"hover", to:d.transform_hover, style:d.style_hover, speed:oh.speed, ease:oh.anim.ease, splitdelay:d.elementdelay});
  35. d.frames = frames;
  36. //layer.frames_added = true;
  37. }
  38. if (!d.frames_added) {
  39. d.inframeindex = 0;
  40. d.outframeindex = -1;
  41. d.hoverframeindex = -1;
  42. if (d.frames!==undefined) {
  43. for (var i=0;i<d.frames.length;i++) {
  44. // CHECK FOR BLOCK SFX ANIMATION
  45. if (d.frames[i].sfx_effect!==undefined && d.frames[i].sfx_effect.indexOf('block')>=0) {
  46. if (i===0) {
  47. d.frames[i].from = "o:0";
  48. d.frames[i].to = "o:1";
  49. } else {
  50. d.frames[i].to = "o:0";
  51. }
  52. d._sfx = "block";
  53. }
  54. if (d.frames[0].from===undefined) d.frames[0].from = "o:inherit";
  55. if (d.frames[0].delay===0) d.frames[0].delay=20;
  56. if (d.frames[i].frame==="hover")
  57. d.hoverframeindex = i;
  58. else
  59. if (d.frames[i].frame==="frame_999" || d.frames[i].frame==="frame_out" || d.frames[i].frame==="last" || d.frames[i].frame==="end")
  60. d.outframeindex = i;
  61. if (d.frames[i].split!==undefined && d.frames[i].split.match(/chars|words|lines/g))
  62. d.splittext = true;
  63. }
  64. }
  65. d.outframeindex = d.outframeindex===-1 ? d.hoverframeindex === -1 ? d.frames.length-1 : d.frames.length -2 : d.outframeindex; // CHECK LATER !!!
  66. d.frames_added = true;
  67. }
  68. },
  69. // MAKE SURE THE ANIMATION ENDS WITH A CLEANING ON MOZ TRANSFORMS
  70. animcompleted : function(_nc,opt) {
  71. var _ = _nc.data(),
  72. t = _.videotype,
  73. ap = _.autoplay,
  74. an = _.autoplayonlyfirsttime;
  75. if (t!=undefined && t!="none")
  76. if (ap==true || ap=="true" || ap=="on" || ap=="1sttime" || an) {
  77. if (opt.sliderType!=="carousel" ||
  78. (opt.sliderType==="carousel" && opt.carousel.showLayersAllTime==="on" && _nc.closest('li').hasClass("active-revslide")) ||
  79. (opt.sliderType==="carousel" && opt.carousel.showLayersAllTime!=="on" && _nc.closest('li').hasClass("active-revslide"))
  80. )
  81. _R.playVideo(_nc,opt);
  82. _R.toggleState(_nc.data('videotoggledby'));
  83. if ( an || ap=="1sttime") {
  84. _.autoplayonlyfirsttime = false;
  85. _.autoplay = "off";
  86. }
  87. } else {
  88. if (ap=="no1sttime")
  89. _.datasetautoplay = 'on';
  90. _R.unToggleState(_nc.data('videotoggledby'));
  91. }
  92. },
  93. /********************************************************
  94. - PREPARE AND DEFINE STATIC LAYER DIRECTIONS -
  95. *********************************************************/
  96. handleStaticLayers : function(_nc,opt) {
  97. var s = parseInt(_nc.data('startslide'),0),
  98. e = parseInt(_nc.data('endslide'),0);
  99. if (s < 0)
  100. s=0;
  101. if (e <0 )
  102. e = opt.realslideamount;
  103. if (s===0 && e===opt.realslideamount-1)
  104. e = opt.realslideamount+1;
  105. _nc.data('startslide',s);
  106. _nc.data('endslide',e);
  107. },
  108. /************************************
  109. ANIMATE ALL CAPTIONS
  110. *************************************/
  111. animateTheCaptions : function(obj) {
  112. if (_R.compare_version(extension).check==="stop") return false;
  113. var opt = obj.opt,
  114. nextli = obj.slide,
  115. recall = obj.recall,
  116. mtl = obj.maintimeline,
  117. preset = obj.preset,
  118. startSlideAnimAt = obj.startslideanimat,
  119. base_offsetx = opt.sliderType==="carousel" ? 0 : opt.width/2 - (opt.gridwidth[opt.curWinRange]*opt.bw)/2,
  120. base_offsety=0,
  121. index = nextli.data('index');
  122. // COLLECTION OF LAYERS
  123. opt.layers = opt.layers || new Object();
  124. opt.layers[index] = opt.layers[index] || nextli.find('.tp-caption');
  125. opt.layers["static"] = opt.layers["static"] || opt.c.find('.tp-static-layers').find('.tp-caption');
  126. if (opt.timelines === undefined) _R.createTimelineStructure(opt);
  127. opt.conh = opt.c.height();
  128. opt.conw = opt.c.width();
  129. opt.ulw = opt.ul.width();
  130. opt.ulh = opt.ul.height();
  131. /* ENABLE DEBUG MODE */
  132. if (opt.debugMode) {
  133. nextli.addClass("indebugmode");
  134. nextli.find('.helpgrid').remove();
  135. opt.c.find('.hglayerinfo').remove();
  136. nextli.append('<div class="helpgrid" style="width:'+(opt.gridwidth[opt.curWinRange]*opt.bw)+'px;height:'+(opt.gridheight[opt.curWinRange]*opt.bw)+'px;"></div>');
  137. var hg = nextli.find('.helpgrid');
  138. hg.append('<div class="hginfo">Zoom:'+(Math.round(opt.bw*100))+'% &nbsp;&nbsp;&nbsp; Device Level:'+opt.curWinRange+'&nbsp;&nbsp;&nbsp; Grid Preset:'+opt.gridwidth[opt.curWinRange]+'x'+opt.gridheight[opt.curWinRange]+'</div>')
  139. opt.c.append('<div class="hglayerinfo"></div>')
  140. hg.append('<div class="tlhg"></div>');
  141. }
  142. // PREPARE THE LAYERS
  143. if (index!==undefined && opt.layers[index])
  144. jQuery.each(opt.layers[index], function(i,a) {
  145. var _t = jQuery(this);
  146. _R.updateMarkup(this,opt);
  147. _R.prepareSingleCaption({caption:_t, opt:opt, offsetx:base_offsetx, offsety:base_offsety, index:i, recall:recall, preset:preset});
  148. if (!preset || startSlideAnimAt===0) _R.buildFullTimeLine({caption:_t, opt:opt, offsetx:base_offsetx, offsety:base_offsety, index:i, recall:recall, preset:preset, regenerate: startSlideAnimAt===0});
  149. if (recall && opt.sliderType==="carousel" && opt.carousel.showLayersAllTime==="on") _R.animcompleted(_t,opt);
  150. });
  151. if (opt.layers["static"])
  152. jQuery.each(opt.layers["static"], function(i,a) {
  153. var _t = jQuery(this),
  154. _ = _t.data();
  155. if (_.hoveredstatus!==true && _.inhoveroutanimation!==true) {
  156. _R.updateMarkup(this,opt);
  157. _R.prepareSingleCaption({caption:_t, opt:opt, offsetx:base_offsetx, offsety:base_offsety, index:i, recall:recall, preset:preset});
  158. if ((!preset || startSlideAnimAt===0) && _.veryfirstststic !==true) {
  159. _R.buildFullTimeLine({caption:_t, opt:opt, offsetx:base_offsetx, offsety:base_offsety, index:i, recall:recall, preset:preset, regenerate: startSlideAnimAt===0});
  160. _.veryfirstststic = true;
  161. }
  162. if (recall && opt.sliderType==="carousel" && opt.carousel.showLayersAllTime==="on") _R.animcompleted(_t,opt);
  163. } else {
  164. _R.prepareSingleCaption({caption:_t, opt:opt, offsetx:base_offsetx, offsety:base_offsety, index:i, recall:recall, preset:preset});
  165. }
  166. });
  167. // RECALCULATE HEIGHTS OF SLIDE IF ROW EXIST
  168. var _actli = opt.nextSlide === -1 || opt.nextSlide===undefined ? 0 : opt.nextSlide;
  169. if (opt.rowzones!==undefined)
  170. _actli = _actli>opt.rowzones.length ? opt.rowzones.length : _actli;
  171. if (opt.rowzones!=undefined && opt.rowzones.length>0 && opt.rowzones[_actli]!=undefined && _actli>=0 && _actli<=opt.rowzones.length && opt.rowzones[_actli].length>0)
  172. _R.setSize(opt);
  173. // RESTART ANIMATION TIMELINES
  174. if (!preset)
  175. if (startSlideAnimAt!==undefined) {
  176. if (index!==undefined)
  177. jQuery.each(opt.timelines[index].layers,function(key,o) {
  178. var _ = o.layer.data();
  179. if (o.wrapper==="none" || o.wrapper===undefined) {
  180. if (o.triggerstate=="keep" && _.triggerstate==="on")
  181. _R.playAnimationFrame({caption:o.layer,opt:opt,frame:"frame_0", triggerdirection:"in", triggerframein:"frame_0", triggerframeout:"frame_999"});
  182. else
  183. o.timeline.restart();
  184. }
  185. });
  186. if (opt.timelines.staticlayers)
  187. jQuery.each(opt.timelines.staticlayers.layers,function(key,o) {
  188. var _ = o.layer.data(),
  189. in_v_range = _actli>=o.firstslide && _actli<=o.lastslide,
  190. in_uv_range = _actli<o.firstslide || _actli>o.lastslide,
  191. flt = o.timeline.getLabelTime("slide_"+o.firstslide),
  192. elt = o.timeline.getLabelTime("slide_"+o.lastslide),
  193. ct = _.static_layer_timeline_time,
  194. isvisible = _.animdirection==="in" ? true : _.animdirection==="out" ? false : undefined,
  195. triggered_in = _.frames[0].delay==="bytrigger",
  196. triggered_out = _.frames[_.frames.length-1].delay==="bytrigger",
  197. layer_start_status = _.triggered_startstatus,
  198. triggerstate = _.lasttriggerstate;
  199. if (_.hoveredstatus===true || _.inhoveroutanimation==true) return;
  200. /*console.log("-----------------------")
  201. console.log("Show Static Layer Start")
  202. console.log("-----------------------")
  203. console.log(ct);
  204. console.log(isvisible)*/
  205. // LAYER ALREADY VISIBLE, TIMER IS NOT UNKNOW ANY MORE
  206. if (ct!==undefined && isvisible) {
  207. if (triggerstate=="keep") {
  208. _R.playAnimationFrame({caption:o.layer,opt:opt,frame:"frame_0", triggerdirection:"in", triggerframein:"frame_0", triggerframeout:"frame_999"});
  209. _.triggeredtimeline.time(ct);
  210. }
  211. else {
  212. if (_.hoveredstatus!==true)
  213. o.timeline.time(ct);
  214. }
  215. }
  216. // RESET STATUS ALWAYS TO HIDDEN
  217. if (triggerstate==="reset" && layer_start_status==="hidden") {
  218. //console.log("Pre Path X");
  219. o.timeline.time(0);
  220. _.animdirection = "out";
  221. }
  222. //console.log("in Range:"+in_v_range+" "+o.firstslide+" <= "+_actli+" <= "+o.lastslide);
  223. // LAYER IS ON SLIDE TO SHOW, OR LAYER NEED TO DISAPPEAR
  224. if (in_v_range) {
  225. if (isvisible) {
  226. //console.log("Path A");
  227. if (_actli===o.lastslide) {
  228. //console.log("Path A.1");
  229. o.timeline.play(elt);
  230. _.animdirection = "in";
  231. }
  232. } else {
  233. //console.log("Path B");
  234. //console.log(triggered_in+" "+_.animdirection)
  235. if (!triggered_in && _.animdirection!=="in") {
  236. //console.log("Path B.1")
  237. o.timeline.play(flt);
  238. }
  239. if ((layer_start_status=="visible" && triggerstate!=="keep") || (triggerstate==="keep" && isvisible===true) || (layer_start_status=="visible" && isvisible===undefined)) {
  240. //console.log("Path B.2");
  241. o.timeline.play(flt+0.01);
  242. _.animdirection = "in";
  243. }
  244. }
  245. } else {
  246. //console.log("Path C");
  247. if (in_uv_range) {
  248. //console.log("Path C.1");
  249. if (isvisible) {
  250. //console.log("Path C.1.1")
  251. o.timeline.play("frame_999");
  252. } else {
  253. //console.log("Path C.1.2")
  254. }
  255. }
  256. }
  257. });
  258. }
  259. // RESUME THE MAIN TIMELINE NOW
  260. if (mtl != undefined) setTimeout(function() {
  261. mtl.resume();
  262. },30);
  263. },
  264. /********************************************
  265. PREPARE ALL LAYER SIZES, POSITION
  266. ********************************************/
  267. prepareSingleCaption : function(obj) {
  268. var _nc = obj.caption,
  269. _ = _nc.data(),
  270. opt = obj.opt,
  271. recall = obj.recall,
  272. internrecall = obj.recall,
  273. preset = obj.preset,
  274. rtl = jQuery('body').hasClass("rtl"),
  275. datas
  276. _._pw = _._pw===undefined ? _nc.closest('.tp-parallax-wrap') : _._pw;
  277. _._lw = _._lw===undefined ? _nc.closest('.tp-loop-wrap') : _._lw;
  278. _._mw = _._mw===undefined ? _nc.closest('.tp-mask-wrap') : _._mw;
  279. _._responsive = _.responsive || "on";
  280. _._respoffset = _.responsive_offset || "on";
  281. _._ba = _.basealign || "grid";
  282. _._gw = _._ba==="grid" ? opt.width : opt.ulw;
  283. _._gh = _._ba==="grid" ? opt.height : opt.ulh;
  284. _._lig = _._lig===undefined ? _nc.hasClass("rev_layer_in_group") ? _nc.closest('.rev_group') : _nc.hasClass("rev_layer_in_column") ?_nc.closest('.rev_column_inner') : _nc.hasClass("rev_column_inner") ? _nc.closest(".rev_row") : "none" : _._lig,
  285. _._column = _._column===undefined ? _nc.hasClass("rev_column_inner") ? _nc.closest(".rev_column") : "none" : _._column,
  286. _._row = _._row===undefined ? _nc.hasClass("rev_column_inner") ? _nc.closest(".rev_row") : "none" : _._row,
  287. _._ingroup = _._ingroup===undefined ? !_nc.hasClass('rev_group') && _nc.closest('.rev_group') ? true : false :_._ingroup;
  288. _._isgroup = _._isgroup===undefined ? _nc.hasClass("rev_group") ? true : false : _._isgroup;
  289. _._nctype = _.type || "none";
  290. _._cbgc_auto = _._cbgc_auto===undefined ? _._nctype==="column" ? _._pw.find('.rev_column_bg_auto_sized') : false : _._cbgc_auto;
  291. _._cbgc_man = _._cbgc_man===undefined ? _._nctype==="column" ? _._pw.find('.rev_column_bg_man_sized') : false : _._cbgc_man;
  292. _._slideid = _._slideid || _nc.closest('.tp-revslider-slidesli').data('index');
  293. _._id = _._id===undefined ? _nc.data('id') || _nc.attr('id') : _._id;
  294. _._slidelink = _._slidelink===undefined ? _nc.hasClass("slidelink")===undefined ? false : _nc.hasClass("slidelink") : _._slidelink;
  295. if (_._li===undefined)
  296. if (_nc.hasClass("tp-static-layer")) {
  297. _._isstatic = true;
  298. _._li = _nc.closest('.tp-static-layers');
  299. _._slideid = "staticlayers";
  300. } else {
  301. _._li = _nc.closest('.tp-revslider-slidesli');
  302. }
  303. _._row = _._row===undefined ? _._nctype==="column" ? _._pw.closest('.rev_row') : false : _._row;
  304. if (_._togglelisteners===undefined && _nc.find('.rs-toggled-content')) {
  305. _._togglelisteners = true;
  306. if (_.actions===undefined) _nc.click(function() {_R.swaptoggleState(_nc); })
  307. } else {
  308. _._togglelisteners = false;
  309. }
  310. if (opt.sliderLayout=="fullscreen")
  311. obj.offsety = _._gh/2 - (opt.gridheight[opt.curWinRange]*opt.bh)/2;
  312. if (opt.autoHeight=="on" || (opt.minHeight!=undefined && opt.minHeight>0))
  313. obj.offsety = opt.conh/2 - (opt.gridheight[opt.curWinRange]*opt.bh)/2;;
  314. if (obj.offsety<0) obj.offsety=0;
  315. // LAYER GRID FOR DEBUGGING
  316. if (opt.debugMode) {
  317. _nc.closest('li').find('.helpgrid').css({top:obj.offsety+"px", left:obj.offsetx+"px"});
  318. var linfo = opt.c.find('.hglayerinfo');
  319. _nc.on("hover, mouseenter",function() {
  320. var ltxt = "",
  321. spa = 0;
  322. if (_nc.data())
  323. jQuery.each(_nc.data(),function(key,val) {
  324. if (typeof val !== "object") {
  325. ltxt = ltxt + '<span style="white-space:nowrap"><span style="color:#27ae60">'+key+":</span>"+val+"</span>&nbsp; &nbsp; ";
  326. }
  327. });
  328. linfo.html(ltxt);
  329. });
  330. }
  331. /* END OF DEBUGGING */
  332. var handlecaption=0,
  333. layervisible = _.visibility === undefined ? "oon" : makeArray(_.visibility,opt)[opt.forcedWinRange] || makeArray(_.visibility,opt) || "ooon";
  334. // HIDE CAPTION IF RESOLUTION IS TOO LOW
  335. if (layervisible==="off" || (_._gw<opt.hideCaptionAtLimit && _.captionhidden=="on") || (_._gw<opt.hideAllCaptionAtLimit))
  336. _._pw.addClass("tp-hidden-caption");
  337. else
  338. _._pw.removeClass("tp-hidden-caption")
  339. _.layertype = "html";
  340. if (obj.offsetx<0) obj.offsetx=0;
  341. // FALL BACK TO NORMAL IMAGES
  342. if (_.thumbimage !=undefined && _.videoposter==undefined)
  343. _.videoposter = _.thumbimage;
  344. // IF IT IS AN IMAGE
  345. if (_nc.find('img').length>0) {
  346. var im = _nc.find('img');
  347. _.layertype = "image";
  348. if (im.width()==0) im.css({width:"auto"});
  349. if (im.height()==0) im.css({height:"auto"});
  350. if (im.data('ww') == undefined && im.width()>0) im.data('ww',im.width());
  351. if (im.data('hh') == undefined && im.height()>0) im.data('hh',im.height());
  352. var ww = im.data('ww'),
  353. hh = im.data('hh'),
  354. fuw = _._ba =="slide" ? opt.ulw : opt.gridwidth[opt.curWinRange],
  355. fuh = _._ba =="slide" ? opt.ulh : opt.gridheight[opt.curWinRange];
  356. ww = makeArray(im.data('ww'),opt)[opt.curWinRange] || makeArray(im.data('ww'),opt) || "auto",
  357. hh = makeArray(im.data('hh'),opt)[opt.curWinRange] || makeArray(im.data('hh'),opt) || "auto";
  358. var wful = ww==="full" || ww === "full-proportional",
  359. hful = hh==="full" || hh === "full-proportional";
  360. if (ww==="full-proportional") {
  361. var ow = im.data('owidth'),
  362. oh = im.data('oheight');
  363. if (ow/fuw < oh/fuh) {
  364. ww = fuw;
  365. hh = oh*(fuw/ow);
  366. } else {
  367. hh = fuh;
  368. ww = ow*(fuh/oh);
  369. }
  370. } else {
  371. ww = wful ? fuw : !jQuery.isNumeric(ww) && ww.indexOf("%")>0 ? ww : parseFloat(ww);
  372. hh = hful ? fuh : !jQuery.isNumeric(hh) && hh.indexOf("%")>0 ? hh : parseFloat(hh);
  373. }
  374. ww = ww===undefined ? 0 : ww;
  375. hh = hh===undefined ? 0 : hh;
  376. if (_._responsive!=="off") {
  377. if (_._ba!="grid" && wful)
  378. if (jQuery.isNumeric(ww))
  379. im.css({width:ww+"px"});
  380. else
  381. im.css({width:ww});
  382. else
  383. if (jQuery.isNumeric(ww))
  384. im.css({width:(ww*opt.bw)+"px"});
  385. else
  386. im.css({width:ww});
  387. if (_._ba!="grid" && hful)
  388. if (jQuery.isNumeric(hh))
  389. im.css({height:hh+"px"});
  390. else
  391. im.css({height:hh});
  392. else
  393. if (jQuery.isNumeric(hh))
  394. im.css({height:(hh*opt.bh)+"px"});
  395. else
  396. im.css({height:hh});
  397. } else {
  398. im.css({width:ww, height:hh});
  399. }
  400. if (_._ingroup && _._nctype!=="row") {
  401. if (ww!==undefined && !jQuery.isNumeric(ww) && jQuery.type(ww)==="string" && ww.indexOf("%")>0)
  402. punchgs.TweenLite.set([_._lw,_._pw,_._mw],{minWidth:ww});
  403. if (hh!==undefined && !jQuery.isNumeric(hh) && jQuery.type(hh)==="string" && hh.indexOf("%")>0)
  404. punchgs.TweenLite.set([_._lw,_._pw,_._mw],{minHeight:hh});
  405. }
  406. }
  407. if (_._ba==="slide") {
  408. obj.offsetx = 0;
  409. obj.offsety=0;
  410. } else {
  411. if (_._isstatic && opt.carousel!==undefined && opt.carousel.horizontal_align!==undefined && opt.sliderType==="carousel") {
  412. switch (opt.carousel.horizontal_align) {
  413. case "center":
  414. obj.offsetx = 0 + (opt.ulw - (opt.gridwidth[opt.curWinRange]*opt.bw))/2;
  415. break;
  416. case "left":
  417. break;
  418. case "right":
  419. obj.offsetx = (opt.ulw - (opt.gridwidth[opt.curWinRange]*opt.bw));
  420. break;
  421. }
  422. obj.offsetx = obj.offsetx<0 ? 0 : obj.offsetx;
  423. }
  424. }
  425. var tag = _.audio=="html5" ? "audio" : "video";
  426. // IF IT IS A VIDEO LAYER
  427. if (_nc.hasClass("tp-videolayer") || _nc.hasClass("tp-audiolayer") || _nc.find('iframe').length>0 || _nc.find(tag).length>0) {
  428. _.layertype = "video";
  429. if (_R.manageVideoLayer) _R.manageVideoLayer(_nc,opt,recall,internrecall);
  430. if (!recall && !internrecall) {
  431. var t = _.videotype;
  432. if (_R.resetVideo) _R.resetVideo(_nc,opt,obj.preset);
  433. }
  434. var asprat = _.aspectratio;
  435. if (asprat!=undefined && asprat.split(":").length>1)
  436. _R.prepareCoveredVideo(asprat,opt,_nc);
  437. var im = _nc.find('iframe') ? _nc.find('iframe') : im = _nc.find(tag),
  438. html5vid = _nc.find('iframe') ? false : true,
  439. yvcover = _nc.hasClass('coverscreenvideo');
  440. im.css({display:"block"});
  441. // SET WIDTH / HEIGHT
  442. if (_nc.data('videowidth') == undefined) {
  443. _nc.data('videowidth',im.width());
  444. _nc.data('videoheight',im.height());
  445. }
  446. var ww = makeArray(_nc.data('videowidth'),opt)[opt.curWinRange] || makeArray(_nc.data('videowidth'),opt) || "auto",
  447. hh = makeArray(_nc.data('videoheight'),opt)[opt.curWinRange] || makeArray(_nc.data('videoheight'),opt) || "auto";
  448. /*if (!jQuery.isNumeric(ww) && ww.indexOf("%")>0) {
  449. hh = (parseFloat(hh)*opt.bh)+"px";
  450. } else {
  451. ww = (parseFloat(ww)*opt.bw)+"px";
  452. hh = (parseFloat(hh)*opt.bh)+"px";
  453. }*/
  454. if (ww==="auto" || (!jQuery.isNumeric(ww) && ww.indexOf("%")>0)) {
  455. ww = ww==="auto" ? "auto" : _._ba==="grid" ? opt.gridwidth[opt.curWinRange]*opt.bw : _._gw;
  456. } else {
  457. ww = (parseFloat(ww)*opt.bw)+"px";
  458. }
  459. if (hh==="auto" || (!jQuery.isNumeric(hh) && hh.indexOf("%")>0)) {
  460. hh = hh==="auto" ? "auto" : _._ba==="grid" ? opt.gridheight[opt.curWinRange]*opt.bw : _._gh;
  461. } else {
  462. hh = (parseFloat(hh)*opt.bh)+"px";
  463. }
  464. // READ AND WRITE CSS SETTINGS OF IFRAME AND VIDEO FOR RESIZING ELEMENST ON DEMAND
  465. _.cssobj = _.cssobj===undefined ? getcssParams(_nc,0) : _.cssobj;
  466. var ncobj = setResponsiveCSSValues(_.cssobj,opt);
  467. // IE8 FIX FOR AUTO LINEHEIGHT
  468. if (ncobj.lineHeight=="auto") ncobj.lineHeight = ncobj.fontSize+4;
  469. if (!_nc.hasClass('fullscreenvideo') && !yvcover) {
  470. punchgs.TweenLite.set(_nc,{
  471. paddingTop: Math.round((ncobj.paddingTop * opt.bh)) + "px",
  472. paddingBottom: Math.round((ncobj.paddingBottom * opt.bh)) + "px",
  473. paddingLeft: Math.round((ncobj.paddingLeft* opt.bw)) + "px",
  474. paddingRight: Math.round((ncobj.paddingRight * opt.bw)) + "px",
  475. marginTop: (ncobj.marginTop * opt.bh) + "px",
  476. marginBottom: (ncobj.marginBottom * opt.bh) + "px",
  477. marginLeft: (ncobj.marginLeft * opt.bw) + "px",
  478. marginRight: (ncobj.marginRight * opt.bw) + "px",
  479. borderTopWidth: Math.round(ncobj.borderTopWidth * opt.bh) + "px",
  480. borderBottomWidth: Math.round(ncobj.borderBottomWidth * opt.bh) + "px",
  481. borderLeftWidth: Math.round(ncobj.borderLeftWidth * opt.bw) + "px",
  482. borderRightWidth: Math.round(ncobj.borderRightWidth * opt.bw) + "px",
  483. width:ww,
  484. height:hh
  485. });
  486. } else {
  487. obj.offsetx=0; obj.offsety=0;
  488. _nc.data('x',0)
  489. _nc.data('y',0)
  490. var ovhh = _._gh;
  491. if (opt.autoHeight=="on") ovhh = opt.conh
  492. _nc.css({'width':_._gw, 'height':ovhh });
  493. }
  494. if ((html5vid == false && !yvcover) || ((_.forcecover!=1 && !_nc.hasClass('fullscreenvideo') && !yvcover))) {
  495. im.width(ww);
  496. im.height(hh);
  497. }
  498. if (_._ingroup) {
  499. if (_.videowidth!==null && _.videowidth!==undefined && !jQuery.isNumeric(_.videowidth) && _.videowidth.indexOf("%")>0)
  500. punchgs.TweenLite.set([_._lw,_._pw,_._mw],{minWidth:_.videowidth});
  501. }
  502. } // END OF POSITION AND STYLE READ OUTS OF VIDEO
  503. // RESPONIVE HANDLING OF CURRENT LAYER
  504. calcCaptionResponsive(_nc,opt,0,_._responsive);
  505. // ALL ELEMENTS IF THE MAIN ELEMENT IS REKURSIVE RESPONSIVE SHOULD BE REPONSIVE HANDLED
  506. if (_nc.hasClass("tp-resizeme"))
  507. _nc.find('*').each(function() {
  508. calcCaptionResponsive(jQuery(this),opt,"rekursive",_._responsive);
  509. });
  510. // _nc FRONTCORNER CHANGES
  511. var ncch = _nc.outerHeight(),
  512. bgcol = _nc.css('backgroundColor');
  513. sharpCorners(_nc,'.frontcorner','left','borderRight','borderTopColor',ncch,bgcol);
  514. sharpCorners(_nc,'.frontcornertop','left','borderRight','borderBottomColor',ncch,bgcol);
  515. sharpCorners(_nc,'.backcorner','right','borderLeft','borderBottomColor',ncch,bgcol);
  516. sharpCorners(_nc,'.backcornertop','right','borderLeft','borderTopColor',ncch,bgcol);
  517. if (opt.fullScreenAlignForce == "on") {
  518. obj.offsetx=0;
  519. obj.offsety=0;
  520. }
  521. // BLOCK ANIMATION ON LAYERS
  522. if (_._sfx==="block")
  523. if (_._bmask === undefined) {
  524. _._bmask = jQuery('<div class="tp-blockmask"></div>');
  525. _._mw.append(_._bmask);
  526. }
  527. _.arrobj = new Object();
  528. _.arrobj.voa = makeArray(_.voffset,opt)[opt.curWinRange] || makeArray(_.voffset,opt)[0];
  529. _.arrobj.hoa = makeArray(_.hoffset,opt)[opt.curWinRange] || makeArray(_.hoffset,opt)[0];
  530. _.arrobj.elx = makeArray(_.x,opt)[opt.curWinRange] || makeArray(_.x,opt)[0];
  531. _.arrobj.ely = makeArray(_.y,opt)[opt.curWinRange] || makeArray(_.y,opt)[0];
  532. var voa = _.arrobj.voa.length==0 ? 0 : _.arrobj.voa,
  533. hoa = _.arrobj.hoa.length==0 ? 0 : _.arrobj.hoa,
  534. elx = _.arrobj.elx.length==0 ? 0 : _.arrobj.elx,
  535. ely = _.arrobj.ely.length==0 ? 0 : _.arrobj.ely;
  536. _.eow = _nc.outerWidth(true);
  537. _.eoh = _nc.outerHeight(true);
  538. // NEED CLASS FOR FULLWIDTH AND FULLHEIGHT LAYER SETTING !!
  539. if (_.eow==0 && _.eoh==0) {
  540. _.eow = opt.ulw;
  541. _.eoh = opt.ulh;
  542. }
  543. var vofs= _._respoffset !=="off" ? parseInt(voa,0)*opt.bw : parseInt(voa,0),
  544. hofs= _._respoffset !=="off" ? parseInt(hoa,0)*opt.bw : parseInt(hoa,0),
  545. crw = _._ba==="grid" ? opt.gridwidth[opt.curWinRange]*opt.bw : _._gw,
  546. crh = _._ba==="grid" ? opt.gridheight[opt.curWinRange]*opt.bw : _._gh;
  547. if (opt.fullScreenAlignForce == "on") {
  548. crw = opt.ulw;
  549. crh = opt.ulh;
  550. }
  551. // ALIGN POSITIONED ELEMENTS
  552. if (_._lig!=="none" && _._lig!=undefined) {
  553. crw=_._lig.width();
  554. crh=_._lig.height();
  555. obj.offsetx =0;
  556. obj.offsety = 0;
  557. }
  558. elx = elx==="center" || elx==="middle" ? (crw/2 - _.eow/2) + hofs : elx==="left" ? hofs : elx==="right" ? (crw - _.eow) - hofs : _._respoffset !=="off" ? elx * opt.bw : elx;
  559. ely = ely=="center" || ely=="middle" ? (crh/2 - _.eoh/2) + vofs : ely =="top" ? vofs : ely=="bottom" ? (crh - _.eoh)-vofs : _._respoffset !=="off" ? ely*opt.bw : ely;
  560. if (rtl && !_._slidelink)
  561. elx = elx + _.eow;
  562. if (_._slidelink) elx=0;
  563. _.calcx = (parseInt(elx,0)+obj.offsetx);
  564. _.calcy = (parseInt(ely,0)+obj.offsety);
  565. var tpcapindex = _nc.css("z-Index");
  566. // SET TOP/LEFT POSITION OF LAYER
  567. if (_._nctype!=="row" && _._nctype!=="column")
  568. punchgs.TweenLite.set(_._pw,{zIndex:tpcapindex, top:_.calcy,left:_.calcx,overwrite:"auto"});
  569. else
  570. if (_._nctype!=="row")
  571. punchgs.TweenLite.set(_._pw,{zIndex:tpcapindex, width:_.columnwidth, top:0,left:0,overwrite:"auto"});
  572. else
  573. if (_._nctype==="row") {
  574. var _roww = _._ba==="grid" ? crw+"px" : "100%";
  575. punchgs.TweenLite.set(_._pw,{zIndex:tpcapindex, width:_roww, top:0,left:obj.offsetx,overwrite:"auto"});
  576. }
  577. if (_.blendmode!==undefined)
  578. punchgs.TweenLite.set(_._pw,{mixBlendMode:_.blendmode});
  579. /*if (_._nctype==="svg") {
  580. _.svgcontainer = _.svgcontainer===undefined ? _nc.find('.tp-svg-innercontainer') : _.svgcontainer;
  581. punchgs.TweenLite.set(_.svgcontainer,{ ... });
  582. }*/
  583. //SET ROW BROKEN / TABLE FORMED
  584. if (_._nctype==="row") {
  585. if (_.columnbreak<=opt.curWinRange) {
  586. _nc.addClass("rev_break_columns");
  587. } else {
  588. _nc.removeClass("rev_break_columns");
  589. }
  590. }
  591. // LOOP ANIMATION WIDTH/HEIGHT
  592. if (_.loopanimation=="on") punchgs.TweenLite.set(_._lw,{minWidth:_.eow,minHeight:_.eoh});
  593. //Preset Position of BG
  594. if (_._nctype==="column") {
  595. var tempy = _nc[0]._gsTransform !==undefined ? _nc[0]._gsTransform.y : 0,
  596. pT = parseInt(_._column[0].style.paddingTop,0);
  597. punchgs.TweenLite.set(_nc,{y:0});
  598. punchgs.TweenLite.set(_._cbgc_man,{y:parseInt(( pT+_._column.offset().top-_nc.offset().top),0)});
  599. punchgs.TweenLite.set(_nc,{y:tempy});
  600. }
  601. // ELEMENT IN GROUPS WITH % WIDTH AND HEIGHT SHOULD EXTEND PARRENT SIZES
  602. if (_._ingroup && _._nctype!=="row") {
  603. if (_._groupw!==undefined && !jQuery.isNumeric(_._groupw) && _._groupw.indexOf("%")>0)
  604. punchgs.TweenLite.set([_._lw,_._pw,_._mw],{minWidth:_._groupw});
  605. if (_._grouph!==undefined && !jQuery.isNumeric(_._grouph) && _._grouph.indexOf("%")>0)
  606. punchgs.TweenLite.set([_._lw,_._pw,_._mw],{minHeight:_._grouph});
  607. }
  608. },
  609. /********************************************
  610. BUILD THE TIMELINE STRUCTURES
  611. ********************************************/
  612. createTimelineStructure : function(opt) {
  613. // COLLECTION OF TIMELINES
  614. opt.timelines = opt.timelines || new Object();
  615. function addTimeLineWithLabel(layer,opt,parentobject,slideid) {
  616. var timeline = new punchgs.TimelineLite({paused:true}),
  617. c;
  618. parentobject = parentobject || new Object();
  619. parentobject[layer.attr('id')] = parentobject[layer.attr('id')] || new Object();
  620. if (slideid==="staticlayers") {
  621. parentobject[layer.attr('id')].firstslide = layer.data('startslide');
  622. parentobject[layer.attr('id')].lastslide = layer.data('endslide');
  623. }
  624. layer.data('slideid',slideid);
  625. parentobject[layer.attr('id')].defclasses=c=layer[0].className;
  626. parentobject[layer.attr('id')].wrapper = c.indexOf("rev_layer_in_column")>=0 ? layer.closest('.rev_column_inner') : c.indexOf("rev_column_inner")>=0 ? layer.closest(".rev_row") : c.indexOf("rev_layer_in_group")>=0 ? layer.closest(".rev_group") : "none";
  627. parentobject[layer.attr('id')].timeline = timeline;
  628. parentobject[layer.attr('id')].layer = layer;
  629. parentobject[layer.attr('id')].triggerstate = layer.data('lasttriggerstate');
  630. parentobject[layer.attr('id')].dchildren = c.indexOf("rev_row")>=0 ? layer[0].getElementsByClassName('rev_column_inner') : c.indexOf("rev_column_inner")>=0 ? layer[0].getElementsByClassName('tp-caption') : c.indexOf("rev_group")>=0 ? layer[0].getElementsByClassName('rev_layer_in_group') : "none";
  631. layer.data('timeline',timeline);
  632. }
  633. //GO THROUGH ALL LI
  634. opt.c.find('.tp-revslider-slidesli, .tp-static-layers').each(function() {
  635. var slide = jQuery(this),
  636. index = slide.data('index');
  637. opt.timelines[index] = opt.timelines[index] || {};
  638. opt.timelines[index].layers = opt.timelines[index].layers || new Object();
  639. // COLLECT LAYERS
  640. slide.find('.tp-caption').each(function(i) {
  641. addTimeLineWithLabel(jQuery(this),opt,opt.timelines[index].layers,index);
  642. });
  643. });
  644. },
  645. /***************************************
  646. - BUILD CAPTION FULL TIMELINES -
  647. ***************************************/
  648. buildFullTimeLine : function(obj) {
  649. //if (obj.recall) return;
  650. var _nc = obj.caption,
  651. _ = _nc.data(),
  652. opt = obj.opt,
  653. $svg = {},
  654. _nc_tl_obj,
  655. _nc_timeline,
  656. $hover = newHoverAnimObject(),
  657. timelineprog = 0;
  658. _nc_tl_obj = opt.timelines[_._slideid]["layers"][_._id];
  659. if (_nc_tl_obj.generated && obj.regenerate!==true) return;
  660. _nc_timeline = _nc_tl_obj.timeline;
  661. _nc_tl_obj.generated = true;
  662. if (_.current_timeline!==undefined && obj.regenerate!==true) {
  663. _.current_timeline_pause = _.current_timeline.paused();
  664. _.current_timeline_time = _.current_timeline.time();
  665. _.current_is_nc_timeline = _nc_timeline === _.current_timeline;
  666. _.static_layer_timeline_time = _.current_timeline_time;
  667. } else {
  668. _.static_layer_timeline_time = _.current_timeline_time;
  669. _.current_timeline_time = 0;
  670. if (_.current_timeline) _.current_timeline.clear();
  671. }
  672. _nc_timeline.clear();
  673. // PRESET SVG STYLE
  674. $svg.svg = _.svg_src!=undefined ? _nc.find('svg') : false;
  675. if ($svg.svg) {
  676. _.idlesvg = setSVGAnimObject(_.svg_idle,newSVGHoverAnimObject());
  677. punchgs.TweenLite.set($svg.svg,_.idlesvg.anim);
  678. }
  679. // HOVER ANIMATION
  680. if (_.hoverframeindex!==-1 && _.hoverframeindex!==undefined) {
  681. if (!_nc.hasClass("rs-hover-ready")) {
  682. _nc.addClass("rs-hover-ready");
  683. _.hovertimelines = {};
  684. _.hoveranim = getAnimDatas($hover,_.frames[_.hoverframeindex].to);
  685. _.hoveranim = convertHoverStyle(_.hoveranim,_.frames[_.hoverframeindex].style);
  686. if ($svg.svg) {
  687. var $svghover = setSVGAnimObject(_.svg_hover,newSVGHoverAnimObject());
  688. if (_.hoveranim.anim.color!=undefined) {
  689. $svghover.anim.fill = _.hoveranim.anim.color;
  690. _.idlesvg.anim.css.fill = $svg.svg.css("fill");
  691. }
  692. _.hoversvg = $svghover;
  693. }
  694. _nc.hover(function(e) {
  695. var obj = {caption:jQuery(e.currentTarget), opt:opt, firstframe : "frame_0", lastframe:"frame_999"},
  696. tl = getTLInfos(obj),
  697. nc = obj.caption,
  698. _ = nc.data(),
  699. frame = _.frames[_.hoverframeindex],
  700. animended = true;
  701. _.forcehover = frame.force;
  702. if (animended) {
  703. _.hovertimelines.item = punchgs.TweenLite.to(nc,frame.speed/1000,_.hoveranim.anim);
  704. if (_.hoverzIndex || (_.hoveranim.anim && _.hoveranim.anim.zIndex)) {
  705. _.basiczindex = _.basiczindex===undefined ? _.cssobj.zIndex : _.basiczindex;
  706. _.hoverzIndex = _.hoverzIndex===undefined ? _.hoveranim.anim.zIndex : _.hoverzIndex;
  707. _.inhoverinanimation = true;
  708. if (frame.speed===0) _.inhoverinanimation= false;
  709. _.hovertimelines.pwhoveranim = punchgs.TweenLite.to(_._pw,frame.speed/1000,{overwrite:"auto",zIndex:_.hoverzIndex});
  710. _.hovertimelines.pwhoveranim.eventCallback("onComplete",function(_) {
  711. _.inhoverinanimation=false;;
  712. },[_])
  713. }
  714. if ($svg.svg)
  715. _.hovertimelines.svghoveranim = punchgs.TweenLite.to([$svg.svg, $svg.svg.find('path')],frame.speed/1000,_.hoversvg.anim);
  716. _.hoveredstatus = true;
  717. }
  718. },
  719. function(e) {
  720. var obj = {caption:jQuery(e.currentTarget), opt:opt, firstframe : "frame_0", lastframe:"frame_999"},
  721. tl = getTLInfos(obj),
  722. nc = obj.caption,
  723. _ = nc.data(),
  724. frame = _.frames[_.hoverframeindex],
  725. animended = true;
  726. if (animended) {
  727. _.hoveredstatus = false;
  728. _.inhoveroutanimation = true;
  729. _.hovertimelines.item.pause();
  730. _.hovertimelines.item = punchgs.TweenLite.to(nc,frame.speed/1000,jQuery.extend(true,{},_._gsTransformTo));
  731. if (frame.speed==0) _.inhoveroutanimation= false;
  732. _.hovertimelines.item.eventCallback("onComplete",function(_) {
  733. _.inhoveroutanimation=false;;
  734. },[_])
  735. if (_.hovertimelines.pwhoveranim!==undefined) _.hovertimelines.pwhoveranim = punchgs.TweenLite.to(_._pw,frame.speed/1000,{overwrite:"auto",zIndex:_.basiczindex});
  736. if ($svg.svg) punchgs.TweenLite.to([$svg.svg, $svg.svg.find('path')],frame.speed/1000,_.idlesvg.anim);
  737. }
  738. });
  739. }
  740. } // END IF HOVER ANIMATION
  741. // LOOP TROUGH THE FRAMES AND CREATE FRAME TWEENS AND TL'S ON THE MAIN TIMELINE
  742. for (var frame_index=0; frame_index<_.frames.length;frame_index++) {
  743. if (frame_index !== _.hoverframeindex) {
  744. // Create a new Timeline for each Frame
  745. var frame_name = frame_index === _.inframeindex ? "frame_0" : frame_index===_.outframeindex || _.frames[frame_index].frame==="frame_999" ? "frame_999" : "frame_"+frame_index;
  746. _.frames[frame_index].framename = frame_name;
  747. _nc_tl_obj[frame_name] = {};
  748. _nc_tl_obj[frame_name].timeline = new punchgs.TimelineLite({align:"normal"});
  749. var $start = _.frames[frame_index].delay,
  750. $start_status = _.triggered_startstatus,
  751. mdelay = $start !== undefined ? jQuery.inArray($start,["slideenter","bytrigger","wait"])>=0 ? $start : parseInt($start,0)/1000 : "wait";
  752. // ADD STARTLABEL FOR STATIC LAYERS
  753. if (_nc_tl_obj.firstslide!==undefined && frame_name==="frame_0") {
  754. _nc_timeline.addLabel("slide_"+_nc_tl_obj.firstslide+"_pause",0);
  755. _nc_timeline.addPause("slide_"+_nc_tl_obj.firstslide+"_pause");
  756. _nc_timeline.addLabel("slide_"+_nc_tl_obj.firstslide,"+=0.005");
  757. }
  758. // ADD ENDSLIDE LABEL FOR STATIC LAYERS
  759. if (_nc_tl_obj.lastslide!==undefined && frame_name==="frame_999") {
  760. _nc_timeline.addLabel("slide_"+_nc_tl_obj.lastslide+"_pause","+=0.01");
  761. _nc_timeline.addPause("slide_"+_nc_tl_obj.lastslide+"_pause");
  762. _nc_timeline.addLabel("slide_"+_nc_tl_obj.lastslide,"+=0.005");
  763. }
  764. if (!jQuery.isNumeric(mdelay)) {
  765. _nc_timeline.addLabel("pause_"+frame_index,"+=0.01");
  766. _nc_timeline.addPause("pause_"+frame_index);
  767. _nc_timeline.addLabel(frame_name,"+=0.01");
  768. } else {
  769. _nc_timeline.addLabel(frame_name,"+="+mdelay);
  770. }
  771. _nc_timeline = _R.createFrameOnTimeline({caption:obj.caption, timeline : _nc_timeline, label:frame_name, frameindex : frame_index, opt:opt });
  772. } //
  773. } // END OF LOOP THROUGH FRAMES AND CREATING NEW TWEENS
  774. //_nc_timeline.time(timelineprog);
  775. if (!obj.regenerate) {
  776. if (_.current_is_nc_timeline)
  777. _.current_timeline = _nc_timeline;
  778. if (_.current_timeline_pause)
  779. _nc_timeline.pause(_.current_timeline_time);
  780. else
  781. _nc_timeline.time(_.current_timeline_time);
  782. }
  783. return;
  784. },
  785. /////////////////////////////////////
  786. // BUILD A FRAME ON THE TIMELINE //
  787. /////////////////////////////////////
  788. createFrameOnTimeline : function(obj) {
  789. var _nc = obj.caption,
  790. _ = _nc.data(),
  791. label = obj.label,
  792. timeline = obj.timeline,
  793. frame_index = obj.frameindex,
  794. opt = obj.opt,
  795. animobject = _nc,
  796. tweens = {},
  797. _nc_tl_obj = opt.timelines[_._slideid]["layers"][_._id],
  798. verylastframe = _.frames.length-1,
  799. $split = _.frames[frame_index].split,
  800. $splitdir = _.frames[frame_index].split_direction,
  801. $sfx = _.frames[frame_index].sfx_effect,
  802. $splitnow = false;
  803. $splitdir = $splitdir === undefined ? "forward" : $splitdir;
  804. if (_.hoverframeindex!==-1 && _.hoverframeindex==verylastframe) verylastframe=verylastframe-1;
  805. tweens.content = new punchgs.TimelineLite({align:"normal"});
  806. tweens.mask = new punchgs.TimelineLite({align:"normal"});
  807. if (timeline.vars.id===undefined)
  808. timeline.vars.id=Math.round(Math.random()*100000);
  809. if (_._nctype==="column") {
  810. timeline.add(punchgs.TweenLite.set(_._cbgc_man,{visibility:"visible"}),label);
  811. timeline.add(punchgs.TweenLite.set(_._cbgc_auto,{visibility:"hidden"}),label);
  812. }
  813. if (_.splittext && frame_index===0) {
  814. if (_.mySplitText !== undefined) _.mySplitText.revert();
  815. var splittarget = _nc.find('a').length>0 ? _nc.find('a') : _nc;
  816. _.mySplitText = new punchgs.SplitText(splittarget,{type:"chars,words,lines",charsClass:"tp-splitted tp-charsplit",wordsClass:"tp-splitted tp-wordsplit",linesClass:"tp-splitted tp-linesplit"});
  817. _nc.addClass("splitted");
  818. }
  819. if ( _.mySplitText !==undefined && $split && $split.match(/chars|words|lines/g)) {
  820. animobject = _.mySplitText[$split];
  821. $splitnow = true;
  822. }
  823. // ANIMATE THE FRAME
  824. var $to = frame_index!==_.outframeindex ? getAnimDatas(newAnimObject(),_.frames[frame_index].to,undefined,$splitnow,animobject.length-1) : _.frames[frame_index].to !==undefined && _.frames[frame_index].to.match(/auto:auto/g)===null ? getAnimDatas(newEndAnimObject(),_.frames[frame_index].to,opt.sdir==1,$splitnow,(animobject.length-1)) : getAnimDatas(newEndAnimObject(),_.frames[_.inframeindex].from,opt.sdir==0,$splitnow,(animobject.length-1)),
  825. $from = _.frames[frame_index].from !==undefined ? getAnimDatas($to,_.frames[_.inframeindex].from,opt.sdir==1,$splitnow,animobject.length-1) : undefined, // ANIMATE FROM THE VERY FIRST SETTING, OR FROM PREVIOUS SETTING
  826. $elemdelay = _.frames[frame_index].splitdelay,
  827. $mask_from,$mask_to;
  828. if (frame_index===0 && !obj.fromcurrentstate)
  829. $mask_from = getMaskDatas(_.frames[frame_index].mask);
  830. else
  831. $mask_to = getMaskDatas(_.frames[frame_index].mask);
  832. $to.anim.ease = _.frames[frame_index].ease===undefined ? punchgs.Power1.easeInOut : _.frames[frame_index].ease;
  833. if ($from!==undefined) {
  834. $from.anim.ease = _.frames[frame_index].ease===undefined ? punchgs.Power1.easeInOut : _.frames[frame_index].ease;
  835. $from.speed = _.frames[frame_index].speed === undefined ? $from.speed : _.frames[frame_index].speed;
  836. $from.anim.x = $from.anim.x * opt.bw || getBorderDirections($from.anim.x,opt,_.eow,_.eoh,_.calcy,_.calcx, "horizontal" );
  837. $from.anim.y = $from.anim.y * opt.bw || getBorderDirections($from.anim.y,opt,_.eow,_.eoh,_.calcy,_.calcx, "vertical" );
  838. }
  839. if ($to!==undefined) {
  840. $to.anim.ease = _.frames[frame_index].ease===undefined ? punchgs.Power1.easeInOut : _.frames[frame_index].ease;
  841. $to.speed = _.frames[frame_index].speed === undefined ? $to.speed : _.frames[frame_index].speed;
  842. $to.anim.x = $to.anim.x * opt.bw || getBorderDirections($to.anim.x,opt,_.eow,_.eoh,_.calcy,_.calcx, "horizontal" );
  843. $to.anim.y = $to.anim.y * opt.bw || getBorderDirections($to.anim.y,opt,_.eow,_.eoh,_.calcy,_.calcx, "vertical" );
  844. }
  845. // FIX VISIBLE IFRAME BUG IN SAFARI
  846. if (_nc.data('iframes')) timeline.add(punchgs.TweenLite.set(_nc.find('iframe'),{autoAlpha:1}),label+"+=0.001");
  847. // IN CASE LAST FRAME REACHED, AND ANIMATION IS SET TO AUTO (REVERSE PLAYING)
  848. if (frame_index===_.outframeindex) {
  849. if (_.frames[frame_index].to && _.frames[frame_index].to.match(/auto:auto/g)) {
  850. //
  851. }
  852. $to.speed = _.frames[frame_index].speed === undefined || _.frames[frame_index].speed==="inherit" ? _.frames[_.inframeindex].speed : _.frames[frame_index].speed;
  853. $to.anim.ease = _.frames[frame_index].ease === undefined || _.frames[frame_index].ease==="inherit" ? _.frames[_.inframeindex].ease : _.frames[frame_index].ease;
  854. $to.anim.overwrite ="auto";
  855. }
  856. // IN CASE FIRST FRAME REACHED
  857. if (frame_index===0 && !obj.fromcurrentstate) {
  858. if (animobject != _nc) {
  859. var old = jQuery.extend({},$to.anim,true);
  860. timeline.add(punchgs.TweenLite.set(_nc, $to.anim),label);
  861. $to = newAnimObject();
  862. $to.ease = old.ease;
  863. if (old.filter!==undefined) $to.anim.filter = old.filter;
  864. if (old["-webkit-filter"]!==undefined) $to.anim["-webkit-filter"] = old["-webkit-filter"];
  865. }
  866. $from.anim.visibility = "hidden";
  867. $from.anim.immediateRender = true;
  868. $to.anim.visibility = "visible";
  869. //_nc.data('speed',$from.speed);
  870. //_nc.data('ease',$to.anim.ease);
  871. } else
  872. if (frame_index===0 && obj.fromcurrentstate) {
  873. $to.speed = $from.speed;
  874. }
  875. if (obj.fromcurrentstate) {
  876. $to.anim.immediateRender = true;
  877. }
  878. // SPECIAL EFFECT LAYER ANIMATIONS
  879. var $sfx_blockdelay = -1;
  880. //Boxed Mask Animation 0 or 999 Frame
  881. if ((frame_index===0 && !obj.fromcurrentstate && _._bmask!==undefined && $sfx!==undefined && $sfx.indexOf("block")>=0) ||
  882. (frame_index===_.outframeindex && !obj.fromcurrentstate && _._bmask!==undefined && $sfx!==undefined && $sfx.indexOf("block")>=0)) {
  883. var $sfx_speed = frame_index===0 ? ($from.speed/1000)/2 : ($to.speed/1000)/2,
  884. $sfx_ft = [{scaleY:1,scaleX:0,transformOrigin:"0% 50%"},{scaleY:1,scaleX:1,ease:$to.anim.ease}],
  885. $sfx_t = {scaleY:1,scaleX:0,transformOrigin:"100% 50%",ease:$to.anim.ease};
  886. $sfx_blockdelay = $elemdelay === undefined ? $sfx_speed : $elemdelay + $sfx_speed;
  887. switch ($sfx) {
  888. case "blocktoleft":
  889. case "blockfromright":
  890. $sfx_ft[0].transformOrigin = "100% 50%";
  891. $sfx_t.transformOrigin = "0% 50%";
  892. break;
  893. case "blockfromtop":
  894. case "blocktobottom":
  895. $sfx_ft = [{scaleX:1,scaleY:0,transformOrigin:"50% 0%"},{scaleX:1,scaleY:1,ease:$to.anim.ease}];
  896. $sfx_t = {scaleX:1,scaleY:0,transformOrigin:"50% 100%",ease:$to.anim.ease};
  897. break;
  898. case "blocktotop":
  899. case "blockfrombottom":
  900. $sfx_ft = [{scaleX:1,scaleY:0,transformOrigin:"50% 100%"},{scaleX:1,scaleY:1,ease:$to.anim.ease}];
  901. $sfx_t = {scaleX:1,scaleY:0,transformOrigin:"50% 0%",ease:$to.anim.ease};
  902. break;
  903. }
  904. $sfx_ft[0].background = _.frames[frame_index].sfxcolor;
  905. timeline.add(tweens.mask.fromTo(_._bmask,$sfx_speed, $sfx_ft[0], $sfx_ft[1],$elemdelay),label);
  906. timeline.add(tweens.mask.to(_._bmask,$sfx_speed,$sfx_t,$sfx_blockdelay),label);
  907. }
  908. if ($splitnow)
  909. var ri = getSplitTextDirs(animobject.length-1, $splitdir);
  910. if (frame_index===0 && !obj.fromcurrentstate) {
  911. if (_._sfx_in==="block")
  912. timeline.add(tweens.content.staggerFromTo(animobject,0.05,{x:0,y:0,autoAlpha:0},{x:0,y:0,autoAlpha:1,delay:$sfx_blockdelay}),label);
  913. else {
  914. if ($splitnow && ri!==undefined) {
  915. var cycles = {from:getCycles($from.anim), to:getCycles($to.anim)};
  916. for (var si in animobject) {
  917. var $fanim = jQuery.extend({},$from.anim),
  918. $tanim = jQuery.extend({},$to.anim);
  919. for (var k in cycles.from) {
  920. $fanim[k] = parseInt(cycles.from[k].values[cycles.from[k].index],0);
  921. cycles.from[k].index = cycles.from[k].index < cycles.from[k].len ? cycles.from[k].index+1 : 0;
  922. }
  923. $tanim.ease = $fanim.ease;
  924. if (_.frames[frame_index].color!==undefined) {
  925. $fanim.color = _.frames[frame_index].color;
  926. $tanim.color = _.cssobj.styleProps.color;
  927. }
  928. if (_.frames[frame_index].bgcolor!==undefined) {
  929. $fanim.backgroundColor = _.frames[frame_index].bgcolor;
  930. $tanim.backgroundColor = _.cssobj.styleProps["background-color"];
  931. }
  932. timeline.add(tweens.content.fromTo(animobject[ri[si]],$from.speed/1000,$fanim,$tanim,$elemdelay*si),label);
  933. }
  934. } else {
  935. if (_.frames[frame_index].color!==undefined) {
  936. $from.anim.color = _.frames[frame_index].color;
  937. $to.anim.color = _.cssobj.styleProps.color;
  938. }
  939. if (_.frames[frame_index].bgcolor!==undefined) {
  940. $from.anim.backgroundColor = _.frames[frame_index].bgcolor;
  941. $to.anim.backgroundColor = _.cssobj.styleProps["background-color"];
  942. }
  943. timeline.add(tweens.content.staggerFromTo(animobject,$from.speed/1000,$from.anim,$to.anim,$elemdelay),label);
  944. }
  945. }
  946. } else {
  947. if (_._sfx_out==="block" && frame_index===_.outframeindex) {
  948. timeline.add(tweens.content.staggerTo(animobject,0.001,{autoAlpha:0,delay:$sfx_blockdelay}),label);
  949. timeline.add(tweens.content.staggerTo(animobject,((($to.speed/1000)/2)-0.001),{x:0,delay:$sfx_blockdelay}),label+"+=0.001");
  950. } else
  951. if ($splitnow && ri!==undefined) {
  952. var cycles = {to:getCycles($to.anim)};
  953. for (var si in animobject) {
  954. var $tanim = jQuery.extend({},$to.anim);
  955. for (var k in cycles.to) {
  956. $tanim[k] = parseInt(cycles.to[k].values[cycles.to[k].index],0);
  957. cycles.to[k].index = cycles.to[k].index < cycles.to[k].len ? cycles.to[k].index+1 : 0;
  958. }
  959. if (_.frames[frame_index].color!==undefined)
  960. $tanim.color = _.frames[frame_index].color;
  961. if (_.frames[frame_index].bgcolor!==undefined)
  962. $tanim.backgroundColor = _.frames[frame_index].bgcolor;
  963. timeline.add(tweens.content.to(animobject[ri[si]],$to.speed/1000,$tanim,$elemdelay*si),label);
  964. }
  965. } else {
  966. if (_.frames[frame_index].color!==undefined)
  967. $to.anim.color = _.frames[frame_index].color;
  968. if (_.frames[frame_index].bgcolor!==undefined)
  969. $to.anim.backgroundColor = _.frames[frame_index].bgcolor;
  970. timeline.add(tweens.content.staggerTo(animobject,$to.speed/1000,$to.anim,$elemdelay),label);
  971. }
  972. }
  973. if ($mask_to!==undefined && $mask_to!==false && (frame_index!==0 || !obj.ignorefirstframe)) {
  974. $mask_to.anim.ease = $mask_to.anim.ease === undefined || $mask_to.anim.ease==="inherit" ? _.frames[0].ease : $mask_to.anim.ease;
  975. $mask_to.anim.overflow = "hidden";
  976. $mask_to.anim.x = $mask_to.anim.x * opt.bw || getBorderDirections($mask_to.anim.x,opt,_.eow,_.eoh,_.calcy,_.calcx,"horizontal");
  977. $mask_to.anim.y = $mask_to.anim.y * opt.bw || getBorderDirections($mask_to.anim.y,opt,_.eow,_.eoh,_.calcy,_.calcx,"vertical");
  978. }
  979. if ((frame_index===0 && $mask_from && $mask_from!==false && !obj.fromcurrentstate) || (frame_index===0 && obj.ignorefirstframe)) {
  980. $mask_to = new Object();
  981. $mask_to.anim = new Object();
  982. $mask_to.anim.overwrite = "auto";
  983. $mask_to.anim.ease = $to.anim.ease;
  984. $mask_to.anim.x = $mask_to.anim.y = 0;
  985. if ($mask_from && $mask_from!==false) {
  986. $mask_from.anim.x = $mask_from.anim.x * opt.bw || getBorderDirections($mask_from.anim.x,opt,_.eow,_.eoh,_.calcy,_.calcx,"horizontal");
  987. $mask_from.anim.y = $mask_from.anim.y * opt.bw || getBorderDirections($mask_from.anim.y,opt,_.eow,_.eoh,_.calcy,_.calcx,"vertical");
  988. $mask_from.anim.overflow ="hidden";
  989. }
  990. } else
  991. if (frame_index===0)
  992. timeline.add(tweens.mask.set(_._mw,{overflow:"visible"}),label);
  993. if ($mask_from!==undefined && $mask_to!==undefined && $mask_from!==false && $mask_to!==false)
  994. timeline.add(tweens.mask.fromTo(_._mw,$from.speed/1000,$mask_from.anim,$mask_to.anim,$elemdelay),label);
  995. else
  996. if ($mask_to!==undefined && $mask_to!==false)
  997. timeline.add(tweens.mask.to(_._mw,$to.speed/1000,$mask_to.anim,$elemdelay),label);
  998. timeline.addLabel(label+"_end");
  999. // Reset Hover Effect when Last Frame (Out Animation) ordered
  1000. if (_._gsTransformTo && frame_index===verylastframe && _.hoveredstatus)
  1001. _.hovertimelines.item = punchgs.TweenLite.to(_nc,0,_._gsTransformTo);
  1002. _._gsTransformTo = false;
  1003. // ON START
  1004. tweens.content.eventCallback("onStart",tweenOnStart,[frame_index,_nc_tl_obj,_._pw,_,timeline,$to.anim,_nc,obj.updateStaticTimeline,opt]);
  1005. // ON UPDATE
  1006. tweens.content.eventCallback("onUpdate",tweenOnUpdate,[label,_._id,_._pw,_,timeline,frame_index,jQuery.extend(true,{},$to.anim),obj.updateStaticTimeline,_nc,opt]);
  1007. // ON COMPLETE
  1008. tweens.content.eventCallback("onComplete",tweenOnComplete,[frame_index,_.frames.length,verylastframe,_._pw,_,timeline,obj.updateStaticTimeline,_nc,opt]);
  1009. return timeline;
  1010. },
  1011. //////////////////////////////
  1012. // MOVE OUT THE CAPTIONS //
  1013. ////////////////////////////
  1014. endMoveCaption : function(obj) {
  1015. obj.firstframe="frame_0";
  1016. obj.lastframe="frame_999";
  1017. var nc = getTLInfos(obj),
  1018. _ = obj.caption.data();
  1019. if (obj.frame!==undefined)
  1020. nc.timeline.play(obj.frame);
  1021. else
  1022. if (!nc.static || (obj.currentslide>=nc.removeonslide) || (obj.currentslide<nc.showonslide)) {
  1023. nc.outnow = new punchgs.TimelineLite;
  1024. nc.timeline.pause();
  1025. if (_.visibleelement===true)
  1026. _R.createFrameOnTimeline({caption:obj.caption, timeline : nc.outnow, label:"outnow", frameindex : obj.caption.data("outframeindex"), opt:obj.opt, fromcurrentstate:true}).play();
  1027. }
  1028. if (obj.checkchildrens)
  1029. if (nc.timeline_obj && nc.timeline_obj.dchildren && nc.timeline_obj.dchildren!=="none" && nc.timeline_obj.dchildren.length>0)
  1030. for (var q = 0; q<nc.timeline_obj.dchildren.length;q++) {
  1031. _R.endMoveCaption({caption:jQuery(nc.timeline_obj.dchildren[q]), opt:obj.opt});
  1032. }
  1033. },
  1034. //////////////////////////////////
  1035. // MOVE CAPTIONS TO xx FRAME //
  1036. /////////////////////////////////
  1037. playAnimationFrame : function(obj) {
  1038. obj.firstframe = obj.triggerframein;
  1039. obj.lastframe = obj.triggerframeout;
  1040. var nc = getTLInfos(obj),
  1041. _ = obj.caption.data(),
  1042. frameindex,
  1043. i=0;
  1044. for (var k in _.frames) {
  1045. if (_.frames[k].framename === obj.frame) frameindex = i;
  1046. i++;
  1047. }
  1048. if (_.triggeredtimeline!==undefined) _.triggeredtimeline.pause();
  1049. _.triggeredtimeline = new punchgs.TimelineLite;
  1050. nc.timeline.pause();
  1051. var fcs = _.visibleelement===true ? true : false;
  1052. _.triggeredtimeline = _R.createFrameOnTimeline({caption:obj.caption, timeline : _.triggeredtimeline, label:"triggered", frameindex : frameindex, updateStaticTimeline:true, opt:obj.opt, ignorefirstframe:true, fromcurrentstate:fcs}).play();
  1053. //nc.timeline.play(obj.frame);
  1054. },
  1055. //////////////////////////
  1056. // REMOVE THE CAPTIONS //
  1057. /////////////////////////
  1058. removeTheCaptions : function(actli,opt) {
  1059. if (_R.compare_version(extension).check==="stop") return false;
  1060. var removetime = 0,
  1061. index = actli.data('index'),
  1062. allcaptions = new Array;
  1063. // COLLECT ALL CAPTIONS
  1064. if (opt.layers[index])
  1065. jQuery.each(opt.layers[index], function(i,a) { allcaptions.push(a); });
  1066. /*if (opt.layers["static"])
  1067. jQuery.each(opt.layers["static"], function(i,a) { allcaptions.push(a); });*/
  1068. var slideindex = _R.currentSlideIndex(opt);
  1069. // GO THROUGH ALL CAPTIONS, AND MANAGE THEM
  1070. if (allcaptions)
  1071. jQuery.each(allcaptions,function(i) {
  1072. var _nc=jQuery(this);
  1073. if (opt.sliderType==="carousel" && opt.carousel.showLayersAllTime==="on") {
  1074. clearTimeout(_nc.data('videoplaywait'));
  1075. if (_R.stopVideo) _R.stopVideo(_nc,opt);
  1076. if (_R.removeMediaFromList) _R.removeMediaFromList(_nc,opt);
  1077. opt.lastplayedvideos = [];
  1078. } else {
  1079. killCaptionLoops(_nc);
  1080. clearTimeout(_nc.data('videoplaywait'));
  1081. _R.endMoveCaption({caption:_nc,opt:opt, currentslide:slideindex});
  1082. if (_R.removeMediaFromList) _R.removeMediaFromList(_nc,opt);
  1083. opt.lastplayedvideos = [];
  1084. }
  1085. });
  1086. }
  1087. });
  1088. /**********************************************************************************************
  1089. - HELPER FUNCTIONS FOR LAYER TRANSFORMS -
  1090. **********************************************************************************************/
  1091. var tweenOnStart = function(frame_index,ncobj,pw,_,tl,toanim,_nc,ust,opt){
  1092. var data={};
  1093. data.layer = _nc;
  1094. data.eventtype = frame_index===0 ? "enterstage" : frame_index===_.outframeindex ? "leavestage" : "framestarted";
  1095. data.layertype = _nc.data('layertype');
  1096. _.active = true;
  1097. //_nc.data('active',true);
  1098. //_.idleanimadded = false;
  1099. data.frame_index = frame_index;
  1100. data.layersettings = _nc.data();
  1101. opt.c.trigger("revolution.layeraction",[data]);
  1102. if (_.loopanimation=="on") callCaptionLoops(_._lw,opt.bw);
  1103. if (data.eventtype==="enterstage") {
  1104. _.animdirection="in";
  1105. _.visibleelement=true;
  1106. _R.toggleState(_.layertoggledby);
  1107. }
  1108. if (ncobj.dchildren!=="none" && ncobj.dchildren!==undefined && ncobj.dchildren.length>0) {
  1109. if (frame_index===0)
  1110. for (var q=0;q<ncobj.dchildren.length;q++) {
  1111. jQuery(ncobj.dchildren[q]).data('timeline').play(0);
  1112. }
  1113. else
  1114. if (frame_index===_.outframeindex)
  1115. for (var q=0;q<ncobj.dchildren.length;q++) {
  1116. _R.endMoveCaption({caption:jQuery(ncobj.dchildren[q]), opt:opt, checkchildrens:true});
  1117. }
  1118. }
  1119. punchgs.TweenLite.set(pw,{visibility:"visible"});
  1120. _.current_frame = frame_index;
  1121. _.current_timeline = tl;
  1122. _.current_timeline_time = tl.time();
  1123. if (ust) _.static_layer_timeline_time = _.current_timeline_time;
  1124. _.last_frame_started = frame_index;
  1125. }
  1126. var tweenOnUpdate = function(label,id,pw,_,tl,frame_index,toanim,ust,_nc,opt) {
  1127. if (_._nctype==="column") setColumnBgDimension(_nc,opt);
  1128. punchgs.TweenLite.set(pw,{visibility:"visible"});
  1129. _.current_frame = frame_index;
  1130. _.current_timeline = tl;
  1131. _.current_timeline_time = tl.time();
  1132. if (ust) _.static_layer_timeline_time = _.current_timeline_time;
  1133. if (_.hoveranim !== undefined && _._gsTransformTo===false) {
  1134. _._gsTransformTo = toanim;
  1135. if (_._gsTransformTo && _._gsTransformTo.startAt) delete _._gsTransformTo.startAt;
  1136. if (_.cssobj.styleProps.css===undefined)
  1137. _._gsTransformTo = jQuery.extend(true,{},_.cssobj.styleProps,_._gsTransformTo);
  1138. else
  1139. _._gsTransformTo = jQuery.extend(true,{},_.cssobj.styleProps.css,_._gsTransformTo);
  1140. }
  1141. _.visibleelement=true;
  1142. }
  1143. var tweenOnComplete = function(frame_index,frame_max,verylastframe,pw,_,tl,ust,_nc,opt) {
  1144. var data={};
  1145. data.layer = _nc;
  1146. data.eventtype = frame_index===0 ? "enteredstage" : frame_index===frame_max-1 || frame_index===verylastframe ? "leftstage" : "frameended";
  1147. data.layertype = _nc.data('layertype');
  1148. data.layersettings = _nc.data();
  1149. opt.c.trigger("revolution.layeraction",[data]);
  1150. if (data.eventtype!=="leftstage") _R.animcompleted(_nc,opt);
  1151. if (data.eventtype==="leftstage")
  1152. if (_R.stopVideo) _R.stopVideo(_nc,opt);
  1153. if (_._nctype==="column") {
  1154. punchgs.TweenLite.to(_._cbgc_man,0.01,{visibility:"hidden"});
  1155. punchgs.TweenLite.to(_._cbgc_auto,0.01,{visibility:"visible"});
  1156. }
  1157. if (data.eventtype === "leftstage") {
  1158. _.active = false;
  1159. punchgs.TweenLite.set(pw,{visibility:"hidden",overwrite:"auto"});
  1160. _.animdirection="out";
  1161. _.visibleelement=false;
  1162. _R.unToggleState(_.layertoggledby);
  1163. }
  1164. _.current_frame = frame_index;
  1165. _.current_timeline = tl;
  1166. _.current_timeline_time = tl.time();
  1167. if (ust) _.static_layer_timeline_time = _.current_timeline_time;
  1168. }
  1169. //////////////////////////////////////////////
  1170. // - GET TIMELINE INFOS FROM CAPTION - //
  1171. /////////////////////////////////////////////
  1172. var getTLInfos = function(obj) {
  1173. var _ = {};
  1174. obj.firstframe=obj.firstframe===undefined ? "frame_0" : obj.firstframe;
  1175. obj.lastframe=obj.lastframe===undefined ? "frame_999" : obj.lastframe;
  1176. _.id = obj.caption.data('id') || obj.caption.attr('id');
  1177. _.slideid = obj.caption.data('slideid') || obj.caption.closest('.tp-revslider-slidesli').data('index');
  1178. _.timeline_obj = obj.opt.timelines[_.slideid]["layers"][_.id];
  1179. _.timeline = _.timeline_obj.timeline;
  1180. _.ffs = _.timeline.getLabelTime(obj.firstframe);
  1181. _.ffe = _.timeline.getLabelTime(obj.firstframe+"_end");
  1182. _.lfs = _.timeline.getLabelTime(obj.lastframe);
  1183. _.lfe = _.timeline.getLabelTime(obj.lastframe+"_end");
  1184. _.ct = _.timeline.time();
  1185. _.static = _.timeline_obj.firstslide!=undefined || _.timeline_obj.lastslide!=undefined;
  1186. if (_.static) {
  1187. _.showonslide = _.timeline_obj.firstslide;
  1188. _.removeonslide = _.timeline_obj.lastslide;
  1189. }
  1190. return _;
  1191. }
  1192. //////////////////////////////////////////////
  1193. // - GET SPLITTEXT DIRECTION ARRAY - //
  1194. /////////////////////////////////////////////
  1195. var shuffleArray = function(array) {
  1196. var currentIndex = array.length, temporaryValue, randomIndex;
  1197. // While there remain elements to shuffle...
  1198. while (0 !== currentIndex) {
  1199. // Pick a remaining element...
  1200. randomIndex = Math.floor(Math.random() * currentIndex);
  1201. currentIndex -= 1;
  1202. // And swap it with the current element.
  1203. temporaryValue = array[currentIndex];
  1204. array[currentIndex] = array[randomIndex];
  1205. array[randomIndex] = temporaryValue;
  1206. }
  1207. return array;
  1208. }
  1209. var getSplitTextDirs = function(alen,d) {
  1210. var ri = new Array();
  1211. switch (d) {
  1212. case "forward":
  1213. case "random":
  1214. for (var si=0;si<=alen;si++) { ri.push(si);}
  1215. if (d==="random") ri = shuffleArray(ri);
  1216. break;
  1217. case "backward":
  1218. for (var si=0;si<=alen;si++) { ri.push(alen-si); }
  1219. break;
  1220. case "middletoedge":
  1221. var cc = Math.ceil(alen/2),
  1222. mm = cc-1,
  1223. pp = cc+1;
  1224. ri.push(cc);
  1225. for (var si=0;si<cc;si++) {
  1226. if (mm>=0) ri.push(mm);
  1227. if (pp<=alen) ri.push(pp);
  1228. mm--;
  1229. pp++;
  1230. }
  1231. break;
  1232. case "edgetomiddle":
  1233. var mm = alen,
  1234. pp = 0;
  1235. for (var si=0;si<=Math.floor(alen/2);si++) {
  1236. ri.push(mm);
  1237. if (pp<mm) ri.push(pp);
  1238. mm--;
  1239. pp++;
  1240. }
  1241. break;
  1242. }
  1243. return ri;
  1244. }
  1245. //////////////////////////////////////////////
  1246. // - GET SPLITTEXT CYCLES ANIMATION - //
  1247. /////////////////////////////////////////////
  1248. var getCycles = function(anim) {
  1249. var _ = {};
  1250. for (var a in anim) {
  1251. if (typeof anim[a] === "string" && anim[a].indexOf("|")>=0) {
  1252. if (_[a]===undefined) _[a] = {index:0};
  1253. _[a].values = ((anim[a].replace("[","")).replace("]","")).split("|");
  1254. _[a].len = _[a].values.length-1;
  1255. }
  1256. }
  1257. return _;
  1258. }
  1259. /////////////////////////////////////
  1260. // - CREATE ANIMATION OBJECT - //
  1261. /////////////////////////////////////
  1262. var newAnimObject = function(a) {
  1263. a = a===undefined ? new Object() : a;
  1264. a.anim = a.anim===undefined ? new Object() : a.anim;
  1265. a.anim.x = a.anim.x===undefined ? 0 : a.anim.x;
  1266. a.anim.y = a.anim.y===undefined ? 0 : a.anim.y;
  1267. a.anim.z = a.anim.z===undefined ? 0 : a.anim.z;
  1268. a.anim.rotationX = a.anim.rotationX===undefined ? 0 : a.anim.rotationX;
  1269. a.anim.rotationY = a.anim.rotationY===undefined ? 0 : a.anim.rotationY;
  1270. a.anim.rotationZ = a.anim.rotationZ===undefined ? 0 : a.anim.rotationZ;
  1271. a.anim.scaleX = a.anim.scaleX===undefined ? 1 : a.anim.scaleX;
  1272. a.anim.scaleY = a.anim.scaleY===undefined ? 1 : a.anim.scaleY;
  1273. a.anim.skewX = a.anim.skewX===undefined ? 0 : a.anim.skewX;
  1274. a.anim.skewY = a.anim.skewY===undefined ? 0 : a.anim.skewY;
  1275. a.anim.opacity = a.anim.opacity===undefined ? 1 : a.anim.opacity;
  1276. a.anim.transformOrigin = a.anim.transformOrigin===undefined ? "50% 50%" : a.anim.transformOrigin;
  1277. a.anim.transformPerspective = a.anim.transformPerspective===undefined ? 600 : a.anim.transformPerspective;
  1278. a.anim.rotation = a.anim.rotation===undefined ? 0 : a.anim.rotation;
  1279. //a.anim.ease = a.anim.ease===undefined ? punchgs.Power3.easeOut : a.anim.ease;
  1280. a.anim.force3D = a.anim.force3D===undefined ? "auto" : a.anim.force3D;
  1281. a.anim.autoAlpha = a.anim.autoAlpha===undefined ? 1 : a.anim.autoAlpha;
  1282. a.anim.visibility = a.anim.visibility===undefined ? "visible" : a.anim.visibility;
  1283. a.anim.overwrite = a.anim.overwrite===undefined ? "auto" : a.anim.overwrite;
  1284. a.speed = a.speed===undefined ? 0.3 : a.speed;
  1285. a.filter = a.filter===undefined ? "blur(0px) grayscale(0%) brightness(100%)" : a.filter;
  1286. a["-webkit-filter"] = a["-webkit-filter"]===undefined ? "blur(0px) grayscale(0%) brightness(100%)" : a["-webkit-filter"];
  1287. return a;
  1288. }
  1289. var newSVGHoverAnimObject = function() {
  1290. var a = new Object();
  1291. a.anim = new Object();
  1292. a.anim.stroke="none";
  1293. a.anim.strokeWidth=0;
  1294. a.anim.strokeDasharray="none";
  1295. a.anim.strokeDashoffset="0";
  1296. return a;
  1297. }
  1298. var setSVGAnimObject = function(data,a) {
  1299. var customarray = data.split(';');
  1300. if (customarray)
  1301. jQuery.each(customarray,function(index,pa) {
  1302. var p = pa.split(":")
  1303. var w = p[0],
  1304. v = p[1];
  1305. if (w=="sc") a.anim.stroke=v;
  1306. if (w=="sw") a.anim.strokeWidth=v;
  1307. if (w=="sda") a.anim.strokeDasharray=v;
  1308. if (w=="sdo") a.anim.strokeDashoffset=v;
  1309. });
  1310. return a;
  1311. }
  1312. var newEndAnimObject = function() {
  1313. var a = new Object();
  1314. a.anim = new Object();
  1315. a.anim.x=0;
  1316. a.anim.y=0;
  1317. a.anim.z=0;
  1318. return a;
  1319. }
  1320. var newHoverAnimObject = function() {
  1321. var a = new Object();
  1322. a.anim = new Object();
  1323. a.speed = 0.2;
  1324. return a;
  1325. }
  1326. var animDataTranslator = function(val,defval,$split,$splitamount,ext) {
  1327. ext = ext===undefined ? "" : ext;
  1328. if (jQuery.isNumeric(parseFloat(val))) {
  1329. return parseFloat(val)+ext;
  1330. } else
  1331. if (val===undefined || val==="inherit") {
  1332. return defval+"ext";
  1333. } else
  1334. if (val.split("{").length>1) {
  1335. var min = val.split(","),
  1336. max = parseFloat(min[1].split("}")[0]);
  1337. min = parseFloat(min[0].split("{")[1]);
  1338. if ($split!==undefined && $splitamount!==undefined) {
  1339. val=="["+(parseInt(Math.random()*(max-min),0) + parseInt(min,0))+"ext";
  1340. for (var i=0;i<$splitamount;i++) {
  1341. val = val+"|"+(parseInt(Math.random()*(max-min),0) + parseInt(min,0))+ext;
  1342. }
  1343. val = val+"]";
  1344. } else {
  1345. val = Math.random()*(max-min) + min;
  1346. }
  1347. }
  1348. return val;
  1349. }
  1350. var getBorderDirections = function (x,o,w,h,top,left,direction) {
  1351. if (!jQuery.isNumeric(x) && x.match(/%]/g)) {
  1352. x = x.split("[")[1].split("]")[0];
  1353. if (direction=="horizontal")
  1354. x = (w+2)*parseInt(x,0)/100;
  1355. else
  1356. if (direction=="vertical")
  1357. x = (h+2)*parseInt(x,0)/100;
  1358. } else {
  1359. x = x === "layer_left" ? (0-w) : x === "layer_right" ? w : x;
  1360. x = x === "layer_top" ? (0-h) : x==="layer_bottom" ? h : x;
  1361. x = x === "left" || x==="stage_left" ? (0-w-left) : x === "right" || x==="stage_right" ? o.conw-left : x === "center" || x === "stage_center" ? (o.conw/2 - w/2)-left : x;
  1362. x = x === "top" || x==="stage_top" ? (0-h-top) : x==="bottom" || x==="stage_bottom" ? o.conh-top : x === "middle" || x === "stage_middle" ? (o.conh/2 - h/2)-top : x;
  1363. }
  1364. return x;
  1365. }
  1366. ///////////////////////////////////////////////////
  1367. // ANALYSE AND READ OUT DATAS FROM HTML CAPTIONS //
  1368. ///////////////////////////////////////////////////
  1369. var getAnimDatas = function(frm,data,reversed,$split,$splitamount) {
  1370. var o = new Object();
  1371. o = jQuery.extend(true,{},o, frm);
  1372. if (data === undefined)
  1373. return o;
  1374. var customarray = data.split(';'),
  1375. tmpf="";
  1376. if (customarray)
  1377. jQuery.each(customarray,function(index,pa) {
  1378. var p = pa.split(":")
  1379. var w = p[0],
  1380. v = p[1];
  1381. if (reversed && reversed!=="none" && v!=undefined && v.length>0 && v.match(/\(R\)/)) {
  1382. v = v.replace("(R)","");
  1383. v = v==="right" ? "left" : v==="left" ? "right" : v==="top" ? "bottom" : v==="bottom" ? "top" : v;
  1384. if (v[0]==="[" && v[1]==="-") v = v.replace("[-","[");
  1385. else
  1386. if (v[0]==="[" && v[1]!=="-") v = v.replace("[","[-");
  1387. else
  1388. if (v[0]==="-") v = v.replace("-","");
  1389. else
  1390. if (v[0].match(/[1-9]/)) v="-"+v;
  1391. }
  1392. if (v!=undefined) {
  1393. v = v.replace(/\(R\)/,'');
  1394. if (w=="rotationX" || w=="rX") o.anim.rotationX = animDataTranslator(v,o.anim.rotationX,$split,$splitamount,"deg");
  1395. if (w=="rotationY" || w=="rY") o.anim.rotationY = animDataTranslator(v,o.anim.rotationY,$split,$splitamount,"deg");
  1396. if (w=="rotationZ" || w=="rZ") o.anim.rotation = animDataTranslator(v,o.anim.rotationZ,$split,$splitamount,"deg");
  1397. if (w=="scaleX" || w=="sX") o.anim.scaleX = animDataTranslator(v,o.anim.scaleX,$split,$splitamount);
  1398. if (w=="scaleY" || w=="sY") o.anim.scaleY = animDataTranslator(v,o.anim.scaleY,$split,$splitamount);
  1399. if (w=="opacity" || w=="o") o.anim.opacity = animDataTranslator(v,o.anim.opacity,$split,$splitamount);
  1400. //if (w=="letterspacing" || w=="ls") o.anim.letterSpacing = animDataTranslator(v,o.anim.letterSpacing);
  1401. if (w=="fb") tmpf = tmpf==="" ? 'blur('+parseInt(v,0)+'px)' : tmpf+" "+'blur('+parseInt(v,0)+'px)';
  1402. if (w=="fg") tmpf = tmpf==="" ? 'grayscale('+parseInt(v,0)+'%)' : tmpf+" "+'grayscale('+parseInt(v,0)+'%)';
  1403. if (w=="fbr") tmpf = tmpf==="" ? 'brightness('+parseInt(v,0)+'%)' : tmpf+" "+'brightness('+parseInt(v,0)+'%)';
  1404. if (o.anim.opacity===0) o.anim.autoAlpha = 0;
  1405. o.anim.opacity = o.anim.opacity == 0 ? 0.0001 : o.anim.opacity;
  1406. if (w=="skewX" || w=="skX") o.anim.skewX = animDataTranslator(v,o.anim.skewX,$split,$splitamount);
  1407. if (w=="skewY" || w=="skY") o.anim.skewY = animDataTranslator(v,o.anim.skewY,$split,$splitamount);
  1408. if (w=="x") o.anim.x = animDataTranslator(v,o.anim.x,$split,$splitamount);
  1409. if (w=="y") o.anim.y = animDataTranslator(v,o.anim.y,$split,$splitamount);
  1410. if (w=="z") o.anim.z = animDataTranslator(v,o.anim.z,$split,$splitamount);
  1411. if (w=="transformOrigin" || w=="tO") o.anim.transformOrigin = v.toString();
  1412. if (w=="transformPerspective" || w=="tP") o.anim.transformPerspective=parseInt(v,0);
  1413. if (w=="speed" || w=="s") o.speed = parseFloat(v);
  1414. //if (w=="ease" || w=="e") o.anim.ease = v;
  1415. }
  1416. })
  1417. if (tmpf!=="") {
  1418. o.anim['-webkit-filter'] = tmpf;
  1419. o.anim['filter'] = tmpf;
  1420. }
  1421. return o;
  1422. }
  1423. /////////////////////////////////
  1424. // BUILD MASK ANIMATION OBJECT //
  1425. /////////////////////////////////
  1426. var getMaskDatas = function(d) {
  1427. if (d === undefined)
  1428. return false;
  1429. var o = new Object();
  1430. o.anim = new Object();
  1431. var s = d.split(';')
  1432. if (s)
  1433. jQuery.each(s,function(index,param) {
  1434. param = param.split(":")
  1435. var w = param[0],
  1436. v = param[1];
  1437. if (w=="x") o.anim.x = v;
  1438. if (w=="y") o.anim.y = v;
  1439. if (w=="s") o.speed = parseFloat(v);
  1440. if (w=="e" || w=="ease") o.anim.ease = v;
  1441. });
  1442. return o;
  1443. }
  1444. ////////////////////////
  1445. // SHOW THE CAPTION //
  1446. ///////////////////////
  1447. var makeArray = function(obj,opt,show) {
  1448. if (obj==undefined) obj = 0;
  1449. if (!jQuery.isArray(obj) && jQuery.type(obj)==="string" && (obj.split(",").length>1 || obj.split("[").length>1)) {
  1450. obj = obj.replace("[","");
  1451. obj = obj.replace("]","");
  1452. var newobj = obj.match(/'/g) ? obj.split("',") : obj.split(",");
  1453. obj = new Array();
  1454. if (newobj)
  1455. jQuery.each(newobj,function(index,element) {
  1456. element = element.replace("'","");
  1457. element = element.replace("'","");
  1458. obj.push(element);
  1459. })
  1460. } else {
  1461. var tempw = obj;
  1462. if (!jQuery.isArray(obj) ) {
  1463. obj = new Array();
  1464. obj.push(tempw);
  1465. }
  1466. }
  1467. var tempw = obj[obj.length-1];
  1468. if (obj.length<opt.rle) {
  1469. for (var i=1;i<=opt.curWinRange;i++) {
  1470. obj.push(tempw);
  1471. }
  1472. }
  1473. return obj;
  1474. }
  1475. /* CREATE SHARP CORNERS */
  1476. function sharpCorners(nc,$class, $side,$borderh,$borderv,ncch,bgcol) {
  1477. var a = nc.find($class);
  1478. a.css('borderWidth',ncch+"px");
  1479. a.css($side,(0-ncch)+'px');
  1480. a.css($borderh,'0px solid transparent');
  1481. a.css($borderv,bgcol);
  1482. }
  1483. var convertHoverStyle = function(t,s) {
  1484. if (s===undefined) return t;
  1485. s = s.replace("c:","color:");
  1486. s = s.replace("bg:","background-color:");
  1487. s = s.replace("bw:","border-width:");
  1488. s = s.replace("bc:","border-color:");
  1489. s = s.replace("br:","borderRadius:");
  1490. s = s.replace("bs:","border-style:");
  1491. s = s.replace("td:","text-decoration:");
  1492. s = s.replace("zi:","zIndex:");
  1493. var sp = s.split(";");
  1494. if (sp)
  1495. jQuery.each(sp,function(key,cont){
  1496. var attr = cont.split(":");
  1497. if (attr[0].length>0) {
  1498. if (attr[0]==="background-color" && attr[1].indexOf("gradient")>=0) attr[0]="background";
  1499. t.anim[attr[0]] = attr[1];
  1500. }
  1501. })
  1502. return t;
  1503. }
  1504. ////////////////////////////////////////////////
  1505. // - GET CSS ATTRIBUTES OF ELEMENT - //
  1506. ////////////////////////////////////////////////
  1507. var getcssParams = function(nc,level) {
  1508. var obj = new Object(),
  1509. gp = false,
  1510. pc;
  1511. // CHECK IF CURRENT ELEMENT SHOULD RESPECT REKURSICVE RESIZES, AND SHOULD OWN THE SAME ATTRIBUTES FROM PARRENT ELEMENT
  1512. if (level=="rekursive") {
  1513. pc = nc.closest('.tp-caption');
  1514. if (pc && (
  1515. (nc.css("fontSize") === pc.css("fontSize")) &&
  1516. (nc.css("fontWeight") === pc.css("fontWeight")) &&
  1517. (nc.css("lineHeight") === pc.css("lineHeight"))
  1518. ))
  1519. gp = true;
  1520. }
  1521. obj.basealign = nc.data('basealign') || "grid";
  1522. obj.fontSize = gp ? pc.data('fontsize')===undefined ? parseInt(pc.css('fontSize'),0) || 0 : pc.data('fontsize') : nc.data('fontsize')===undefined ? parseInt(nc.css('fontSize'),0) || 0 : nc.data('fontsize');
  1523. obj.fontWeight = gp ? pc.data('fontweight')===undefined ? parseInt(pc.css('fontWeight'),0) || 0 : pc.data('fontweight') : nc.data('fontweight')===undefined ? parseInt(nc.css('fontWeight'),0) || 0 : nc.data('fontweight');
  1524. obj.whiteSpace = gp ? pc.data('whitespace')===undefined ? pc.css('whitespace') || "normal" : pc.data('whitespace') : nc.data('whitespace')===undefined ? nc.css('whitespace') || "normal" : nc.data('whitespace');
  1525. obj.textAlign = gp ? pc.data('textalign')===undefined ? pc.css('textalign') || "inherit" : pc.data('textalign') : nc.data('textalign')===undefined ? nc.css('textalign') || "inherit" : nc.data('textalign');
  1526. obj.zIndex = gp ? pc.data('zIndex')===undefined ? pc.css('zIndex') || "inherit" : pc.data('zIndex') : nc.data('zIndex')===undefined ? nc.css('zIndex') || "inherit" : nc.data('zIndex');
  1527. if (jQuery.inArray(nc.data('layertype'),["video","image","audio"])===-1 && !nc.is("img"))
  1528. obj.lineHeight = gp ? pc.data('lineheight')===undefined ? parseInt(pc.css('lineHeight'),0) || 0 : pc.data('lineheight') : nc.data('lineheight')===undefined ? parseInt(nc.css('lineHeight'),0) || 0 : nc.data('lineheight');
  1529. else
  1530. obj.lineHeight = 0;
  1531. obj.letterSpacing = gp ? pc.data('letterspacing')===undefined ? parseFloat(pc.css('letterSpacing'),0) || 0 : pc.data('letterspacing') : nc.data('letterspacing')===undefined ? parseFloat(nc.css('letterSpacing')) || 0 : nc.data('letterspacing');
  1532. obj.paddingTop = nc.data('paddingtop')===undefined ? parseInt(nc.css('paddingTop'),0) || 0 : nc.data('paddingtop');
  1533. obj.paddingBottom = nc.data('paddingbottom')===undefined ? parseInt(nc.css('paddingBottom'),0) || 0 : nc.data('paddingbottom');
  1534. obj.paddingLeft = nc.data('paddingleft')===undefined ? parseInt(nc.css('paddingLeft'),0) || 0 : nc.data('paddingleft');
  1535. obj.paddingRight = nc.data('paddingright')===undefined ? parseInt(nc.css('paddingRight'),0) || 0 : nc.data('paddingright');
  1536. obj.marginTop = nc.data('margintop')===undefined ? parseInt(nc.css('marginTop'),0) || 0 : nc.data('margintop');
  1537. obj.marginBottom = nc.data('marginbottom')===undefined ? parseInt(nc.css('marginBottom'),0) || 0 : nc.data('marginbottom');
  1538. obj.marginLeft = nc.data('marginleft')===undefined ? parseInt(nc.css('marginLeft'),0) || 0 : nc.data('marginleft');
  1539. obj.marginRight = nc.data('marginright')===undefined ? parseInt(nc.css('marginRight'),0) || 0 : nc.data('marginright');
  1540. obj.borderTopWidth = nc.data('bordertopwidth')===undefined ? parseInt(nc.css('borderTopWidth'),0) || 0 : nc.data('bordertopwidth');
  1541. obj.borderBottomWidth = nc.data('borderbottomwidth')===undefined ? parseInt(nc.css('borderBottomWidth'),0) || 0 : nc.data('borderbottomwidth');
  1542. obj.borderLeftWidth = nc.data('borderleftwidth')===undefined ? parseInt(nc.css('borderLeftWidth'),0) || 0 : nc.data('borderleftwidth');
  1543. obj.borderRightWidth = nc.data('borderrightwidth')===undefined ? parseInt(nc.css('borderRightWidth'),0) || 0 : nc.data('borderrightwidth');
  1544. if (level!="rekursive") {
  1545. obj.color = nc.data('color')===undefined ? "nopredefinedcolor" : nc.data('color');
  1546. obj.whiteSpace = gp ? pc.data('whitespace')===undefined ? pc.css('whiteSpace') || "nowrap" : pc.data('whitespace') : nc.data('whitespace')===undefined ? nc.css('whiteSpace') || "nowrap" : nc.data('whitespace');
  1547. obj.textAlign = gp ? pc.data('textalign')===undefined ? pc.css('textalign') || "inherit" : pc.data('textalign') : nc.data('textalign')===undefined ? nc.css('textalign') || "inherit" : nc.data('textalign');
  1548. obj.fontWeight = gp ? pc.data('fontweight')===undefined ? parseInt(pc.css('fontWeight'),0) || 0 : pc.data('fontweight') : nc.data('fontweight')===undefined ? parseInt(nc.css('fontWeight'),0) || 0 : nc.data('fontweight');
  1549. obj.minWidth = nc.data('width')===undefined ? parseInt(nc.css('minWidth'),0) || 0 : nc.data('width');
  1550. obj.minHeight = nc.data('height')===undefined ? parseInt(nc.css('minHeight'),0) || 0 : nc.data('height');
  1551. if (nc.data('videowidth')!=undefined && nc.data('videoheight')!=undefined) {
  1552. var vwid = nc.data('videowidth'),
  1553. vhei = nc.data('videoheight');
  1554. vwid = vwid==="100%" ? "none" : vwid;
  1555. vhei = vhei==="100%" ? "none" : vhei;
  1556. nc.data('width',vwid);
  1557. nc.data('height',vhei);
  1558. }
  1559. obj.maxWidth = nc.data('width')===undefined ? parseInt(nc.css('maxWidth'),0) || "none" : nc.data('width');
  1560. obj.maxHeight = jQuery.inArray(nc.data('type'),["column","row"])!==-1 ? "none" : nc.data('height')===undefined ? parseInt(nc.css('maxHeight'),0) || "none" : nc.data('height');
  1561. obj.wan = nc.data('wan')===undefined ? parseInt(nc.css('-webkit-transition'),0) || "none" : nc.data('wan');
  1562. obj.moan = nc.data('moan')===undefined ? parseInt(nc.css('-moz-animation-transition'),0) || "none" : nc.data('moan');
  1563. obj.man = nc.data('man')===undefined ? parseInt(nc.css('-ms-animation-transition'),0) || "none" : nc.data('man');
  1564. obj.ani = nc.data('ani')===undefined ? parseInt(nc.css('transition'),0) || "none" : nc.data('ani');
  1565. }
  1566. obj.styleProps = { borderTopLeftRadius : nc[0].style.borderTopLeftRadius,
  1567. borderTopRightRadius : nc[0].style.borderTopRightRadius,
  1568. borderBottomRightRadius : nc[0].style.borderBottomRightRadius,
  1569. borderBottomLeftRadius : nc[0].style.borderBottomLeftRadius,
  1570. "background" : nc[0].style["background"],
  1571. "boxShadow" : nc[0].style["boxShadow"],
  1572. "background-color" : nc[0].style["background-color"],
  1573. "border-top-color" : nc[0].style["border-top-color"],
  1574. "border-bottom-color" : nc[0].style["border-bottom-color"],
  1575. "border-right-color" : nc[0].style["border-right-color"],
  1576. "border-left-color" : nc[0].style["border-left-color"],
  1577. "border-top-style" : nc[0].style["border-top-style"],
  1578. "border-bottom-style" : nc[0].style["border-bottom-style"],
  1579. "border-left-style" : nc[0].style["border-left-style"],
  1580. "border-right-style" : nc[0].style["border-right-style"],
  1581. "border-left-width" : nc[0].style["border-left-width"],
  1582. "border-right-width" : nc[0].style["border-right-width"],
  1583. "border-bottom-width" : nc[0].style["border-bottom-width"],
  1584. "border-top-width" : nc[0].style["border-top-width"],
  1585. "color" : nc[0].style["color"],
  1586. "text-decoration" : nc[0].style["text-decoration"],
  1587. "font-style" : nc[0].style["font-style"]
  1588. };
  1589. if (obj.styleProps.background==="" || obj.styleProps.background===undefined || obj.styleProps.background === obj.styleProps["background-color"])
  1590. delete obj.styleProps.background;
  1591. if (obj.styleProps.color=="")
  1592. obj.styleProps.color = nc.css("color");
  1593. return obj;
  1594. }
  1595. // READ SINGLE OR ARRAY VALUES OF OBJ CSS ELEMENTS
  1596. var setResponsiveCSSValues = function(obj,opt) {
  1597. var newobj = new Object();
  1598. if (obj)
  1599. jQuery.each(obj,function(key,val){
  1600. var res_a = makeArray(val,opt)[opt.curWinRange];
  1601. newobj[key] = res_a!==undefined ? res_a : obj[key];
  1602. });
  1603. return newobj;
  1604. }
  1605. var minmaxconvert = function(a,m,r,fr) {
  1606. a = jQuery.isNumeric(a) ? (a * m)+"px" : a;
  1607. a = a==="full" ? fr : a==="auto" || a==="none" ? r : a;
  1608. return a;
  1609. }
  1610. /////////////////////////////////////////////////////////////////
  1611. // - CALCULATE THE RESPONSIVE SIZES OF THE CAPTIONS - //
  1612. /////////////////////////////////////////////////////////////////
  1613. var calcCaptionResponsive = function(nc,opt,level,responsive) {
  1614. var _=nc.data();
  1615. _ = _===undefined ? {} : _;
  1616. try{
  1617. if (nc[0].nodeName=="BR" || nc[0].tagName=="br"
  1618. /*|| nc[0].nodeName=="b" || nc[0].tagName=="b" ||
  1619. nc[0].nodeName=="strong" || nc[0].tagName=="STRONG"*/
  1620. )
  1621. return false;
  1622. } catch(e) {
  1623. }
  1624. _.cssobj = _.cssobj===undefined ? getcssParams(nc,level) : _.cssobj;
  1625. var obj = setResponsiveCSSValues(_.cssobj,opt),
  1626. bw=opt.bw,
  1627. bh=opt.bh;
  1628. if (responsive==="off") {
  1629. bw=1;
  1630. bh=1;
  1631. }
  1632. // IE8 FIX FOR AUTO LINEHEIGHT
  1633. if (obj.lineHeight=="auto") obj.lineHeight = obj.fontSize+4;
  1634. var objmargins = { Top: obj.marginTop,
  1635. Bottom: obj.marginBottom,
  1636. Left: obj.marginLeft,
  1637. Right: obj.marginRight
  1638. }
  1639. if (_._nctype==="column") {
  1640. punchgs.TweenLite.set(_._column,{
  1641. paddingTop: Math.round((obj.marginTop * bh)) + "px",
  1642. paddingBottom: Math.round((obj.marginBottom * bh)) + "px",
  1643. paddingLeft: Math.round((obj.marginLeft* bw)) + "px",
  1644. paddingRight: Math.round((obj.marginRight * bw)) + "px"});
  1645. objmargins = { Top: 0,
  1646. Bottom: 0,
  1647. Left: 0,
  1648. Right: 0
  1649. }
  1650. }
  1651. if (!nc.hasClass("tp-splitted")) {
  1652. nc.css("-webkit-transition", "none");
  1653. nc.css("-moz-transition", "none");
  1654. nc.css("-ms-transition", "none");
  1655. nc.css("transition", "none");
  1656. var hashover = nc.data('transform_hover')!==undefined || nc.data('style_hover')!==undefined;
  1657. if (hashover) punchgs.TweenLite.set(nc,obj.styleProps);
  1658. punchgs.TweenLite.set(nc,{
  1659. fontSize: Math.round((obj.fontSize * bw))+"px",
  1660. fontWeight: obj.fontWeight,
  1661. letterSpacing:Math.floor((obj.letterSpacing * bw))+"px",
  1662. paddingTop: Math.round((obj.paddingTop * bh)) + "px",
  1663. paddingBottom: Math.round((obj.paddingBottom * bh)) + "px",
  1664. paddingLeft: Math.round((obj.paddingLeft* bw)) + "px",
  1665. paddingRight: Math.round((obj.paddingRight * bw)) + "px",
  1666. marginTop: (objmargins.Top * bh) + "px",
  1667. marginBottom: (objmargins.Bottom * bh) + "px",
  1668. marginLeft: (objmargins.Left * bw) + "px",
  1669. marginRight: (objmargins.Right * bw) + "px",
  1670. borderTopWidth: Math.round(obj.borderTopWidth * bh) + "px",
  1671. borderBottomWidth: Math.round(obj.borderBottomWidth * bh) + "px",
  1672. borderLeftWidth: Math.round(obj.borderLeftWidth * bw) + "px",
  1673. borderRightWidth: Math.round(obj.borderRightWidth * bw) + "px",
  1674. lineHeight: Math.round(obj.lineHeight * bh) + "px",
  1675. textAlign:(obj.textAlign),
  1676. overwrite:"auto"});
  1677. if (level!="rekursive") {
  1678. var winw = obj.basealign =="slide" ? opt.ulw : opt.gridwidth[opt.curWinRange],
  1679. winh = obj.basealign =="slide" ? opt.ulh : opt.gridheight[opt.curWinRange],
  1680. maxw = minmaxconvert(obj.maxWidth,bw,"none",winw),
  1681. maxh = minmaxconvert(obj.maxHeight,bh,"none",winh),
  1682. minw = minmaxconvert(obj.minWidth,bw,"0px",winw),
  1683. minh = minmaxconvert(obj.minHeight,bh,"0px",winh);
  1684. // TWEEN FIX ISSUES
  1685. minw=minw===undefined ? 0 : minw;
  1686. minh=minh===undefined ? 0 : minh;
  1687. maxw=maxw===undefined ? "none" : maxw;
  1688. maxh=maxh===undefined ? "none" : maxh;
  1689. if (_._isgroup) {
  1690. if (minw==="#1/1#") minw = maxw = winw;
  1691. if (minw==="#1/2#") minw = maxw = winw / 2;
  1692. if (minw==="#1/3#") minw = maxw = winw/3;
  1693. if (minw==="#1/4#") minw = maxw = winw / 4;
  1694. if (minw==="#1/5#") minw = maxw = winw / 5;
  1695. if (minw==="#1/6#") minw = maxw = winw / 6;
  1696. if (minw==="#2/3#") minw = maxw = (winw / 3) * 2;
  1697. if (minw==="#3/4#") minw = maxw = (winw / 4) * 3;
  1698. if (minw==="#2/5#") minw = maxw = (winw / 5) * 2;
  1699. if (minw==="#3/5#") minw = maxw = (winw / 5) * 3;
  1700. if (minw==="#4/5#") minw = maxw = (winw / 5) * 4;
  1701. if (minw==="#3/6#") minw = maxw = (winw / 6) * 3;
  1702. if (minw==="#4/6#") minw = maxw = (winw / 6) * 4;
  1703. if (minw==="#5/6#") minw = maxw = (winw / 6) * 5;
  1704. }
  1705. if (_._ingroup) {
  1706. _._groupw = minw;
  1707. _._grouph = minh;
  1708. }
  1709. punchgs.TweenLite.set(nc,{
  1710. maxWidth:maxw,
  1711. maxHeight:maxh,
  1712. minWidth:minw,
  1713. minHeight:minh,
  1714. whiteSpace:obj.whiteSpace,
  1715. textAlign:(obj.textAlign),
  1716. overwrite:"auto"
  1717. });
  1718. if (obj.color!="nopredefinedcolor")
  1719. punchgs.TweenLite.set(nc,{color:obj.color,overwrite:"auto"});
  1720. if (_.svg_src!=undefined) {
  1721. var scolto = obj.color!="nopredefinedcolor" && obj.color!=undefined ? obj.color : obj.css!=undefined && obj.css.color!="nopredefinedcolor" && obj.css.color!=undefined ? obj.css.color : obj.styleProps.color!=undefined ? obj.styleProps.color : obj.styleProps.css!=undefined && obj.styleProps.css.color!=undefined ? obj.styleProps.css.color : false;
  1722. if (scolto!=false) {
  1723. punchgs.TweenLite.set(nc.find('svg'),{fill:scolto,overwrite:"auto"});
  1724. punchgs.TweenLite.set(nc.find('svg path'),{fill:scolto,overwrite:"auto"});
  1725. }
  1726. }
  1727. }
  1728. if (_._nctype==="column") {
  1729. if (_._column_bg_set===undefined) {
  1730. _._column_bg_set = nc.css('backgroundColor');
  1731. _._column_bg_image = nc.css('backgroundImage');
  1732. _._column_bg_image_repeat =nc.css('backgroundRepeat');
  1733. _._column_bg_image_position =nc.css('backgroundPosition');
  1734. _._column_bg_image_size =nc.css('backgroundSize');
  1735. _._column_bg_opacity = nc.data('bgopacity');
  1736. _._column_bg_opacity = _._column_bg_opacity===undefined ? 1 : _._column_bg_opacity;
  1737. punchgs.TweenLite.set(nc,{
  1738. backgroundColor:"transparent",
  1739. backgroundImage:""
  1740. });
  1741. }
  1742. setTimeout(function() {
  1743. setColumnBgDimension(nc,opt);
  1744. },1);
  1745. // DYNAMIC HEIGHT AUTO CALCULATED BY BROWSER
  1746. if (_._cbgc_auto && _._cbgc_auto.length>0) {
  1747. _._cbgc_auto[0].style.backgroundSize = _._column_bg_image_size;
  1748. if (jQuery.isArray(obj.marginLeft)) {
  1749. punchgs.TweenLite.set(_._cbgc_auto,{
  1750. borderTopWidth: (obj.marginTop[opt.curWinRange] * bh) + "px",
  1751. borderLeftWidth: (obj.marginLeft[opt.curWinRange] * bw) + "px",
  1752. borderRightWidth: (obj.marginRight[opt.curWinRange] * bw) + "px",
  1753. borderBottomWidth:(obj.marginBottom[opt.curWinRange] * bh) + "px",
  1754. backgroundColor:_._column_bg_set,
  1755. backgroundImage:_._column_bg_image,
  1756. backgroundRepeat:_._column_bg_image_repeat,
  1757. backgroundPosition:_._column_bg_image_position,
  1758. opacity:_._column_bg_opacity
  1759. });
  1760. } else {
  1761. punchgs.TweenLite.set(_._cbgc_auto,{
  1762. borderTopWidth: (obj.marginTop * bh) + "px",
  1763. borderLeftWidth: (obj.marginLeft * bw) + "px",
  1764. borderRightWidth: (obj.marginRight * bw) + "px",
  1765. borderBottomWidth:(obj.marginBottom * bh) + "px",
  1766. backgroundColor:_._column_bg_set,
  1767. backgroundImage:_._column_bg_image,
  1768. backgroundRepeat:_._column_bg_image_repeat,
  1769. backgroundPosition:_._column_bg_image_position,
  1770. opacity:_._column_bg_opacity
  1771. });
  1772. }
  1773. }
  1774. }
  1775. setTimeout(function() {
  1776. nc.css("-webkit-transition", nc.data('wan'));
  1777. nc.css("-moz-transition", nc.data('moan'));
  1778. nc.css("-ms-transition", nc.data('man'));
  1779. nc.css("transition", nc.data('ani'));
  1780. },30);
  1781. }
  1782. }
  1783. var setColumnBgDimension = function(nc,opt) {
  1784. // DYNAMIC HEIGHT BASED ON ROW HEIGHT
  1785. var _ = nc.data();
  1786. if (_._cbgc_man && _._cbgc_man.length>0) {
  1787. var _l,_t,_b,_r,_h,_o;
  1788. if (!jQuery.isArray(_.cssobj.marginLeft)) {
  1789. _l = (_.cssobj.marginLeft * opt.bw);
  1790. _t = (_.cssobj.marginTop * opt.bh);
  1791. _b = (_.cssobj.marginBottom * opt.bh);
  1792. _r = (_.cssobj.marginRight * opt.bw);
  1793. } else {
  1794. _l = (_.cssobj.marginLeft[opt.curWinRange] * opt.bw);
  1795. _t = (_.cssobj.marginTop[opt.curWinRange] * opt.bh);
  1796. _b = (_.cssobj.marginBottom[opt.curWinRange] * opt.bh);
  1797. _r = (_.cssobj.marginRight[opt.curWinRange] * opt.bw);
  1798. }
  1799. _h = _._row.hasClass("rev_break_columns") ? "100%" : (_._row.height() - (_t+_b))+"px";
  1800. _._cbgc_man[0].style.backgroundSize = _._column_bg_image_size;
  1801. punchgs.TweenLite.set(_._cbgc_man,{
  1802. width:"100%",
  1803. height:_h,
  1804. backgroundColor:_._column_bg_set,
  1805. backgroundImage:_._column_bg_image,
  1806. backgroundRepeat:_._column_bg_image_repeat,
  1807. backgroundPosition:_._column_bg_image_position,
  1808. overwrite:"auto",
  1809. opacity:_._column_bg_opacity
  1810. });
  1811. }
  1812. }
  1813. //////////////////////
  1814. // CAPTION LOOPS //
  1815. //////////////////////
  1816. var callCaptionLoops = function(el,factor) {
  1817. var _ = el.data();
  1818. // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
  1819. if (el.hasClass("rs-pendulum")) {
  1820. if (_._loop_timeline==undefined) {
  1821. _._loop_timeline = new punchgs.TimelineLite;
  1822. var startdeg = el.data('startdeg')==undefined ? -20 : el.data('startdeg'),
  1823. enddeg = el.data('enddeg')==undefined ? 20 : el.data('enddeg'),
  1824. speed = el.data('speed')==undefined ? 2 : el.data('speed'),
  1825. origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'),
  1826. easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing');
  1827. startdeg = startdeg * factor;
  1828. enddeg = enddeg * factor;
  1829. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:startdeg,transformOrigin:origin},{rotation:enddeg,ease:easing}));
  1830. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:enddeg,transformOrigin:origin},{rotation:startdeg,ease:easing,onComplete:function() {
  1831. _._loop_timeline.restart();
  1832. }}));
  1833. }
  1834. }
  1835. // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
  1836. if (el.hasClass("rs-rotate")) {
  1837. if (_._loop_timeline==undefined) {
  1838. _._loop_timeline = new punchgs.TimelineLite;
  1839. var startdeg = el.data('startdeg')==undefined ? 0 : el.data('startdeg'),
  1840. enddeg = el.data('enddeg')==undefined ? 360 : el.data('enddeg'),
  1841. speed = el.data('speed')==undefined ? 2 : el.data('speed'),
  1842. origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'),
  1843. easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing');
  1844. startdeg = startdeg * factor;
  1845. enddeg = enddeg * factor;
  1846. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:startdeg,transformOrigin:origin},{rotation:enddeg,ease:easing,onComplete:function() {
  1847. _._loop_timeline.restart();
  1848. }}));
  1849. }
  1850. }
  1851. // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
  1852. if (el.hasClass("rs-slideloop")) {
  1853. if (_._loop_timeline==undefined) {
  1854. _._loop_timeline = new punchgs.TimelineLite;
  1855. var xs = el.data('xs')==undefined ? 0 : el.data('xs'),
  1856. ys = el.data('ys')==undefined ? 0 : el.data('ys'),
  1857. xe = el.data('xe')==undefined ? 0 : el.data('xe'),
  1858. ye = el.data('ye')==undefined ? 0 : el.data('ye'),
  1859. speed = el.data('speed')==undefined ? 2 : el.data('speed'),
  1860. easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing');
  1861. xs = xs * factor;
  1862. ys = ys * factor;
  1863. xe = xe * factor;
  1864. ye = ye * factor;
  1865. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",x:xs,y:ys},{x:xe,y:ye,ease:easing}));
  1866. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",x:xe,y:ye},{x:xs,y:ys,onComplete:function() {
  1867. _._loop_timeline.restart();
  1868. }}));
  1869. }
  1870. }
  1871. // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
  1872. if (el.hasClass("rs-pulse")) {
  1873. if (_._loop_timeline==undefined) {
  1874. _._loop_timeline = new punchgs.TimelineLite;
  1875. var zoomstart = el.data('zoomstart')==undefined ? 0 : el.data('zoomstart'),
  1876. zoomend = el.data('zoomend')==undefined ? 0 : el.data('zoomend'),
  1877. speed = el.data('speed')==undefined ? 2 : el.data('speed'),
  1878. easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing');
  1879. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",scale:zoomstart},{scale:zoomend,ease:easing}));
  1880. _._loop_timeline.append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",scale:zoomend},{scale:zoomstart,onComplete:function() {
  1881. _._loop_timeline.restart();
  1882. }}));
  1883. }
  1884. }
  1885. if (el.hasClass("rs-wave")) {
  1886. if (_._loop_timeline==undefined) {
  1887. _._loop_timeline = new punchgs.TimelineLite;
  1888. var angle= el.data('angle')==undefined ? 10 : parseInt(el.data('angle'),0),
  1889. radius = el.data('radius')==undefined ? 10 : parseInt(el.data('radius'),0),
  1890. speed = el.data('speed')==undefined ? -20 : el.data('speed'),
  1891. origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'),
  1892. ors = origin.split(" "),
  1893. oo = new Object();
  1894. if (ors.length>=1) {
  1895. oo.x = ors[0];
  1896. oo.y = ors[1];
  1897. } else {
  1898. oo.x = "50%";
  1899. oo.y = "50%";
  1900. }
  1901. radius = radius * factor;
  1902. var _ox = ((parseInt(oo.x,0)/100)-0.5) * el.width(),
  1903. _oy = ((parseInt(oo.y,0)/100)-0.5) * el.height(),
  1904. yo = (-1*radius) + _oy,
  1905. xo = 0 + _ox,
  1906. angobj= {a:0, ang : angle, element:el, unit:radius, xoffset:xo, yoffset:yo},
  1907. ang = parseInt(angle,0),
  1908. waveanim = new punchgs.TweenLite.fromTo(angobj,speed,{ a:(0+ang) },{ a:(360+ang),force3D:"auto",ease:punchgs.Linear.easeNone});
  1909. waveanim.eventCallback("onUpdate",function(angobj) {
  1910. var rad = angobj.a * (Math.PI / 180),
  1911. yy = angobj.yoffset+(angobj.unit * (1 - Math.sin(rad))),
  1912. xx = angobj.xoffset+Math.cos(rad) * angobj.unit;
  1913. punchgs.TweenLite.to(angobj.element,0.1,{force3D:"auto",x:xx, y:yy});
  1914. },[angobj]);
  1915. waveanim.eventCallback("onComplete",function(_) {
  1916. _._loop_timeline.restart();
  1917. },[_]);
  1918. _._loop_timeline.append(waveanim);
  1919. }
  1920. }
  1921. }
  1922. var killCaptionLoops = function(nextcaption) {
  1923. // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
  1924. nextcaption.closest('.rs-pendulum, .rs-slideloop, .rs-pulse, .rs-wave').each(function() {
  1925. var _ = this;
  1926. if (_._loop_timeline!=undefined) {
  1927. _._loop_timeline.pause();
  1928. _._loop_timeline = null;
  1929. }
  1930. });
  1931. }
  1932. })(jQuery);