gsap.js 179 KB

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