gsap.js 175 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636
  1. /*!
  2. GSAP
  3. Version: 3.13.0
  4. Plugin URL: https://gsap.com
  5. License: Copyright 2025, GreenSock. All rights reserved. | Subject to the terms at https://gsap.com/standard-license or for Club GreenSock members, the agreement issued with that membership. | author: Jack Doyle, jack@greensock.com
  6. !*/
  7. (function (global, factory) {
  8. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  9. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  10. (global = global || self, factory(global.window = global.window || {}));
  11. }(this, (function (exports) { 'use strict';
  12. function _inheritsLoose(subClass, superClass) {
  13. subClass.prototype = Object.create(superClass.prototype);
  14. subClass.prototype.constructor = subClass;
  15. subClass.__proto__ = superClass;
  16. }
  17. function _assertThisInitialized(self) {
  18. if (self === void 0) {
  19. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  20. }
  21. return self;
  22. }
  23. /*!
  24. * GSAP 3.13.0
  25. * https://gsap.com
  26. *
  27. * @license Copyright 2008-2025, GreenSock. All rights reserved.
  28. * Subject to the terms at https://gsap.com/standard-license
  29. * @author: Jack Doyle, jack@greensock.com
  30. */
  31. var _config = {
  32. autoSleep: 120,
  33. force3D: "auto",
  34. nullTargetWarn: 1,
  35. units: {
  36. lineHeight: ""
  37. }
  38. },
  39. _defaults = {
  40. duration: .5,
  41. overwrite: false,
  42. delay: 0
  43. },
  44. _suppressOverwrites,
  45. _reverting,
  46. _context,
  47. _bigNum = 1e8,
  48. _tinyNum = 1 / _bigNum,
  49. _2PI = Math.PI * 2,
  50. _HALF_PI = _2PI / 4,
  51. _gsID = 0,
  52. _sqrt = Math.sqrt,
  53. _cos = Math.cos,
  54. _sin = Math.sin,
  55. _isString = function _isString(value) {
  56. return typeof value === "string";
  57. },
  58. _isFunction = function _isFunction(value) {
  59. return typeof value === "function";
  60. },
  61. _isNumber = function _isNumber(value) {
  62. return typeof value === "number";
  63. },
  64. _isUndefined = function _isUndefined(value) {
  65. return typeof value === "undefined";
  66. },
  67. _isObject = function _isObject(value) {
  68. return typeof value === "object";
  69. },
  70. _isNotFalse = function _isNotFalse(value) {
  71. return value !== false;
  72. },
  73. _windowExists = function _windowExists() {
  74. return typeof window !== "undefined";
  75. },
  76. _isFuncOrString = function _isFuncOrString(value) {
  77. return _isFunction(value) || _isString(value);
  78. },
  79. _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {},
  80. _isArray = Array.isArray,
  81. _strictNumExp = /(?:-?\.?\d|\.)+/gi,
  82. _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,
  83. _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g,
  84. _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,
  85. _relExp = /[+-]=-?[.\d]+/,
  86. _delimitedValueExp = /[^,'"\[\]\s]+/gi,
  87. _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,
  88. _globalTimeline,
  89. _win,
  90. _coreInitted,
  91. _doc,
  92. _globals = {},
  93. _installScope = {},
  94. _coreReady,
  95. _install = function _install(scope) {
  96. return (_installScope = _merge(scope, _globals)) && gsap;
  97. },
  98. _missingPlugin = function _missingPlugin(property, value) {
  99. return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
  100. },
  101. _warn = function _warn(message, suppress) {
  102. return !suppress && console.warn(message);
  103. },
  104. _addGlobal = function _addGlobal(name, obj) {
  105. return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals;
  106. },
  107. _emptyFunc = function _emptyFunc() {
  108. return 0;
  109. },
  110. _startAtRevertConfig = {
  111. suppressEvents: true,
  112. isStart: true,
  113. kill: false
  114. },
  115. _revertConfigNoKill = {
  116. suppressEvents: true,
  117. kill: false
  118. },
  119. _revertConfig = {
  120. suppressEvents: true
  121. },
  122. _reservedProps = {},
  123. _lazyTweens = [],
  124. _lazyLookup = {},
  125. _lastRenderedFrame,
  126. _plugins = {},
  127. _effects = {},
  128. _nextGCFrame = 30,
  129. _harnessPlugins = [],
  130. _callbackNames = "",
  131. _harness = function _harness(targets) {
  132. var target = targets[0],
  133. harnessPlugin,
  134. i;
  135. _isObject(target) || _isFunction(target) || (targets = [targets]);
  136. if (!(harnessPlugin = (target._gsap || {}).harness)) {
  137. i = _harnessPlugins.length;
  138. while (i-- && !_harnessPlugins[i].targetTest(target)) {}
  139. harnessPlugin = _harnessPlugins[i];
  140. }
  141. i = targets.length;
  142. while (i--) {
  143. targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1);
  144. }
  145. return targets;
  146. },
  147. _getCache = function _getCache(target) {
  148. return target._gsap || _harness(toArray(target))[0]._gsap;
  149. },
  150. _getProperty = function _getProperty(target, property, v) {
  151. return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v;
  152. },
  153. _forEachName = function _forEachName(names, func) {
  154. return (names = names.split(",")).forEach(func) || names;
  155. },
  156. _round = function _round(value) {
  157. return Math.round(value * 100000) / 100000 || 0;
  158. },
  159. _roundPrecise = function _roundPrecise(value) {
  160. return Math.round(value * 10000000) / 10000000 || 0;
  161. },
  162. _parseRelative = function _parseRelative(start, value) {
  163. var operator = value.charAt(0),
  164. end = parseFloat(value.substr(2));
  165. start = parseFloat(start);
  166. return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end;
  167. },
  168. _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) {
  169. var l = toFind.length,
  170. i = 0;
  171. for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {}
  172. return i < l;
  173. },
  174. _lazyRender = function _lazyRender() {
  175. var l = _lazyTweens.length,
  176. a = _lazyTweens.slice(0),
  177. i,
  178. tween;
  179. _lazyLookup = {};
  180. _lazyTweens.length = 0;
  181. for (i = 0; i < l; i++) {
  182. tween = a[i];
  183. tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0);
  184. }
  185. },
  186. _isRevertWorthy = function _isRevertWorthy(animation) {
  187. return !!(animation._initted || animation._startAt || animation.add);
  188. },
  189. _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) {
  190. _lazyTweens.length && !_reverting && _lazyRender();
  191. animation.render(time, suppressEvents, force || !!(_reverting && time < 0 && _isRevertWorthy(animation)));
  192. _lazyTweens.length && !_reverting && _lazyRender();
  193. },
  194. _numericIfPossible = function _numericIfPossible(value) {
  195. var n = parseFloat(value);
  196. return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value;
  197. },
  198. _passThrough = function _passThrough(p) {
  199. return p;
  200. },
  201. _setDefaults = function _setDefaults(obj, defaults) {
  202. for (var p in defaults) {
  203. p in obj || (obj[p] = defaults[p]);
  204. }
  205. return obj;
  206. },
  207. _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) {
  208. return function (obj, defaults) {
  209. for (var p in defaults) {
  210. p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]);
  211. }
  212. };
  213. },
  214. _merge = function _merge(base, toMerge) {
  215. for (var p in toMerge) {
  216. base[p] = toMerge[p];
  217. }
  218. return base;
  219. },
  220. _mergeDeep = function _mergeDeep(base, toMerge) {
  221. for (var p in toMerge) {
  222. p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]);
  223. }
  224. return base;
  225. },
  226. _copyExcluding = function _copyExcluding(obj, excluding) {
  227. var copy = {},
  228. p;
  229. for (p in obj) {
  230. p in excluding || (copy[p] = obj[p]);
  231. }
  232. return copy;
  233. },
  234. _inheritDefaults = function _inheritDefaults(vars) {
  235. var parent = vars.parent || _globalTimeline,
  236. func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults;
  237. if (_isNotFalse(vars.inherit)) {
  238. while (parent) {
  239. func(vars, parent.vars.defaults);
  240. parent = parent.parent || parent._dp;
  241. }
  242. }
  243. return vars;
  244. },
  245. _arraysMatch = function _arraysMatch(a1, a2) {
  246. var i = a1.length,
  247. match = i === a2.length;
  248. while (match && i-- && a1[i] === a2[i]) {}
  249. return i < 0;
  250. },
  251. _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) {
  252. if (firstProp === void 0) {
  253. firstProp = "_first";
  254. }
  255. if (lastProp === void 0) {
  256. lastProp = "_last";
  257. }
  258. var prev = parent[lastProp],
  259. t;
  260. if (sortBy) {
  261. t = child[sortBy];
  262. while (prev && prev[sortBy] > t) {
  263. prev = prev._prev;
  264. }
  265. }
  266. if (prev) {
  267. child._next = prev._next;
  268. prev._next = child;
  269. } else {
  270. child._next = parent[firstProp];
  271. parent[firstProp] = child;
  272. }
  273. if (child._next) {
  274. child._next._prev = child;
  275. } else {
  276. parent[lastProp] = child;
  277. }
  278. child._prev = prev;
  279. child.parent = child._dp = parent;
  280. return child;
  281. },
  282. _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) {
  283. if (firstProp === void 0) {
  284. firstProp = "_first";
  285. }
  286. if (lastProp === void 0) {
  287. lastProp = "_last";
  288. }
  289. var prev = child._prev,
  290. next = child._next;
  291. if (prev) {
  292. prev._next = next;
  293. } else if (parent[firstProp] === child) {
  294. parent[firstProp] = next;
  295. }
  296. if (next) {
  297. next._prev = prev;
  298. } else if (parent[lastProp] === child) {
  299. parent[lastProp] = prev;
  300. }
  301. child._next = child._prev = child.parent = null;
  302. },
  303. _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) {
  304. child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child);
  305. child._act = 0;
  306. },
  307. _uncache = function _uncache(animation, child) {
  308. if (animation && (!child || child._end > animation._dur || child._start < 0)) {
  309. var a = animation;
  310. while (a) {
  311. a._dirty = 1;
  312. a = a.parent;
  313. }
  314. }
  315. return animation;
  316. },
  317. _recacheAncestors = function _recacheAncestors(animation) {
  318. var parent = animation.parent;
  319. while (parent && parent.parent) {
  320. parent._dirty = 1;
  321. parent.totalDuration();
  322. parent = parent.parent;
  323. }
  324. return animation;
  325. },
  326. _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) {
  327. return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force));
  328. },
  329. _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) {
  330. return !animation || animation._ts && _hasNoPausedAncestors(animation.parent);
  331. },
  332. _elapsedCycleDuration = function _elapsedCycleDuration(animation) {
  333. return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0;
  334. },
  335. _animationCycle = function _animationCycle(tTime, cycleDuration) {
  336. var whole = Math.floor(tTime = _roundPrecise(tTime / cycleDuration));
  337. return tTime && whole === tTime ? whole - 1 : whole;
  338. },
  339. _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) {
  340. return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur);
  341. },
  342. _setEnd = function _setEnd(animation) {
  343. return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0));
  344. },
  345. _alignPlayhead = function _alignPlayhead(animation, totalTime) {
  346. var parent = animation._dp;
  347. if (parent && parent.smoothChildTiming && animation._ts) {
  348. animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts));
  349. _setEnd(animation);
  350. parent._dirty || _uncache(parent, animation);
  351. }
  352. return animation;
  353. },
  354. _postAddChecks = function _postAddChecks(timeline, child) {
  355. var t;
  356. if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) {
  357. t = _parentToChildTotalTime(timeline.rawTime(), child);
  358. if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) {
  359. child.render(t, true);
  360. }
  361. }
  362. if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) {
  363. if (timeline._dur < timeline.duration()) {
  364. t = timeline;
  365. while (t._dp) {
  366. t.rawTime() >= 0 && t.totalTime(t._tTime);
  367. t = t._dp;
  368. }
  369. }
  370. timeline._zTime = -_tinyNum;
  371. }
  372. },
  373. _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) {
  374. child.parent && _removeFromParent(child);
  375. child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay);
  376. child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0));
  377. _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0);
  378. _isFromOrFromStart(child) || (timeline._recent = child);
  379. skipChecks || _postAddChecks(timeline, child);
  380. timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime);
  381. return timeline;
  382. },
  383. _scrollTrigger = function _scrollTrigger(animation, trigger) {
  384. return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation);
  385. },
  386. _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) {
  387. _initTween(tween, time, tTime);
  388. if (!tween._initted) {
  389. return 1;
  390. }
  391. if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) {
  392. _lazyTweens.push(tween);
  393. tween._lazy = [tTime, suppressEvents];
  394. return 1;
  395. }
  396. },
  397. _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) {
  398. var parent = _ref.parent;
  399. return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent));
  400. },
  401. _isFromOrFromStart = function _isFromOrFromStart(_ref2) {
  402. var data = _ref2.data;
  403. return data === "isFromStart" || data === "isStart";
  404. },
  405. _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) {
  406. var prevRatio = tween.ratio,
  407. ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1,
  408. repeatDelay = tween._rDelay,
  409. tTime = 0,
  410. pt,
  411. iteration,
  412. prevIteration;
  413. if (repeatDelay && tween._repeat) {
  414. tTime = _clamp(0, tween._tDur, totalTime);
  415. iteration = _animationCycle(tTime, repeatDelay);
  416. tween._yoyo && iteration & 1 && (ratio = 1 - ratio);
  417. if (iteration !== _animationCycle(tween._tTime, repeatDelay)) {
  418. prevRatio = 1 - ratio;
  419. tween.vars.repeatRefresh && tween._initted && tween.invalidate();
  420. }
  421. }
  422. if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) {
  423. if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) {
  424. return;
  425. }
  426. prevIteration = tween._zTime;
  427. tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0);
  428. suppressEvents || (suppressEvents = totalTime && !prevIteration);
  429. tween.ratio = ratio;
  430. tween._from && (ratio = 1 - ratio);
  431. tween._time = 0;
  432. tween._tTime = tTime;
  433. pt = tween._pt;
  434. while (pt) {
  435. pt.r(ratio, pt.d);
  436. pt = pt._next;
  437. }
  438. totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true);
  439. tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate");
  440. tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat");
  441. if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) {
  442. ratio && _removeFromParent(tween, 1);
  443. if (!suppressEvents && !_reverting) {
  444. _callback(tween, ratio ? "onComplete" : "onReverseComplete", true);
  445. tween._prom && tween._prom();
  446. }
  447. }
  448. } else if (!tween._zTime) {
  449. tween._zTime = totalTime;
  450. }
  451. },
  452. _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) {
  453. var child;
  454. if (time > prevTime) {
  455. child = animation._first;
  456. while (child && child._start <= time) {
  457. if (child.data === "isPause" && child._start > prevTime) {
  458. return child;
  459. }
  460. child = child._next;
  461. }
  462. } else {
  463. child = animation._last;
  464. while (child && child._start >= time) {
  465. if (child.data === "isPause" && child._start < prevTime) {
  466. return child;
  467. }
  468. child = child._prev;
  469. }
  470. }
  471. },
  472. _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) {
  473. var repeat = animation._repeat,
  474. dur = _roundPrecise(duration) || 0,
  475. totalProgress = animation._tTime / animation._tDur;
  476. totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur);
  477. animation._dur = dur;
  478. animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat);
  479. totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress);
  480. animation.parent && _setEnd(animation);
  481. skipUncache || _uncache(animation.parent, animation);
  482. return animation;
  483. },
  484. _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) {
  485. return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur);
  486. },
  487. _zeroPosition = {
  488. _start: 0,
  489. endTime: _emptyFunc,
  490. totalDuration: _emptyFunc
  491. },
  492. _parsePosition = function _parsePosition(animation, position, percentAnimation) {
  493. var labels = animation.labels,
  494. recent = animation._recent || _zeroPosition,
  495. clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur,
  496. i,
  497. offset,
  498. isPercent;
  499. if (_isString(position) && (isNaN(position) || position in labels)) {
  500. offset = position.charAt(0);
  501. isPercent = position.substr(-1) === "%";
  502. i = position.indexOf("=");
  503. if (offset === "<" || offset === ">") {
  504. i >= 0 && (position = position.replace(/=/, ""));
  505. return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1);
  506. }
  507. if (i < 0) {
  508. position in labels || (labels[position] = clippedDuration);
  509. return labels[position];
  510. }
  511. offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1));
  512. if (isPercent && percentAnimation) {
  513. offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration();
  514. }
  515. return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset;
  516. }
  517. return position == null ? clippedDuration : +position;
  518. },
  519. _createTweenType = function _createTweenType(type, params, timeline) {
  520. var isLegacy = _isNumber(params[1]),
  521. varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1),
  522. vars = params[varsIndex],
  523. irVars,
  524. parent;
  525. isLegacy && (vars.duration = params[1]);
  526. vars.parent = timeline;
  527. if (type) {
  528. irVars = vars;
  529. parent = timeline;
  530. while (parent && !("immediateRender" in irVars)) {
  531. irVars = parent.vars.defaults || {};
  532. parent = _isNotFalse(parent.vars.inherit) && parent.parent;
  533. }
  534. vars.immediateRender = _isNotFalse(irVars.immediateRender);
  535. type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1];
  536. }
  537. return new Tween(params[0], vars, params[varsIndex + 1]);
  538. },
  539. _conditionalReturn = function _conditionalReturn(value, func) {
  540. return value || value === 0 ? func(value) : func;
  541. },
  542. _clamp = function _clamp(min, max, value) {
  543. return value < min ? min : value > max ? max : value;
  544. },
  545. getUnit = function getUnit(value, v) {
  546. return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1];
  547. },
  548. clamp = function clamp(min, max, value) {
  549. return _conditionalReturn(value, function (v) {
  550. return _clamp(min, max, v);
  551. });
  552. },
  553. _slice = [].slice,
  554. _isArrayLike = function _isArrayLike(value, nonEmpty) {
  555. return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win;
  556. },
  557. _flatten = function _flatten(ar, leaveStrings, accumulator) {
  558. if (accumulator === void 0) {
  559. accumulator = [];
  560. }
  561. return ar.forEach(function (value) {
  562. var _accumulator;
  563. return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value);
  564. }) || accumulator;
  565. },
  566. toArray = function toArray(value, scope, leaveStrings) {
  567. return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : [];
  568. },
  569. selector = function selector(value) {
  570. value = toArray(value)[0] || _warn("Invalid scope") || {};
  571. return function (v) {
  572. var el = value.current || value.nativeElement || value;
  573. return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value);
  574. };
  575. },
  576. shuffle = function shuffle(a) {
  577. return a.sort(function () {
  578. return .5 - Math.random();
  579. });
  580. },
  581. distribute = function distribute(v) {
  582. if (_isFunction(v)) {
  583. return v;
  584. }
  585. var vars = _isObject(v) ? v : {
  586. each: v
  587. },
  588. ease = _parseEase(vars.ease),
  589. from = vars.from || 0,
  590. base = parseFloat(vars.base) || 0,
  591. cache = {},
  592. isDecimal = from > 0 && from < 1,
  593. ratios = isNaN(from) || isDecimal,
  594. axis = vars.axis,
  595. ratioX = from,
  596. ratioY = from;
  597. if (_isString(from)) {
  598. ratioX = ratioY = {
  599. center: .5,
  600. edges: .5,
  601. end: 1
  602. }[from] || 0;
  603. } else if (!isDecimal && ratios) {
  604. ratioX = from[0];
  605. ratioY = from[1];
  606. }
  607. return function (i, target, a) {
  608. var l = (a || vars).length,
  609. distances = cache[l],
  610. originX,
  611. originY,
  612. x,
  613. y,
  614. d,
  615. j,
  616. max,
  617. min,
  618. wrapAt;
  619. if (!distances) {
  620. wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1];
  621. if (!wrapAt) {
  622. max = -_bigNum;
  623. while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {}
  624. wrapAt < l && wrapAt--;
  625. }
  626. distances = cache[l] = [];
  627. originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt;
  628. originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0;
  629. max = 0;
  630. min = _bigNum;
  631. for (j = 0; j < l; j++) {
  632. x = j % wrapAt - originX;
  633. y = originY - (j / wrapAt | 0);
  634. distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x);
  635. d > max && (max = d);
  636. d < min && (min = d);
  637. }
  638. from === "random" && shuffle(distances);
  639. distances.max = max - min;
  640. distances.min = min;
  641. distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1);
  642. distances.b = l < 0 ? base - l : base;
  643. distances.u = getUnit(vars.amount || vars.each) || 0;
  644. ease = ease && l < 0 ? _invertEase(ease) : ease;
  645. }
  646. l = (distances[i] - distances.min) / distances.max || 0;
  647. return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u;
  648. };
  649. },
  650. _roundModifier = function _roundModifier(v) {
  651. var p = Math.pow(10, ((v + "").split(".")[1] || "").length);
  652. return function (raw) {
  653. var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p);
  654. return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw));
  655. };
  656. },
  657. snap = function snap(snapTo, value) {
  658. var isArray = _isArray(snapTo),
  659. radius,
  660. is2D;
  661. if (!isArray && _isObject(snapTo)) {
  662. radius = isArray = snapTo.radius || _bigNum;
  663. if (snapTo.values) {
  664. snapTo = toArray(snapTo.values);
  665. if (is2D = !_isNumber(snapTo[0])) {
  666. radius *= radius;
  667. }
  668. } else {
  669. snapTo = _roundModifier(snapTo.increment);
  670. }
  671. }
  672. return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) {
  673. is2D = snapTo(raw);
  674. return Math.abs(is2D - raw) <= radius ? is2D : raw;
  675. } : function (raw) {
  676. var x = parseFloat(is2D ? raw.x : raw),
  677. y = parseFloat(is2D ? raw.y : 0),
  678. min = _bigNum,
  679. closest = 0,
  680. i = snapTo.length,
  681. dx,
  682. dy;
  683. while (i--) {
  684. if (is2D) {
  685. dx = snapTo[i].x - x;
  686. dy = snapTo[i].y - y;
  687. dx = dx * dx + dy * dy;
  688. } else {
  689. dx = Math.abs(snapTo[i] - x);
  690. }
  691. if (dx < min) {
  692. min = dx;
  693. closest = i;
  694. }
  695. }
  696. closest = !radius || min <= radius ? snapTo[closest] : raw;
  697. return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
  698. });
  699. },
  700. random = function random(min, max, roundingIncrement, returnFunction) {
  701. return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () {
  702. return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction;
  703. });
  704. },
  705. pipe = function pipe() {
  706. for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
  707. functions[_key] = arguments[_key];
  708. }
  709. return function (value) {
  710. return functions.reduce(function (v, f) {
  711. return f(v);
  712. }, value);
  713. };
  714. },
  715. unitize = function unitize(func, unit) {
  716. return function (value) {
  717. return func(parseFloat(value)) + (unit || getUnit(value));
  718. };
  719. },
  720. normalize = function normalize(min, max, value) {
  721. return mapRange(min, max, 0, 1, value);
  722. },
  723. _wrapArray = function _wrapArray(a, wrapper, value) {
  724. return _conditionalReturn(value, function (index) {
  725. return a[~~wrapper(index)];
  726. });
  727. },
  728. wrap = function wrap(min, max, value) {
  729. var range = max - min;
  730. return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) {
  731. return (range + (value - min) % range) % range + min;
  732. });
  733. },
  734. wrapYoyo = function wrapYoyo(min, max, value) {
  735. var range = max - min,
  736. total = range * 2;
  737. return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) {
  738. value = (total + (value - min) % total) % total || 0;
  739. return min + (value > range ? total - value : value);
  740. });
  741. },
  742. _replaceRandom = function _replaceRandom(value) {
  743. var prev = 0,
  744. s = "",
  745. i,
  746. nums,
  747. end,
  748. isArray;
  749. while (~(i = value.indexOf("random(", prev))) {
  750. end = value.indexOf(")", i);
  751. isArray = value.charAt(i + 7) === "[";
  752. nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp);
  753. s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5);
  754. prev = end + 1;
  755. }
  756. return s + value.substr(prev, value.length - prev);
  757. },
  758. mapRange = function mapRange(inMin, inMax, outMin, outMax, value) {
  759. var inRange = inMax - inMin,
  760. outRange = outMax - outMin;
  761. return _conditionalReturn(value, function (value) {
  762. return outMin + ((value - inMin) / inRange * outRange || 0);
  763. });
  764. },
  765. interpolate = function interpolate(start, end, progress, mutate) {
  766. var func = isNaN(start + end) ? 0 : function (p) {
  767. return (1 - p) * start + p * end;
  768. };
  769. if (!func) {
  770. var isString = _isString(start),
  771. master = {},
  772. p,
  773. i,
  774. interpolators,
  775. l,
  776. il;
  777. progress === true && (mutate = 1) && (progress = null);
  778. if (isString) {
  779. start = {
  780. p: start
  781. };
  782. end = {
  783. p: end
  784. };
  785. } else if (_isArray(start) && !_isArray(end)) {
  786. interpolators = [];
  787. l = start.length;
  788. il = l - 2;
  789. for (i = 1; i < l; i++) {
  790. interpolators.push(interpolate(start[i - 1], start[i]));
  791. }
  792. l--;
  793. func = function func(p) {
  794. p *= l;
  795. var i = Math.min(il, ~~p);
  796. return interpolators[i](p - i);
  797. };
  798. progress = end;
  799. } else if (!mutate) {
  800. start = _merge(_isArray(start) ? [] : {}, start);
  801. }
  802. if (!interpolators) {
  803. for (p in end) {
  804. _addPropTween.call(master, start, p, "get", end[p]);
  805. }
  806. func = function func(p) {
  807. return _renderPropTweens(p, master) || (isString ? start.p : start);
  808. };
  809. }
  810. }
  811. return _conditionalReturn(progress, func);
  812. },
  813. _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) {
  814. var labels = timeline.labels,
  815. min = _bigNum,
  816. p,
  817. distance,
  818. label;
  819. for (p in labels) {
  820. distance = labels[p] - fromTime;
  821. if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) {
  822. label = p;
  823. min = distance;
  824. }
  825. }
  826. return label;
  827. },
  828. _callback = function _callback(animation, type, executeLazyFirst) {
  829. var v = animation.vars,
  830. callback = v[type],
  831. prevContext = _context,
  832. context = animation._ctx,
  833. params,
  834. scope,
  835. result;
  836. if (!callback) {
  837. return;
  838. }
  839. params = v[type + "Params"];
  840. scope = v.callbackScope || animation;
  841. executeLazyFirst && _lazyTweens.length && _lazyRender();
  842. context && (_context = context);
  843. result = params ? callback.apply(scope, params) : callback.call(scope);
  844. _context = prevContext;
  845. return result;
  846. },
  847. _interrupt = function _interrupt(animation) {
  848. _removeFromParent(animation);
  849. animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting);
  850. animation.progress() < 1 && _callback(animation, "onInterrupt");
  851. return animation;
  852. },
  853. _quickTween,
  854. _registerPluginQueue = [],
  855. _createPlugin = function _createPlugin(config) {
  856. if (!config) return;
  857. config = !config.name && config["default"] || config;
  858. if (_windowExists() || config.headless) {
  859. var name = config.name,
  860. isFunc = _isFunction(config),
  861. Plugin = name && !isFunc && config.init ? function () {
  862. this._props = [];
  863. } : config,
  864. instanceDefaults = {
  865. init: _emptyFunc,
  866. render: _renderPropTweens,
  867. add: _addPropTween,
  868. kill: _killPropTweensOf,
  869. modifier: _addPluginModifier,
  870. rawVars: 0
  871. },
  872. statics = {
  873. targetTest: 0,
  874. get: 0,
  875. getSetter: _getSetter,
  876. aliases: {},
  877. register: 0
  878. };
  879. _wake();
  880. if (config !== Plugin) {
  881. if (_plugins[name]) {
  882. return;
  883. }
  884. _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics));
  885. _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics)));
  886. _plugins[Plugin.prop = name] = Plugin;
  887. if (config.targetTest) {
  888. _harnessPlugins.push(Plugin);
  889. _reservedProps[name] = 1;
  890. }
  891. name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
  892. }
  893. _addGlobal(name, Plugin);
  894. config.register && config.register(gsap, Plugin, PropTween);
  895. } else {
  896. _registerPluginQueue.push(config);
  897. }
  898. },
  899. _255 = 255,
  900. _colorLookup = {
  901. aqua: [0, _255, _255],
  902. lime: [0, _255, 0],
  903. silver: [192, 192, 192],
  904. black: [0, 0, 0],
  905. maroon: [128, 0, 0],
  906. teal: [0, 128, 128],
  907. blue: [0, 0, _255],
  908. navy: [0, 0, 128],
  909. white: [_255, _255, _255],
  910. olive: [128, 128, 0],
  911. yellow: [_255, _255, 0],
  912. orange: [_255, 165, 0],
  913. gray: [128, 128, 128],
  914. purple: [128, 0, 128],
  915. green: [0, 128, 0],
  916. red: [_255, 0, 0],
  917. pink: [_255, 192, 203],
  918. cyan: [0, _255, _255],
  919. transparent: [_255, _255, _255, 0]
  920. },
  921. _hue = function _hue(h, m1, m2) {
  922. h += h < 0 ? 1 : h > 1 ? -1 : 0;
  923. return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0;
  924. },
  925. splitColor = function splitColor(v, toHSL, forceAlpha) {
  926. var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0,
  927. r,
  928. g,
  929. b,
  930. h,
  931. s,
  932. l,
  933. max,
  934. min,
  935. d,
  936. wasHSL;
  937. if (!a) {
  938. if (v.substr(-1) === ",") {
  939. v = v.substr(0, v.length - 1);
  940. }
  941. if (_colorLookup[v]) {
  942. a = _colorLookup[v];
  943. } else if (v.charAt(0) === "#") {
  944. if (v.length < 6) {
  945. r = v.charAt(1);
  946. g = v.charAt(2);
  947. b = v.charAt(3);
  948. v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : "");
  949. }
  950. if (v.length === 9) {
  951. a = parseInt(v.substr(1, 6), 16);
  952. return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255];
  953. }
  954. v = parseInt(v.substr(1), 16);
  955. a = [v >> 16, v >> 8 & _255, v & _255];
  956. } else if (v.substr(0, 3) === "hsl") {
  957. a = wasHSL = v.match(_strictNumExp);
  958. if (!toHSL) {
  959. h = +a[0] % 360 / 360;
  960. s = +a[1] / 100;
  961. l = +a[2] / 100;
  962. g = l <= .5 ? l * (s + 1) : l + s - l * s;
  963. r = l * 2 - g;
  964. a.length > 3 && (a[3] *= 1);
  965. a[0] = _hue(h + 1 / 3, r, g);
  966. a[1] = _hue(h, r, g);
  967. a[2] = _hue(h - 1 / 3, r, g);
  968. } else if (~v.indexOf("=")) {
  969. a = v.match(_numExp);
  970. forceAlpha && a.length < 4 && (a[3] = 1);
  971. return a;
  972. }
  973. } else {
  974. a = v.match(_strictNumExp) || _colorLookup.transparent;
  975. }
  976. a = a.map(Number);
  977. }
  978. if (toHSL && !wasHSL) {
  979. r = a[0] / _255;
  980. g = a[1] / _255;
  981. b = a[2] / _255;
  982. max = Math.max(r, g, b);
  983. min = Math.min(r, g, b);
  984. l = (max + min) / 2;
  985. if (max === min) {
  986. h = s = 0;
  987. } else {
  988. d = max - min;
  989. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  990. h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
  991. h *= 60;
  992. }
  993. a[0] = ~~(h + .5);
  994. a[1] = ~~(s * 100 + .5);
  995. a[2] = ~~(l * 100 + .5);
  996. }
  997. forceAlpha && a.length < 4 && (a[3] = 1);
  998. return a;
  999. },
  1000. _colorOrderData = function _colorOrderData(v) {
  1001. var values = [],
  1002. c = [],
  1003. i = -1;
  1004. v.split(_colorExp).forEach(function (v) {
  1005. var a = v.match(_numWithUnitExp) || [];
  1006. values.push.apply(values, a);
  1007. c.push(i += a.length + 1);
  1008. });
  1009. values.c = c;
  1010. return values;
  1011. },
  1012. _formatColors = function _formatColors(s, toHSL, orderMatchData) {
  1013. var result = "",
  1014. colors = (s + result).match(_colorExp),
  1015. type = toHSL ? "hsla(" : "rgba(",
  1016. i = 0,
  1017. c,
  1018. shell,
  1019. d,
  1020. l;
  1021. if (!colors) {
  1022. return s;
  1023. }
  1024. colors = colors.map(function (color) {
  1025. return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")";
  1026. });
  1027. if (orderMatchData) {
  1028. d = _colorOrderData(s);
  1029. c = orderMatchData.c;
  1030. if (c.join(result) !== d.c.join(result)) {
  1031. shell = s.replace(_colorExp, "1").split(_numWithUnitExp);
  1032. l = shell.length - 1;
  1033. for (; i < l; i++) {
  1034. result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift());
  1035. }
  1036. }
  1037. }
  1038. if (!shell) {
  1039. shell = s.split(_colorExp);
  1040. l = shell.length - 1;
  1041. for (; i < l; i++) {
  1042. result += shell[i] + colors[i];
  1043. }
  1044. }
  1045. return result + shell[l];
  1046. },
  1047. _colorExp = function () {
  1048. var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",
  1049. p;
  1050. for (p in _colorLookup) {
  1051. s += "|" + p + "\\b";
  1052. }
  1053. return new RegExp(s + ")", "gi");
  1054. }(),
  1055. _hslExp = /hsl[a]?\(/,
  1056. _colorStringFilter = function _colorStringFilter(a) {
  1057. var combined = a.join(" "),
  1058. toHSL;
  1059. _colorExp.lastIndex = 0;
  1060. if (_colorExp.test(combined)) {
  1061. toHSL = _hslExp.test(combined);
  1062. a[1] = _formatColors(a[1], toHSL);
  1063. a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1]));
  1064. return true;
  1065. }
  1066. },
  1067. _tickerActive,
  1068. _ticker = function () {
  1069. var _getTime = Date.now,
  1070. _lagThreshold = 500,
  1071. _adjustedLag = 33,
  1072. _startTime = _getTime(),
  1073. _lastUpdate = _startTime,
  1074. _gap = 1000 / 240,
  1075. _nextTime = _gap,
  1076. _listeners = [],
  1077. _id,
  1078. _req,
  1079. _raf,
  1080. _self,
  1081. _delta,
  1082. _i,
  1083. _tick = function _tick(v) {
  1084. var elapsed = _getTime() - _lastUpdate,
  1085. manual = v === true,
  1086. overlap,
  1087. dispatch,
  1088. time,
  1089. frame;
  1090. (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag);
  1091. _lastUpdate += elapsed;
  1092. time = _lastUpdate - _startTime;
  1093. overlap = time - _nextTime;
  1094. if (overlap > 0 || manual) {
  1095. frame = ++_self.frame;
  1096. _delta = time - _self.time * 1000;
  1097. _self.time = time = time / 1000;
  1098. _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap);
  1099. dispatch = 1;
  1100. }
  1101. manual || (_id = _req(_tick));
  1102. if (dispatch) {
  1103. for (_i = 0; _i < _listeners.length; _i++) {
  1104. _listeners[_i](time, _delta, frame, v);
  1105. }
  1106. }
  1107. };
  1108. _self = {
  1109. time: 0,
  1110. frame: 0,
  1111. tick: function tick() {
  1112. _tick(true);
  1113. },
  1114. deltaRatio: function deltaRatio(fps) {
  1115. return _delta / (1000 / (fps || 60));
  1116. },
  1117. wake: function wake() {
  1118. if (_coreReady) {
  1119. if (!_coreInitted && _windowExists()) {
  1120. _win = _coreInitted = window;
  1121. _doc = _win.document || {};
  1122. _globals.gsap = gsap;
  1123. (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version);
  1124. _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {});
  1125. _registerPluginQueue.forEach(_createPlugin);
  1126. }
  1127. _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame;
  1128. _id && _self.sleep();
  1129. _req = _raf || function (f) {
  1130. return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0);
  1131. };
  1132. _tickerActive = 1;
  1133. _tick(2);
  1134. }
  1135. },
  1136. sleep: function sleep() {
  1137. (_raf ? cancelAnimationFrame : clearTimeout)(_id);
  1138. _tickerActive = 0;
  1139. _req = _emptyFunc;
  1140. },
  1141. lagSmoothing: function lagSmoothing(threshold, adjustedLag) {
  1142. _lagThreshold = threshold || Infinity;
  1143. _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold);
  1144. },
  1145. fps: function fps(_fps) {
  1146. _gap = 1000 / (_fps || 240);
  1147. _nextTime = _self.time * 1000 + _gap;
  1148. },
  1149. add: function add(callback, once, prioritize) {
  1150. var func = once ? function (t, d, f, v) {
  1151. callback(t, d, f, v);
  1152. _self.remove(func);
  1153. } : callback;
  1154. _self.remove(callback);
  1155. _listeners[prioritize ? "unshift" : "push"](func);
  1156. _wake();
  1157. return func;
  1158. },
  1159. remove: function remove(callback, i) {
  1160. ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--;
  1161. },
  1162. _listeners: _listeners
  1163. };
  1164. return _self;
  1165. }(),
  1166. _wake = function _wake() {
  1167. return !_tickerActive && _ticker.wake();
  1168. },
  1169. _easeMap = {},
  1170. _customEaseExp = /^[\d.\-M][\d.\-,\s]/,
  1171. _quotesExp = /["']/g,
  1172. _parseObjectInString = function _parseObjectInString(value) {
  1173. var obj = {},
  1174. split = value.substr(1, value.length - 3).split(":"),
  1175. key = split[0],
  1176. i = 1,
  1177. l = split.length,
  1178. index,
  1179. val,
  1180. parsedVal;
  1181. for (; i < l; i++) {
  1182. val = split[i];
  1183. index = i !== l - 1 ? val.lastIndexOf(",") : val.length;
  1184. parsedVal = val.substr(0, index);
  1185. obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal;
  1186. key = val.substr(index + 1).trim();
  1187. }
  1188. return obj;
  1189. },
  1190. _valueInParentheses = function _valueInParentheses(value) {
  1191. var open = value.indexOf("(") + 1,
  1192. close = value.indexOf(")"),
  1193. nested = value.indexOf("(", open);
  1194. return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close);
  1195. },
  1196. _configEaseFromString = function _configEaseFromString(name) {
  1197. var split = (name + "").split("("),
  1198. ease = _easeMap[split[0]];
  1199. return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease;
  1200. },
  1201. _invertEase = function _invertEase(ease) {
  1202. return function (p) {
  1203. return 1 - ease(1 - p);
  1204. };
  1205. },
  1206. _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) {
  1207. var child = timeline._first,
  1208. ease;
  1209. while (child) {
  1210. if (child instanceof Timeline) {
  1211. _propagateYoyoEase(child, isYoyo);
  1212. } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) {
  1213. if (child.timeline) {
  1214. _propagateYoyoEase(child.timeline, isYoyo);
  1215. } else {
  1216. ease = child._ease;
  1217. child._ease = child._yEase;
  1218. child._yEase = ease;
  1219. child._yoyo = isYoyo;
  1220. }
  1221. }
  1222. child = child._next;
  1223. }
  1224. },
  1225. _parseEase = function _parseEase(ease, defaultEase) {
  1226. return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase;
  1227. },
  1228. _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) {
  1229. if (easeOut === void 0) {
  1230. easeOut = function easeOut(p) {
  1231. return 1 - easeIn(1 - p);
  1232. };
  1233. }
  1234. if (easeInOut === void 0) {
  1235. easeInOut = function easeInOut(p) {
  1236. return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2;
  1237. };
  1238. }
  1239. var ease = {
  1240. easeIn: easeIn,
  1241. easeOut: easeOut,
  1242. easeInOut: easeInOut
  1243. },
  1244. lowercaseName;
  1245. _forEachName(names, function (name) {
  1246. _easeMap[name] = _globals[name] = ease;
  1247. _easeMap[lowercaseName = name.toLowerCase()] = easeOut;
  1248. for (var p in ease) {
  1249. _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p];
  1250. }
  1251. });
  1252. return ease;
  1253. },
  1254. _easeInOutFromOut = function _easeInOutFromOut(easeOut) {
  1255. return function (p) {
  1256. return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2;
  1257. };
  1258. },
  1259. _configElastic = function _configElastic(type, amplitude, period) {
  1260. var p1 = amplitude >= 1 ? amplitude : 1,
  1261. p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1),
  1262. p3 = p2 / _2PI * (Math.asin(1 / p1) || 0),
  1263. easeOut = function easeOut(p) {
  1264. return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
  1265. },
  1266. ease = type === "out" ? easeOut : type === "in" ? function (p) {
  1267. return 1 - easeOut(1 - p);
  1268. } : _easeInOutFromOut(easeOut);
  1269. p2 = _2PI / p2;
  1270. ease.config = function (amplitude, period) {
  1271. return _configElastic(type, amplitude, period);
  1272. };
  1273. return ease;
  1274. },
  1275. _configBack = function _configBack(type, overshoot) {
  1276. if (overshoot === void 0) {
  1277. overshoot = 1.70158;
  1278. }
  1279. var easeOut = function easeOut(p) {
  1280. return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0;
  1281. },
  1282. ease = type === "out" ? easeOut : type === "in" ? function (p) {
  1283. return 1 - easeOut(1 - p);
  1284. } : _easeInOutFromOut(easeOut);
  1285. ease.config = function (overshoot) {
  1286. return _configBack(type, overshoot);
  1287. };
  1288. return ease;
  1289. };
  1290. _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) {
  1291. var power = i < 5 ? i + 1 : i;
  1292. _insertEase(name + ",Power" + (power - 1), i ? function (p) {
  1293. return Math.pow(p, power);
  1294. } : function (p) {
  1295. return p;
  1296. }, function (p) {
  1297. return 1 - Math.pow(1 - p, power);
  1298. }, function (p) {
  1299. return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2;
  1300. });
  1301. });
  1302. _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
  1303. _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
  1304. (function (n, c) {
  1305. var n1 = 1 / c,
  1306. n2 = 2 * n1,
  1307. n3 = 2.5 * n1,
  1308. easeOut = function easeOut(p) {
  1309. return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375;
  1310. };
  1311. _insertEase("Bounce", function (p) {
  1312. return 1 - easeOut(1 - p);
  1313. }, easeOut);
  1314. })(7.5625, 2.75);
  1315. _insertEase("Expo", function (p) {
  1316. return Math.pow(2, 10 * (p - 1)) * p + p * p * p * p * p * p * (1 - p);
  1317. });
  1318. _insertEase("Circ", function (p) {
  1319. return -(_sqrt(1 - p * p) - 1);
  1320. });
  1321. _insertEase("Sine", function (p) {
  1322. return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1;
  1323. });
  1324. _insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
  1325. _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = {
  1326. config: function config(steps, immediateStart) {
  1327. if (steps === void 0) {
  1328. steps = 1;
  1329. }
  1330. var p1 = 1 / steps,
  1331. p2 = steps + (immediateStart ? 0 : 1),
  1332. p3 = immediateStart ? 1 : 0,
  1333. max = 1 - _tinyNum;
  1334. return function (p) {
  1335. return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
  1336. };
  1337. }
  1338. };
  1339. _defaults.ease = _easeMap["quad.out"];
  1340. _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) {
  1341. return _callbackNames += name + "," + name + "Params,";
  1342. });
  1343. var GSCache = function GSCache(target, harness) {
  1344. this.id = _gsID++;
  1345. target._gsap = this;
  1346. this.target = target;
  1347. this.harness = harness;
  1348. this.get = harness ? harness.get : _getProperty;
  1349. this.set = harness ? harness.getSetter : _getSetter;
  1350. };
  1351. var Animation = function () {
  1352. function Animation(vars) {
  1353. this.vars = vars;
  1354. this._delay = +vars.delay || 0;
  1355. if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) {
  1356. this._rDelay = vars.repeatDelay || 0;
  1357. this._yoyo = !!vars.yoyo || !!vars.yoyoEase;
  1358. }
  1359. this._ts = 1;
  1360. _setDuration(this, +vars.duration, 1, 1);
  1361. this.data = vars.data;
  1362. if (_context) {
  1363. this._ctx = _context;
  1364. _context.data.push(this);
  1365. }
  1366. _tickerActive || _ticker.wake();
  1367. }
  1368. var _proto = Animation.prototype;
  1369. _proto.delay = function delay(value) {
  1370. if (value || value === 0) {
  1371. this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
  1372. this._delay = value;
  1373. return this;
  1374. }
  1375. return this._delay;
  1376. };
  1377. _proto.duration = function duration(value) {
  1378. return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur;
  1379. };
  1380. _proto.totalDuration = function totalDuration(value) {
  1381. if (!arguments.length) {
  1382. return this._tDur;
  1383. }
  1384. this._dirty = 0;
  1385. return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1));
  1386. };
  1387. _proto.totalTime = function totalTime(_totalTime, suppressEvents) {
  1388. _wake();
  1389. if (!arguments.length) {
  1390. return this._tTime;
  1391. }
  1392. var parent = this._dp;
  1393. if (parent && parent.smoothChildTiming && this._ts) {
  1394. _alignPlayhead(this, _totalTime);
  1395. !parent._dp || parent.parent || _postAddChecks(parent, this);
  1396. while (parent && parent.parent) {
  1397. if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) {
  1398. parent.totalTime(parent._tTime, true);
  1399. }
  1400. parent = parent.parent;
  1401. }
  1402. if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) {
  1403. _addToTimeline(this._dp, this, this._start - this._delay);
  1404. }
  1405. }
  1406. if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) {
  1407. this._ts || (this._pTime = _totalTime);
  1408. _lazySafeRender(this, _totalTime, suppressEvents);
  1409. }
  1410. return this;
  1411. };
  1412. _proto.time = function time(value, suppressEvents) {
  1413. return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time;
  1414. };
  1415. _proto.totalProgress = function totalProgress(value, suppressEvents) {
  1416. return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() >= 0 && this._initted ? 1 : 0;
  1417. };
  1418. _proto.progress = function progress(value, suppressEvents) {
  1419. return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.rawTime() > 0 ? 1 : 0;
  1420. };
  1421. _proto.iteration = function iteration(value, suppressEvents) {
  1422. var cycleDuration = this.duration() + this._rDelay;
  1423. return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1;
  1424. };
  1425. _proto.timeScale = function timeScale(value, suppressEvents) {
  1426. if (!arguments.length) {
  1427. return this._rts === -_tinyNum ? 0 : this._rts;
  1428. }
  1429. if (this._rts === value) {
  1430. return this;
  1431. }
  1432. var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime;
  1433. this._rts = +value || 0;
  1434. this._ts = this._ps || value === -_tinyNum ? 0 : this._rts;
  1435. this.totalTime(_clamp(-Math.abs(this._delay), this.totalDuration(), tTime), suppressEvents !== false);
  1436. _setEnd(this);
  1437. return _recacheAncestors(this);
  1438. };
  1439. _proto.paused = function paused(value) {
  1440. if (!arguments.length) {
  1441. return this._ps;
  1442. }
  1443. if (this._ps !== value) {
  1444. this._ps = value;
  1445. if (value) {
  1446. this._pTime = this._tTime || Math.max(-this._delay, this.rawTime());
  1447. this._ts = this._act = 0;
  1448. } else {
  1449. _wake();
  1450. this._ts = this._rts;
  1451. this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum));
  1452. }
  1453. }
  1454. return this;
  1455. };
  1456. _proto.startTime = function startTime(value) {
  1457. if (arguments.length) {
  1458. this._start = value;
  1459. var parent = this.parent || this._dp;
  1460. parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay);
  1461. return this;
  1462. }
  1463. return this._start;
  1464. };
  1465. _proto.endTime = function endTime(includeRepeats) {
  1466. return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1);
  1467. };
  1468. _proto.rawTime = function rawTime(wrapRepeats) {
  1469. var parent = this.parent || this._dp;
  1470. return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this);
  1471. };
  1472. _proto.revert = function revert(config) {
  1473. if (config === void 0) {
  1474. config = _revertConfig;
  1475. }
  1476. var prevIsReverting = _reverting;
  1477. _reverting = config;
  1478. if (_isRevertWorthy(this)) {
  1479. this.timeline && this.timeline.revert(config);
  1480. this.totalTime(-0.01, config.suppressEvents);
  1481. }
  1482. this.data !== "nested" && config.kill !== false && this.kill();
  1483. _reverting = prevIsReverting;
  1484. return this;
  1485. };
  1486. _proto.globalTime = function globalTime(rawTime) {
  1487. var animation = this,
  1488. time = arguments.length ? rawTime : animation.rawTime();
  1489. while (animation) {
  1490. time = animation._start + time / (Math.abs(animation._ts) || 1);
  1491. animation = animation._dp;
  1492. }
  1493. return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time;
  1494. };
  1495. _proto.repeat = function repeat(value) {
  1496. if (arguments.length) {
  1497. this._repeat = value === Infinity ? -2 : value;
  1498. return _onUpdateTotalDuration(this);
  1499. }
  1500. return this._repeat === -2 ? Infinity : this._repeat;
  1501. };
  1502. _proto.repeatDelay = function repeatDelay(value) {
  1503. if (arguments.length) {
  1504. var time = this._time;
  1505. this._rDelay = value;
  1506. _onUpdateTotalDuration(this);
  1507. return time ? this.time(time) : this;
  1508. }
  1509. return this._rDelay;
  1510. };
  1511. _proto.yoyo = function yoyo(value) {
  1512. if (arguments.length) {
  1513. this._yoyo = value;
  1514. return this;
  1515. }
  1516. return this._yoyo;
  1517. };
  1518. _proto.seek = function seek(position, suppressEvents) {
  1519. return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
  1520. };
  1521. _proto.restart = function restart(includeDelay, suppressEvents) {
  1522. this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents));
  1523. this._dur || (this._zTime = -_tinyNum);
  1524. return this;
  1525. };
  1526. _proto.play = function play(from, suppressEvents) {
  1527. from != null && this.seek(from, suppressEvents);
  1528. return this.reversed(false).paused(false);
  1529. };
  1530. _proto.reverse = function reverse(from, suppressEvents) {
  1531. from != null && this.seek(from || this.totalDuration(), suppressEvents);
  1532. return this.reversed(true).paused(false);
  1533. };
  1534. _proto.pause = function pause(atTime, suppressEvents) {
  1535. atTime != null && this.seek(atTime, suppressEvents);
  1536. return this.paused(true);
  1537. };
  1538. _proto.resume = function resume() {
  1539. return this.paused(false);
  1540. };
  1541. _proto.reversed = function reversed(value) {
  1542. if (arguments.length) {
  1543. !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0));
  1544. return this;
  1545. }
  1546. return this._rts < 0;
  1547. };
  1548. _proto.invalidate = function invalidate() {
  1549. this._initted = this._act = 0;
  1550. this._zTime = -_tinyNum;
  1551. return this;
  1552. };
  1553. _proto.isActive = function isActive() {
  1554. var parent = this.parent || this._dp,
  1555. start = this._start,
  1556. rawTime;
  1557. return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum);
  1558. };
  1559. _proto.eventCallback = function eventCallback(type, callback, params) {
  1560. var vars = this.vars;
  1561. if (arguments.length > 1) {
  1562. if (!callback) {
  1563. delete vars[type];
  1564. } else {
  1565. vars[type] = callback;
  1566. params && (vars[type + "Params"] = params);
  1567. type === "onUpdate" && (this._onUpdate = callback);
  1568. }
  1569. return this;
  1570. }
  1571. return vars[type];
  1572. };
  1573. _proto.then = function then(onFulfilled) {
  1574. var self = this;
  1575. return new Promise(function (resolve) {
  1576. var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough,
  1577. _resolve = function _resolve() {
  1578. var _then = self.then;
  1579. self.then = null;
  1580. _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then);
  1581. resolve(f);
  1582. self.then = _then;
  1583. };
  1584. if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) {
  1585. _resolve();
  1586. } else {
  1587. self._prom = _resolve;
  1588. }
  1589. });
  1590. };
  1591. _proto.kill = function kill() {
  1592. _interrupt(this);
  1593. };
  1594. return Animation;
  1595. }();
  1596. _setDefaults(Animation.prototype, {
  1597. _time: 0,
  1598. _start: 0,
  1599. _end: 0,
  1600. _tTime: 0,
  1601. _tDur: 0,
  1602. _dirty: 0,
  1603. _repeat: 0,
  1604. _yoyo: false,
  1605. parent: null,
  1606. _initted: false,
  1607. _rDelay: 0,
  1608. _ts: 1,
  1609. _dp: 0,
  1610. ratio: 0,
  1611. _zTime: -_tinyNum,
  1612. _prom: 0,
  1613. _ps: false,
  1614. _rts: 1
  1615. });
  1616. var Timeline = function (_Animation) {
  1617. _inheritsLoose(Timeline, _Animation);
  1618. function Timeline(vars, position) {
  1619. var _this;
  1620. if (vars === void 0) {
  1621. vars = {};
  1622. }
  1623. _this = _Animation.call(this, vars) || this;
  1624. _this.labels = {};
  1625. _this.smoothChildTiming = !!vars.smoothChildTiming;
  1626. _this.autoRemoveChildren = !!vars.autoRemoveChildren;
  1627. _this._sort = _isNotFalse(vars.sortChildren);
  1628. _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position);
  1629. vars.reversed && _this.reverse();
  1630. vars.paused && _this.paused(true);
  1631. vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
  1632. return _this;
  1633. }
  1634. var _proto2 = Timeline.prototype;
  1635. _proto2.to = function to(targets, vars, position) {
  1636. _createTweenType(0, arguments, this);
  1637. return this;
  1638. };
  1639. _proto2.from = function from(targets, vars, position) {
  1640. _createTweenType(1, arguments, this);
  1641. return this;
  1642. };
  1643. _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) {
  1644. _createTweenType(2, arguments, this);
  1645. return this;
  1646. };
  1647. _proto2.set = function set(targets, vars, position) {
  1648. vars.duration = 0;
  1649. vars.parent = this;
  1650. _inheritDefaults(vars).repeatDelay || (vars.repeat = 0);
  1651. vars.immediateRender = !!vars.immediateRender;
  1652. new Tween(targets, vars, _parsePosition(this, position), 1);
  1653. return this;
  1654. };
  1655. _proto2.call = function call(callback, params, position) {
  1656. return _addToTimeline(this, Tween.delayedCall(0, callback, params), position);
  1657. };
  1658. _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
  1659. vars.duration = duration;
  1660. vars.stagger = vars.stagger || stagger;
  1661. vars.onComplete = onCompleteAll;
  1662. vars.onCompleteParams = onCompleteAllParams;
  1663. vars.parent = this;
  1664. new Tween(targets, vars, _parsePosition(this, position));
  1665. return this;
  1666. };
  1667. _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
  1668. vars.runBackwards = 1;
  1669. _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender);
  1670. return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
  1671. };
  1672. _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) {
  1673. toVars.startAt = fromVars;
  1674. _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender);
  1675. return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
  1676. };
  1677. _proto2.render = function render(totalTime, suppressEvents, force) {
  1678. var prevTime = this._time,
  1679. tDur = this._dirty ? this.totalDuration() : this._tDur,
  1680. dur = this._dur,
  1681. tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime),
  1682. crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur),
  1683. time,
  1684. child,
  1685. next,
  1686. iteration,
  1687. cycleDuration,
  1688. prevPaused,
  1689. pauseTween,
  1690. timeScale,
  1691. prevStart,
  1692. prevIteration,
  1693. yoyo,
  1694. isYoyo;
  1695. this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur);
  1696. if (tTime !== this._tTime || force || crossingStart) {
  1697. if (prevTime !== this._time && dur) {
  1698. tTime += this._time - prevTime;
  1699. totalTime += this._time - prevTime;
  1700. }
  1701. time = tTime;
  1702. prevStart = this._start;
  1703. timeScale = this._ts;
  1704. prevPaused = !timeScale;
  1705. if (crossingStart) {
  1706. dur || (prevTime = this._zTime);
  1707. (totalTime || !suppressEvents) && (this._zTime = totalTime);
  1708. }
  1709. if (this._repeat) {
  1710. yoyo = this._yoyo;
  1711. cycleDuration = dur + this._rDelay;
  1712. if (this._repeat < -1 && totalTime < 0) {
  1713. return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
  1714. }
  1715. time = _roundPrecise(tTime % cycleDuration);
  1716. if (tTime === tDur) {
  1717. iteration = this._repeat;
  1718. time = dur;
  1719. } else {
  1720. prevIteration = _roundPrecise(tTime / cycleDuration);
  1721. iteration = ~~prevIteration;
  1722. if (iteration && iteration === prevIteration) {
  1723. time = dur;
  1724. iteration--;
  1725. }
  1726. time > dur && (time = dur);
  1727. }
  1728. prevIteration = _animationCycle(this._tTime, cycleDuration);
  1729. !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration);
  1730. if (yoyo && iteration & 1) {
  1731. time = dur - time;
  1732. isYoyo = 1;
  1733. }
  1734. if (iteration !== prevIteration && !this._lock) {
  1735. var rewinding = yoyo && prevIteration & 1,
  1736. doesWrap = rewinding === (yoyo && iteration & 1);
  1737. iteration < prevIteration && (rewinding = !rewinding);
  1738. prevTime = rewinding ? 0 : tTime % dur ? dur : tTime;
  1739. this._lock = 1;
  1740. this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0;
  1741. this._tTime = tTime;
  1742. !suppressEvents && this.parent && _callback(this, "onRepeat");
  1743. this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1);
  1744. if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) {
  1745. return this;
  1746. }
  1747. dur = this._dur;
  1748. tDur = this._tDur;
  1749. if (doesWrap) {
  1750. this._lock = 2;
  1751. prevTime = rewinding ? dur : -0.0001;
  1752. this.render(prevTime, true);
  1753. this.vars.repeatRefresh && !isYoyo && this.invalidate();
  1754. }
  1755. this._lock = 0;
  1756. if (!this._ts && !prevPaused) {
  1757. return this;
  1758. }
  1759. _propagateYoyoEase(this, isYoyo);
  1760. }
  1761. }
  1762. if (this._hasPause && !this._forcing && this._lock < 2) {
  1763. pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time));
  1764. if (pauseTween) {
  1765. tTime -= time - (time = pauseTween._start);
  1766. }
  1767. }
  1768. this._tTime = tTime;
  1769. this._time = time;
  1770. this._act = !timeScale;
  1771. if (!this._initted) {
  1772. this._onUpdate = this.vars.onUpdate;
  1773. this._initted = 1;
  1774. this._zTime = totalTime;
  1775. prevTime = 0;
  1776. }
  1777. if (!prevTime && tTime && !suppressEvents && !prevIteration) {
  1778. _callback(this, "onStart");
  1779. if (this._tTime !== tTime) {
  1780. return this;
  1781. }
  1782. }
  1783. if (time >= prevTime && totalTime >= 0) {
  1784. child = this._first;
  1785. while (child) {
  1786. next = child._next;
  1787. if ((child._act || time >= child._start) && child._ts && pauseTween !== child) {
  1788. if (child.parent !== this) {
  1789. return this.render(totalTime, suppressEvents, force);
  1790. }
  1791. child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
  1792. if (time !== this._time || !this._ts && !prevPaused) {
  1793. pauseTween = 0;
  1794. next && (tTime += this._zTime = -_tinyNum);
  1795. break;
  1796. }
  1797. }
  1798. child = next;
  1799. }
  1800. } else {
  1801. child = this._last;
  1802. var adjustedTime = totalTime < 0 ? totalTime : time;
  1803. while (child) {
  1804. next = child._prev;
  1805. if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) {
  1806. if (child.parent !== this) {
  1807. return this.render(totalTime, suppressEvents, force);
  1808. }
  1809. child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && _isRevertWorthy(child));
  1810. if (time !== this._time || !this._ts && !prevPaused) {
  1811. pauseTween = 0;
  1812. next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum);
  1813. break;
  1814. }
  1815. }
  1816. child = next;
  1817. }
  1818. }
  1819. if (pauseTween && !suppressEvents) {
  1820. this.pause();
  1821. pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
  1822. if (this._ts) {
  1823. this._start = prevStart;
  1824. _setEnd(this);
  1825. return this.render(totalTime, suppressEvents, force);
  1826. }
  1827. }
  1828. this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true);
  1829. if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) {
  1830. (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
  1831. if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) {
  1832. _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true);
  1833. this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
  1834. }
  1835. }
  1836. }
  1837. return this;
  1838. };
  1839. _proto2.add = function add(child, position) {
  1840. var _this2 = this;
  1841. _isNumber(position) || (position = _parsePosition(this, position, child));
  1842. if (!(child instanceof Animation)) {
  1843. if (_isArray(child)) {
  1844. child.forEach(function (obj) {
  1845. return _this2.add(obj, position);
  1846. });
  1847. return this;
  1848. }
  1849. if (_isString(child)) {
  1850. return this.addLabel(child, position);
  1851. }
  1852. if (_isFunction(child)) {
  1853. child = Tween.delayedCall(0, child);
  1854. } else {
  1855. return this;
  1856. }
  1857. }
  1858. return this !== child ? _addToTimeline(this, child, position) : this;
  1859. };
  1860. _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) {
  1861. if (nested === void 0) {
  1862. nested = true;
  1863. }
  1864. if (tweens === void 0) {
  1865. tweens = true;
  1866. }
  1867. if (timelines === void 0) {
  1868. timelines = true;
  1869. }
  1870. if (ignoreBeforeTime === void 0) {
  1871. ignoreBeforeTime = -_bigNum;
  1872. }
  1873. var a = [],
  1874. child = this._first;
  1875. while (child) {
  1876. if (child._start >= ignoreBeforeTime) {
  1877. if (child instanceof Tween) {
  1878. tweens && a.push(child);
  1879. } else {
  1880. timelines && a.push(child);
  1881. nested && a.push.apply(a, child.getChildren(true, tweens, timelines));
  1882. }
  1883. }
  1884. child = child._next;
  1885. }
  1886. return a;
  1887. };
  1888. _proto2.getById = function getById(id) {
  1889. var animations = this.getChildren(1, 1, 1),
  1890. i = animations.length;
  1891. while (i--) {
  1892. if (animations[i].vars.id === id) {
  1893. return animations[i];
  1894. }
  1895. }
  1896. };
  1897. _proto2.remove = function remove(child) {
  1898. if (_isString(child)) {
  1899. return this.removeLabel(child);
  1900. }
  1901. if (_isFunction(child)) {
  1902. return this.killTweensOf(child);
  1903. }
  1904. child.parent === this && _removeLinkedListItem(this, child);
  1905. if (child === this._recent) {
  1906. this._recent = this._last;
  1907. }
  1908. return _uncache(this);
  1909. };
  1910. _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) {
  1911. if (!arguments.length) {
  1912. return this._tTime;
  1913. }
  1914. this._forcing = 1;
  1915. if (!this._dp && this._ts) {
  1916. this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts));
  1917. }
  1918. _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
  1919. this._forcing = 0;
  1920. return this;
  1921. };
  1922. _proto2.addLabel = function addLabel(label, position) {
  1923. this.labels[label] = _parsePosition(this, position);
  1924. return this;
  1925. };
  1926. _proto2.removeLabel = function removeLabel(label) {
  1927. delete this.labels[label];
  1928. return this;
  1929. };
  1930. _proto2.addPause = function addPause(position, callback, params) {
  1931. var t = Tween.delayedCall(0, callback || _emptyFunc, params);
  1932. t.data = "isPause";
  1933. this._hasPause = 1;
  1934. return _addToTimeline(this, t, _parsePosition(this, position));
  1935. };
  1936. _proto2.removePause = function removePause(position) {
  1937. var child = this._first;
  1938. position = _parsePosition(this, position);
  1939. while (child) {
  1940. if (child._start === position && child.data === "isPause") {
  1941. _removeFromParent(child);
  1942. }
  1943. child = child._next;
  1944. }
  1945. };
  1946. _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
  1947. var tweens = this.getTweensOf(targets, onlyActive),
  1948. i = tweens.length;
  1949. while (i--) {
  1950. _overwritingTween !== tweens[i] && tweens[i].kill(targets, props);
  1951. }
  1952. return this;
  1953. };
  1954. _proto2.getTweensOf = function getTweensOf(targets, onlyActive) {
  1955. var a = [],
  1956. parsedTargets = toArray(targets),
  1957. child = this._first,
  1958. isGlobalTime = _isNumber(onlyActive),
  1959. children;
  1960. while (child) {
  1961. if (child instanceof Tween) {
  1962. if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) {
  1963. a.push(child);
  1964. }
  1965. } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) {
  1966. a.push.apply(a, children);
  1967. }
  1968. child = child._next;
  1969. }
  1970. return a;
  1971. };
  1972. _proto2.tweenTo = function tweenTo(position, vars) {
  1973. vars = vars || {};
  1974. var tl = this,
  1975. endTime = _parsePosition(tl, position),
  1976. _vars = vars,
  1977. startAt = _vars.startAt,
  1978. _onStart = _vars.onStart,
  1979. onStartParams = _vars.onStartParams,
  1980. immediateRender = _vars.immediateRender,
  1981. initted,
  1982. tween = Tween.to(tl, _setDefaults({
  1983. ease: vars.ease || "none",
  1984. lazy: false,
  1985. immediateRender: false,
  1986. time: endTime,
  1987. overwrite: "auto",
  1988. duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum,
  1989. onStart: function onStart() {
  1990. tl.pause();
  1991. if (!initted) {
  1992. var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale());
  1993. tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true);
  1994. initted = 1;
  1995. }
  1996. _onStart && _onStart.apply(tween, onStartParams || []);
  1997. }
  1998. }, vars));
  1999. return immediateRender ? tween.render(0) : tween;
  2000. };
  2001. _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) {
  2002. return this.tweenTo(toPosition, _setDefaults({
  2003. startAt: {
  2004. time: _parsePosition(this, fromPosition)
  2005. }
  2006. }, vars));
  2007. };
  2008. _proto2.recent = function recent() {
  2009. return this._recent;
  2010. };
  2011. _proto2.nextLabel = function nextLabel(afterTime) {
  2012. if (afterTime === void 0) {
  2013. afterTime = this._time;
  2014. }
  2015. return _getLabelInDirection(this, _parsePosition(this, afterTime));
  2016. };
  2017. _proto2.previousLabel = function previousLabel(beforeTime) {
  2018. if (beforeTime === void 0) {
  2019. beforeTime = this._time;
  2020. }
  2021. return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
  2022. };
  2023. _proto2.currentLabel = function currentLabel(value) {
  2024. return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum);
  2025. };
  2026. _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) {
  2027. if (ignoreBeforeTime === void 0) {
  2028. ignoreBeforeTime = 0;
  2029. }
  2030. var child = this._first,
  2031. labels = this.labels,
  2032. p;
  2033. while (child) {
  2034. if (child._start >= ignoreBeforeTime) {
  2035. child._start += amount;
  2036. child._end += amount;
  2037. }
  2038. child = child._next;
  2039. }
  2040. if (adjustLabels) {
  2041. for (p in labels) {
  2042. if (labels[p] >= ignoreBeforeTime) {
  2043. labels[p] += amount;
  2044. }
  2045. }
  2046. }
  2047. return _uncache(this);
  2048. };
  2049. _proto2.invalidate = function invalidate(soft) {
  2050. var child = this._first;
  2051. this._lock = 0;
  2052. while (child) {
  2053. child.invalidate(soft);
  2054. child = child._next;
  2055. }
  2056. return _Animation.prototype.invalidate.call(this, soft);
  2057. };
  2058. _proto2.clear = function clear(includeLabels) {
  2059. if (includeLabels === void 0) {
  2060. includeLabels = true;
  2061. }
  2062. var child = this._first,
  2063. next;
  2064. while (child) {
  2065. next = child._next;
  2066. this.remove(child);
  2067. child = next;
  2068. }
  2069. this._dp && (this._time = this._tTime = this._pTime = 0);
  2070. includeLabels && (this.labels = {});
  2071. return _uncache(this);
  2072. };
  2073. _proto2.totalDuration = function totalDuration(value) {
  2074. var max = 0,
  2075. self = this,
  2076. child = self._last,
  2077. prevStart = _bigNum,
  2078. prev,
  2079. start,
  2080. parent;
  2081. if (arguments.length) {
  2082. return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value));
  2083. }
  2084. if (self._dirty) {
  2085. parent = self.parent;
  2086. while (child) {
  2087. prev = child._prev;
  2088. child._dirty && child.totalDuration();
  2089. start = child._start;
  2090. if (start > prevStart && self._sort && child._ts && !self._lock) {
  2091. self._lock = 1;
  2092. _addToTimeline(self, child, start - child._delay, 1)._lock = 0;
  2093. } else {
  2094. prevStart = start;
  2095. }
  2096. if (start < 0 && child._ts) {
  2097. max -= start;
  2098. if (!parent && !self._dp || parent && parent.smoothChildTiming) {
  2099. self._start += start / self._ts;
  2100. self._time -= start;
  2101. self._tTime -= start;
  2102. }
  2103. self.shiftChildren(-start, false, -1e999);
  2104. prevStart = 0;
  2105. }
  2106. child._end > max && child._ts && (max = child._end);
  2107. child = prev;
  2108. }
  2109. _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1);
  2110. self._dirty = 0;
  2111. }
  2112. return self._tDur;
  2113. };
  2114. Timeline.updateRoot = function updateRoot(time) {
  2115. if (_globalTimeline._ts) {
  2116. _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
  2117. _lastRenderedFrame = _ticker.frame;
  2118. }
  2119. if (_ticker.frame >= _nextGCFrame) {
  2120. _nextGCFrame += _config.autoSleep || 120;
  2121. var child = _globalTimeline._first;
  2122. if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) {
  2123. while (child && !child._ts) {
  2124. child = child._next;
  2125. }
  2126. child || _ticker.sleep();
  2127. }
  2128. }
  2129. };
  2130. return Timeline;
  2131. }(Animation);
  2132. _setDefaults(Timeline.prototype, {
  2133. _lock: 0,
  2134. _hasPause: 0,
  2135. _forcing: 0
  2136. });
  2137. var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) {
  2138. var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter),
  2139. index = 0,
  2140. matchIndex = 0,
  2141. result,
  2142. startNums,
  2143. color,
  2144. endNum,
  2145. chunk,
  2146. startNum,
  2147. hasRandom,
  2148. a;
  2149. pt.b = start;
  2150. pt.e = end;
  2151. start += "";
  2152. end += "";
  2153. if (hasRandom = ~end.indexOf("random(")) {
  2154. end = _replaceRandom(end);
  2155. }
  2156. if (stringFilter) {
  2157. a = [start, end];
  2158. stringFilter(a, target, prop);
  2159. start = a[0];
  2160. end = a[1];
  2161. }
  2162. startNums = start.match(_complexStringNumExp) || [];
  2163. while (result = _complexStringNumExp.exec(end)) {
  2164. endNum = result[0];
  2165. chunk = end.substring(index, result.index);
  2166. if (color) {
  2167. color = (color + 1) % 5;
  2168. } else if (chunk.substr(-5) === "rgba(") {
  2169. color = 1;
  2170. }
  2171. if (endNum !== startNums[matchIndex++]) {
  2172. startNum = parseFloat(startNums[matchIndex - 1]) || 0;
  2173. pt._pt = {
  2174. _next: pt._pt,
  2175. p: chunk || matchIndex === 1 ? chunk : ",",
  2176. s: startNum,
  2177. c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum,
  2178. m: color && color < 4 ? Math.round : 0
  2179. };
  2180. index = _complexStringNumExp.lastIndex;
  2181. }
  2182. }
  2183. pt.c = index < end.length ? end.substring(index, end.length) : "";
  2184. pt.fp = funcParam;
  2185. if (_relExp.test(end) || hasRandom) {
  2186. pt.e = 0;
  2187. }
  2188. this._pt = pt;
  2189. return pt;
  2190. },
  2191. _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) {
  2192. _isFunction(end) && (end = end(index || 0, target, targets));
  2193. var currentValue = target[prop],
  2194. parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](),
  2195. setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc,
  2196. pt;
  2197. if (_isString(end)) {
  2198. if (~end.indexOf("random(")) {
  2199. end = _replaceRandom(end);
  2200. }
  2201. if (end.charAt(1) === "=") {
  2202. pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0);
  2203. if (pt || pt === 0) {
  2204. end = pt;
  2205. }
  2206. }
  2207. }
  2208. if (!optional || parsedStart !== end || _forceAllPropTweens) {
  2209. if (!isNaN(parsedStart * end) && end !== "") {
  2210. pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter);
  2211. funcParam && (pt.fp = funcParam);
  2212. modifier && pt.modifier(modifier, this, target);
  2213. return this._pt = pt;
  2214. }
  2215. !currentValue && !(prop in target) && _missingPlugin(prop, end);
  2216. return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam);
  2217. }
  2218. },
  2219. _processVars = function _processVars(vars, index, target, targets, tween) {
  2220. _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets));
  2221. if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) {
  2222. return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars;
  2223. }
  2224. var copy = {},
  2225. p;
  2226. for (p in vars) {
  2227. copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets);
  2228. }
  2229. return copy;
  2230. },
  2231. _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) {
  2232. var plugin, pt, ptLookup, i;
  2233. if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) {
  2234. tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
  2235. if (tween !== _quickTween) {
  2236. ptLookup = tween._ptLookup[tween._targets.indexOf(target)];
  2237. i = plugin._props.length;
  2238. while (i--) {
  2239. ptLookup[plugin._props[i]] = pt;
  2240. }
  2241. }
  2242. }
  2243. return plugin;
  2244. },
  2245. _overwritingTween,
  2246. _forceAllPropTweens,
  2247. _initTween = function _initTween(tween, time, tTime) {
  2248. var vars = tween.vars,
  2249. ease = vars.ease,
  2250. startAt = vars.startAt,
  2251. immediateRender = vars.immediateRender,
  2252. lazy = vars.lazy,
  2253. onUpdate = vars.onUpdate,
  2254. runBackwards = vars.runBackwards,
  2255. yoyoEase = vars.yoyoEase,
  2256. keyframes = vars.keyframes,
  2257. autoRevert = vars.autoRevert,
  2258. dur = tween._dur,
  2259. prevStartAt = tween._startAt,
  2260. targets = tween._targets,
  2261. parent = tween.parent,
  2262. fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets,
  2263. autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites,
  2264. tl = tween.timeline,
  2265. cleanVars,
  2266. i,
  2267. p,
  2268. pt,
  2269. target,
  2270. hasPriority,
  2271. gsData,
  2272. harness,
  2273. plugin,
  2274. ptLookup,
  2275. index,
  2276. harnessVars,
  2277. overwritten;
  2278. tl && (!keyframes || !ease) && (ease = "none");
  2279. tween._ease = _parseEase(ease, _defaults.ease);
  2280. tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0;
  2281. if (yoyoEase && tween._yoyo && !tween._repeat) {
  2282. yoyoEase = tween._yEase;
  2283. tween._yEase = tween._ease;
  2284. tween._ease = yoyoEase;
  2285. }
  2286. tween._from = !tl && !!vars.runBackwards;
  2287. if (!tl || keyframes && !vars.stagger) {
  2288. harness = targets[0] ? _getCache(targets[0]).harness : 0;
  2289. harnessVars = harness && vars[harness.prop];
  2290. cleanVars = _copyExcluding(vars, _reservedProps);
  2291. if (prevStartAt) {
  2292. prevStartAt._zTime < 0 && prevStartAt.progress(1);
  2293. time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig);
  2294. prevStartAt._lazy = 0;
  2295. }
  2296. if (startAt) {
  2297. _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({
  2298. data: "isStart",
  2299. overwrite: false,
  2300. parent: parent,
  2301. immediateRender: true,
  2302. lazy: !prevStartAt && _isNotFalse(lazy),
  2303. startAt: null,
  2304. delay: 0,
  2305. onUpdate: onUpdate && function () {
  2306. return _callback(tween, "onUpdate");
  2307. },
  2308. stagger: 0
  2309. }, startAt)));
  2310. tween._startAt._dp = 0;
  2311. tween._startAt._sat = tween;
  2312. time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill);
  2313. if (immediateRender) {
  2314. if (dur && time <= 0 && tTime <= 0) {
  2315. time && (tween._zTime = time);
  2316. return;
  2317. }
  2318. }
  2319. } else if (runBackwards && dur) {
  2320. if (!prevStartAt) {
  2321. time && (immediateRender = false);
  2322. p = _setDefaults({
  2323. overwrite: false,
  2324. data: "isFromStart",
  2325. lazy: immediateRender && !prevStartAt && _isNotFalse(lazy),
  2326. immediateRender: immediateRender,
  2327. stagger: 0,
  2328. parent: parent
  2329. }, cleanVars);
  2330. harnessVars && (p[harness.prop] = harnessVars);
  2331. _removeFromParent(tween._startAt = Tween.set(targets, p));
  2332. tween._startAt._dp = 0;
  2333. tween._startAt._sat = tween;
  2334. time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true));
  2335. tween._zTime = time;
  2336. if (!immediateRender) {
  2337. _initTween(tween._startAt, _tinyNum, _tinyNum);
  2338. } else if (!time) {
  2339. return;
  2340. }
  2341. }
  2342. }
  2343. tween._pt = tween._ptCache = 0;
  2344. lazy = dur && _isNotFalse(lazy) || lazy && !dur;
  2345. for (i = 0; i < targets.length; i++) {
  2346. target = targets[i];
  2347. gsData = target._gsap || _harness(targets)[i]._gsap;
  2348. tween._ptLookup[i] = ptLookup = {};
  2349. _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender();
  2350. index = fullTargets === targets ? i : fullTargets.indexOf(target);
  2351. if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) {
  2352. tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
  2353. plugin._props.forEach(function (name) {
  2354. ptLookup[name] = pt;
  2355. });
  2356. plugin.priority && (hasPriority = 1);
  2357. }
  2358. if (!harness || harnessVars) {
  2359. for (p in cleanVars) {
  2360. if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) {
  2361. plugin.priority && (hasPriority = 1);
  2362. } else {
  2363. ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
  2364. }
  2365. }
  2366. }
  2367. tween._op && tween._op[i] && tween.kill(target, tween._op[i]);
  2368. if (autoOverwrite && tween._pt) {
  2369. _overwritingTween = tween;
  2370. _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time));
  2371. overwritten = !tween.parent;
  2372. _overwritingTween = 0;
  2373. }
  2374. tween._pt && lazy && (_lazyLookup[gsData.id] = 1);
  2375. }
  2376. hasPriority && _sortPropTweensByPriority(tween);
  2377. tween._onInit && tween._onInit(tween);
  2378. }
  2379. tween._onUpdate = onUpdate;
  2380. tween._initted = (!tween._op || tween._pt) && !overwritten;
  2381. keyframes && time <= 0 && tl.render(_bigNum, true, true);
  2382. },
  2383. _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) {
  2384. var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property],
  2385. pt,
  2386. rootPT,
  2387. lookup,
  2388. i;
  2389. if (!ptCache) {
  2390. ptCache = tween._ptCache[property] = [];
  2391. lookup = tween._ptLookup;
  2392. i = tween._targets.length;
  2393. while (i--) {
  2394. pt = lookup[i][property];
  2395. if (pt && pt.d && pt.d._pt) {
  2396. pt = pt.d._pt;
  2397. while (pt && pt.p !== property && pt.fp !== property) {
  2398. pt = pt._next;
  2399. }
  2400. }
  2401. if (!pt) {
  2402. _forceAllPropTweens = 1;
  2403. tween.vars[property] = "+=0";
  2404. _initTween(tween, time);
  2405. _forceAllPropTweens = 0;
  2406. return skipRecursion ? _warn(property + " not eligible for reset") : 1;
  2407. }
  2408. ptCache.push(pt);
  2409. }
  2410. }
  2411. i = ptCache.length;
  2412. while (i--) {
  2413. rootPT = ptCache[i];
  2414. pt = rootPT._pt || rootPT;
  2415. pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c;
  2416. pt.c = value - pt.s;
  2417. rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e));
  2418. rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b));
  2419. }
  2420. },
  2421. _addAliasesToVars = function _addAliasesToVars(targets, vars) {
  2422. var harness = targets[0] ? _getCache(targets[0]).harness : 0,
  2423. propertyAliases = harness && harness.aliases,
  2424. copy,
  2425. p,
  2426. i,
  2427. aliases;
  2428. if (!propertyAliases) {
  2429. return vars;
  2430. }
  2431. copy = _merge({}, vars);
  2432. for (p in propertyAliases) {
  2433. if (p in copy) {
  2434. aliases = propertyAliases[p].split(",");
  2435. i = aliases.length;
  2436. while (i--) {
  2437. copy[aliases[i]] = copy[p];
  2438. }
  2439. }
  2440. }
  2441. return copy;
  2442. },
  2443. _parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) {
  2444. var ease = obj.ease || easeEach || "power1.inOut",
  2445. p,
  2446. a;
  2447. if (_isArray(obj)) {
  2448. a = allProps[prop] || (allProps[prop] = []);
  2449. obj.forEach(function (value, i) {
  2450. return a.push({
  2451. t: i / (obj.length - 1) * 100,
  2452. v: value,
  2453. e: ease
  2454. });
  2455. });
  2456. } else {
  2457. for (p in obj) {
  2458. a = allProps[p] || (allProps[p] = []);
  2459. p === "ease" || a.push({
  2460. t: parseFloat(prop),
  2461. v: obj[p],
  2462. e: ease
  2463. });
  2464. }
  2465. }
  2466. },
  2467. _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) {
  2468. return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value;
  2469. },
  2470. _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",
  2471. _staggerPropsToSkip = {};
  2472. _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function (name) {
  2473. return _staggerPropsToSkip[name] = 1;
  2474. });
  2475. var Tween = function (_Animation2) {
  2476. _inheritsLoose(Tween, _Animation2);
  2477. function Tween(targets, vars, position, skipInherit) {
  2478. var _this3;
  2479. if (typeof vars === "number") {
  2480. position.duration = vars;
  2481. vars = position;
  2482. position = null;
  2483. }
  2484. _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this;
  2485. var _this3$vars = _this3.vars,
  2486. duration = _this3$vars.duration,
  2487. delay = _this3$vars.delay,
  2488. immediateRender = _this3$vars.immediateRender,
  2489. stagger = _this3$vars.stagger,
  2490. overwrite = _this3$vars.overwrite,
  2491. keyframes = _this3$vars.keyframes,
  2492. defaults = _this3$vars.defaults,
  2493. scrollTrigger = _this3$vars.scrollTrigger,
  2494. yoyoEase = _this3$vars.yoyoEase,
  2495. parent = vars.parent || _globalTimeline,
  2496. parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets),
  2497. tl,
  2498. i,
  2499. copy,
  2500. l,
  2501. p,
  2502. curTarget,
  2503. staggerFunc,
  2504. staggerVarsToMerge;
  2505. _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || [];
  2506. _this3._ptLookup = [];
  2507. _this3._overwrite = overwrite;
  2508. if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
  2509. vars = _this3.vars;
  2510. tl = _this3.timeline = new Timeline({
  2511. data: "nested",
  2512. defaults: defaults || {},
  2513. targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets
  2514. });
  2515. tl.kill();
  2516. tl.parent = tl._dp = _assertThisInitialized(_this3);
  2517. tl._start = 0;
  2518. if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
  2519. l = parsedTargets.length;
  2520. staggerFunc = stagger && distribute(stagger);
  2521. if (_isObject(stagger)) {
  2522. for (p in stagger) {
  2523. if (~_staggerTweenProps.indexOf(p)) {
  2524. staggerVarsToMerge || (staggerVarsToMerge = {});
  2525. staggerVarsToMerge[p] = stagger[p];
  2526. }
  2527. }
  2528. }
  2529. for (i = 0; i < l; i++) {
  2530. copy = _copyExcluding(vars, _staggerPropsToSkip);
  2531. copy.stagger = 0;
  2532. yoyoEase && (copy.yoyoEase = yoyoEase);
  2533. staggerVarsToMerge && _merge(copy, staggerVarsToMerge);
  2534. curTarget = parsedTargets[i];
  2535. copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
  2536. copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay;
  2537. if (!stagger && l === 1 && copy.delay) {
  2538. _this3._delay = delay = copy.delay;
  2539. _this3._start += delay;
  2540. copy.delay = 0;
  2541. }
  2542. tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0);
  2543. tl._ease = _easeMap.none;
  2544. }
  2545. tl.duration() ? duration = delay = 0 : _this3.timeline = 0;
  2546. } else if (keyframes) {
  2547. _inheritDefaults(_setDefaults(tl.vars.defaults, {
  2548. ease: "none"
  2549. }));
  2550. tl._ease = _parseEase(keyframes.ease || vars.ease || "none");
  2551. var time = 0,
  2552. a,
  2553. kf,
  2554. v;
  2555. if (_isArray(keyframes)) {
  2556. keyframes.forEach(function (frame) {
  2557. return tl.to(parsedTargets, frame, ">");
  2558. });
  2559. tl.duration();
  2560. } else {
  2561. copy = {};
  2562. for (p in keyframes) {
  2563. p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach);
  2564. }
  2565. for (p in copy) {
  2566. a = copy[p].sort(function (a, b) {
  2567. return a.t - b.t;
  2568. });
  2569. time = 0;
  2570. for (i = 0; i < a.length; i++) {
  2571. kf = a[i];
  2572. v = {
  2573. ease: kf.e,
  2574. duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration
  2575. };
  2576. v[p] = kf.v;
  2577. tl.to(parsedTargets, v, time);
  2578. time += v.duration;
  2579. }
  2580. }
  2581. tl.duration() < duration && tl.to({}, {
  2582. duration: duration - tl.duration()
  2583. });
  2584. }
  2585. }
  2586. duration || _this3.duration(duration = tl.duration());
  2587. } else {
  2588. _this3.timeline = 0;
  2589. }
  2590. if (overwrite === true && !_suppressOverwrites) {
  2591. _overwritingTween = _assertThisInitialized(_this3);
  2592. _globalTimeline.killTweensOf(parsedTargets);
  2593. _overwritingTween = 0;
  2594. }
  2595. _addToTimeline(parent, _assertThisInitialized(_this3), position);
  2596. vars.reversed && _this3.reverse();
  2597. vars.paused && _this3.paused(true);
  2598. if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") {
  2599. _this3._tTime = -_tinyNum;
  2600. _this3.render(Math.max(0, -delay) || 0);
  2601. }
  2602. scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
  2603. return _this3;
  2604. }
  2605. var _proto3 = Tween.prototype;
  2606. _proto3.render = function render(totalTime, suppressEvents, force) {
  2607. var prevTime = this._time,
  2608. tDur = this._tDur,
  2609. dur = this._dur,
  2610. isNegative = totalTime < 0,
  2611. tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime,
  2612. time,
  2613. pt,
  2614. iteration,
  2615. cycleDuration,
  2616. prevIteration,
  2617. isYoyo,
  2618. ratio,
  2619. timeline,
  2620. yoyoEase;
  2621. if (!dur) {
  2622. _renderZeroDurationTween(this, totalTime, suppressEvents, force);
  2623. } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative || this._lazy) {
  2624. time = tTime;
  2625. timeline = this.timeline;
  2626. if (this._repeat) {
  2627. cycleDuration = dur + this._rDelay;
  2628. if (this._repeat < -1 && isNegative) {
  2629. return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
  2630. }
  2631. time = _roundPrecise(tTime % cycleDuration);
  2632. if (tTime === tDur) {
  2633. iteration = this._repeat;
  2634. time = dur;
  2635. } else {
  2636. prevIteration = _roundPrecise(tTime / cycleDuration);
  2637. iteration = ~~prevIteration;
  2638. if (iteration && iteration === prevIteration) {
  2639. time = dur;
  2640. iteration--;
  2641. } else if (time > dur) {
  2642. time = dur;
  2643. }
  2644. }
  2645. isYoyo = this._yoyo && iteration & 1;
  2646. if (isYoyo) {
  2647. yoyoEase = this._yEase;
  2648. time = dur - time;
  2649. }
  2650. prevIteration = _animationCycle(this._tTime, cycleDuration);
  2651. if (time === prevTime && !force && this._initted && iteration === prevIteration) {
  2652. this._tTime = tTime;
  2653. return this;
  2654. }
  2655. if (iteration !== prevIteration) {
  2656. timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo);
  2657. if (this.vars.repeatRefresh && !isYoyo && !this._lock && time !== cycleDuration && this._initted) {
  2658. this._lock = force = 1;
  2659. this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0;
  2660. }
  2661. }
  2662. }
  2663. if (!this._initted) {
  2664. if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) {
  2665. this._tTime = 0;
  2666. return this;
  2667. }
  2668. if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) {
  2669. return this;
  2670. }
  2671. if (dur !== this._dur) {
  2672. return this.render(totalTime, suppressEvents, force);
  2673. }
  2674. }
  2675. this._tTime = tTime;
  2676. this._time = time;
  2677. if (!this._act && this._ts) {
  2678. this._act = 1;
  2679. this._lazy = 0;
  2680. }
  2681. this.ratio = ratio = (yoyoEase || this._ease)(time / dur);
  2682. if (this._from) {
  2683. this.ratio = ratio = 1 - ratio;
  2684. }
  2685. if (!prevTime && tTime && !suppressEvents && !prevIteration) {
  2686. _callback(this, "onStart");
  2687. if (this._tTime !== tTime) {
  2688. return this;
  2689. }
  2690. }
  2691. pt = this._pt;
  2692. while (pt) {
  2693. pt.r(ratio, pt.d);
  2694. pt = pt._next;
  2695. }
  2696. timeline && timeline.render(totalTime < 0 ? totalTime : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime);
  2697. if (this._onUpdate && !suppressEvents) {
  2698. isNegative && _rewindStartAt(this, totalTime, suppressEvents, force);
  2699. _callback(this, "onUpdate");
  2700. }
  2701. this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat");
  2702. if ((tTime === this._tDur || !tTime) && this._tTime === tTime) {
  2703. isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true);
  2704. (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
  2705. if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) {
  2706. _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
  2707. this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
  2708. }
  2709. }
  2710. }
  2711. return this;
  2712. };
  2713. _proto3.targets = function targets() {
  2714. return this._targets;
  2715. };
  2716. _proto3.invalidate = function invalidate(soft) {
  2717. (!soft || !this.vars.runBackwards) && (this._startAt = 0);
  2718. this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0;
  2719. this._ptLookup = [];
  2720. this.timeline && this.timeline.invalidate(soft);
  2721. return _Animation2.prototype.invalidate.call(this, soft);
  2722. };
  2723. _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) {
  2724. _tickerActive || _ticker.wake();
  2725. this._ts || this.play();
  2726. var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts),
  2727. ratio;
  2728. this._initted || _initTween(this, time);
  2729. ratio = this._ease(time / this._dur);
  2730. if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) {
  2731. return this.resetTo(property, value, start, startIsRelative, 1);
  2732. }
  2733. _alignPlayhead(this, 0);
  2734. this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0);
  2735. return this.render(0);
  2736. };
  2737. _proto3.kill = function kill(targets, vars) {
  2738. if (vars === void 0) {
  2739. vars = "all";
  2740. }
  2741. if (!targets && (!vars || vars === "all")) {
  2742. this._lazy = this._pt = 0;
  2743. this.parent ? _interrupt(this) : this.scrollTrigger && this.scrollTrigger.kill(!!_reverting);
  2744. return this;
  2745. }
  2746. if (this.timeline) {
  2747. var tDur = this.timeline.totalDuration();
  2748. this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this);
  2749. this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
  2750. return this;
  2751. }
  2752. var parsedTargets = this._targets,
  2753. killingTargets = targets ? toArray(targets) : parsedTargets,
  2754. propTweenLookup = this._ptLookup,
  2755. firstPT = this._pt,
  2756. overwrittenProps,
  2757. curLookup,
  2758. curOverwriteProps,
  2759. props,
  2760. p,
  2761. pt,
  2762. i;
  2763. if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) {
  2764. vars === "all" && (this._pt = 0);
  2765. return _interrupt(this);
  2766. }
  2767. overwrittenProps = this._op = this._op || [];
  2768. if (vars !== "all") {
  2769. if (_isString(vars)) {
  2770. p = {};
  2771. _forEachName(vars, function (name) {
  2772. return p[name] = 1;
  2773. });
  2774. vars = p;
  2775. }
  2776. vars = _addAliasesToVars(parsedTargets, vars);
  2777. }
  2778. i = parsedTargets.length;
  2779. while (i--) {
  2780. if (~killingTargets.indexOf(parsedTargets[i])) {
  2781. curLookup = propTweenLookup[i];
  2782. if (vars === "all") {
  2783. overwrittenProps[i] = vars;
  2784. props = curLookup;
  2785. curOverwriteProps = {};
  2786. } else {
  2787. curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {};
  2788. props = vars;
  2789. }
  2790. for (p in props) {
  2791. pt = curLookup && curLookup[p];
  2792. if (pt) {
  2793. if (!("kill" in pt.d) || pt.d.kill(p) === true) {
  2794. _removeLinkedListItem(this, pt, "_pt");
  2795. }
  2796. delete curLookup[p];
  2797. }
  2798. if (curOverwriteProps !== "all") {
  2799. curOverwriteProps[p] = 1;
  2800. }
  2801. }
  2802. }
  2803. }
  2804. this._initted && !this._pt && firstPT && _interrupt(this);
  2805. return this;
  2806. };
  2807. Tween.to = function to(targets, vars) {
  2808. return new Tween(targets, vars, arguments[2]);
  2809. };
  2810. Tween.from = function from(targets, vars) {
  2811. return _createTweenType(1, arguments);
  2812. };
  2813. Tween.delayedCall = function delayedCall(delay, callback, params, scope) {
  2814. return new Tween(callback, 0, {
  2815. immediateRender: false,
  2816. lazy: false,
  2817. overwrite: false,
  2818. delay: delay,
  2819. onComplete: callback,
  2820. onReverseComplete: callback,
  2821. onCompleteParams: params,
  2822. onReverseCompleteParams: params,
  2823. callbackScope: scope
  2824. });
  2825. };
  2826. Tween.fromTo = function fromTo(targets, fromVars, toVars) {
  2827. return _createTweenType(2, arguments);
  2828. };
  2829. Tween.set = function set(targets, vars) {
  2830. vars.duration = 0;
  2831. vars.repeatDelay || (vars.repeat = 0);
  2832. return new Tween(targets, vars);
  2833. };
  2834. Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) {
  2835. return _globalTimeline.killTweensOf(targets, props, onlyActive);
  2836. };
  2837. return Tween;
  2838. }(Animation);
  2839. _setDefaults(Tween.prototype, {
  2840. _targets: [],
  2841. _lazy: 0,
  2842. _startAt: 0,
  2843. _op: 0,
  2844. _onInit: 0
  2845. });
  2846. _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) {
  2847. Tween[name] = function () {
  2848. var tl = new Timeline(),
  2849. params = _slice.call(arguments, 0);
  2850. params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0);
  2851. return tl[name].apply(tl, params);
  2852. };
  2853. });
  2854. var _setterPlain = function _setterPlain(target, property, value) {
  2855. return target[property] = value;
  2856. },
  2857. _setterFunc = function _setterFunc(target, property, value) {
  2858. return target[property](value);
  2859. },
  2860. _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) {
  2861. return target[property](data.fp, value);
  2862. },
  2863. _setterAttribute = function _setterAttribute(target, property, value) {
  2864. return target.setAttribute(property, value);
  2865. },
  2866. _getSetter = function _getSetter(target, property) {
  2867. return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain;
  2868. },
  2869. _renderPlain = function _renderPlain(ratio, data) {
  2870. return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data);
  2871. },
  2872. _renderBoolean = function _renderBoolean(ratio, data) {
  2873. return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
  2874. },
  2875. _renderComplexString = function _renderComplexString(ratio, data) {
  2876. var pt = data._pt,
  2877. s = "";
  2878. if (!ratio && data.b) {
  2879. s = data.b;
  2880. } else if (ratio === 1 && data.e) {
  2881. s = data.e;
  2882. } else {
  2883. while (pt) {
  2884. s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s;
  2885. pt = pt._next;
  2886. }
  2887. s += data.c;
  2888. }
  2889. data.set(data.t, data.p, s, data);
  2890. },
  2891. _renderPropTweens = function _renderPropTweens(ratio, data) {
  2892. var pt = data._pt;
  2893. while (pt) {
  2894. pt.r(ratio, pt.d);
  2895. pt = pt._next;
  2896. }
  2897. },
  2898. _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) {
  2899. var pt = this._pt,
  2900. next;
  2901. while (pt) {
  2902. next = pt._next;
  2903. pt.p === property && pt.modifier(modifier, tween, target);
  2904. pt = next;
  2905. }
  2906. },
  2907. _killPropTweensOf = function _killPropTweensOf(property) {
  2908. var pt = this._pt,
  2909. hasNonDependentRemaining,
  2910. next;
  2911. while (pt) {
  2912. next = pt._next;
  2913. if (pt.p === property && !pt.op || pt.op === property) {
  2914. _removeLinkedListItem(this, pt, "_pt");
  2915. } else if (!pt.dep) {
  2916. hasNonDependentRemaining = 1;
  2917. }
  2918. pt = next;
  2919. }
  2920. return !hasNonDependentRemaining;
  2921. },
  2922. _setterWithModifier = function _setterWithModifier(target, property, value, data) {
  2923. data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
  2924. },
  2925. _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) {
  2926. var pt = parent._pt,
  2927. next,
  2928. pt2,
  2929. first,
  2930. last;
  2931. while (pt) {
  2932. next = pt._next;
  2933. pt2 = first;
  2934. while (pt2 && pt2.pr > pt.pr) {
  2935. pt2 = pt2._next;
  2936. }
  2937. if (pt._prev = pt2 ? pt2._prev : last) {
  2938. pt._prev._next = pt;
  2939. } else {
  2940. first = pt;
  2941. }
  2942. if (pt._next = pt2) {
  2943. pt2._prev = pt;
  2944. } else {
  2945. last = pt;
  2946. }
  2947. pt = next;
  2948. }
  2949. parent._pt = first;
  2950. };
  2951. var PropTween = function () {
  2952. function PropTween(next, target, prop, start, change, renderer, data, setter, priority) {
  2953. this.t = target;
  2954. this.s = start;
  2955. this.c = change;
  2956. this.p = prop;
  2957. this.r = renderer || _renderPlain;
  2958. this.d = data || this;
  2959. this.set = setter || _setterPlain;
  2960. this.pr = priority || 0;
  2961. this._next = next;
  2962. if (next) {
  2963. next._prev = this;
  2964. }
  2965. }
  2966. var _proto4 = PropTween.prototype;
  2967. _proto4.modifier = function modifier(func, tween, target) {
  2968. this.mSet = this.mSet || this.set;
  2969. this.set = _setterWithModifier;
  2970. this.m = func;
  2971. this.mt = target;
  2972. this.tween = tween;
  2973. };
  2974. return PropTween;
  2975. }();
  2976. _forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function (name) {
  2977. return _reservedProps[name] = 1;
  2978. });
  2979. _globals.TweenMax = _globals.TweenLite = Tween;
  2980. _globals.TimelineLite = _globals.TimelineMax = Timeline;
  2981. _globalTimeline = new Timeline({
  2982. sortChildren: false,
  2983. defaults: _defaults,
  2984. autoRemoveChildren: true,
  2985. id: "root",
  2986. smoothChildTiming: true
  2987. });
  2988. _config.stringFilter = _colorStringFilter;
  2989. var _media = [],
  2990. _listeners = {},
  2991. _emptyArray = [],
  2992. _lastMediaTime = 0,
  2993. _contextID = 0,
  2994. _dispatch = function _dispatch(type) {
  2995. return (_listeners[type] || _emptyArray).map(function (f) {
  2996. return f();
  2997. });
  2998. },
  2999. _onMediaChange = function _onMediaChange() {
  3000. var time = Date.now(),
  3001. matches = [];
  3002. if (time - _lastMediaTime > 2) {
  3003. _dispatch("matchMediaInit");
  3004. _media.forEach(function (c) {
  3005. var queries = c.queries,
  3006. conditions = c.conditions,
  3007. match,
  3008. p,
  3009. anyMatch,
  3010. toggled;
  3011. for (p in queries) {
  3012. match = _win.matchMedia(queries[p]).matches;
  3013. match && (anyMatch = 1);
  3014. if (match !== conditions[p]) {
  3015. conditions[p] = match;
  3016. toggled = 1;
  3017. }
  3018. }
  3019. if (toggled) {
  3020. c.revert();
  3021. anyMatch && matches.push(c);
  3022. }
  3023. });
  3024. _dispatch("matchMediaRevert");
  3025. matches.forEach(function (c) {
  3026. return c.onMatch(c, function (func) {
  3027. return c.add(null, func);
  3028. });
  3029. });
  3030. _lastMediaTime = time;
  3031. _dispatch("matchMedia");
  3032. }
  3033. };
  3034. var Context = function () {
  3035. function Context(func, scope) {
  3036. this.selector = scope && selector(scope);
  3037. this.data = [];
  3038. this._r = [];
  3039. this.isReverted = false;
  3040. this.id = _contextID++;
  3041. func && this.add(func);
  3042. }
  3043. var _proto5 = Context.prototype;
  3044. _proto5.add = function add(name, func, scope) {
  3045. if (_isFunction(name)) {
  3046. scope = func;
  3047. func = name;
  3048. name = _isFunction;
  3049. }
  3050. var self = this,
  3051. f = function f() {
  3052. var prev = _context,
  3053. prevSelector = self.selector,
  3054. result;
  3055. prev && prev !== self && prev.data.push(self);
  3056. scope && (self.selector = selector(scope));
  3057. _context = self;
  3058. result = func.apply(self, arguments);
  3059. _isFunction(result) && self._r.push(result);
  3060. _context = prev;
  3061. self.selector = prevSelector;
  3062. self.isReverted = false;
  3063. return result;
  3064. };
  3065. self.last = f;
  3066. return name === _isFunction ? f(self, function (func) {
  3067. return self.add(null, func);
  3068. }) : name ? self[name] = f : f;
  3069. };
  3070. _proto5.ignore = function ignore(func) {
  3071. var prev = _context;
  3072. _context = null;
  3073. func(this);
  3074. _context = prev;
  3075. };
  3076. _proto5.getTweens = function getTweens() {
  3077. var a = [];
  3078. this.data.forEach(function (e) {
  3079. return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e);
  3080. });
  3081. return a;
  3082. };
  3083. _proto5.clear = function clear() {
  3084. this._r.length = this.data.length = 0;
  3085. };
  3086. _proto5.kill = function kill(revert, matchMedia) {
  3087. var _this4 = this;
  3088. if (revert) {
  3089. (function () {
  3090. var tweens = _this4.getTweens(),
  3091. i = _this4.data.length,
  3092. t;
  3093. while (i--) {
  3094. t = _this4.data[i];
  3095. if (t.data === "isFlip") {
  3096. t.revert();
  3097. t.getChildren(true, true, false).forEach(function (tween) {
  3098. return tweens.splice(tweens.indexOf(tween), 1);
  3099. });
  3100. }
  3101. }
  3102. tweens.map(function (t) {
  3103. return {
  3104. g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity,
  3105. t: t
  3106. };
  3107. }).sort(function (a, b) {
  3108. return b.g - a.g || -Infinity;
  3109. }).forEach(function (o) {
  3110. return o.t.revert(revert);
  3111. });
  3112. i = _this4.data.length;
  3113. while (i--) {
  3114. t = _this4.data[i];
  3115. if (t instanceof Timeline) {
  3116. if (t.data !== "nested") {
  3117. t.scrollTrigger && t.scrollTrigger.revert();
  3118. t.kill();
  3119. }
  3120. } else {
  3121. !(t instanceof Tween) && t.revert && t.revert(revert);
  3122. }
  3123. }
  3124. _this4._r.forEach(function (f) {
  3125. return f(revert, _this4);
  3126. });
  3127. _this4.isReverted = true;
  3128. })();
  3129. } else {
  3130. this.data.forEach(function (e) {
  3131. return e.kill && e.kill();
  3132. });
  3133. }
  3134. this.clear();
  3135. if (matchMedia) {
  3136. var i = _media.length;
  3137. while (i--) {
  3138. _media[i].id === this.id && _media.splice(i, 1);
  3139. }
  3140. }
  3141. };
  3142. _proto5.revert = function revert(config) {
  3143. this.kill(config || {});
  3144. };
  3145. return Context;
  3146. }();
  3147. var MatchMedia = function () {
  3148. function MatchMedia(scope) {
  3149. this.contexts = [];
  3150. this.scope = scope;
  3151. _context && _context.data.push(this);
  3152. }
  3153. var _proto6 = MatchMedia.prototype;
  3154. _proto6.add = function add(conditions, func, scope) {
  3155. _isObject(conditions) || (conditions = {
  3156. matches: conditions
  3157. });
  3158. var context = new Context(0, scope || this.scope),
  3159. cond = context.conditions = {},
  3160. mq,
  3161. p,
  3162. active;
  3163. _context && !context.selector && (context.selector = _context.selector);
  3164. this.contexts.push(context);
  3165. func = context.add("onMatch", func);
  3166. context.queries = conditions;
  3167. for (p in conditions) {
  3168. if (p === "all") {
  3169. active = 1;
  3170. } else {
  3171. mq = _win.matchMedia(conditions[p]);
  3172. if (mq) {
  3173. _media.indexOf(context) < 0 && _media.push(context);
  3174. (cond[p] = mq.matches) && (active = 1);
  3175. mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange);
  3176. }
  3177. }
  3178. }
  3179. active && func(context, function (f) {
  3180. return context.add(null, f);
  3181. });
  3182. return this;
  3183. };
  3184. _proto6.revert = function revert(config) {
  3185. this.kill(config || {});
  3186. };
  3187. _proto6.kill = function kill(revert) {
  3188. this.contexts.forEach(function (c) {
  3189. return c.kill(revert, true);
  3190. });
  3191. };
  3192. return MatchMedia;
  3193. }();
  3194. var _gsap = {
  3195. registerPlugin: function registerPlugin() {
  3196. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  3197. args[_key2] = arguments[_key2];
  3198. }
  3199. args.forEach(function (config) {
  3200. return _createPlugin(config);
  3201. });
  3202. },
  3203. timeline: function timeline(vars) {
  3204. return new Timeline(vars);
  3205. },
  3206. getTweensOf: function getTweensOf(targets, onlyActive) {
  3207. return _globalTimeline.getTweensOf(targets, onlyActive);
  3208. },
  3209. getProperty: function getProperty(target, property, unit, uncache) {
  3210. _isString(target) && (target = toArray(target)[0]);
  3211. var getter = _getCache(target || {}).get,
  3212. format = unit ? _passThrough : _numericIfPossible;
  3213. unit === "native" && (unit = "");
  3214. return !target ? target : !property ? function (property, unit, uncache) {
  3215. return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
  3216. } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
  3217. },
  3218. quickSetter: function quickSetter(target, property, unit) {
  3219. target = toArray(target);
  3220. if (target.length > 1) {
  3221. var setters = target.map(function (t) {
  3222. return gsap.quickSetter(t, property, unit);
  3223. }),
  3224. l = setters.length;
  3225. return function (value) {
  3226. var i = l;
  3227. while (i--) {
  3228. setters[i](value);
  3229. }
  3230. };
  3231. }
  3232. target = target[0] || {};
  3233. var Plugin = _plugins[property],
  3234. cache = _getCache(target),
  3235. p = cache.harness && (cache.harness.aliases || {})[property] || property,
  3236. setter = Plugin ? function (value) {
  3237. var p = new Plugin();
  3238. _quickTween._pt = 0;
  3239. p.init(target, unit ? value + unit : value, _quickTween, 0, [target]);
  3240. p.render(1, p);
  3241. _quickTween._pt && _renderPropTweens(1, _quickTween);
  3242. } : cache.set(target, p);
  3243. return Plugin ? setter : function (value) {
  3244. return setter(target, p, unit ? value + unit : value, cache, 1);
  3245. };
  3246. },
  3247. quickTo: function quickTo(target, property, vars) {
  3248. var _setDefaults2;
  3249. var tween = gsap.to(target, _setDefaults((_setDefaults2 = {}, _setDefaults2[property] = "+=0.1", _setDefaults2.paused = true, _setDefaults2.stagger = 0, _setDefaults2), vars || {})),
  3250. func = function func(value, start, startIsRelative) {
  3251. return tween.resetTo(property, value, start, startIsRelative);
  3252. };
  3253. func.tween = tween;
  3254. return func;
  3255. },
  3256. isTweening: function isTweening(targets) {
  3257. return _globalTimeline.getTweensOf(targets, true).length > 0;
  3258. },
  3259. defaults: function defaults(value) {
  3260. value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
  3261. return _mergeDeep(_defaults, value || {});
  3262. },
  3263. config: function config(value) {
  3264. return _mergeDeep(_config, value || {});
  3265. },
  3266. registerEffect: function registerEffect(_ref3) {
  3267. var name = _ref3.name,
  3268. effect = _ref3.effect,
  3269. plugins = _ref3.plugins,
  3270. defaults = _ref3.defaults,
  3271. extendTimeline = _ref3.extendTimeline;
  3272. (plugins || "").split(",").forEach(function (pluginName) {
  3273. return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin.");
  3274. });
  3275. _effects[name] = function (targets, vars, tl) {
  3276. return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl);
  3277. };
  3278. if (extendTimeline) {
  3279. Timeline.prototype[name] = function (targets, vars, position) {
  3280. return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position);
  3281. };
  3282. }
  3283. },
  3284. registerEase: function registerEase(name, ease) {
  3285. _easeMap[name] = _parseEase(ease);
  3286. },
  3287. parseEase: function parseEase(ease, defaultEase) {
  3288. return arguments.length ? _parseEase(ease, defaultEase) : _easeMap;
  3289. },
  3290. getById: function getById(id) {
  3291. return _globalTimeline.getById(id);
  3292. },
  3293. exportRoot: function exportRoot(vars, includeDelayedCalls) {
  3294. if (vars === void 0) {
  3295. vars = {};
  3296. }
  3297. var tl = new Timeline(vars),
  3298. child,
  3299. next;
  3300. tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming);
  3301. _globalTimeline.remove(tl);
  3302. tl._dp = 0;
  3303. tl._time = tl._tTime = _globalTimeline._time;
  3304. child = _globalTimeline._first;
  3305. while (child) {
  3306. next = child._next;
  3307. if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
  3308. _addToTimeline(tl, child, child._start - child._delay);
  3309. }
  3310. child = next;
  3311. }
  3312. _addToTimeline(_globalTimeline, tl, 0);
  3313. return tl;
  3314. },
  3315. context: function context(func, scope) {
  3316. return func ? new Context(func, scope) : _context;
  3317. },
  3318. matchMedia: function matchMedia(scope) {
  3319. return new MatchMedia(scope);
  3320. },
  3321. matchMediaRefresh: function matchMediaRefresh() {
  3322. return _media.forEach(function (c) {
  3323. var cond = c.conditions,
  3324. found,
  3325. p;
  3326. for (p in cond) {
  3327. if (cond[p]) {
  3328. cond[p] = false;
  3329. found = 1;
  3330. }
  3331. }
  3332. found && c.revert();
  3333. }) || _onMediaChange();
  3334. },
  3335. addEventListener: function addEventListener(type, callback) {
  3336. var a = _listeners[type] || (_listeners[type] = []);
  3337. ~a.indexOf(callback) || a.push(callback);
  3338. },
  3339. removeEventListener: function removeEventListener(type, callback) {
  3340. var a = _listeners[type],
  3341. i = a && a.indexOf(callback);
  3342. i >= 0 && a.splice(i, 1);
  3343. },
  3344. utils: {
  3345. wrap: wrap,
  3346. wrapYoyo: wrapYoyo,
  3347. distribute: distribute,
  3348. random: random,
  3349. snap: snap,
  3350. normalize: normalize,
  3351. getUnit: getUnit,
  3352. clamp: clamp,
  3353. splitColor: splitColor,
  3354. toArray: toArray,
  3355. selector: selector,
  3356. mapRange: mapRange,
  3357. pipe: pipe,
  3358. unitize: unitize,
  3359. interpolate: interpolate,
  3360. shuffle: shuffle
  3361. },
  3362. install: _install,
  3363. effects: _effects,
  3364. ticker: _ticker,
  3365. updateRoot: Timeline.updateRoot,
  3366. plugins: _plugins,
  3367. globalTimeline: _globalTimeline,
  3368. core: {
  3369. PropTween: PropTween,
  3370. globals: _addGlobal,
  3371. Tween: Tween,
  3372. Timeline: Timeline,
  3373. Animation: Animation,
  3374. getCache: _getCache,
  3375. _removeLinkedListItem: _removeLinkedListItem,
  3376. reverting: function reverting() {
  3377. return _reverting;
  3378. },
  3379. context: function context(toAdd) {
  3380. if (toAdd && _context) {
  3381. _context.data.push(toAdd);
  3382. toAdd._ctx = _context;
  3383. }
  3384. return _context;
  3385. },
  3386. suppressOverwrites: function suppressOverwrites(value) {
  3387. return _suppressOverwrites = value;
  3388. }
  3389. }
  3390. };
  3391. _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) {
  3392. return _gsap[name] = Tween[name];
  3393. });
  3394. _ticker.add(Timeline.updateRoot);
  3395. _quickTween = _gsap.to({}, {
  3396. duration: 0
  3397. });
  3398. var _getPluginPropTween = function _getPluginPropTween(plugin, prop) {
  3399. var pt = plugin._pt;
  3400. while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) {
  3401. pt = pt._next;
  3402. }
  3403. return pt;
  3404. },
  3405. _addModifiers = function _addModifiers(tween, modifiers) {
  3406. var targets = tween._targets,
  3407. p,
  3408. i,
  3409. pt;
  3410. for (p in modifiers) {
  3411. i = targets.length;
  3412. while (i--) {
  3413. pt = tween._ptLookup[i][p];
  3414. if (pt && (pt = pt.d)) {
  3415. if (pt._pt) {
  3416. pt = _getPluginPropTween(pt, p);
  3417. }
  3418. pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p);
  3419. }
  3420. }
  3421. }
  3422. },
  3423. _buildModifierPlugin = function _buildModifierPlugin(name, modifier) {
  3424. return {
  3425. name: name,
  3426. headless: 1,
  3427. rawVars: 1,
  3428. init: function init(target, vars, tween) {
  3429. tween._onInit = function (tween) {
  3430. var temp, p;
  3431. if (_isString(vars)) {
  3432. temp = {};
  3433. _forEachName(vars, function (name) {
  3434. return temp[name] = 1;
  3435. });
  3436. vars = temp;
  3437. }
  3438. if (modifier) {
  3439. temp = {};
  3440. for (p in vars) {
  3441. temp[p] = modifier(vars[p]);
  3442. }
  3443. vars = temp;
  3444. }
  3445. _addModifiers(tween, vars);
  3446. };
  3447. }
  3448. };
  3449. };
  3450. var gsap = _gsap.registerPlugin({
  3451. name: "attr",
  3452. init: function init(target, vars, tween, index, targets) {
  3453. var p, pt, v;
  3454. this.tween = tween;
  3455. for (p in vars) {
  3456. v = target.getAttribute(p) || "";
  3457. pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p);
  3458. pt.op = p;
  3459. pt.b = v;
  3460. this._props.push(p);
  3461. }
  3462. },
  3463. render: function render(ratio, data) {
  3464. var pt = data._pt;
  3465. while (pt) {
  3466. _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d);
  3467. pt = pt._next;
  3468. }
  3469. }
  3470. }, {
  3471. name: "endArray",
  3472. headless: 1,
  3473. init: function init(target, value) {
  3474. var i = value.length;
  3475. while (i--) {
  3476. this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1);
  3477. }
  3478. }
  3479. }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
  3480. Tween.version = Timeline.version = gsap.version = "3.13.0";
  3481. _coreReady = 1;
  3482. _windowExists() && _wake();
  3483. var Power0 = _easeMap.Power0,
  3484. Power1 = _easeMap.Power1,
  3485. Power2 = _easeMap.Power2,
  3486. Power3 = _easeMap.Power3,
  3487. Power4 = _easeMap.Power4,
  3488. Linear = _easeMap.Linear,
  3489. Quad = _easeMap.Quad,
  3490. Cubic = _easeMap.Cubic,
  3491. Quart = _easeMap.Quart,
  3492. Quint = _easeMap.Quint,
  3493. Strong = _easeMap.Strong,
  3494. Elastic = _easeMap.Elastic,
  3495. Back = _easeMap.Back,
  3496. SteppedEase = _easeMap.SteppedEase,
  3497. Bounce = _easeMap.Bounce,
  3498. Sine = _easeMap.Sine,
  3499. Expo = _easeMap.Expo,
  3500. Circ = _easeMap.Circ;
  3501. var _win$1,
  3502. _doc$1,
  3503. _docElement,
  3504. _pluginInitted,
  3505. _tempDiv,
  3506. _tempDivStyler,
  3507. _recentSetterPlugin,
  3508. _reverting$1,
  3509. _windowExists$1 = function _windowExists() {
  3510. return typeof window !== "undefined";
  3511. },
  3512. _transformProps = {},
  3513. _RAD2DEG = 180 / Math.PI,
  3514. _DEG2RAD = Math.PI / 180,
  3515. _atan2 = Math.atan2,
  3516. _bigNum$1 = 1e8,
  3517. _capsExp = /([A-Z])/g,
  3518. _horizontalExp = /(left|right|width|margin|padding|x)/i,
  3519. _complexExp = /[\s,\(]\S/,
  3520. _propertyAliases = {
  3521. autoAlpha: "opacity,visibility",
  3522. scale: "scaleX,scaleY",
  3523. alpha: "opacity"
  3524. },
  3525. _renderCSSProp = function _renderCSSProp(ratio, data) {
  3526. return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
  3527. },
  3528. _renderPropWithEnd = function _renderPropWithEnd(ratio, data) {
  3529. return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
  3530. },
  3531. _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) {
  3532. return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data);
  3533. },
  3534. _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) {
  3535. var value = data.s + data.c * ratio;
  3536. data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data);
  3537. },
  3538. _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) {
  3539. return data.set(data.t, data.p, ratio ? data.e : data.b, data);
  3540. },
  3541. _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) {
  3542. return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data);
  3543. },
  3544. _setterCSSStyle = function _setterCSSStyle(target, property, value) {
  3545. return target.style[property] = value;
  3546. },
  3547. _setterCSSProp = function _setterCSSProp(target, property, value) {
  3548. return target.style.setProperty(property, value);
  3549. },
  3550. _setterTransform = function _setterTransform(target, property, value) {
  3551. return target._gsap[property] = value;
  3552. },
  3553. _setterScale = function _setterScale(target, property, value) {
  3554. return target._gsap.scaleX = target._gsap.scaleY = value;
  3555. },
  3556. _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) {
  3557. var cache = target._gsap;
  3558. cache.scaleX = cache.scaleY = value;
  3559. cache.renderTransform(ratio, cache);
  3560. },
  3561. _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) {
  3562. var cache = target._gsap;
  3563. cache[property] = value;
  3564. cache.renderTransform(ratio, cache);
  3565. },
  3566. _transformProp = "transform",
  3567. _transformOriginProp = _transformProp + "Origin",
  3568. _saveStyle = function _saveStyle(property, isNotCSS) {
  3569. var _this = this;
  3570. var target = this.target,
  3571. style = target.style,
  3572. cache = target._gsap;
  3573. if (property in _transformProps && style) {
  3574. this.tfm = this.tfm || {};
  3575. if (property !== "transform") {
  3576. property = _propertyAliases[property] || property;
  3577. ~property.indexOf(",") ? property.split(",").forEach(function (a) {
  3578. return _this.tfm[a] = _get(target, a);
  3579. }) : this.tfm[property] = cache.x ? cache[property] : _get(target, property);
  3580. property === _transformOriginProp && (this.tfm.zOrigin = cache.zOrigin);
  3581. } else {
  3582. return _propertyAliases.transform.split(",").forEach(function (p) {
  3583. return _saveStyle.call(_this, p, isNotCSS);
  3584. });
  3585. }
  3586. if (this.props.indexOf(_transformProp) >= 0) {
  3587. return;
  3588. }
  3589. if (cache.svg) {
  3590. this.svgo = target.getAttribute("data-svg-origin");
  3591. this.props.push(_transformOriginProp, isNotCSS, "");
  3592. }
  3593. property = _transformProp;
  3594. }
  3595. (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]);
  3596. },
  3597. _removeIndependentTransforms = function _removeIndependentTransforms(style) {
  3598. if (style.translate) {
  3599. style.removeProperty("translate");
  3600. style.removeProperty("scale");
  3601. style.removeProperty("rotate");
  3602. }
  3603. },
  3604. _revertStyle = function _revertStyle() {
  3605. var props = this.props,
  3606. target = this.target,
  3607. style = target.style,
  3608. cache = target._gsap,
  3609. i,
  3610. p;
  3611. for (i = 0; i < props.length; i += 3) {
  3612. if (!props[i + 1]) {
  3613. props[i + 2] ? style[props[i]] = props[i + 2] : style.removeProperty(props[i].substr(0, 2) === "--" ? props[i] : props[i].replace(_capsExp, "-$1").toLowerCase());
  3614. } else if (props[i + 1] === 2) {
  3615. target[props[i]](props[i + 2]);
  3616. } else {
  3617. target[props[i]] = props[i + 2];
  3618. }
  3619. }
  3620. if (this.tfm) {
  3621. for (p in this.tfm) {
  3622. cache[p] = this.tfm[p];
  3623. }
  3624. if (cache.svg) {
  3625. cache.renderTransform();
  3626. target.setAttribute("data-svg-origin", this.svgo || "");
  3627. }
  3628. i = _reverting$1();
  3629. if ((!i || !i.isStart) && !style[_transformProp]) {
  3630. _removeIndependentTransforms(style);
  3631. if (cache.zOrigin && style[_transformOriginProp]) {
  3632. style[_transformOriginProp] += " " + cache.zOrigin + "px";
  3633. cache.zOrigin = 0;
  3634. cache.renderTransform();
  3635. }
  3636. cache.uncache = 1;
  3637. }
  3638. }
  3639. },
  3640. _getStyleSaver = function _getStyleSaver(target, properties) {
  3641. var saver = {
  3642. target: target,
  3643. props: [],
  3644. revert: _revertStyle,
  3645. save: _saveStyle
  3646. };
  3647. target._gsap || gsap.core.getCache(target);
  3648. properties && target.style && target.nodeType && properties.split(",").forEach(function (p) {
  3649. return saver.save(p);
  3650. });
  3651. return saver;
  3652. },
  3653. _supports3D,
  3654. _createElement = function _createElement(type, ns) {
  3655. var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type);
  3656. return e && e.style ? e : _doc$1.createElement(type);
  3657. },
  3658. _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) {
  3659. var cs = getComputedStyle(target);
  3660. return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || "";
  3661. },
  3662. _prefixes = "O,Moz,ms,Ms,Webkit".split(","),
  3663. _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) {
  3664. var e = element || _tempDiv,
  3665. s = e.style,
  3666. i = 5;
  3667. if (property in s && !preferPrefix) {
  3668. return property;
  3669. }
  3670. property = property.charAt(0).toUpperCase() + property.substr(1);
  3671. while (i-- && !(_prefixes[i] + property in s)) {}
  3672. return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property;
  3673. },
  3674. _initCore = function _initCore() {
  3675. if (_windowExists$1() && window.document) {
  3676. _win$1 = window;
  3677. _doc$1 = _win$1.document;
  3678. _docElement = _doc$1.documentElement;
  3679. _tempDiv = _createElement("div") || {
  3680. style: {}
  3681. };
  3682. _tempDivStyler = _createElement("div");
  3683. _transformProp = _checkPropPrefix(_transformProp);
  3684. _transformOriginProp = _transformProp + "Origin";
  3685. _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0";
  3686. _supports3D = !!_checkPropPrefix("perspective");
  3687. _reverting$1 = gsap.core.reverting;
  3688. _pluginInitted = 1;
  3689. }
  3690. },
  3691. _getReparentedCloneBBox = function _getReparentedCloneBBox(target) {
  3692. var owner = target.ownerSVGElement,
  3693. svg = _createElement("svg", owner && owner.getAttribute("xmlns") || "http://www.w3.org/2000/svg"),
  3694. clone = target.cloneNode(true),
  3695. bbox;
  3696. clone.style.display = "block";
  3697. svg.appendChild(clone);
  3698. _docElement.appendChild(svg);
  3699. try {
  3700. bbox = clone.getBBox();
  3701. } catch (e) {}
  3702. svg.removeChild(clone);
  3703. _docElement.removeChild(svg);
  3704. return bbox;
  3705. },
  3706. _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) {
  3707. var i = attributesArray.length;
  3708. while (i--) {
  3709. if (target.hasAttribute(attributesArray[i])) {
  3710. return target.getAttribute(attributesArray[i]);
  3711. }
  3712. }
  3713. },
  3714. _getBBox = function _getBBox(target) {
  3715. var bounds, cloned;
  3716. try {
  3717. bounds = target.getBBox();
  3718. } catch (error) {
  3719. bounds = _getReparentedCloneBBox(target);
  3720. cloned = 1;
  3721. }
  3722. bounds && (bounds.width || bounds.height) || cloned || (bounds = _getReparentedCloneBBox(target));
  3723. return bounds && !bounds.width && !bounds.x && !bounds.y ? {
  3724. x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0,
  3725. y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0,
  3726. width: 0,
  3727. height: 0
  3728. } : bounds;
  3729. },
  3730. _isSVG = function _isSVG(e) {
  3731. return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e));
  3732. },
  3733. _removeProperty = function _removeProperty(target, property) {
  3734. if (property) {
  3735. var style = target.style,
  3736. first2Chars;
  3737. if (property in _transformProps && property !== _transformOriginProp) {
  3738. property = _transformProp;
  3739. }
  3740. if (style.removeProperty) {
  3741. first2Chars = property.substr(0, 2);
  3742. if (first2Chars === "ms" || property.substr(0, 6) === "webkit") {
  3743. property = "-" + property;
  3744. }
  3745. style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp, "-$1").toLowerCase());
  3746. } else {
  3747. style.removeAttribute(property);
  3748. }
  3749. }
  3750. },
  3751. _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) {
  3752. var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue);
  3753. plugin._pt = pt;
  3754. pt.b = beginning;
  3755. pt.e = end;
  3756. plugin._props.push(property);
  3757. return pt;
  3758. },
  3759. _nonConvertibleUnits = {
  3760. deg: 1,
  3761. rad: 1,
  3762. turn: 1
  3763. },
  3764. _nonStandardLayouts = {
  3765. grid: 1,
  3766. flex: 1
  3767. },
  3768. _convertToUnit = function _convertToUnit(target, property, value, unit) {
  3769. var curValue = parseFloat(value) || 0,
  3770. curUnit = (value + "").trim().substr((curValue + "").length) || "px",
  3771. style = _tempDiv.style,
  3772. horizontal = _horizontalExp.test(property),
  3773. isRootSVG = target.tagName.toLowerCase() === "svg",
  3774. measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"),
  3775. amount = 100,
  3776. toPixels = unit === "px",
  3777. toPercent = unit === "%",
  3778. px,
  3779. parent,
  3780. cache,
  3781. isSVG;
  3782. if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) {
  3783. return curValue;
  3784. }
  3785. curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px"));
  3786. isSVG = target.getCTM && _isSVG(target);
  3787. if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) {
  3788. px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty];
  3789. return _round(toPercent ? curValue / px * amount : curValue / 100 * px);
  3790. }
  3791. style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit);
  3792. parent = unit !== "rem" && ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode;
  3793. if (isSVG) {
  3794. parent = (target.ownerSVGElement || {}).parentNode;
  3795. }
  3796. if (!parent || parent === _doc$1 || !parent.appendChild) {
  3797. parent = _doc$1.body;
  3798. }
  3799. cache = parent._gsap;
  3800. if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time && !cache.uncache) {
  3801. return _round(curValue / cache.width * amount);
  3802. } else {
  3803. if (toPercent && (property === "height" || property === "width")) {
  3804. var v = target.style[property];
  3805. target.style[property] = amount + unit;
  3806. px = target[measureProperty];
  3807. v ? target.style[property] = v : _removeProperty(target, property);
  3808. } else {
  3809. (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position"));
  3810. parent === target && (style.position = "static");
  3811. parent.appendChild(_tempDiv);
  3812. px = _tempDiv[measureProperty];
  3813. parent.removeChild(_tempDiv);
  3814. style.position = "absolute";
  3815. }
  3816. if (horizontal && toPercent) {
  3817. cache = _getCache(parent);
  3818. cache.time = _ticker.time;
  3819. cache.width = parent[measureProperty];
  3820. }
  3821. }
  3822. return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0);
  3823. },
  3824. _get = function _get(target, property, unit, uncache) {
  3825. var value;
  3826. _pluginInitted || _initCore();
  3827. if (property in _propertyAliases && property !== "transform") {
  3828. property = _propertyAliases[property];
  3829. if (~property.indexOf(",")) {
  3830. property = property.split(",")[0];
  3831. }
  3832. }
  3833. if (_transformProps[property] && property !== "transform") {
  3834. value = _parseTransform(target, uncache);
  3835. value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px";
  3836. } else {
  3837. value = target.style[property];
  3838. if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) {
  3839. value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0);
  3840. }
  3841. }
  3842. return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value;
  3843. },
  3844. _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) {
  3845. if (!start || start === "none") {
  3846. var p = _checkPropPrefix(prop, target, 1),
  3847. s = p && _getComputedProperty(target, p, 1);
  3848. if (s && s !== start) {
  3849. prop = p;
  3850. start = s;
  3851. } else if (prop === "borderColor") {
  3852. start = _getComputedProperty(target, "borderTopColor");
  3853. }
  3854. }
  3855. var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString),
  3856. index = 0,
  3857. matchIndex = 0,
  3858. a,
  3859. result,
  3860. startValues,
  3861. startNum,
  3862. color,
  3863. startValue,
  3864. endValue,
  3865. endNum,
  3866. chunk,
  3867. endUnit,
  3868. startUnit,
  3869. endValues;
  3870. pt.b = start;
  3871. pt.e = end;
  3872. start += "";
  3873. end += "";
  3874. if (end.substring(0, 6) === "var(--") {
  3875. end = _getComputedProperty(target, end.substring(4, end.indexOf(")")));
  3876. }
  3877. if (end === "auto") {
  3878. startValue = target.style[prop];
  3879. target.style[prop] = end;
  3880. end = _getComputedProperty(target, prop) || end;
  3881. startValue ? target.style[prop] = startValue : _removeProperty(target, prop);
  3882. }
  3883. a = [start, end];
  3884. _colorStringFilter(a);
  3885. start = a[0];
  3886. end = a[1];
  3887. startValues = start.match(_numWithUnitExp) || [];
  3888. endValues = end.match(_numWithUnitExp) || [];
  3889. if (endValues.length) {
  3890. while (result = _numWithUnitExp.exec(end)) {
  3891. endValue = result[0];
  3892. chunk = end.substring(index, result.index);
  3893. if (color) {
  3894. color = (color + 1) % 5;
  3895. } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") {
  3896. color = 1;
  3897. }
  3898. if (endValue !== (startValue = startValues[matchIndex++] || "")) {
  3899. startNum = parseFloat(startValue) || 0;
  3900. startUnit = startValue.substr((startNum + "").length);
  3901. endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit);
  3902. endNum = parseFloat(endValue);
  3903. endUnit = endValue.substr((endNum + "").length);
  3904. index = _numWithUnitExp.lastIndex - endUnit.length;
  3905. if (!endUnit) {
  3906. endUnit = endUnit || _config.units[prop] || startUnit;
  3907. if (index === end.length) {
  3908. end += endUnit;
  3909. pt.e += endUnit;
  3910. }
  3911. }
  3912. if (startUnit !== endUnit) {
  3913. startNum = _convertToUnit(target, prop, startValue, endUnit) || 0;
  3914. }
  3915. pt._pt = {
  3916. _next: pt._pt,
  3917. p: chunk || matchIndex === 1 ? chunk : ",",
  3918. s: startNum,
  3919. c: endNum - startNum,
  3920. m: color && color < 4 || prop === "zIndex" ? Math.round : 0
  3921. };
  3922. }
  3923. }
  3924. pt.c = index < end.length ? end.substring(index, end.length) : "";
  3925. } else {
  3926. pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue;
  3927. }
  3928. _relExp.test(end) && (pt.e = 0);
  3929. this._pt = pt;
  3930. return pt;
  3931. },
  3932. _keywordToPercent = {
  3933. top: "0%",
  3934. bottom: "100%",
  3935. left: "0%",
  3936. right: "100%",
  3937. center: "50%"
  3938. },
  3939. _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) {
  3940. var split = value.split(" "),
  3941. x = split[0],
  3942. y = split[1] || "50%";
  3943. if (x === "top" || x === "bottom" || y === "left" || y === "right") {
  3944. value = x;
  3945. x = y;
  3946. y = value;
  3947. }
  3948. split[0] = _keywordToPercent[x] || x;
  3949. split[1] = _keywordToPercent[y] || y;
  3950. return split.join(" ");
  3951. },
  3952. _renderClearProps = function _renderClearProps(ratio, data) {
  3953. if (data.tween && data.tween._time === data.tween._dur) {
  3954. var target = data.t,
  3955. style = target.style,
  3956. props = data.u,
  3957. cache = target._gsap,
  3958. prop,
  3959. clearTransforms,
  3960. i;
  3961. if (props === "all" || props === true) {
  3962. style.cssText = "";
  3963. clearTransforms = 1;
  3964. } else {
  3965. props = props.split(",");
  3966. i = props.length;
  3967. while (--i > -1) {
  3968. prop = props[i];
  3969. if (_transformProps[prop]) {
  3970. clearTransforms = 1;
  3971. prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp;
  3972. }
  3973. _removeProperty(target, prop);
  3974. }
  3975. }
  3976. if (clearTransforms) {
  3977. _removeProperty(target, _transformProp);
  3978. if (cache) {
  3979. cache.svg && target.removeAttribute("transform");
  3980. style.scale = style.rotate = style.translate = "none";
  3981. _parseTransform(target, 1);
  3982. cache.uncache = 1;
  3983. _removeIndependentTransforms(style);
  3984. }
  3985. }
  3986. }
  3987. },
  3988. _specialProps = {
  3989. clearProps: function clearProps(plugin, target, property, endValue, tween) {
  3990. if (tween.data !== "isFromStart") {
  3991. var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps);
  3992. pt.u = endValue;
  3993. pt.pr = -10;
  3994. pt.tween = tween;
  3995. plugin._props.push(property);
  3996. return 1;
  3997. }
  3998. }
  3999. },
  4000. _identity2DMatrix = [1, 0, 0, 1, 0, 0],
  4001. _rotationalProperties = {},
  4002. _isNullTransform = function _isNullTransform(value) {
  4003. return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value;
  4004. },
  4005. _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) {
  4006. var matrixString = _getComputedProperty(target, _transformProp);
  4007. return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round);
  4008. },
  4009. _getMatrix = function _getMatrix(target, force2D) {
  4010. var cache = target._gsap || _getCache(target),
  4011. style = target.style,
  4012. matrix = _getComputedTransformMatrixAsArray(target),
  4013. parent,
  4014. nextSibling,
  4015. temp,
  4016. addedToDOM;
  4017. if (cache.svg && target.getAttribute("transform")) {
  4018. temp = target.transform.baseVal.consolidate().matrix;
  4019. matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f];
  4020. return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix;
  4021. } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) {
  4022. temp = style.display;
  4023. style.display = "block";
  4024. parent = target.parentNode;
  4025. if (!parent || !target.offsetParent && !target.getBoundingClientRect().width) {
  4026. addedToDOM = 1;
  4027. nextSibling = target.nextElementSibling;
  4028. _docElement.appendChild(target);
  4029. }
  4030. matrix = _getComputedTransformMatrixAsArray(target);
  4031. temp ? style.display = temp : _removeProperty(target, "display");
  4032. if (addedToDOM) {
  4033. nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target);
  4034. }
  4035. }
  4036. return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix;
  4037. },
  4038. _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) {
  4039. var cache = target._gsap,
  4040. matrix = matrixArray || _getMatrix(target, true),
  4041. xOriginOld = cache.xOrigin || 0,
  4042. yOriginOld = cache.yOrigin || 0,
  4043. xOffsetOld = cache.xOffset || 0,
  4044. yOffsetOld = cache.yOffset || 0,
  4045. a = matrix[0],
  4046. b = matrix[1],
  4047. c = matrix[2],
  4048. d = matrix[3],
  4049. tx = matrix[4],
  4050. ty = matrix[5],
  4051. originSplit = origin.split(" "),
  4052. xOrigin = parseFloat(originSplit[0]) || 0,
  4053. yOrigin = parseFloat(originSplit[1]) || 0,
  4054. bounds,
  4055. determinant,
  4056. x,
  4057. y;
  4058. if (!originIsAbsolute) {
  4059. bounds = _getBBox(target);
  4060. xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin);
  4061. yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin);
  4062. } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) {
  4063. x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant;
  4064. y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant;
  4065. xOrigin = x;
  4066. yOrigin = y;
  4067. }
  4068. if (smooth || smooth !== false && cache.smooth) {
  4069. tx = xOrigin - xOriginOld;
  4070. ty = yOrigin - yOriginOld;
  4071. cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx;
  4072. cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty;
  4073. } else {
  4074. cache.xOffset = cache.yOffset = 0;
  4075. }
  4076. cache.xOrigin = xOrigin;
  4077. cache.yOrigin = yOrigin;
  4078. cache.smooth = !!smooth;
  4079. cache.origin = origin;
  4080. cache.originIsAbsolute = !!originIsAbsolute;
  4081. target.style[_transformOriginProp] = "0px 0px";
  4082. if (pluginToAddPropTweensTo) {
  4083. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin);
  4084. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin);
  4085. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset);
  4086. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset);
  4087. }
  4088. target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin);
  4089. },
  4090. _parseTransform = function _parseTransform(target, uncache) {
  4091. var cache = target._gsap || new GSCache(target);
  4092. if ("x" in cache && !uncache && !cache.uncache) {
  4093. return cache;
  4094. }
  4095. var style = target.style,
  4096. invertedScaleX = cache.scaleX < 0,
  4097. px = "px",
  4098. deg = "deg",
  4099. cs = getComputedStyle(target),
  4100. origin = _getComputedProperty(target, _transformOriginProp) || "0",
  4101. x,
  4102. y,
  4103. z,
  4104. scaleX,
  4105. scaleY,
  4106. rotation,
  4107. rotationX,
  4108. rotationY,
  4109. skewX,
  4110. skewY,
  4111. perspective,
  4112. xOrigin,
  4113. yOrigin,
  4114. matrix,
  4115. angle,
  4116. cos,
  4117. sin,
  4118. a,
  4119. b,
  4120. c,
  4121. d,
  4122. a12,
  4123. a22,
  4124. t1,
  4125. t2,
  4126. t3,
  4127. a13,
  4128. a23,
  4129. a33,
  4130. a42,
  4131. a43,
  4132. a32;
  4133. x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0;
  4134. scaleX = scaleY = 1;
  4135. cache.svg = !!(target.getCTM && _isSVG(target));
  4136. if (cs.translate) {
  4137. if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") {
  4138. style[_transformProp] = (cs.translate !== "none" ? "translate3d(" + (cs.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (cs.rotate !== "none" ? "rotate(" + cs.rotate + ") " : "") + (cs.scale !== "none" ? "scale(" + cs.scale.split(" ").join(",") + ") " : "") + (cs[_transformProp] !== "none" ? cs[_transformProp] : "");
  4139. }
  4140. style.scale = style.rotate = style.translate = "none";
  4141. }
  4142. matrix = _getMatrix(target, cache.svg);
  4143. if (cache.svg) {
  4144. if (cache.uncache) {
  4145. t2 = target.getBBox();
  4146. origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px";
  4147. t1 = "";
  4148. } else {
  4149. t1 = !uncache && target.getAttribute("data-svg-origin");
  4150. }
  4151. _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix);
  4152. }
  4153. xOrigin = cache.xOrigin || 0;
  4154. yOrigin = cache.yOrigin || 0;
  4155. if (matrix !== _identity2DMatrix) {
  4156. a = matrix[0];
  4157. b = matrix[1];
  4158. c = matrix[2];
  4159. d = matrix[3];
  4160. x = a12 = matrix[4];
  4161. y = a22 = matrix[5];
  4162. if (matrix.length === 6) {
  4163. scaleX = Math.sqrt(a * a + b * b);
  4164. scaleY = Math.sqrt(d * d + c * c);
  4165. rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0;
  4166. skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0;
  4167. skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD)));
  4168. if (cache.svg) {
  4169. x -= xOrigin - (xOrigin * a + yOrigin * c);
  4170. y -= yOrigin - (xOrigin * b + yOrigin * d);
  4171. }
  4172. } else {
  4173. a32 = matrix[6];
  4174. a42 = matrix[7];
  4175. a13 = matrix[8];
  4176. a23 = matrix[9];
  4177. a33 = matrix[10];
  4178. a43 = matrix[11];
  4179. x = matrix[12];
  4180. y = matrix[13];
  4181. z = matrix[14];
  4182. angle = _atan2(a32, a33);
  4183. rotationX = angle * _RAD2DEG;
  4184. if (angle) {
  4185. cos = Math.cos(-angle);
  4186. sin = Math.sin(-angle);
  4187. t1 = a12 * cos + a13 * sin;
  4188. t2 = a22 * cos + a23 * sin;
  4189. t3 = a32 * cos + a33 * sin;
  4190. a13 = a12 * -sin + a13 * cos;
  4191. a23 = a22 * -sin + a23 * cos;
  4192. a33 = a32 * -sin + a33 * cos;
  4193. a43 = a42 * -sin + a43 * cos;
  4194. a12 = t1;
  4195. a22 = t2;
  4196. a32 = t3;
  4197. }
  4198. angle = _atan2(-c, a33);
  4199. rotationY = angle * _RAD2DEG;
  4200. if (angle) {
  4201. cos = Math.cos(-angle);
  4202. sin = Math.sin(-angle);
  4203. t1 = a * cos - a13 * sin;
  4204. t2 = b * cos - a23 * sin;
  4205. t3 = c * cos - a33 * sin;
  4206. a43 = d * sin + a43 * cos;
  4207. a = t1;
  4208. b = t2;
  4209. c = t3;
  4210. }
  4211. angle = _atan2(b, a);
  4212. rotation = angle * _RAD2DEG;
  4213. if (angle) {
  4214. cos = Math.cos(angle);
  4215. sin = Math.sin(angle);
  4216. t1 = a * cos + b * sin;
  4217. t2 = a12 * cos + a22 * sin;
  4218. b = b * cos - a * sin;
  4219. a22 = a22 * cos - a12 * sin;
  4220. a = t1;
  4221. a12 = t2;
  4222. }
  4223. if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) {
  4224. rotationX = rotation = 0;
  4225. rotationY = 180 - rotationY;
  4226. }
  4227. scaleX = _round(Math.sqrt(a * a + b * b + c * c));
  4228. scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32));
  4229. angle = _atan2(a12, a22);
  4230. skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0;
  4231. perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0;
  4232. }
  4233. if (cache.svg) {
  4234. t1 = target.getAttribute("transform");
  4235. cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp));
  4236. t1 && target.setAttribute("transform", t1);
  4237. }
  4238. }
  4239. if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
  4240. if (invertedScaleX) {
  4241. scaleX *= -1;
  4242. skewX += rotation <= 0 ? 180 : -180;
  4243. rotation += rotation <= 0 ? 180 : -180;
  4244. } else {
  4245. scaleY *= -1;
  4246. skewX += skewX <= 0 ? 180 : -180;
  4247. }
  4248. }
  4249. uncache = uncache || cache.uncache;
  4250. cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px;
  4251. cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px;
  4252. cache.z = z + px;
  4253. cache.scaleX = _round(scaleX);
  4254. cache.scaleY = _round(scaleY);
  4255. cache.rotation = _round(rotation) + deg;
  4256. cache.rotationX = _round(rotationX) + deg;
  4257. cache.rotationY = _round(rotationY) + deg;
  4258. cache.skewX = skewX + deg;
  4259. cache.skewY = skewY + deg;
  4260. cache.transformPerspective = perspective + px;
  4261. if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache.zOrigin || 0) {
  4262. style[_transformOriginProp] = _firstTwoOnly(origin);
  4263. }
  4264. cache.xOffset = cache.yOffset = 0;
  4265. cache.force3D = _config.force3D;
  4266. cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms;
  4267. cache.uncache = 0;
  4268. return cache;
  4269. },
  4270. _firstTwoOnly = function _firstTwoOnly(value) {
  4271. return (value = value.split(" "))[0] + " " + value[1];
  4272. },
  4273. _addPxTranslate = function _addPxTranslate(target, start, value) {
  4274. var unit = getUnit(start);
  4275. return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit;
  4276. },
  4277. _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) {
  4278. cache.z = "0px";
  4279. cache.rotationY = cache.rotationX = "0deg";
  4280. cache.force3D = 0;
  4281. _renderCSSTransforms(ratio, cache);
  4282. },
  4283. _zeroDeg = "0deg",
  4284. _zeroPx = "0px",
  4285. _endParenthesis = ") ",
  4286. _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) {
  4287. var _ref = cache || this,
  4288. xPercent = _ref.xPercent,
  4289. yPercent = _ref.yPercent,
  4290. x = _ref.x,
  4291. y = _ref.y,
  4292. z = _ref.z,
  4293. rotation = _ref.rotation,
  4294. rotationY = _ref.rotationY,
  4295. rotationX = _ref.rotationX,
  4296. skewX = _ref.skewX,
  4297. skewY = _ref.skewY,
  4298. scaleX = _ref.scaleX,
  4299. scaleY = _ref.scaleY,
  4300. transformPerspective = _ref.transformPerspective,
  4301. force3D = _ref.force3D,
  4302. target = _ref.target,
  4303. zOrigin = _ref.zOrigin,
  4304. transforms = "",
  4305. use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true;
  4306. if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) {
  4307. var angle = parseFloat(rotationY) * _DEG2RAD,
  4308. a13 = Math.sin(angle),
  4309. a33 = Math.cos(angle),
  4310. cos;
  4311. angle = parseFloat(rotationX) * _DEG2RAD;
  4312. cos = Math.cos(angle);
  4313. x = _addPxTranslate(target, x, a13 * cos * -zOrigin);
  4314. y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin);
  4315. z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin);
  4316. }
  4317. if (transformPerspective !== _zeroPx) {
  4318. transforms += "perspective(" + transformPerspective + _endParenthesis;
  4319. }
  4320. if (xPercent || yPercent) {
  4321. transforms += "translate(" + xPercent + "%, " + yPercent + "%) ";
  4322. }
  4323. if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) {
  4324. transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis;
  4325. }
  4326. if (rotation !== _zeroDeg) {
  4327. transforms += "rotate(" + rotation + _endParenthesis;
  4328. }
  4329. if (rotationY !== _zeroDeg) {
  4330. transforms += "rotateY(" + rotationY + _endParenthesis;
  4331. }
  4332. if (rotationX !== _zeroDeg) {
  4333. transforms += "rotateX(" + rotationX + _endParenthesis;
  4334. }
  4335. if (skewX !== _zeroDeg || skewY !== _zeroDeg) {
  4336. transforms += "skew(" + skewX + ", " + skewY + _endParenthesis;
  4337. }
  4338. if (scaleX !== 1 || scaleY !== 1) {
  4339. transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis;
  4340. }
  4341. target.style[_transformProp] = transforms || "translate(0, 0)";
  4342. },
  4343. _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) {
  4344. var _ref2 = cache || this,
  4345. xPercent = _ref2.xPercent,
  4346. yPercent = _ref2.yPercent,
  4347. x = _ref2.x,
  4348. y = _ref2.y,
  4349. rotation = _ref2.rotation,
  4350. skewX = _ref2.skewX,
  4351. skewY = _ref2.skewY,
  4352. scaleX = _ref2.scaleX,
  4353. scaleY = _ref2.scaleY,
  4354. target = _ref2.target,
  4355. xOrigin = _ref2.xOrigin,
  4356. yOrigin = _ref2.yOrigin,
  4357. xOffset = _ref2.xOffset,
  4358. yOffset = _ref2.yOffset,
  4359. forceCSS = _ref2.forceCSS,
  4360. tx = parseFloat(x),
  4361. ty = parseFloat(y),
  4362. a11,
  4363. a21,
  4364. a12,
  4365. a22,
  4366. temp;
  4367. rotation = parseFloat(rotation);
  4368. skewX = parseFloat(skewX);
  4369. skewY = parseFloat(skewY);
  4370. if (skewY) {
  4371. skewY = parseFloat(skewY);
  4372. skewX += skewY;
  4373. rotation += skewY;
  4374. }
  4375. if (rotation || skewX) {
  4376. rotation *= _DEG2RAD;
  4377. skewX *= _DEG2RAD;
  4378. a11 = Math.cos(rotation) * scaleX;
  4379. a21 = Math.sin(rotation) * scaleX;
  4380. a12 = Math.sin(rotation - skewX) * -scaleY;
  4381. a22 = Math.cos(rotation - skewX) * scaleY;
  4382. if (skewX) {
  4383. skewY *= _DEG2RAD;
  4384. temp = Math.tan(skewX - skewY);
  4385. temp = Math.sqrt(1 + temp * temp);
  4386. a12 *= temp;
  4387. a22 *= temp;
  4388. if (skewY) {
  4389. temp = Math.tan(skewY);
  4390. temp = Math.sqrt(1 + temp * temp);
  4391. a11 *= temp;
  4392. a21 *= temp;
  4393. }
  4394. }
  4395. a11 = _round(a11);
  4396. a21 = _round(a21);
  4397. a12 = _round(a12);
  4398. a22 = _round(a22);
  4399. } else {
  4400. a11 = scaleX;
  4401. a22 = scaleY;
  4402. a21 = a12 = 0;
  4403. }
  4404. if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) {
  4405. tx = _convertToUnit(target, "x", x, "px");
  4406. ty = _convertToUnit(target, "y", y, "px");
  4407. }
  4408. if (xOrigin || yOrigin || xOffset || yOffset) {
  4409. tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset);
  4410. ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset);
  4411. }
  4412. if (xPercent || yPercent) {
  4413. temp = target.getBBox();
  4414. tx = _round(tx + xPercent / 100 * temp.width);
  4415. ty = _round(ty + yPercent / 100 * temp.height);
  4416. }
  4417. temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")";
  4418. target.setAttribute("transform", temp);
  4419. forceCSS && (target.style[_transformProp] = temp);
  4420. },
  4421. _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) {
  4422. var cap = 360,
  4423. isString = _isString(endValue),
  4424. endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1),
  4425. change = endNum - startNum,
  4426. finalValue = startNum + change + "deg",
  4427. direction,
  4428. pt;
  4429. if (isString) {
  4430. direction = endValue.split("_")[1];
  4431. if (direction === "short") {
  4432. change %= cap;
  4433. if (change !== change % (cap / 2)) {
  4434. change += change < 0 ? cap : -cap;
  4435. }
  4436. }
  4437. if (direction === "cw" && change < 0) {
  4438. change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap;
  4439. } else if (direction === "ccw" && change > 0) {
  4440. change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap;
  4441. }
  4442. }
  4443. plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd);
  4444. pt.e = finalValue;
  4445. pt.u = "deg";
  4446. plugin._props.push(property);
  4447. return pt;
  4448. },
  4449. _assign = function _assign(target, source) {
  4450. for (var p in source) {
  4451. target[p] = source[p];
  4452. }
  4453. return target;
  4454. },
  4455. _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) {
  4456. var startCache = _assign({}, target._gsap),
  4457. exclude = "perspective,force3D,transformOrigin,svgOrigin",
  4458. style = target.style,
  4459. endCache,
  4460. p,
  4461. startValue,
  4462. endValue,
  4463. startNum,
  4464. endNum,
  4465. startUnit,
  4466. endUnit;
  4467. if (startCache.svg) {
  4468. startValue = target.getAttribute("transform");
  4469. target.setAttribute("transform", "");
  4470. style[_transformProp] = transforms;
  4471. endCache = _parseTransform(target, 1);
  4472. _removeProperty(target, _transformProp);
  4473. target.setAttribute("transform", startValue);
  4474. } else {
  4475. startValue = getComputedStyle(target)[_transformProp];
  4476. style[_transformProp] = transforms;
  4477. endCache = _parseTransform(target, 1);
  4478. style[_transformProp] = startValue;
  4479. }
  4480. for (p in _transformProps) {
  4481. startValue = startCache[p];
  4482. endValue = endCache[p];
  4483. if (startValue !== endValue && exclude.indexOf(p) < 0) {
  4484. startUnit = getUnit(startValue);
  4485. endUnit = getUnit(endValue);
  4486. startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue);
  4487. endNum = parseFloat(endValue);
  4488. plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp);
  4489. plugin._pt.u = endUnit || 0;
  4490. plugin._props.push(p);
  4491. }
  4492. }
  4493. _assign(endCache, startCache);
  4494. };
  4495. _forEachName("padding,margin,Width,Radius", function (name, index) {
  4496. var t = "Top",
  4497. r = "Right",
  4498. b = "Bottom",
  4499. l = "Left",
  4500. props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) {
  4501. return index < 2 ? name + side : "border" + side + name;
  4502. });
  4503. _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) {
  4504. var a, vars;
  4505. if (arguments.length < 4) {
  4506. a = props.map(function (prop) {
  4507. return _get(plugin, prop, property);
  4508. });
  4509. vars = a.join(" ");
  4510. return vars.split(a[0]).length === 5 ? a[0] : vars;
  4511. }
  4512. a = (endValue + "").split(" ");
  4513. vars = {};
  4514. props.forEach(function (prop, i) {
  4515. return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0];
  4516. });
  4517. plugin.init(target, vars, tween);
  4518. };
  4519. });
  4520. var CSSPlugin = {
  4521. name: "css",
  4522. register: _initCore,
  4523. targetTest: function targetTest(target) {
  4524. return target.style && target.nodeType;
  4525. },
  4526. init: function init(target, vars, tween, index, targets) {
  4527. var props = this._props,
  4528. style = target.style,
  4529. startAt = tween.vars.startAt,
  4530. startValue,
  4531. endValue,
  4532. endNum,
  4533. startNum,
  4534. type,
  4535. specialProp,
  4536. p,
  4537. startUnit,
  4538. endUnit,
  4539. relative,
  4540. isTransformRelated,
  4541. transformPropTween,
  4542. cache,
  4543. smooth,
  4544. hasPriority,
  4545. inlineProps;
  4546. _pluginInitted || _initCore();
  4547. this.styles = this.styles || _getStyleSaver(target);
  4548. inlineProps = this.styles.props;
  4549. this.tween = tween;
  4550. for (p in vars) {
  4551. if (p === "autoRound") {
  4552. continue;
  4553. }
  4554. endValue = vars[p];
  4555. if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) {
  4556. continue;
  4557. }
  4558. type = typeof endValue;
  4559. specialProp = _specialProps[p];
  4560. if (type === "function") {
  4561. endValue = endValue.call(tween, index, target, targets);
  4562. type = typeof endValue;
  4563. }
  4564. if (type === "string" && ~endValue.indexOf("random(")) {
  4565. endValue = _replaceRandom(endValue);
  4566. }
  4567. if (specialProp) {
  4568. specialProp(this, target, p, endValue, tween) && (hasPriority = 1);
  4569. } else if (p.substr(0, 2) === "--") {
  4570. startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim();
  4571. endValue += "";
  4572. _colorExp.lastIndex = 0;
  4573. if (!_colorExp.test(startValue)) {
  4574. startUnit = getUnit(startValue);
  4575. endUnit = getUnit(endValue);
  4576. }
  4577. endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit);
  4578. this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p);
  4579. props.push(p);
  4580. inlineProps.push(p, 0, style[p]);
  4581. } else if (type !== "undefined") {
  4582. if (startAt && p in startAt) {
  4583. startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p];
  4584. _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue));
  4585. getUnit(startValue + "") || startValue === "auto" || (startValue += _config.units[p] || getUnit(_get(target, p)) || "");
  4586. (startValue + "").charAt(1) === "=" && (startValue = _get(target, p));
  4587. } else {
  4588. startValue = _get(target, p);
  4589. }
  4590. startNum = parseFloat(startValue);
  4591. relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2);
  4592. relative && (endValue = endValue.substr(2));
  4593. endNum = parseFloat(endValue);
  4594. if (p in _propertyAliases) {
  4595. if (p === "autoAlpha") {
  4596. if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) {
  4597. startNum = 0;
  4598. }
  4599. inlineProps.push("visibility", 0, style.visibility);
  4600. _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum);
  4601. }
  4602. if (p !== "scale" && p !== "transform") {
  4603. p = _propertyAliases[p];
  4604. ~p.indexOf(",") && (p = p.split(",")[0]);
  4605. }
  4606. }
  4607. isTransformRelated = p in _transformProps;
  4608. if (isTransformRelated) {
  4609. this.styles.save(p);
  4610. if (type === "string" && endValue.substring(0, 6) === "var(--") {
  4611. endValue = _getComputedProperty(target, endValue.substring(4, endValue.indexOf(")")));
  4612. endNum = parseFloat(endValue);
  4613. }
  4614. if (!transformPropTween) {
  4615. cache = target._gsap;
  4616. cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform);
  4617. smooth = vars.smoothOrigin !== false && cache.smooth;
  4618. transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1);
  4619. transformPropTween.dep = 1;
  4620. }
  4621. if (p === "scale") {
  4622. this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp);
  4623. this._pt.u = 0;
  4624. props.push("scaleY", p);
  4625. p += "X";
  4626. } else if (p === "transformOrigin") {
  4627. inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]);
  4628. endValue = _convertKeywordsToPercentages(endValue);
  4629. if (cache.svg) {
  4630. _applySVGOrigin(target, endValue, 0, smooth, 0, this);
  4631. } else {
  4632. endUnit = parseFloat(endValue.split(" ")[2]) || 0;
  4633. endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit);
  4634. _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue));
  4635. }
  4636. continue;
  4637. } else if (p === "svgOrigin") {
  4638. _applySVGOrigin(target, endValue, 1, smooth, 0, this);
  4639. continue;
  4640. } else if (p in _rotationalProperties) {
  4641. _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue);
  4642. continue;
  4643. } else if (p === "smoothOrigin") {
  4644. _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue);
  4645. continue;
  4646. } else if (p === "force3D") {
  4647. cache[p] = endValue;
  4648. continue;
  4649. } else if (p === "transform") {
  4650. _addRawTransformPTs(this, endValue, target);
  4651. continue;
  4652. }
  4653. } else if (!(p in style)) {
  4654. p = _checkPropPrefix(p) || p;
  4655. }
  4656. if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) {
  4657. startUnit = (startValue + "").substr((startNum + "").length);
  4658. endNum || (endNum = 0);
  4659. endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit);
  4660. startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit));
  4661. this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? _parseRelative(startNum, relative + endNum) : endNum) - startNum, !isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp);
  4662. this._pt.u = endUnit || 0;
  4663. if (startUnit !== endUnit && endUnit !== "%") {
  4664. this._pt.b = startValue;
  4665. this._pt.r = _renderCSSPropWithBeginning;
  4666. }
  4667. } else if (!(p in style)) {
  4668. if (p in target) {
  4669. this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets);
  4670. } else if (p !== "parseTransform") {
  4671. _missingPlugin(p, endValue);
  4672. continue;
  4673. }
  4674. } else {
  4675. _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue);
  4676. }
  4677. isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : typeof target[p] === "function" ? inlineProps.push(p, 2, target[p]()) : inlineProps.push(p, 1, startValue || target[p]));
  4678. props.push(p);
  4679. }
  4680. }
  4681. hasPriority && _sortPropTweensByPriority(this);
  4682. },
  4683. render: function render(ratio, data) {
  4684. if (data.tween._time || !_reverting$1()) {
  4685. var pt = data._pt;
  4686. while (pt) {
  4687. pt.r(ratio, pt.d);
  4688. pt = pt._next;
  4689. }
  4690. } else {
  4691. data.styles.revert();
  4692. }
  4693. },
  4694. get: _get,
  4695. aliases: _propertyAliases,
  4696. getSetter: function getSetter(target, property, plugin) {
  4697. var p = _propertyAliases[property];
  4698. p && p.indexOf(",") < 0 && (property = p);
  4699. return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property);
  4700. },
  4701. core: {
  4702. _removeProperty: _removeProperty,
  4703. _getMatrix: _getMatrix
  4704. }
  4705. };
  4706. gsap.utils.checkPrefix = _checkPropPrefix;
  4707. gsap.core.getStyleSaver = _getStyleSaver;
  4708. (function (positionAndScale, rotation, others, aliases) {
  4709. var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) {
  4710. _transformProps[name] = 1;
  4711. });
  4712. _forEachName(rotation, function (name) {
  4713. _config.units[name] = "deg";
  4714. _rotationalProperties[name] = 1;
  4715. });
  4716. _propertyAliases[all[13]] = positionAndScale + "," + rotation;
  4717. _forEachName(aliases, function (name) {
  4718. var split = name.split(":");
  4719. _propertyAliases[split[1]] = all[split[0]];
  4720. });
  4721. })("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");
  4722. _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) {
  4723. _config.units[name] = "px";
  4724. });
  4725. gsap.registerPlugin(CSSPlugin);
  4726. var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap,
  4727. TweenMaxWithCSS = gsapWithCSS.core.Tween;
  4728. exports.Back = Back;
  4729. exports.Bounce = Bounce;
  4730. exports.CSSPlugin = CSSPlugin;
  4731. exports.Circ = Circ;
  4732. exports.Cubic = Cubic;
  4733. exports.Elastic = Elastic;
  4734. exports.Expo = Expo;
  4735. exports.Linear = Linear;
  4736. exports.Power0 = Power0;
  4737. exports.Power1 = Power1;
  4738. exports.Power2 = Power2;
  4739. exports.Power3 = Power3;
  4740. exports.Power4 = Power4;
  4741. exports.Quad = Quad;
  4742. exports.Quart = Quart;
  4743. exports.Quint = Quint;
  4744. exports.Sine = Sine;
  4745. exports.SteppedEase = SteppedEase;
  4746. exports.Strong = Strong;
  4747. exports.TimelineLite = Timeline;
  4748. exports.TimelineMax = Timeline;
  4749. exports.TweenLite = Tween;
  4750. exports.TweenMax = TweenMaxWithCSS;
  4751. exports.default = gsapWithCSS;
  4752. exports.gsap = gsapWithCSS;
  4753. if (typeof(window) === 'undefined' || window !== exports) {Object.defineProperty(exports, '__esModule', { value: true });} else {delete window.default;}
  4754. })));