revolution.extension.slideanims.js 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  1. /************************************************
  2. * REVOLUTION 5.0 EXTENSION - SLIDE ANIMATIONS
  3. * @version: 1.0.5 (20.10.2015)
  4. * @requires jquery.themepunch.revolution.js
  5. * @author ThemePunch
  6. ************************************************/
  7. (function($) {
  8. var _R = jQuery.fn.revolution;
  9. ///////////////////////////////////////////
  10. // EXTENDED FUNCTIONS AVAILABLE GLOBAL //
  11. ///////////////////////////////////////////
  12. jQuery.extend(true,_R, {
  13. animateSlide : function(nexttrans, comingtransition, container, opt, nextli, actli, nextsh, actsh, mtl) {
  14. return animateSlideIntern(nexttrans, comingtransition, container, opt, nextli, actli, nextsh, actsh, mtl)
  15. }
  16. });
  17. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  18. /////////////////////////////////////////////////////////////////////////////// SLIDE TRANSITION MODULES ////////////////////////////////////////////////////
  19. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  20. //////////////////////////////////////////////////////
  21. //
  22. // * Revolution Slider - TRANSITION PREDEFINITION MODULES
  23. // * @version: 5.0.0 (13.02.2015)
  24. // * @author ThemePunch
  25. //
  26. //////////////////////////////////////////////////////
  27. ///////////////////////
  28. // PREPARE THE SLIDE //
  29. //////////////////////
  30. var prepareOneSlide = function(slotholder,opt,visible,vorh) {
  31. var sh=slotholder,
  32. img = sh.find('.defaultimg'),
  33. scalestart = sh.data('zoomstart'),
  34. rotatestart = sh.data('rotationstart');
  35. if (img.data('currotate')!=undefined)
  36. rotatestart = img.data('currotate');
  37. if (img.data('curscale')!=undefined && vorh=="box")
  38. scalestart = img.data('curscale')*100;
  39. else
  40. if (img.data('curscale')!=undefined)
  41. scalestart = img.data('curscale');
  42. _R.slotSize(img,opt);
  43. var src = img.attr('src'),
  44. bgcolor=img.css('backgroundColor'),
  45. w = opt.width,
  46. h = opt.height,
  47. fulloff = img.data("fxof"),
  48. fullyoff=0;
  49. if (opt.autoHeight=="on") h = opt.c.height();
  50. if (fulloff==undefined) fulloff=0;
  51. var off=0,
  52. bgfit = img.data('bgfit'),
  53. bgrepeat = img.data('bgrepeat'),
  54. bgposition = img.data('bgposition');
  55. if (bgfit==undefined) bgfit="cover";
  56. if (bgrepeat==undefined) bgrepeat="no-repeat";
  57. if (bgposition==undefined) bgposition="center center";
  58. switch (vorh) {
  59. // BOX ANIMATION PREPARING
  60. case "box":
  61. // SET THE MINIMAL SIZE OF A BOX
  62. var basicsize = 0,
  63. x = 0,
  64. y = 0;
  65. if (opt.sloth>opt.slotw)
  66. basicsize=opt.sloth
  67. else
  68. basicsize=opt.slotw;
  69. if (!visible) {
  70. var off=0-basicsize;
  71. }
  72. opt.slotw = basicsize;
  73. opt.sloth = basicsize;
  74. var x=0;
  75. var y=0;
  76. for (var j=0;j<opt.slots;j++) {
  77. y=0;
  78. for (var i=0;i<opt.slots;i++) {
  79. sh.append('<div class="slot" '+
  80. 'style="position:absolute;'+
  81. 'top:'+(fullyoff+y)+'px;'+
  82. 'left:'+(fulloff+x)+'px;'+
  83. 'width:'+basicsize+'px;'+
  84. 'height:'+basicsize+'px;'+
  85. 'overflow:hidden;">'+
  86. '<div class="slotslide" data-x="'+x+'" data-y="'+y+'" '+
  87. 'style="position:absolute;'+
  88. 'top:'+(0)+'px;'+
  89. 'left:'+(0)+'px;'+
  90. 'width:'+basicsize+'px;'+
  91. 'height:'+basicsize+'px;'+
  92. 'overflow:hidden;">'+
  93. '<div style="position:absolute;'+
  94. 'top:'+(0-y)+'px;'+
  95. 'left:'+(0-x)+'px;'+
  96. 'width:'+w+'px;'+
  97. 'height:'+h+'px;'+
  98. 'background-color:'+bgcolor+';'+
  99. 'background-image:url('+src+');'+
  100. 'background-repeat:'+bgrepeat+';'+
  101. 'background-size:'+bgfit+';background-position:'+bgposition+';">'+
  102. '</div></div></div>');
  103. y=y+basicsize;
  104. if (scalestart!=undefined && rotatestart!=undefined)
  105. punchgs.TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart});
  106. }
  107. x=x+basicsize;
  108. }
  109. break;
  110. // SLOT ANIMATION PREPARING
  111. case "vertical":
  112. case "horizontal":
  113. if (vorh == "horizontal") {
  114. if (!visible) var off=0-opt.slotw;
  115. for (var i=0;i<opt.slots;i++) {
  116. sh.append('<div class="slot" style="position:absolute;'+
  117. 'top:'+(0+fullyoff)+'px;'+
  118. 'left:'+(fulloff+(i*opt.slotw))+'px;'+
  119. 'overflow:hidden;width:'+(opt.slotw+0.6)+'px;'+
  120. 'height:'+h+'px">'+
  121. '<div class="slotslide" style="position:absolute;'+
  122. 'top:0px;left:'+off+'px;'+
  123. 'width:'+(opt.slotw+0.6)+'px;'+
  124. 'height:'+h+'px;overflow:hidden;">'+
  125. '<div style="background-color:'+bgcolor+';'+
  126. 'position:absolute;top:0px;'+
  127. 'left:'+(0-(i*opt.slotw))+'px;'+
  128. 'width:'+w+'px;height:'+h+'px;'+
  129. 'background-image:url('+src+');'+
  130. 'background-repeat:'+bgrepeat+';'+
  131. 'background-size:'+bgfit+';background-position:'+bgposition+';">'+
  132. '</div></div></div>');
  133. if (scalestart!=undefined && rotatestart!=undefined)
  134. punchgs.TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart});
  135. }
  136. } else {
  137. if (!visible) var off=0-opt.sloth;
  138. for (var i=0;i<opt.slots+2;i++) {
  139. sh.append('<div class="slot" style="position:absolute;'+
  140. 'top:'+(fullyoff+(i*opt.sloth))+'px;'+
  141. 'left:'+(fulloff)+'px;'+
  142. 'overflow:hidden;'+
  143. 'width:'+w+'px;'+
  144. 'height:'+(opt.sloth)+'px">'+
  145. '<div class="slotslide" style="position:absolute;'+
  146. 'top:'+(off)+'px;'+
  147. 'left:0px;width:'+w+'px;'+
  148. 'height:'+opt.sloth+'px;'+
  149. 'overflow:hidden;">'+
  150. '<div style="background-color:'+bgcolor+';'+
  151. 'position:absolute;'+
  152. 'top:'+(0-(i*opt.sloth))+'px;'+
  153. 'left:0px;'+
  154. 'width:'+w+'px;height:'+h+'px;'+
  155. 'background-image:url('+src+');'+
  156. 'background-repeat:'+bgrepeat+';'+
  157. 'background-size:'+bgfit+';background-position:'+bgposition+';">'+
  158. '</div></div></div>');
  159. if (scalestart!=undefined && rotatestart!=undefined)
  160. punchgs.TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart});
  161. }
  162. }
  163. break;
  164. }
  165. }
  166. var getSliderTransitionParameters = function(container,opt,comingtransition,nextsh,slidedirection) {
  167. /* Transition Name ,
  168. Transition Code,
  169. Transition Sub Code,
  170. Max Slots,
  171. MasterSpeed Delays,
  172. Preparing Slots (box,slideh, slidev),
  173. Call on nextsh (null = no, true/false for visibility first preparing),
  174. Call on actsh (null = no, true/false for visibility first preparing),
  175. Index of Animation
  176. easeIn,
  177. easeOut,
  178. speed,
  179. slots,
  180. */
  181. var p1i = punchgs.Power1.easeIn,
  182. p1o = punchgs.Power1.easeOut,
  183. p1io = punchgs.Power1.easeInOut,
  184. p2i = punchgs.Power2.easeIn,
  185. p2o = punchgs.Power2.easeOut,
  186. p2io = punchgs.Power2.easeInOut,
  187. p3i = punchgs.Power3.easeIn,
  188. p3o = punchgs.Power3.easeOut,
  189. p3io = punchgs.Power3.easeInOut,
  190. flatTransitions = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],
  191. premiumTransitions = [16,17,18,19,20,21,22,23,24,25,27],
  192. nexttrans =0,
  193. specials = 1,
  194. STAindex = 0,
  195. indexcounter =0,
  196. STA = new Array,
  197. transitionsArray = [ ['boxslide' , 0, 1, 10, 0,'box',false,null,0,p1o,p1o,500,6],
  198. ['boxfade', 1, 0, 10, 0,'box',false,null,1,p1io,p1io,700,5],
  199. ['slotslide-horizontal', 2, 0, 0, 200,'horizontal',true,false,2,p2io,p2io,700,3],
  200. ['slotslide-vertical', 3, 0,0,200,'vertical',true,false,3,p2io,p2io,700,3],
  201. ['curtain-1', 4, 3,0,0,'horizontal',true,true,4,p1o,p1o,300,5],
  202. ['curtain-2', 5, 3,0,0,'horizontal',true,true,5,p1o,p1o,300,5],
  203. ['curtain-3', 6, 3,25,0,'horizontal',true,true,6,p1o,p1o,300,5],
  204. ['slotzoom-horizontal', 7, 0,0,400,'horizontal',true,true,7,p1o,p1o,300,7],
  205. ['slotzoom-vertical', 8, 0,0,0,'vertical',true,true,8,p2o,p2o,500,8],
  206. ['slotfade-horizontal', 9, 0,0,500,'horizontal',true,null,9,p2o,p2o,500,25],
  207. ['slotfade-vertical', 10, 0,0 ,500,'vertical',true,null,10,p2o,p2o,500,25],
  208. ['fade', 11, 0, 1 ,300,'horizontal',true,null,11,p2io,p2io,1000,1],
  209. ['crossfade', 11, 1, 1 ,300,'horizontal',true,null,11,p2io,p2io,1000,1],
  210. ['fadethroughdark', 11, 2, 1 ,300,'horizontal',true,null,11,p2io,p2io,1000,1],
  211. ['fadethroughlight', 11, 3, 1 ,300,'horizontal',true,null,11,p2io,p2io,1000,1],
  212. ['fadethroughtransparent', 11, 4, 1 ,300,'horizontal',true,null,11,p2io,p2io,1000,1],
  213. ['slideleft', 12, 0,1,0,'horizontal',true,true,12,p3io,p3io,1000,1],
  214. ['slideup', 13, 0,1,0,'horizontal',true,true,13,p3io,p3io,1000,1],
  215. ['slidedown', 14, 0,1,0,'horizontal',true,true,14,p3io,p3io,1000,1],
  216. ['slideright', 15, 0,1,0,'horizontal',true,true,15,p3io,p3io,1000,1],
  217. ['slideoverleft', 12, 7,1,0,'horizontal',true,true,12,p3io,p3io,1000,1],
  218. ['slideoverup', 13, 7,1,0,'horizontal',true,true,13,p3io,p3io,1000,1],
  219. ['slideoverdown', 14, 7,1,0,'horizontal',true,true,14,p3io,p3io,1000,1],
  220. ['slideoverright', 15, 7,1,0,'horizontal',true,true,15,p3io,p3io,1000,1],
  221. ['slideremoveleft', 12, 8,1,0,'horizontal',true,true,12,p3io,p3io,1000,1],
  222. ['slideremoveup', 13, 8,1,0,'horizontal',true,true,13,p3io,p3io,1000,1],
  223. ['slideremovedown', 14, 8,1,0,'horizontal',true,true,14,p3io,p3io,1000,1],
  224. ['slideremoveright', 15, 8,1,0,'horizontal',true,true,15,p3io,p3io,1000,1],
  225. ['papercut', 16, 0,0,600,'',null,null,16,p3io,p3io,1000,2],
  226. ['3dcurtain-horizontal', 17, 0,20,100,'vertical',false,true,17,p1io,p1io,500,7],
  227. ['3dcurtain-vertical', 18, 0,10,100,'horizontal',false,true,18,p1io,p1io,500,5],
  228. ['cubic', 19, 0,20,600,'horizontal',false,true,19,p3io,p3io,500,1],
  229. ['cube',19,0,20,600,'horizontal',false,true,20,p3io,p3io,500,1],
  230. ['flyin', 20, 0,4,600,'vertical',false,true,21,p3o,p3io,500,1],
  231. ['turnoff', 21, 0,1,500,'horizontal',false,true,22,p3io,p3io,500,1],
  232. ['incube', 22, 0,20,200,'horizontal',false,true,23,p2io,p2io,500,1],
  233. ['cubic-horizontal', 23, 0,20,500,'vertical',false,true,24,p2o,p2o,500,1],
  234. ['cube-horizontal', 23, 0,20,500,'vertical',false,true,25,p2o,p2o,500,1],
  235. ['incube-horizontal', 24, 0,20,500,'vertical',false,true,26,p2io,p2io,500,1],
  236. ['turnoff-vertical', 25, 0,1,200,'horizontal',false,true,27,p2io,p2io,500,1],
  237. ['fadefromright', 12, 1,1,0,'horizontal',true,true,28,p2io,p2io,1000,1],
  238. ['fadefromleft', 15, 1,1,0,'horizontal',true,true,29,p2io,p2io,1000,1],
  239. ['fadefromtop', 14, 1,1,0,'horizontal',true,true,30,p2io,p2io,1000,1],
  240. ['fadefrombottom', 13, 1,1,0,'horizontal',true,true,31,p2io,p2io,1000,1],
  241. ['fadetoleftfadefromright', 12, 2,1,0,'horizontal',true,true,32,p2io,p2io,1000,1],
  242. ['fadetorightfadefromleft', 15, 2,1,0,'horizontal',true,true,33,p2io,p2io,1000,1],
  243. ['fadetobottomfadefromtop', 14, 2,1,0,'horizontal',true,true,34,p2io,p2io,1000,1],
  244. ['fadetotopfadefrombottom', 13, 2,1,0,'horizontal',true,true,35,p2io,p2io,1000,1],
  245. ['parallaxtoright', 12, 3,1,0,'horizontal',true,true,36,p2io,p2i,1500,1],
  246. ['parallaxtoleft', 15, 3,1,0,'horizontal',true,true,37,p2io,p2i,1500,1],
  247. ['parallaxtotop', 14, 3,1,0,'horizontal',true,true,38,p2io,p1i,1500,1],
  248. ['parallaxtobottom', 13, 3,1,0,'horizontal',true,true,39,p2io,p1i,1500,1],
  249. ['scaledownfromright', 12, 4,1,0,'horizontal',true,true,40,p2io,p2i,1000,1],
  250. ['scaledownfromleft', 15, 4,1,0,'horizontal',true,true,41,p2io,p2i,1000,1],
  251. ['scaledownfromtop', 14, 4,1,0,'horizontal',true,true,42,p2io,p2i,1000,1],
  252. ['scaledownfrombottom', 13, 4,1,0,'horizontal',true,true,43,p2io,p2i,1000,1],
  253. ['zoomout', 13, 5,1,0,'horizontal',true,true,44,p2io,p2i,1000,1],
  254. ['zoomin', 13, 6,1,0,'horizontal',true,true,45,p2io,p2i,1000,1],
  255. ['slidingoverlayup', 27, 0,1,0,'horizontal',true,true,47,p1io,p1o,2000,1],
  256. ['slidingoverlaydown', 28, 0,1,0,'horizontal',true,true,48,p1io,p1o,2000,1],
  257. ['slidingoverlayright', 30, 0,1,0,'horizontal',true,true,49,p1io,p1o,2000,1],
  258. ['slidingoverlayleft', 29, 0,1,0,'horizontal',true,true,50,p1io,p1o,2000,1],
  259. ['parallaxcirclesup', 31, 0,1,0,'horizontal',true,true,51,p2io,p1i,1500,1],
  260. ['parallaxcirclesdown', 32, 0,1,0,'horizontal',true,true,52,p2io,p1i,1500,1],
  261. ['parallaxcirclesright', 33, 0,1,0,'horizontal',true,true,53,p2io,p1i,1500,1],
  262. ['parallaxcirclesleft', 34, 0,1,0,'horizontal',true,true,54,p2io,p1i,1500,1],
  263. ['notransition',26,0,1,0,'horizontal',true,null,46,p2io,p2i,1000,1],
  264. ['parallaxright', 12, 3,1,0,'horizontal',true,true,55,p2io,p2i,1500,1],
  265. ['parallaxleft', 15, 3,1,0,'horizontal',true,true,56,p2io,p2i,1500,1],
  266. ['parallaxup', 14, 3,1,0,'horizontal',true,true,57,p2io,p1i,1500,1],
  267. ['parallaxdown', 13, 3,1,0,'horizontal',true,true,58,p2io,p1i,1500,1],
  268. ];
  269. // INTERNAL TEST FOR TRANSITIONS
  270. opt.testanims = false;
  271. if (opt.testanims==true) {
  272. opt.nexttesttransform = opt.nexttesttransform === undefined ? 34 : opt.nexttesttransform + 1;
  273. opt.nexttesttransform = opt.nexttesttransform>70 ? 0 : opt.nexttesttransform;
  274. comingtransition = transitionsArray[opt.nexttesttransform][0];
  275. console.log(comingtransition+" "+opt.nexttesttransform+" "+transitionsArray[opt.nexttesttransform][1]+" "+transitionsArray[opt.nexttesttransform][2]);
  276. }
  277. // CHECK AUTO DIRECTION FOR TRANSITION ARTS
  278. jQuery.each(["parallaxcircles","slidingoverlay","slide","slideover","slideremove","parallax"],function(i,b) {
  279. if (comingtransition==b+"horizontal") comingtransition = slidedirection!=1 ? b+"left" : b+"right";
  280. if (comingtransition==b+"vertical") comingtransition = slidedirection!=1 ? b+"up" : b+"down";
  281. });
  282. // RANDOM TRANSITIONS
  283. if (comingtransition == "random") {
  284. comingtransition = Math.round(Math.random()*transitionsArray.length-1);
  285. if (comingtransition>transitionsArray.length-1) comingtransition=transitionsArray.length-1;
  286. }
  287. // RANDOM FLAT TRANSITIONS
  288. if (comingtransition == "random-static") {
  289. comingtransition = Math.round(Math.random()*flatTransitions.length-1);
  290. if (comingtransition>flatTransitions.length-1) comingtransition=flatTransitions.length-1;
  291. comingtransition = flatTransitions[comingtransition];
  292. }
  293. // RANDOM PREMIUM TRANSITIONS
  294. if (comingtransition == "random-premium") {
  295. comingtransition = Math.round(Math.random()*premiumTransitions.length-1);
  296. if (comingtransition>premiumTransitions.length-1) comingtransition=premiumTransitions.length-1;
  297. comingtransition = premiumTransitions[comingtransition];
  298. }
  299. //joomla only change: avoid problematic transitions that don't compatible with mootools
  300. var problematicTransitions = [12,13,14,15,16,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45];
  301. if(opt.isJoomla == true && window.MooTools != undefined && problematicTransitions.indexOf(comingtransition) != -1){
  302. var newTransIndex = Math.round(Math.random() * (premiumTransitions.length-2) ) + 1;
  303. //some limits fix
  304. if (newTransIndex > premiumTransitions.length-1)
  305. newTransIndex = premiumTransitions.length-1;
  306. if(newTransIndex == 0)
  307. newTransIndex = 1;
  308. comingtransition = premiumTransitions[newTransIndex];
  309. }
  310. function findTransition() {
  311. // FIND THE RIGHT TRANSITION PARAMETERS HERE
  312. jQuery.each(transitionsArray,function(inde,trans) {
  313. if (trans[0] == comingtransition || trans[8] == comingtransition) {
  314. nexttrans = trans[1];
  315. specials = trans[2];
  316. STAindex = indexcounter;
  317. }
  318. indexcounter = indexcounter+1;
  319. })
  320. }
  321. findTransition();
  322. if (nexttrans>30) nexttrans = 30;
  323. if (nexttrans<0) nexttrans = 0;
  324. var obj = new Object();
  325. obj.nexttrans = nexttrans;
  326. obj.STA = transitionsArray[STAindex]; // PREPARED DEFAULT SETTINGS PER TRANSITION
  327. obj.specials = specials;
  328. return obj;
  329. }
  330. /*************************************
  331. - ANIMATE THE SLIDE -
  332. *************************************/
  333. var gSlideTransA = function(a,i) {
  334. if (i==undefined || jQuery.isNumeric(a)) return a;
  335. if (a==undefined) return a;
  336. return a.split(",")[i];
  337. }
  338. var animateSlideIntern = function(nexttrans, comingtransition, container, opt, nextli, actli, nextsh, actsh, mtl) {
  339. // GET THE TRANSITION
  340. var ai = actli.index(),
  341. ni = nextli.index(),
  342. slidedirection = ni<ai ? 1 : 0;
  343. if (opt.sc_indicator=="arrow") slidedirection = opt.sc_indicator_dir;
  344. var stp = getSliderTransitionParameters(container,opt,comingtransition,nextsh,slidedirection),
  345. STA = stp.STA,
  346. specials = stp.specials,
  347. nexttrans = stp.nexttrans;
  348. //KEN BURNS ONLY WITH FADE TRANSITION
  349. if (nextsh.data('kenburns')=="on") //|| actsh.data('kenburns')=="on")
  350. nexttrans = 11;
  351. // DEFINE THE MASTERSPEED FOR THE SLIDE //
  352. var ctid = nextli.data('nexttransid') || 0,
  353. masterspeed=gSlideTransA(nextli.data('masterspeed'),ctid);
  354. masterspeed = masterspeed==="default" ? STA[11] : masterspeed==="random" ? Math.round(Math.random()*1000+300) : masterspeed!=undefined ? parseInt(masterspeed,0) : STA[11];
  355. masterspeed = masterspeed > opt.delay ? opt.delay : masterspeed;
  356. // ADJUST MASTERSPEED
  357. masterspeed = masterspeed + STA[4];
  358. ///////////////////////
  359. // ADJUST SLOTS //
  360. ///////////////////////
  361. opt.slots = gSlideTransA(nextli.data('slotamount'),ctid);
  362. opt.slots = opt.slots==undefined || opt.slots=="default" ? STA[12] : opt.slots=="random" ? Math.round(Math.random()*12+4) : STA[12];
  363. opt.slots = opt.slots < 1 ? comingtransition=="boxslide" ? Math.round(Math.random()*6+3) : comingtransition=="flyin" ? Math.round(Math.random()*4+1) : opt.slots : opt.slots;
  364. opt.slots = (nexttrans==4 || nexttrans==5 || nexttrans==6) && opt.slots<3 ? 3 : opt.slots;
  365. opt.slots = STA[3] != 0 ? Math.min(opt.slots,STA[3]) : opt.slots;
  366. opt.slots = nexttrans==9 ? opt.width/20 : nexttrans==10 ? opt.height/20 : opt.slots;
  367. /////////////////////////////////////////////
  368. // SET THE ACTUAL AMOUNT OF SLIDES !! //
  369. // SET A RANDOM AMOUNT OF SLOTS //
  370. ///////////////////////////////////////////
  371. opt.rotate = gSlideTransA(nextli.data('rotate'),ctid);
  372. opt.rotate = opt.rotate==undefined || opt.rotate=="default" ? 0 : opt.rotate==999 || opt.rotate=="random" ? Math.round(Math.random()*360) : opt.rotate;
  373. opt.rotate = (!jQuery.support.transition || opt.ie || opt.ie9) ? 0 : opt.rotate;
  374. // prepareOneSlide
  375. if (nexttrans!=11) {
  376. if (STA[7] !=null) prepareOneSlide(actsh,opt,STA[7],STA[5]);
  377. if (STA[6] !=null) prepareOneSlide(nextsh,opt,STA[6],STA[5]);
  378. }
  379. // DEFAULT SETTINGS FOR NEXT AND ACT SH
  380. mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultvid'),{y:0,x:0,top:0,left:0,scale:1}),0);
  381. mtl.add(punchgs.TweenLite.set(actsh.find('.defaultvid'),{y:0,x:0,top:0,left:0,scale:1}),0);
  382. mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultvid'),{y:"+0%",x:"+0%"}),0);
  383. mtl.add(punchgs.TweenLite.set(actsh.find('.defaultvid'),{y:"+0%",x:"+0%"}),0);
  384. mtl.add(punchgs.TweenLite.set(nextsh,{autoAlpha:1,y:"+0%",x:"+0%"}),0);
  385. mtl.add(punchgs.TweenLite.set(actsh,{autoAlpha:1,y:"+0%",x:"+0%"}),0);
  386. mtl.add(punchgs.TweenLite.set(nextsh.parent(),{backgroundColor:"transparent"}),0);
  387. mtl.add(punchgs.TweenLite.set(actsh.parent(),{backgroundColor:"transparent"}),0);
  388. var ei= gSlideTransA(nextli.data('easein'),ctid),
  389. eo =gSlideTransA(nextli.data('easeout'),ctid);
  390. ei = ei==="default" ? STA[9] || punchgs.Power2.easeInOut : ei || STA[9] || punchgs.Power2.easeInOut;
  391. eo = eo==="default" ? STA[10] || punchgs.Power2.easeInOut : eo || STA[10] || punchgs.Power2.easeInOut;
  392. /////////////////////////////////////
  393. // THE SLOTSLIDE - TRANSITION I. //
  394. ////////////////////////////////////
  395. if (nexttrans==0) { // BOXSLIDE
  396. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  397. var maxz = Math.ceil(opt.height/opt.sloth);
  398. var curz = 0;
  399. nextsh.find('.slotslide').each(function(j) {
  400. var ss=jQuery(this);
  401. curz=curz+1;
  402. if (curz==maxz) curz=0;
  403. mtl.add(punchgs.TweenLite.from(ss,(masterspeed)/600,
  404. {opacity:0,top:(0-opt.sloth),left:(0-opt.slotw),rotation:opt.rotate,force3D:"auto",ease:ei}),((j*15) + ((curz)*30))/1500);
  405. });
  406. }
  407. /////////////////////////////////////
  408. // THE SLOTSLIDE - TRANSITION I. //
  409. ////////////////////////////////////
  410. if (nexttrans==1) {
  411. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  412. var maxtime,
  413. maxj = 0;
  414. nextsh.find('.slotslide').each(function(j) {
  415. var ss=jQuery(this),
  416. rand=Math.random()*masterspeed+300,
  417. rand2=Math.random()*500+200;
  418. if (rand+rand2>maxtime) {
  419. maxtime = rand2+rand2;
  420. maxj = j;
  421. }
  422. mtl.add(punchgs.TweenLite.from(ss,rand/1000,
  423. {autoAlpha:0, force3D:"auto",rotation:opt.rotate,ease:ei}),rand2/1000);
  424. });
  425. }
  426. /////////////////////////////////////
  427. // THE SLOTSLIDE - TRANSITION I. //
  428. ////////////////////////////////////
  429. if (nexttrans==2) {
  430. var subtl = new punchgs.TimelineLite();
  431. // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
  432. actsh.find('.slotslide').each(function() {
  433. var ss=jQuery(this);
  434. subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,{left:opt.slotw,ease:ei, force3D:"auto",rotation:(0-opt.rotate)}),0);
  435. mtl.add(subtl,0);
  436. });
  437. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  438. nextsh.find('.slotslide').each(function() {
  439. var ss=jQuery(this);
  440. subtl.add(punchgs.TweenLite.from(ss,masterspeed/1000,{left:0-opt.slotw,ease:ei, force3D:"auto",rotation:opt.rotate}),0);
  441. mtl.add(subtl,0);
  442. });
  443. }
  444. /////////////////////////////////////
  445. // THE SLOTSLIDE - TRANSITION I. //
  446. ////////////////////////////////////
  447. if (nexttrans==3) {
  448. var subtl = new punchgs.TimelineLite();
  449. // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
  450. actsh.find('.slotslide').each(function() {
  451. var ss=jQuery(this);
  452. subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,{top:opt.sloth,ease:ei,rotation:opt.rotate,force3D:"auto",transformPerspective:600}),0);
  453. mtl.add(subtl,0);
  454. });
  455. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  456. nextsh.find('.slotslide').each(function() {
  457. var ss=jQuery(this);
  458. subtl.add(punchgs.TweenLite.from(ss,masterspeed/1000,{top:0-opt.sloth,rotation:opt.rotate,ease:eo,force3D:"auto",transformPerspective:600}),0);
  459. mtl.add(subtl,0);
  460. });
  461. }
  462. /////////////////////////////////////
  463. // THE SLOTSLIDE - TRANSITION I. //
  464. ////////////////////////////////////
  465. if (nexttrans==4 || nexttrans==5) {
  466. setTimeout(function() {
  467. actsh.find('.defaultimg').css({opacity:0});
  468. },100);
  469. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  470. var cspeed = (masterspeed)/1000,
  471. ticker = cspeed,
  472. subtl = new punchgs.TimelineLite();
  473. actsh.find('.slotslide').each(function(i) {
  474. var ss=jQuery(this);
  475. var del = (i*cspeed)/opt.slots;
  476. if (nexttrans==5) del = ((opt.slots-i-1)*cspeed)/(opt.slots)/1.5;
  477. subtl.add(punchgs.TweenLite.to(ss,cspeed*3,{transformPerspective:600,force3D:"auto",top:0+opt.height,opacity:0.5,rotation:opt.rotate,ease:ei,delay:del}),0);
  478. mtl.add(subtl,0);
  479. });
  480. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  481. nextsh.find('.slotslide').each(function(i) {
  482. var ss=jQuery(this);
  483. var del = (i*cspeed)/opt.slots;
  484. if (nexttrans==5) del = ((opt.slots-i-1)*cspeed)/(opt.slots)/1.5;
  485. subtl.add(punchgs.TweenLite.from(ss,cspeed*3,
  486. {top:(0-opt.height),opacity:0.5,rotation:opt.rotate,force3D:"auto",ease:punchgs.eo,delay:del}),0);
  487. mtl.add(subtl,0);
  488. });
  489. }
  490. /////////////////////////////////////
  491. // THE SLOTSLIDE - TRANSITION I. //
  492. ////////////////////////////////////
  493. if (nexttrans==6) {
  494. if (opt.slots<2) opt.slots=2;
  495. if (opt.slots % 2) opt.slots = opt.slots+1;
  496. var subtl = new punchgs.TimelineLite();
  497. //SET DEFAULT IMG UNVISIBLE
  498. setTimeout(function() {
  499. actsh.find('.defaultimg').css({opacity:0});
  500. },100);
  501. actsh.find('.slotslide').each(function(i) {
  502. var ss=jQuery(this);
  503. if (i+1<opt.slots/2)
  504. var tempo = (i+2)*90;
  505. else
  506. var tempo = (2+opt.slots-i)*90;
  507. subtl.add(punchgs.TweenLite.to(ss,(masterspeed+tempo)/1000,{top:0+opt.height,opacity:1,force3D:"auto",rotation:opt.rotate,ease:ei}),0);
  508. mtl.add(subtl,0);
  509. });
  510. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  511. nextsh.find('.slotslide').each(function(i) {
  512. var ss=jQuery(this);
  513. if (i+1<opt.slots/2)
  514. var tempo = (i+2)*90;
  515. else
  516. var tempo = (2+opt.slots-i)*90;
  517. subtl.add(punchgs.TweenLite.from(ss,(masterspeed+tempo)/1000,
  518. {top:(0-opt.height),opacity:1,force3D:"auto",rotation:opt.rotate,ease:eo}),0);
  519. mtl.add(subtl,0);
  520. });
  521. }
  522. ////////////////////////////////////
  523. // THE SLOTSZOOM - TRANSITION II. //
  524. ////////////////////////////////////
  525. if (nexttrans==7) {
  526. masterspeed = masterspeed *2;
  527. if (masterspeed>opt.delay) masterspeed=opt.delay;
  528. var subtl = new punchgs.TimelineLite();
  529. //SET DEFAULT IMG UNVISIBLE
  530. setTimeout(function() {
  531. actsh.find('.defaultimg').css({opacity:0});
  532. },100);
  533. // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
  534. actsh.find('.slotslide').each(function() {
  535. var ss=jQuery(this).find('div');
  536. subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,{
  537. left:(0-opt.slotw/2)+'px',
  538. top:(0-opt.height/2)+'px',
  539. width:(opt.slotw*2)+"px",
  540. height:(opt.height*2)+"px",
  541. opacity:0,
  542. rotation:opt.rotate,
  543. force3D:"auto",
  544. ease:ei}),0);
  545. mtl.add(subtl,0);
  546. });
  547. //////////////////////////////////////////////////////////////
  548. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT //
  549. ///////////////////////////////////////////////////////////////
  550. nextsh.find('.slotslide').each(function(i) {
  551. var ss=jQuery(this).find('div');
  552. subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  553. {left:0,top:0,opacity:0,transformPerspective:600},
  554. {left:(0-i*opt.slotw)+'px',
  555. ease:eo,
  556. force3D:"auto",
  557. top:(0)+'px',
  558. width:opt.width,
  559. height:opt.height,
  560. opacity:1,rotation:0,
  561. delay:0.1}),0);
  562. mtl.add(subtl,0);
  563. });
  564. }
  565. ////////////////////////////////////
  566. // THE SLOTSZOOM - TRANSITION II. //
  567. ////////////////////////////////////
  568. if (nexttrans==8) {
  569. masterspeed = masterspeed * 3;
  570. if (masterspeed>opt.delay) masterspeed=opt.delay;
  571. var subtl = new punchgs.TimelineLite();
  572. // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
  573. actsh.find('.slotslide').each(function() {
  574. var ss=jQuery(this).find('div');
  575. subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,
  576. {left:(0-opt.width/2)+'px',
  577. top:(0-opt.sloth/2)+'px',
  578. width:(opt.width*2)+"px",
  579. height:(opt.sloth*2)+"px",
  580. force3D:"auto",
  581. ease:ei,
  582. opacity:0,rotation:opt.rotate}),0);
  583. mtl.add(subtl,0);
  584. });
  585. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT //
  586. ///////////////////////////////////////////////////////////////
  587. nextsh.find('.slotslide').each(function(i) {
  588. var ss=jQuery(this).find('div');
  589. subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  590. {left:0, top:0,opacity:0,force3D:"auto"},
  591. {'left':(0)+'px',
  592. 'top':(0-i*opt.sloth)+'px',
  593. 'width':(nextsh.find('.defaultimg').data('neww'))+"px",
  594. 'height':(nextsh.find('.defaultimg').data('newh'))+"px",
  595. opacity:1,
  596. ease:eo,rotation:0,
  597. }),0);
  598. mtl.add(subtl,0);
  599. });
  600. }
  601. ////////////////////////////////////////
  602. // THE SLOTSFADE - TRANSITION III. //
  603. //////////////////////////////////////
  604. if (nexttrans==9 || nexttrans==10) {
  605. var ssamount=0;
  606. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  607. nextsh.find('.slotslide').each(function(i) {
  608. var ss=jQuery(this);
  609. ssamount++;
  610. mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,{autoAlpha:0,force3D:"auto",transformPerspective:600},
  611. {autoAlpha:1,ease:ei,delay:(i*5)/1000}),0);
  612. });
  613. }
  614. //////////////////////
  615. // SLIDING OVERLAYS //
  616. //////////////////////
  617. if (nexttrans==27||nexttrans==28||nexttrans==29||nexttrans==30) {
  618. var slot = nextsh.find('.slot'),
  619. nd = nexttrans==27 || nexttrans==28 ? 1 : 2,
  620. mhp = nexttrans==27 || nexttrans==29 ? "-100%" : "+100%",
  621. php = nexttrans==27 || nexttrans==29 ? "+100%" : "-100%",
  622. mep = nexttrans==27 || nexttrans==29 ? "-80%" : "80%",
  623. pep = nexttrans==27 || nexttrans==29 ? "80%" : "-80%",
  624. ptp = nexttrans==27 || nexttrans==29 ? "10%" : "-10%",
  625. fa = {overwrite:"all"},
  626. ta = {autoAlpha:0,zIndex:1,force3D:"auto",ease:ei},
  627. fb = {position:"inherit",autoAlpha:0,overwrite:"all",zIndex:1},
  628. tb = {autoAlpha:1,force3D:"auto",ease:eo},
  629. fc = {overwrite:"all",zIndex:2},
  630. tc = {autoAlpha:1,force3D:"auto",overwrite:"all",ease:ei},
  631. fd = {overwrite:"all",zIndex:2},
  632. td = {autoAlpha:1,force3D:"auto",ease:ei},
  633. at = nd==1 ? "y" : "x";
  634. fa[at] = "0px";
  635. ta[at] = mhp;
  636. fb[at] = ptp;
  637. tb[at] = "0%";
  638. fc[at] = php;
  639. tc[at] = mhp;
  640. fd[at] = mep;
  641. td[at] = pep;
  642. slot.append('<span style="background-color:rgba(0,0,0,0.6);width:100%;height:100%;position:absolute;top:0px;left:0px;display:block;z-index:2"></span>');
  643. mtl.add(punchgs.TweenLite.fromTo(actsh,masterspeed/1000,fa,ta),0);
  644. mtl.add(punchgs.TweenLite.fromTo(nextsh.find('.defaultimg'),masterspeed/2000,fb,tb),masterspeed/2000);
  645. mtl.add(punchgs.TweenLite.fromTo(slot,masterspeed/1000,fc,tc),0);
  646. mtl.add(punchgs.TweenLite.fromTo(slot.find('.slotslide div'),masterspeed/1000,fd,td),0);
  647. }
  648. ////////////////////////////////
  649. // PARALLAX CIRCLE TRANSITION //
  650. ////////////////////////////////
  651. //nexttrans = 34;
  652. if (nexttrans==31||nexttrans==32||nexttrans==33||nexttrans==34) { // up , down, right ,left
  653. masterspeed = 6000;
  654. ei = punchgs.Power3.easeInOut;
  655. var ms = masterspeed / 1000;
  656. mas = ms - ms/5,
  657. _nt = nexttrans,
  658. fy = _nt == 31 ? "+100%" : _nt == 32 ? "-100%" : "0%",
  659. fx = _nt == 33 ? "+100%" : _nt == 34 ? "-100%" : "0%",
  660. ty = _nt == 31 ? "-100%" : _nt == 32 ? "+100%" : "0%",
  661. tx = _nt == 33 ? "-100%" : _nt == 34 ? "+100%" : "0%",
  662. mtl.add(punchgs.TweenLite.fromTo(actsh,ms-(ms*0.2),{y:0,x:0},{y:ty,x:tx,ease:eo}),ms*0.2);
  663. mtl.add(punchgs.TweenLite.fromTo(nextsh,ms,{y:fy, x:fx},{y:"0%",x:"0%",ease:ei}),0);
  664. //mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{autoAlpha:0}),0);border:1px solid #fff
  665. function moveCircles(cont,ms,_nt,dir,ei) {
  666. var slot = cont.find('.slot'),
  667. pieces = 6,
  668. sizearray = [2,1.2,0.9,0.7,0.55,0.42],
  669. sw = cont.width(),
  670. sh = cont.height(),
  671. di = sh>sw ? (sw*2) / pieces : (sh*2) / pieces;
  672. slot.wrap('<div class="slot-circle-wrapper" style="overflow:hidden;position:absolute;border:1px solid #fff"></div>');
  673. for (var i=0; i<pieces;i++) slot.parent().clone(false).appendTo(nextsh);
  674. cont.find('.slot-circle-wrapper').each(function(i) {
  675. if (i<pieces) {
  676. var t = jQuery(this),
  677. s = t.find('.slot'),
  678. nh = sw>sh ? sizearray[i]*sw : sizearray[i]*sh,
  679. nw = nh,
  680. nl = 0 + (nw/2 - sw/2),
  681. nt = 0 + (nh/2 - sh/2),
  682. br = i!=0 ? "50%" : "0",
  683. ftop = _nt == 31 ? sh/2 - nh/2 : _nt == 32 ? sh/2 - nh/2 : sh/2 - nh/2,
  684. fleft = _nt == 33 ? sw/2 - nw/2 : _nt == 34 ? sw - nw : sw/2 - nw/2,
  685. fa = {scale:1,transformOrigo:"50% 50%",width:nw+"px",height:nh+"px",top:ftop+"px",left:fleft+"px",borderRadius:br},
  686. ta = {scale:1,top:sh/2 - nh/2,left:sw/2 - nw/2,ease:ei},
  687. fftop = _nt == 31 ? nt : _nt == 32 ? nt : nt,
  688. ffleft = _nt == 33 ? nl : _nt == 34 ? nl+(sw/2) : nl,
  689. fb = {width:sw,height:sh,autoAlpha:1,top:fftop+"px",position:"absolute",left:ffleft+"px"},
  690. tb = {top:nt+"px",left:nl+"px",ease:ei},
  691. speed = ms,
  692. delay = 0;
  693. mtl.add(punchgs.TweenLite.fromTo(t,speed,fa,ta),delay);
  694. mtl.add(punchgs.TweenLite.fromTo(s,speed,fb,tb),delay);
  695. mtl.add(punchgs.TweenLite.fromTo(t,0.001,{autoAlpha:0},{autoAlpha:1}),0);
  696. }
  697. })
  698. }
  699. nextsh.find('.slot').remove();
  700. nextsh.find('.defaultimg').clone().appendTo(nextsh).addClass("slot");
  701. moveCircles(nextsh, ms,_nt,"in",ei);
  702. // moveCircles(actsh, mas,_nt,"out",eo);
  703. }
  704. /////////////////////////////
  705. // SIMPLE FADE ANIMATIONS //
  706. ////////////////////////////
  707. if (nexttrans==11) {
  708. if (specials>4) specials = 0;
  709. var ssamount=0,
  710. bgcol = specials == 2 ? "#000000" : specials == 3 ? "#ffffff" : "transparent";
  711. switch (specials) {
  712. case 0: //FADE
  713. mtl.add(punchgs.TweenLite.fromTo(nextsh,masterspeed/1000,{autoAlpha:0},{autoAlpha:1,force3D:"auto",ease:ei}),0);
  714. break;
  715. case 1: // CROSSFADE
  716. mtl.add(punchgs.TweenLite.fromTo(nextsh,masterspeed/1000,{autoAlpha:0},{autoAlpha:1,force3D:"auto",ease:ei}),0);
  717. mtl.add(punchgs.TweenLite.fromTo(actsh,masterspeed/1000,{autoAlpha:1},{autoAlpha:0,force3D:"auto",ease:ei}),0);
  718. break;
  719. case 2:
  720. case 3:
  721. case 4:
  722. mtl.add(punchgs.TweenLite.set(actsh.parent(),{backgroundColor:bgcol,force3D:"auto"}),0);
  723. mtl.add(punchgs.TweenLite.set(nextsh.parent(),{backgroundColor:"transparent",force3D:"auto"}),0);
  724. mtl.add(punchgs.TweenLite.to(actsh,masterspeed/2000,{autoAlpha:0,force3D:"auto",ease:ei}),0);
  725. mtl.add(punchgs.TweenLite.fromTo(nextsh,masterspeed/2000,{autoAlpha:0},{autoAlpha:1,force3D:"auto",ease:ei}),masterspeed/2000);
  726. break;
  727. }
  728. mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{autoAlpha:1}),0);
  729. mtl.add(punchgs.TweenLite.set(actsh.find('defaultimg'),{autoAlpha:1}),0);
  730. }
  731. if (nexttrans==26) {
  732. var ssamount=0;
  733. masterspeed=0;
  734. mtl.add(punchgs.TweenLite.fromTo(nextsh,masterspeed/1000,{autoAlpha:0},{autoAlpha:1,force3D:"auto",ease:ei}),0);
  735. mtl.add(punchgs.TweenLite.to(actsh,masterspeed/1000,{autoAlpha:0,force3D:"auto",ease:ei}),0);
  736. mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{autoAlpha:1}),0);
  737. mtl.add(punchgs.TweenLite.set(actsh.find('defaultimg'),{autoAlpha:1}),0);
  738. }
  739. if (nexttrans==12 || nexttrans==13 || nexttrans==14 || nexttrans==15) {
  740. masterspeed = masterspeed;
  741. if (masterspeed>opt.delay) masterspeed=opt.delay;
  742. //masterspeed = 1000;
  743. setTimeout(function() {
  744. punchgs.TweenLite.set(actsh.find('.defaultimg'),{autoAlpha:0});
  745. },100);
  746. var oow = opt.width,
  747. ooh = opt.height,
  748. ssn=nextsh.find('.slotslide, .defaultvid'),
  749. twx = 0,
  750. twy = 0,
  751. op = 1,
  752. scal = 1,
  753. fromscale = 1,
  754. speedy = masterspeed/1000,
  755. speedy2 = speedy;
  756. if (opt.sliderLayout=="fullwidth" || opt.sliderLayout=="fullscreen") {
  757. oow=ssn.width();
  758. ooh=ssn.height();
  759. }
  760. if (nexttrans==12)
  761. twx = oow;
  762. else
  763. if (nexttrans==15)
  764. twx = 0-oow;
  765. else
  766. if (nexttrans==13)
  767. twy = ooh;
  768. else
  769. if (nexttrans==14)
  770. twy = 0-ooh;
  771. // DEPENDING ON EXTENDED SPECIALS, DIFFERENT SCALE AND OPACITY FUNCTIONS NEED TO BE ADDED
  772. if (specials == 1) op = 0;
  773. if (specials == 2) op = 0;
  774. if (specials == 3) speedy = masterspeed / 1300;
  775. if (specials==4 || specials==5)
  776. scal=0.6;
  777. if (specials==6 )
  778. scal=1.4;
  779. if (specials==5 || specials==6) {
  780. fromscale=1.4;
  781. op=0;
  782. oow=0;
  783. ooh=0;twx=0;twy=0;
  784. }
  785. if (specials==6) fromscale=0.6;
  786. var dd = 0;
  787. if (specials==7) {
  788. oow = 0;
  789. ooh = 0;
  790. }
  791. var inc = nextsh.find('.slotslide'),
  792. outc = actsh.find('.slotslide, .defaultvid');
  793. mtl.add(punchgs.TweenLite.set(actli,{zIndex:15}),0);
  794. mtl.add(punchgs.TweenLite.set(nextli,{zIndex:20}),0);
  795. if (specials==8) {
  796. mtl.add(punchgs.TweenLite.set(actli,{zIndex:20}),0);
  797. mtl.add(punchgs.TweenLite.set(nextli,{zIndex:15}),0);
  798. mtl.add(punchgs.TweenLite.set(inc,{left:0, top:0, scale:1, opacity:1,rotation:0,ease:ei,force3D:"auto"}),0);
  799. } else {
  800. mtl.add(punchgs.TweenLite.from(inc,speedy,{left:twx, top:twy, scale:fromscale, opacity:op,rotation:opt.rotate,ease:ei,force3D:"auto"}),0);
  801. }
  802. if (specials==4 || specials==5) {
  803. oow = 0; ooh=0;
  804. }
  805. if (specials!=1)
  806. switch (nexttrans) {
  807. case 12:
  808. mtl.add(punchgs.TweenLite.to(outc,speedy2,{'left':(0-oow)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:eo}),0);
  809. break;
  810. case 15:
  811. mtl.add(punchgs.TweenLite.to(outc,speedy2,{'left':(oow)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:eo}),0);
  812. break;
  813. case 13:
  814. mtl.add(punchgs.TweenLite.to(outc,speedy2,{'top':(0-ooh)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:eo}),0);
  815. break;
  816. case 14:
  817. mtl.add(punchgs.TweenLite.to(outc,speedy2,{'top':(ooh)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:eo}),0);
  818. break;
  819. }
  820. }
  821. //////////////////////////////////////
  822. // THE SLOTSLIDE - TRANSITION XVI. //
  823. //////////////////////////////////////
  824. if (nexttrans==16) { // PAPERCUT
  825. var subtl = new punchgs.TimelineLite();
  826. mtl.add(punchgs.TweenLite.set(actli,{'position':'absolute','z-index':20}),0);
  827. mtl.add(punchgs.TweenLite.set(nextli,{'position':'absolute','z-index':15}),0);
  828. // PREPARE THE CUTS
  829. actli.wrapInner('<div class="tp-half-one" style="position:relative; width:100%;height:100%"></div>');
  830. actli.find('.tp-half-one').clone(true).appendTo(actli).addClass("tp-half-two");
  831. actli.find('.tp-half-two').removeClass('tp-half-one');
  832. var oow = opt.width,
  833. ooh = opt.height;
  834. if (opt.autoHeight=="on")
  835. ooh = container.height();
  836. actli.find('.tp-half-one .defaultimg').wrap('<div class="tp-papercut" style="width:'+oow+'px;height:'+ooh+'px;"></div>')
  837. actli.find('.tp-half-two .defaultimg').wrap('<div class="tp-papercut" style="width:'+oow+'px;height:'+ooh+'px;"></div>')
  838. actli.find('.tp-half-two .defaultimg').css({position:'absolute',top:'-50%'});
  839. actli.find('.tp-half-two .tp-caption').wrapAll('<div style="position:absolute;top:-50%;left:0px;"></div>');
  840. mtl.add(punchgs.TweenLite.set(actli.find('.tp-half-two'),
  841. {width:oow,height:ooh,overflow:'hidden',zIndex:15,position:'absolute',top:ooh/2,left:'0px',transformPerspective:600,transformOrigin:"center bottom"}),0);
  842. mtl.add(punchgs.TweenLite.set(actli.find('.tp-half-one'),
  843. {width:oow,height:ooh/2,overflow:'visible',zIndex:10,position:'absolute',top:'0px',left:'0px',transformPerspective:600,transformOrigin:"center top"}),0);
  844. // ANIMATE THE CUTS
  845. var img=actli.find('.defaultimg'),
  846. ro1=Math.round(Math.random()*20-10),
  847. ro2=Math.round(Math.random()*20-10),
  848. ro3=Math.round(Math.random()*20-10),
  849. xof = Math.random()*0.4-0.2,
  850. yof = Math.random()*0.4-0.2,
  851. sc1=Math.random()*1+1,
  852. sc2=Math.random()*1+1,
  853. sc3=Math.random()*0.3+0.3;
  854. mtl.add(punchgs.TweenLite.set(actli.find('.tp-half-one'),{overflow:'hidden'}),0);
  855. mtl.add(punchgs.TweenLite.fromTo(actli.find('.tp-half-one'),masterspeed/800,
  856. {width:oow,height:ooh/2,position:'absolute',top:'0px',left:'0px',force3D:"auto",transformOrigin:"center top"},
  857. {scale:sc1,rotation:ro1,y:(0-ooh-ooh/4),autoAlpha:0,ease:ei}),0);
  858. mtl.add(punchgs.TweenLite.fromTo(actli.find('.tp-half-two'),masterspeed/800,
  859. {width:oow,height:ooh,overflow:'hidden',position:'absolute',top:ooh/2,left:'0px',force3D:"auto",transformOrigin:"center bottom"},
  860. {scale:sc2,rotation:ro2,y:ooh+ooh/4,ease:ei,autoAlpha:0,onComplete:function() {
  861. // CLEAN UP
  862. punchgs.TweenLite.set(actli,{'position':'absolute','z-index':15});
  863. punchgs.TweenLite.set(nextli,{'position':'absolute','z-index':20});
  864. if (actli.find('.tp-half-one').length>0) {
  865. actli.find('.tp-half-one .defaultimg').unwrap();
  866. actli.find('.tp-half-one .slotholder').unwrap();
  867. }
  868. actli.find('.tp-half-two').remove();
  869. }}),0);
  870. subtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{autoAlpha:1}),0);
  871. if (actli.html()!=null)
  872. mtl.add(punchgs.TweenLite.fromTo(nextli,(masterspeed-200)/1000,
  873. {scale:sc3,x:(opt.width/4)*xof, y:(ooh/4)*yof,rotation:ro3,force3D:"auto",transformOrigin:"center center",ease:eo},
  874. {autoAlpha:1,scale:1,x:0,y:0,rotation:0}),0);
  875. mtl.add(subtl,0);
  876. }
  877. ////////////////////////////////////////
  878. // THE SLOTSLIDE - TRANSITION XVII. //
  879. ///////////////////////////////////////
  880. if (nexttrans==17) { // 3D CURTAIN HORIZONTAL
  881. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  882. nextsh.find('.slotslide').each(function(j) {
  883. var ss=jQuery(this);
  884. mtl.add(punchgs.TweenLite.fromTo(ss,(masterspeed)/800,
  885. {opacity:0,rotationY:0,scale:0.9,rotationX:-110,force3D:"auto",transformPerspective:600,transformOrigin:"center center"},
  886. {opacity:1,top:0,left:0,scale:1,rotation:0,rotationX:0,force3D:"auto",rotationY:0,ease:ei,delay:j*0.06}),0);
  887. });
  888. }
  889. ////////////////////////////////////////
  890. // THE SLOTSLIDE - TRANSITION XVIII. //
  891. ///////////////////////////////////////
  892. if (nexttrans==18) { // 3D CURTAIN VERTICAL
  893. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  894. nextsh.find('.slotslide').each(function(j) {
  895. var ss=jQuery(this);
  896. mtl.add(punchgs.TweenLite.fromTo(ss,(masterspeed)/500,
  897. {autoAlpha:0,rotationY:110,scale:0.9,rotationX:10,force3D:"auto",transformPerspective:600,transformOrigin:"center center"},
  898. {autoAlpha:1,top:0,left:0,scale:1,rotation:0,rotationX:0,force3D:"auto",rotationY:0,ease:ei,delay:j*0.06}),0);
  899. });
  900. }
  901. ////////////////////////////////////////
  902. // THE SLOTSLIDE - TRANSITION XIX. //
  903. ///////////////////////////////////////
  904. if (nexttrans==19 || nexttrans==22) { // IN CUBE
  905. var subtl = new punchgs.TimelineLite();
  906. //SET DEFAULT IMG UNVISIBLE
  907. mtl.add(punchgs.TweenLite.set(actli,{zIndex:20}),0);
  908. mtl.add(punchgs.TweenLite.set(nextli,{zIndex:20}),0);
  909. setTimeout(function() {
  910. actsh.find('.defaultimg').css({opacity:0});
  911. },100);
  912. var rot = 90,
  913. op = 1,
  914. torig ="center center ";
  915. if (slidedirection==1) rot = -90;
  916. if (nexttrans==19) {
  917. torig = torig+"-"+opt.height/2;
  918. op=0;
  919. } else {
  920. torig = torig+opt.height/2;
  921. }
  922. // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
  923. punchgs.TweenLite.set(container,{transformStyle:"flat",backfaceVisibility:"hidden",transformPerspective:600});
  924. nextsh.find('.slotslide').each(function(j) {
  925. var ss=jQuery(this);
  926. subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  927. {transformStyle:"flat",backfaceVisibility:"hidden",left:0,rotationY:opt.rotate,z:10,top:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig,rotationX:rot},
  928. {left:0,rotationY:0,top:0,z:0, scale:1,force3D:"auto",rotationX:0, delay:(j*50)/1000,ease:ei}),0);
  929. subtl.add(punchgs.TweenLite.to(ss,0.1,{autoAlpha:1,delay:(j*50)/1000}),0);
  930. mtl.add(subtl);
  931. });
  932. actsh.find('.slotslide').each(function(j) {
  933. var ss=jQuery(this);
  934. var rot = -90;
  935. if (slidedirection==1) rot = 90;
  936. subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  937. {transformStyle:"flat",backfaceVisibility:"hidden",autoAlpha:1,rotationY:0,top:0,z:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig, rotationX:0},
  938. {autoAlpha:1,rotationY:opt.rotate,top:0,z:10, scale:1,rotationX:rot, delay:(j*50)/1000,force3D:"auto",ease:eo}),0);
  939. mtl.add(subtl);
  940. });
  941. mtl.add(punchgs.TweenLite.set(actli,{zIndex:18}),0);
  942. }
  943. ////////////////////////////////////////
  944. // THE SLOTSLIDE - TRANSITION XX. //
  945. ///////////////////////////////////////
  946. if (nexttrans==20 ) { // FLYIN
  947. setTimeout(function() {
  948. actsh.find('.defaultimg').css({opacity:0});
  949. },100);
  950. if (slidedirection==1) {
  951. var ofx = -opt.width
  952. var rot =80;
  953. var torig = "20% 70% -"+opt.height/2;
  954. } else {
  955. var ofx = opt.width;
  956. var rot = -80;
  957. var torig = "80% 70% -"+opt.height/2;
  958. }
  959. nextsh.find('.slotslide').each(function(j) {
  960. var ss=jQuery(this),
  961. d = (j*50)/1000;
  962. mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  963. {left:ofx,rotationX:40,z:-600, opacity:op,top:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig,transformStyle:"flat",rotationY:rot},
  964. {left:0,rotationX:0,opacity:1,top:0,z:0, scale:1,rotationY:0, delay:d,ease:ei}),0);
  965. });
  966. actsh.find('.slotslide').each(function(j) {
  967. var ss=jQuery(this),
  968. d = (j*50)/1000;
  969. d = j>0 ? d + masterspeed/9000 : 0;
  970. if (slidedirection!=1) {
  971. var ofx = -opt.width/2
  972. var rot =30;
  973. var torig = "20% 70% -"+opt.height/2;
  974. } else {
  975. var ofx = opt.width/2;
  976. var rot = -30;
  977. var torig = "80% 70% -"+opt.height/2;
  978. }
  979. eo=punchgs.Power2.easeInOut;
  980. mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  981. {opacity:1,rotationX:0,top:0,z:0,scale:1,left:0, force3D:"auto",transformPerspective:600,transformOrigin:torig, transformStyle:"flat",rotationY:0},
  982. {opacity:1,rotationX:20,top:0, z:-600, left:ofx, force3D:"auto",rotationY:rot, delay:d,ease:eo}),0);
  983. });
  984. }
  985. ////////////////////////////////////////
  986. // THE SLOTSLIDE - TRANSITION XX. //
  987. ///////////////////////////////////////
  988. if (nexttrans==21 || nexttrans==25) { // TURNOFF
  989. //SET DEFAULT IMG UNVISIBLE
  990. setTimeout(function() {
  991. actsh.find('.defaultimg').css({opacity:0});
  992. },100);
  993. var rot = 90,
  994. ofx = -opt.width,
  995. rot2 = -rot;
  996. if (slidedirection==1) {
  997. if (nexttrans==25) {
  998. var torig = "center top 0";
  999. rot = opt.rotate;
  1000. } else {
  1001. var torig = "left center 0";
  1002. rot2 = opt.rotate;
  1003. }
  1004. } else {
  1005. ofx = opt.width;
  1006. rot = -90;
  1007. if (nexttrans==25) {
  1008. var torig = "center bottom 0"
  1009. rot2 = -rot;
  1010. rot = opt.rotate;
  1011. } else {
  1012. var torig = "right center 0";
  1013. rot2 = opt.rotate;
  1014. }
  1015. }
  1016. nextsh.find('.slotslide').each(function(j) {
  1017. var ss=jQuery(this),
  1018. ms2 = ((masterspeed/1.5)/3);
  1019. mtl.add(punchgs.TweenLite.fromTo(ss,(ms2*2)/1000,
  1020. {left:0,transformStyle:"flat",rotationX:rot2,z:0, autoAlpha:0,top:0,scale:1,force3D:"auto",transformPerspective:1200,transformOrigin:torig,rotationY:rot},
  1021. {left:0,rotationX:0,top:0,z:0, autoAlpha:1,scale:1,rotationY:0,force3D:"auto",delay:ms2/1000, ease:ei}),0);
  1022. });
  1023. if (slidedirection!=1) {
  1024. ofx = -opt.width
  1025. rot = 90;
  1026. if (nexttrans==25) {
  1027. torig = "center top 0"
  1028. rot2 = -rot;
  1029. rot = opt.rotate;
  1030. } else {
  1031. torig = "left center 0";
  1032. rot2 = opt.rotate;
  1033. }
  1034. } else {
  1035. ofx = opt.width;
  1036. rot = -90;
  1037. if (nexttrans==25) {
  1038. torig = "center bottom 0"
  1039. rot2 = -rot;
  1040. rot = opt.rotate;
  1041. } else {
  1042. torig = "right center 0";
  1043. rot2 = opt.rotate;
  1044. }
  1045. }
  1046. actsh.find('.slotslide').each(function(j) {
  1047. var ss=jQuery(this);
  1048. mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  1049. {left:0,transformStyle:"flat",rotationX:0,z:0, autoAlpha:1,top:0,scale:1,force3D:"auto",transformPerspective:1200,transformOrigin:torig,rotationY:0},
  1050. {left:0,rotationX:rot2,top:0,z:0,autoAlpha:1,force3D:"auto", scale:1,rotationY:rot,ease:eo}),0);
  1051. });
  1052. }
  1053. ////////////////////////////////////////
  1054. // THE SLOTSLIDE - TRANSITION XX. //
  1055. ///////////////////////////////////////
  1056. if (nexttrans==23 || nexttrans == 24) { // cube-horizontal - inboxhorizontal
  1057. //SET DEFAULT IMG UNVISIBLE
  1058. setTimeout(function() {
  1059. actsh.find('.defaultimg').css({opacity:0});
  1060. },100);
  1061. var rot = -90,
  1062. op = 1,
  1063. opx=0;
  1064. if (slidedirection==1) rot = 90;
  1065. if (nexttrans==23) {
  1066. var torig = "center center -"+opt.width/2;
  1067. op=0;
  1068. } else
  1069. var torig = "center center "+opt.width/2;
  1070. punchgs.TweenLite.set(container,{transformStyle:"preserve-3d",backfaceVisibility:"hidden",perspective:2500});
  1071. nextsh.find('.slotslide').each(function(j) {
  1072. var ss=jQuery(this);
  1073. mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  1074. {left:opx,rotationX:opt.rotate,force3D:"auto",opacity:op,top:0,scale:1,transformPerspective:1200,transformOrigin:torig,rotationY:rot},
  1075. {left:0,rotationX:0,autoAlpha:1,top:0,z:0, scale:1,rotationY:0, delay:(j*50)/500,ease:ei}),0);
  1076. });
  1077. rot = 90;
  1078. if (slidedirection==1) rot = -90;
  1079. actsh.find('.slotslide').each(function(j) {
  1080. var ss=jQuery(this);
  1081. mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
  1082. {left:0,rotationX:0,top:0,z:0,scale:1,force3D:"auto",transformStyle:"flat",transformPerspective:1200,transformOrigin:torig, rotationY:0},
  1083. {left:opx,rotationX:opt.rotate,top:0, scale:1,rotationY:rot, delay:(j*50)/500,ease:eo}),0);
  1084. if (nexttrans==23) mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/2000,{autoAlpha:1},{autoAlpha:0,delay:(j*50)/500 + masterspeed/3000,ease:eo}),0);
  1085. });
  1086. }
  1087. return mtl;
  1088. }
  1089. })(jQuery);