| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614 |
- /*!
- GSAP
- Version: 3.12.4
- Plugin URL: https://gsap.com
- 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
- !*/
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = global || self, factory(global.window = global.window || {}));
- }(this, (function (exports) { 'use strict';
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
- }
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- var _config = {
- autoSleep: 120,
- force3D: "auto",
- nullTargetWarn: 1,
- units: {
- lineHeight: ""
- }
- },
- _defaults = {
- duration: .5,
- overwrite: false,
- delay: 0
- },
- _suppressOverwrites,
- _reverting,
- _context,
- _bigNum = 1e8,
- _tinyNum = 1 / _bigNum,
- _2PI = Math.PI * 2,
- _HALF_PI = _2PI / 4,
- _gsID = 0,
- _sqrt = Math.sqrt,
- _cos = Math.cos,
- _sin = Math.sin,
- _isString = function _isString(value) {
- return typeof value === "string";
- },
- _isFunction = function _isFunction(value) {
- return typeof value === "function";
- },
- _isNumber = function _isNumber(value) {
- return typeof value === "number";
- },
- _isUndefined = function _isUndefined(value) {
- return typeof value === "undefined";
- },
- _isObject = function _isObject(value) {
- return typeof value === "object";
- },
- _isNotFalse = function _isNotFalse(value) {
- return value !== false;
- },
- _windowExists = function _windowExists() {
- return typeof window !== "undefined";
- },
- _isFuncOrString = function _isFuncOrString(value) {
- return _isFunction(value) || _isString(value);
- },
- _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {},
- _isArray = Array.isArray,
- _strictNumExp = /(?:-?\.?\d|\.)+/gi,
- _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,
- _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g,
- _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,
- _relExp = /[+-]=-?[.\d]+/,
- _delimitedValueExp = /[^,'"\[\]\s]+/gi,
- _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,
- _globalTimeline,
- _win,
- _coreInitted,
- _doc,
- _globals = {},
- _installScope = {},
- _coreReady,
- _install = function _install(scope) {
- return (_installScope = _merge(scope, _globals)) && gsap;
- },
- _missingPlugin = function _missingPlugin(property, value) {
- return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
- },
- _warn = function _warn(message, suppress) {
- return !suppress && console.warn(message);
- },
- _addGlobal = function _addGlobal(name, obj) {
- return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals;
- },
- _emptyFunc = function _emptyFunc() {
- return 0;
- },
- _startAtRevertConfig = {
- suppressEvents: true,
- isStart: true,
- kill: false
- },
- _revertConfigNoKill = {
- suppressEvents: true,
- kill: false
- },
- _revertConfig = {
- suppressEvents: true
- },
- _reservedProps = {},
- _lazyTweens = [],
- _lazyLookup = {},
- _lastRenderedFrame,
- _plugins = {},
- _effects = {},
- _nextGCFrame = 30,
- _harnessPlugins = [],
- _callbackNames = "",
- _harness = function _harness(targets) {
- var target = targets[0],
- harnessPlugin,
- i;
- _isObject(target) || _isFunction(target) || (targets = [targets]);
- if (!(harnessPlugin = (target._gsap || {}).harness)) {
- i = _harnessPlugins.length;
- while (i-- && !_harnessPlugins[i].targetTest(target)) {}
- harnessPlugin = _harnessPlugins[i];
- }
- i = targets.length;
- while (i--) {
- targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1);
- }
- return targets;
- },
- _getCache = function _getCache(target) {
- return target._gsap || _harness(toArray(target))[0]._gsap;
- },
- _getProperty = function _getProperty(target, property, v) {
- return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v;
- },
- _forEachName = function _forEachName(names, func) {
- return (names = names.split(",")).forEach(func) || names;
- },
- _round = function _round(value) {
- return Math.round(value * 100000) / 100000 || 0;
- },
- _roundPrecise = function _roundPrecise(value) {
- return Math.round(value * 10000000) / 10000000 || 0;
- },
- _parseRelative = function _parseRelative(start, value) {
- var operator = value.charAt(0),
- end = parseFloat(value.substr(2));
- start = parseFloat(start);
- return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end;
- },
- _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) {
- var l = toFind.length,
- i = 0;
- for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {}
- return i < l;
- },
- _lazyRender = function _lazyRender() {
- var l = _lazyTweens.length,
- a = _lazyTweens.slice(0),
- i,
- tween;
- _lazyLookup = {};
- _lazyTweens.length = 0;
- for (i = 0; i < l; i++) {
- tween = a[i];
- tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0);
- }
- },
- _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) {
- _lazyTweens.length && !_reverting && _lazyRender();
- animation.render(time, suppressEvents, force || _reverting && time < 0 && (animation._initted || animation._startAt));
- _lazyTweens.length && !_reverting && _lazyRender();
- },
- _numericIfPossible = function _numericIfPossible(value) {
- var n = parseFloat(value);
- return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value;
- },
- _passThrough = function _passThrough(p) {
- return p;
- },
- _setDefaults = function _setDefaults(obj, defaults) {
- for (var p in defaults) {
- p in obj || (obj[p] = defaults[p]);
- }
- return obj;
- },
- _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) {
- return function (obj, defaults) {
- for (var p in defaults) {
- p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]);
- }
- };
- },
- _merge = function _merge(base, toMerge) {
- for (var p in toMerge) {
- base[p] = toMerge[p];
- }
- return base;
- },
- _mergeDeep = function _mergeDeep(base, toMerge) {
- for (var p in toMerge) {
- p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]);
- }
- return base;
- },
- _copyExcluding = function _copyExcluding(obj, excluding) {
- var copy = {},
- p;
- for (p in obj) {
- p in excluding || (copy[p] = obj[p]);
- }
- return copy;
- },
- _inheritDefaults = function _inheritDefaults(vars) {
- var parent = vars.parent || _globalTimeline,
- func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults;
- if (_isNotFalse(vars.inherit)) {
- while (parent) {
- func(vars, parent.vars.defaults);
- parent = parent.parent || parent._dp;
- }
- }
- return vars;
- },
- _arraysMatch = function _arraysMatch(a1, a2) {
- var i = a1.length,
- match = i === a2.length;
- while (match && i-- && a1[i] === a2[i]) {}
- return i < 0;
- },
- _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) {
- if (firstProp === void 0) {
- firstProp = "_first";
- }
- if (lastProp === void 0) {
- lastProp = "_last";
- }
- var prev = parent[lastProp],
- t;
- if (sortBy) {
- t = child[sortBy];
- while (prev && prev[sortBy] > t) {
- prev = prev._prev;
- }
- }
- if (prev) {
- child._next = prev._next;
- prev._next = child;
- } else {
- child._next = parent[firstProp];
- parent[firstProp] = child;
- }
- if (child._next) {
- child._next._prev = child;
- } else {
- parent[lastProp] = child;
- }
- child._prev = prev;
- child.parent = child._dp = parent;
- return child;
- },
- _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) {
- if (firstProp === void 0) {
- firstProp = "_first";
- }
- if (lastProp === void 0) {
- lastProp = "_last";
- }
- var prev = child._prev,
- next = child._next;
- if (prev) {
- prev._next = next;
- } else if (parent[firstProp] === child) {
- parent[firstProp] = next;
- }
- if (next) {
- next._prev = prev;
- } else if (parent[lastProp] === child) {
- parent[lastProp] = prev;
- }
- child._next = child._prev = child.parent = null;
- },
- _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) {
- child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child);
- child._act = 0;
- },
- _uncache = function _uncache(animation, child) {
- if (animation && (!child || child._end > animation._dur || child._start < 0)) {
- var a = animation;
- while (a) {
- a._dirty = 1;
- a = a.parent;
- }
- }
- return animation;
- },
- _recacheAncestors = function _recacheAncestors(animation) {
- var parent = animation.parent;
- while (parent && parent.parent) {
- parent._dirty = 1;
- parent.totalDuration();
- parent = parent.parent;
- }
- return animation;
- },
- _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) {
- return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force));
- },
- _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) {
- return !animation || animation._ts && _hasNoPausedAncestors(animation.parent);
- },
- _elapsedCycleDuration = function _elapsedCycleDuration(animation) {
- return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0;
- },
- _animationCycle = function _animationCycle(tTime, cycleDuration) {
- var whole = Math.floor(tTime /= cycleDuration);
- return tTime && whole === tTime ? whole - 1 : whole;
- },
- _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) {
- return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur);
- },
- _setEnd = function _setEnd(animation) {
- return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0));
- },
- _alignPlayhead = function _alignPlayhead(animation, totalTime) {
- var parent = animation._dp;
- if (parent && parent.smoothChildTiming && animation._ts) {
- animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts));
- _setEnd(animation);
- parent._dirty || _uncache(parent, animation);
- }
- return animation;
- },
- _postAddChecks = function _postAddChecks(timeline, child) {
- var t;
- if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) {
- t = _parentToChildTotalTime(timeline.rawTime(), child);
- if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) {
- child.render(t, true);
- }
- }
- if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) {
- if (timeline._dur < timeline.duration()) {
- t = timeline;
- while (t._dp) {
- t.rawTime() >= 0 && t.totalTime(t._tTime);
- t = t._dp;
- }
- }
- timeline._zTime = -_tinyNum;
- }
- },
- _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) {
- child.parent && _removeFromParent(child);
- child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay);
- child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0));
- _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0);
- _isFromOrFromStart(child) || (timeline._recent = child);
- skipChecks || _postAddChecks(timeline, child);
- timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime);
- return timeline;
- },
- _scrollTrigger = function _scrollTrigger(animation, trigger) {
- return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation);
- },
- _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) {
- _initTween(tween, time, tTime);
- if (!tween._initted) {
- return 1;
- }
- if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) {
- _lazyTweens.push(tween);
- tween._lazy = [tTime, suppressEvents];
- return 1;
- }
- },
- _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) {
- var parent = _ref.parent;
- return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent));
- },
- _isFromOrFromStart = function _isFromOrFromStart(_ref2) {
- var data = _ref2.data;
- return data === "isFromStart" || data === "isStart";
- },
- _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) {
- var prevRatio = tween.ratio,
- ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1,
- repeatDelay = tween._rDelay,
- tTime = 0,
- pt,
- iteration,
- prevIteration;
- if (repeatDelay && tween._repeat) {
- tTime = _clamp(0, tween._tDur, totalTime);
- iteration = _animationCycle(tTime, repeatDelay);
- tween._yoyo && iteration & 1 && (ratio = 1 - ratio);
- if (iteration !== _animationCycle(tween._tTime, repeatDelay)) {
- prevRatio = 1 - ratio;
- tween.vars.repeatRefresh && tween._initted && tween.invalidate();
- }
- }
- if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) {
- if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) {
- return;
- }
- prevIteration = tween._zTime;
- tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0);
- suppressEvents || (suppressEvents = totalTime && !prevIteration);
- tween.ratio = ratio;
- tween._from && (ratio = 1 - ratio);
- tween._time = 0;
- tween._tTime = tTime;
- pt = tween._pt;
- while (pt) {
- pt.r(ratio, pt.d);
- pt = pt._next;
- }
- totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true);
- tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate");
- tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat");
- if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) {
- ratio && _removeFromParent(tween, 1);
- if (!suppressEvents && !_reverting) {
- _callback(tween, ratio ? "onComplete" : "onReverseComplete", true);
- tween._prom && tween._prom();
- }
- }
- } else if (!tween._zTime) {
- tween._zTime = totalTime;
- }
- },
- _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) {
- var child;
- if (time > prevTime) {
- child = animation._first;
- while (child && child._start <= time) {
- if (child.data === "isPause" && child._start > prevTime) {
- return child;
- }
- child = child._next;
- }
- } else {
- child = animation._last;
- while (child && child._start >= time) {
- if (child.data === "isPause" && child._start < prevTime) {
- return child;
- }
- child = child._prev;
- }
- }
- },
- _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) {
- var repeat = animation._repeat,
- dur = _roundPrecise(duration) || 0,
- totalProgress = animation._tTime / animation._tDur;
- totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur);
- animation._dur = dur;
- animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat);
- totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress);
- animation.parent && _setEnd(animation);
- skipUncache || _uncache(animation.parent, animation);
- return animation;
- },
- _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) {
- return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur);
- },
- _zeroPosition = {
- _start: 0,
- endTime: _emptyFunc,
- totalDuration: _emptyFunc
- },
- _parsePosition = function _parsePosition(animation, position, percentAnimation) {
- var labels = animation.labels,
- recent = animation._recent || _zeroPosition,
- clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur,
- i,
- offset,
- isPercent;
- if (_isString(position) && (isNaN(position) || position in labels)) {
- offset = position.charAt(0);
- isPercent = position.substr(-1) === "%";
- i = position.indexOf("=");
- if (offset === "<" || offset === ">") {
- i >= 0 && (position = position.replace(/=/, ""));
- return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1);
- }
- if (i < 0) {
- position in labels || (labels[position] = clippedDuration);
- return labels[position];
- }
- offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1));
- if (isPercent && percentAnimation) {
- offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration();
- }
- return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset;
- }
- return position == null ? clippedDuration : +position;
- },
- _createTweenType = function _createTweenType(type, params, timeline) {
- var isLegacy = _isNumber(params[1]),
- varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1),
- vars = params[varsIndex],
- irVars,
- parent;
- isLegacy && (vars.duration = params[1]);
- vars.parent = timeline;
- if (type) {
- irVars = vars;
- parent = timeline;
- while (parent && !("immediateRender" in irVars)) {
- irVars = parent.vars.defaults || {};
- parent = _isNotFalse(parent.vars.inherit) && parent.parent;
- }
- vars.immediateRender = _isNotFalse(irVars.immediateRender);
- type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1];
- }
- return new Tween(params[0], vars, params[varsIndex + 1]);
- },
- _conditionalReturn = function _conditionalReturn(value, func) {
- return value || value === 0 ? func(value) : func;
- },
- _clamp = function _clamp(min, max, value) {
- return value < min ? min : value > max ? max : value;
- },
- getUnit = function getUnit(value, v) {
- return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1];
- },
- clamp = function clamp(min, max, value) {
- return _conditionalReturn(value, function (v) {
- return _clamp(min, max, v);
- });
- },
- _slice = [].slice,
- _isArrayLike = function _isArrayLike(value, nonEmpty) {
- return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win;
- },
- _flatten = function _flatten(ar, leaveStrings, accumulator) {
- if (accumulator === void 0) {
- accumulator = [];
- }
- return ar.forEach(function (value) {
- var _accumulator;
- return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value);
- }) || accumulator;
- },
- toArray = function toArray(value, scope, leaveStrings) {
- 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] : [];
- },
- selector = function selector(value) {
- value = toArray(value)[0] || _warn("Invalid scope") || {};
- return function (v) {
- var el = value.current || value.nativeElement || value;
- return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value);
- };
- },
- shuffle = function shuffle(a) {
- return a.sort(function () {
- return .5 - Math.random();
- });
- },
- distribute = function distribute(v) {
- if (_isFunction(v)) {
- return v;
- }
- var vars = _isObject(v) ? v : {
- each: v
- },
- ease = _parseEase(vars.ease),
- from = vars.from || 0,
- base = parseFloat(vars.base) || 0,
- cache = {},
- isDecimal = from > 0 && from < 1,
- ratios = isNaN(from) || isDecimal,
- axis = vars.axis,
- ratioX = from,
- ratioY = from;
- if (_isString(from)) {
- ratioX = ratioY = {
- center: .5,
- edges: .5,
- end: 1
- }[from] || 0;
- } else if (!isDecimal && ratios) {
- ratioX = from[0];
- ratioY = from[1];
- }
- return function (i, target, a) {
- var l = (a || vars).length,
- distances = cache[l],
- originX,
- originY,
- x,
- y,
- d,
- j,
- max,
- min,
- wrapAt;
- if (!distances) {
- wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1];
- if (!wrapAt) {
- max = -_bigNum;
- while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {}
- wrapAt < l && wrapAt--;
- }
- distances = cache[l] = [];
- originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt;
- originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0;
- max = 0;
- min = _bigNum;
- for (j = 0; j < l; j++) {
- x = j % wrapAt - originX;
- y = originY - (j / wrapAt | 0);
- distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x);
- d > max && (max = d);
- d < min && (min = d);
- }
- from === "random" && shuffle(distances);
- distances.max = max - min;
- distances.min = min;
- 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);
- distances.b = l < 0 ? base - l : base;
- distances.u = getUnit(vars.amount || vars.each) || 0;
- ease = ease && l < 0 ? _invertEase(ease) : ease;
- }
- l = (distances[i] - distances.min) / distances.max || 0;
- return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u;
- };
- },
- _roundModifier = function _roundModifier(v) {
- var p = Math.pow(10, ((v + "").split(".")[1] || "").length);
- return function (raw) {
- var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p);
- return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw));
- };
- },
- snap = function snap(snapTo, value) {
- var isArray = _isArray(snapTo),
- radius,
- is2D;
- if (!isArray && _isObject(snapTo)) {
- radius = isArray = snapTo.radius || _bigNum;
- if (snapTo.values) {
- snapTo = toArray(snapTo.values);
- if (is2D = !_isNumber(snapTo[0])) {
- radius *= radius;
- }
- } else {
- snapTo = _roundModifier(snapTo.increment);
- }
- }
- return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) {
- is2D = snapTo(raw);
- return Math.abs(is2D - raw) <= radius ? is2D : raw;
- } : function (raw) {
- var x = parseFloat(is2D ? raw.x : raw),
- y = parseFloat(is2D ? raw.y : 0),
- min = _bigNum,
- closest = 0,
- i = snapTo.length,
- dx,
- dy;
- while (i--) {
- if (is2D) {
- dx = snapTo[i].x - x;
- dy = snapTo[i].y - y;
- dx = dx * dx + dy * dy;
- } else {
- dx = Math.abs(snapTo[i] - x);
- }
- if (dx < min) {
- min = dx;
- closest = i;
- }
- }
- closest = !radius || min <= radius ? snapTo[closest] : raw;
- return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
- });
- },
- random = function random(min, max, roundingIncrement, returnFunction) {
- return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () {
- 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;
- });
- },
- pipe = function pipe() {
- for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
- functions[_key] = arguments[_key];
- }
- return function (value) {
- return functions.reduce(function (v, f) {
- return f(v);
- }, value);
- };
- },
- unitize = function unitize(func, unit) {
- return function (value) {
- return func(parseFloat(value)) + (unit || getUnit(value));
- };
- },
- normalize = function normalize(min, max, value) {
- return mapRange(min, max, 0, 1, value);
- },
- _wrapArray = function _wrapArray(a, wrapper, value) {
- return _conditionalReturn(value, function (index) {
- return a[~~wrapper(index)];
- });
- },
- wrap = function wrap(min, max, value) {
- var range = max - min;
- return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) {
- return (range + (value - min) % range) % range + min;
- });
- },
- wrapYoyo = function wrapYoyo(min, max, value) {
- var range = max - min,
- total = range * 2;
- return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) {
- value = (total + (value - min) % total) % total || 0;
- return min + (value > range ? total - value : value);
- });
- },
- _replaceRandom = function _replaceRandom(value) {
- var prev = 0,
- s = "",
- i,
- nums,
- end,
- isArray;
- while (~(i = value.indexOf("random(", prev))) {
- end = value.indexOf(")", i);
- isArray = value.charAt(i + 7) === "[";
- nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp);
- s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5);
- prev = end + 1;
- }
- return s + value.substr(prev, value.length - prev);
- },
- mapRange = function mapRange(inMin, inMax, outMin, outMax, value) {
- var inRange = inMax - inMin,
- outRange = outMax - outMin;
- return _conditionalReturn(value, function (value) {
- return outMin + ((value - inMin) / inRange * outRange || 0);
- });
- },
- interpolate = function interpolate(start, end, progress, mutate) {
- var func = isNaN(start + end) ? 0 : function (p) {
- return (1 - p) * start + p * end;
- };
- if (!func) {
- var isString = _isString(start),
- master = {},
- p,
- i,
- interpolators,
- l,
- il;
- progress === true && (mutate = 1) && (progress = null);
- if (isString) {
- start = {
- p: start
- };
- end = {
- p: end
- };
- } else if (_isArray(start) && !_isArray(end)) {
- interpolators = [];
- l = start.length;
- il = l - 2;
- for (i = 1; i < l; i++) {
- interpolators.push(interpolate(start[i - 1], start[i]));
- }
- l--;
- func = function func(p) {
- p *= l;
- var i = Math.min(il, ~~p);
- return interpolators[i](p - i);
- };
- progress = end;
- } else if (!mutate) {
- start = _merge(_isArray(start) ? [] : {}, start);
- }
- if (!interpolators) {
- for (p in end) {
- _addPropTween.call(master, start, p, "get", end[p]);
- }
- func = function func(p) {
- return _renderPropTweens(p, master) || (isString ? start.p : start);
- };
- }
- }
- return _conditionalReturn(progress, func);
- },
- _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) {
- var labels = timeline.labels,
- min = _bigNum,
- p,
- distance,
- label;
- for (p in labels) {
- distance = labels[p] - fromTime;
- if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) {
- label = p;
- min = distance;
- }
- }
- return label;
- },
- _callback = function _callback(animation, type, executeLazyFirst) {
- var v = animation.vars,
- callback = v[type],
- prevContext = _context,
- context = animation._ctx,
- params,
- scope,
- result;
- if (!callback) {
- return;
- }
- params = v[type + "Params"];
- scope = v.callbackScope || animation;
- executeLazyFirst && _lazyTweens.length && _lazyRender();
- context && (_context = context);
- result = params ? callback.apply(scope, params) : callback.call(scope);
- _context = prevContext;
- return result;
- },
- _interrupt = function _interrupt(animation) {
- _removeFromParent(animation);
- animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting);
- animation.progress() < 1 && _callback(animation, "onInterrupt");
- return animation;
- },
- _quickTween,
- _registerPluginQueue = [],
- _createPlugin = function _createPlugin(config) {
- if (_windowExists() && config) {
- config = !config.name && config["default"] || config;
- var name = config.name,
- isFunc = _isFunction(config),
- Plugin = name && !isFunc && config.init ? function () {
- this._props = [];
- } : config,
- instanceDefaults = {
- init: _emptyFunc,
- render: _renderPropTweens,
- add: _addPropTween,
- kill: _killPropTweensOf,
- modifier: _addPluginModifier,
- rawVars: 0
- },
- statics = {
- targetTest: 0,
- get: 0,
- getSetter: _getSetter,
- aliases: {},
- register: 0
- };
- _wake();
- if (config !== Plugin) {
- if (_plugins[name]) {
- return;
- }
- _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics));
- _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics)));
- _plugins[Plugin.prop = name] = Plugin;
- if (config.targetTest) {
- _harnessPlugins.push(Plugin);
- _reservedProps[name] = 1;
- }
- name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
- }
- _addGlobal(name, Plugin);
- config.register && config.register(gsap, Plugin, PropTween);
- } else {
- config && _registerPluginQueue.push(config);
- }
- },
- _255 = 255,
- _colorLookup = {
- aqua: [0, _255, _255],
- lime: [0, _255, 0],
- silver: [192, 192, 192],
- black: [0, 0, 0],
- maroon: [128, 0, 0],
- teal: [0, 128, 128],
- blue: [0, 0, _255],
- navy: [0, 0, 128],
- white: [_255, _255, _255],
- olive: [128, 128, 0],
- yellow: [_255, _255, 0],
- orange: [_255, 165, 0],
- gray: [128, 128, 128],
- purple: [128, 0, 128],
- green: [0, 128, 0],
- red: [_255, 0, 0],
- pink: [_255, 192, 203],
- cyan: [0, _255, _255],
- transparent: [_255, _255, _255, 0]
- },
- _hue = function _hue(h, m1, m2) {
- h += h < 0 ? 1 : h > 1 ? -1 : 0;
- 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;
- },
- splitColor = function splitColor(v, toHSL, forceAlpha) {
- var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0,
- r,
- g,
- b,
- h,
- s,
- l,
- max,
- min,
- d,
- wasHSL;
- if (!a) {
- if (v.substr(-1) === ",") {
- v = v.substr(0, v.length - 1);
- }
- if (_colorLookup[v]) {
- a = _colorLookup[v];
- } else if (v.charAt(0) === "#") {
- if (v.length < 6) {
- r = v.charAt(1);
- g = v.charAt(2);
- b = v.charAt(3);
- v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : "");
- }
- if (v.length === 9) {
- a = parseInt(v.substr(1, 6), 16);
- return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255];
- }
- v = parseInt(v.substr(1), 16);
- a = [v >> 16, v >> 8 & _255, v & _255];
- } else if (v.substr(0, 3) === "hsl") {
- a = wasHSL = v.match(_strictNumExp);
- if (!toHSL) {
- h = +a[0] % 360 / 360;
- s = +a[1] / 100;
- l = +a[2] / 100;
- g = l <= .5 ? l * (s + 1) : l + s - l * s;
- r = l * 2 - g;
- a.length > 3 && (a[3] *= 1);
- a[0] = _hue(h + 1 / 3, r, g);
- a[1] = _hue(h, r, g);
- a[2] = _hue(h - 1 / 3, r, g);
- } else if (~v.indexOf("=")) {
- a = v.match(_numExp);
- forceAlpha && a.length < 4 && (a[3] = 1);
- return a;
- }
- } else {
- a = v.match(_strictNumExp) || _colorLookup.transparent;
- }
- a = a.map(Number);
- }
- if (toHSL && !wasHSL) {
- r = a[0] / _255;
- g = a[1] / _255;
- b = a[2] / _255;
- max = Math.max(r, g, b);
- min = Math.min(r, g, b);
- l = (max + min) / 2;
- if (max === min) {
- h = s = 0;
- } else {
- d = max - min;
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
- h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
- h *= 60;
- }
- a[0] = ~~(h + .5);
- a[1] = ~~(s * 100 + .5);
- a[2] = ~~(l * 100 + .5);
- }
- forceAlpha && a.length < 4 && (a[3] = 1);
- return a;
- },
- _colorOrderData = function _colorOrderData(v) {
- var values = [],
- c = [],
- i = -1;
- v.split(_colorExp).forEach(function (v) {
- var a = v.match(_numWithUnitExp) || [];
- values.push.apply(values, a);
- c.push(i += a.length + 1);
- });
- values.c = c;
- return values;
- },
- _formatColors = function _formatColors(s, toHSL, orderMatchData) {
- var result = "",
- colors = (s + result).match(_colorExp),
- type = toHSL ? "hsla(" : "rgba(",
- i = 0,
- c,
- shell,
- d,
- l;
- if (!colors) {
- return s;
- }
- colors = colors.map(function (color) {
- return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")";
- });
- if (orderMatchData) {
- d = _colorOrderData(s);
- c = orderMatchData.c;
- if (c.join(result) !== d.c.join(result)) {
- shell = s.replace(_colorExp, "1").split(_numWithUnitExp);
- l = shell.length - 1;
- for (; i < l; i++) {
- result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift());
- }
- }
- }
- if (!shell) {
- shell = s.split(_colorExp);
- l = shell.length - 1;
- for (; i < l; i++) {
- result += shell[i] + colors[i];
- }
- }
- return result + shell[l];
- },
- _colorExp = function () {
- var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",
- p;
- for (p in _colorLookup) {
- s += "|" + p + "\\b";
- }
- return new RegExp(s + ")", "gi");
- }(),
- _hslExp = /hsl[a]?\(/,
- _colorStringFilter = function _colorStringFilter(a) {
- var combined = a.join(" "),
- toHSL;
- _colorExp.lastIndex = 0;
- if (_colorExp.test(combined)) {
- toHSL = _hslExp.test(combined);
- a[1] = _formatColors(a[1], toHSL);
- a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1]));
- return true;
- }
- },
- _tickerActive,
- _ticker = function () {
- var _getTime = Date.now,
- _lagThreshold = 500,
- _adjustedLag = 33,
- _startTime = _getTime(),
- _lastUpdate = _startTime,
- _gap = 1000 / 240,
- _nextTime = _gap,
- _listeners = [],
- _id,
- _req,
- _raf,
- _self,
- _delta,
- _i,
- _tick = function _tick(v) {
- var elapsed = _getTime() - _lastUpdate,
- manual = v === true,
- overlap,
- dispatch,
- time,
- frame;
- elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag);
- _lastUpdate += elapsed;
- time = _lastUpdate - _startTime;
- overlap = time - _nextTime;
- if (overlap > 0 || manual) {
- frame = ++_self.frame;
- _delta = time - _self.time * 1000;
- _self.time = time = time / 1000;
- _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap);
- dispatch = 1;
- }
- manual || (_id = _req(_tick));
- if (dispatch) {
- for (_i = 0; _i < _listeners.length; _i++) {
- _listeners[_i](time, _delta, frame, v);
- }
- }
- };
- _self = {
- time: 0,
- frame: 0,
- tick: function tick() {
- _tick(true);
- },
- deltaRatio: function deltaRatio(fps) {
- return _delta / (1000 / (fps || 60));
- },
- wake: function wake() {
- if (_coreReady) {
- if (!_coreInitted && _windowExists()) {
- _win = _coreInitted = window;
- _doc = _win.document || {};
- _globals.gsap = gsap;
- (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version);
- _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {});
- _raf = _win.requestAnimationFrame;
- _registerPluginQueue.forEach(_createPlugin);
- }
- _id && _self.sleep();
- _req = _raf || function (f) {
- return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0);
- };
- _tickerActive = 1;
- _tick(2);
- }
- },
- sleep: function sleep() {
- (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id);
- _tickerActive = 0;
- _req = _emptyFunc;
- },
- lagSmoothing: function lagSmoothing(threshold, adjustedLag) {
- _lagThreshold = threshold || Infinity;
- _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold);
- },
- fps: function fps(_fps) {
- _gap = 1000 / (_fps || 240);
- _nextTime = _self.time * 1000 + _gap;
- },
- add: function add(callback, once, prioritize) {
- var func = once ? function (t, d, f, v) {
- callback(t, d, f, v);
- _self.remove(func);
- } : callback;
- _self.remove(callback);
- _listeners[prioritize ? "unshift" : "push"](func);
- _wake();
- return func;
- },
- remove: function remove(callback, i) {
- ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--;
- },
- _listeners: _listeners
- };
- return _self;
- }(),
- _wake = function _wake() {
- return !_tickerActive && _ticker.wake();
- },
- _easeMap = {},
- _customEaseExp = /^[\d.\-M][\d.\-,\s]/,
- _quotesExp = /["']/g,
- _parseObjectInString = function _parseObjectInString(value) {
- var obj = {},
- split = value.substr(1, value.length - 3).split(":"),
- key = split[0],
- i = 1,
- l = split.length,
- index,
- val,
- parsedVal;
- for (; i < l; i++) {
- val = split[i];
- index = i !== l - 1 ? val.lastIndexOf(",") : val.length;
- parsedVal = val.substr(0, index);
- obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal;
- key = val.substr(index + 1).trim();
- }
- return obj;
- },
- _valueInParentheses = function _valueInParentheses(value) {
- var open = value.indexOf("(") + 1,
- close = value.indexOf(")"),
- nested = value.indexOf("(", open);
- return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close);
- },
- _configEaseFromString = function _configEaseFromString(name) {
- var split = (name + "").split("("),
- ease = _easeMap[split[0]];
- 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;
- },
- _invertEase = function _invertEase(ease) {
- return function (p) {
- return 1 - ease(1 - p);
- };
- },
- _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) {
- var child = timeline._first,
- ease;
- while (child) {
- if (child instanceof Timeline) {
- _propagateYoyoEase(child, isYoyo);
- } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) {
- if (child.timeline) {
- _propagateYoyoEase(child.timeline, isYoyo);
- } else {
- ease = child._ease;
- child._ease = child._yEase;
- child._yEase = ease;
- child._yoyo = isYoyo;
- }
- }
- child = child._next;
- }
- },
- _parseEase = function _parseEase(ease, defaultEase) {
- return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase;
- },
- _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) {
- if (easeOut === void 0) {
- easeOut = function easeOut(p) {
- return 1 - easeIn(1 - p);
- };
- }
- if (easeInOut === void 0) {
- easeInOut = function easeInOut(p) {
- return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2;
- };
- }
- var ease = {
- easeIn: easeIn,
- easeOut: easeOut,
- easeInOut: easeInOut
- },
- lowercaseName;
- _forEachName(names, function (name) {
- _easeMap[name] = _globals[name] = ease;
- _easeMap[lowercaseName = name.toLowerCase()] = easeOut;
- for (var p in ease) {
- _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p];
- }
- });
- return ease;
- },
- _easeInOutFromOut = function _easeInOutFromOut(easeOut) {
- return function (p) {
- return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2;
- };
- },
- _configElastic = function _configElastic(type, amplitude, period) {
- var p1 = amplitude >= 1 ? amplitude : 1,
- p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1),
- p3 = p2 / _2PI * (Math.asin(1 / p1) || 0),
- easeOut = function easeOut(p) {
- return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
- },
- ease = type === "out" ? easeOut : type === "in" ? function (p) {
- return 1 - easeOut(1 - p);
- } : _easeInOutFromOut(easeOut);
- p2 = _2PI / p2;
- ease.config = function (amplitude, period) {
- return _configElastic(type, amplitude, period);
- };
- return ease;
- },
- _configBack = function _configBack(type, overshoot) {
- if (overshoot === void 0) {
- overshoot = 1.70158;
- }
- var easeOut = function easeOut(p) {
- return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0;
- },
- ease = type === "out" ? easeOut : type === "in" ? function (p) {
- return 1 - easeOut(1 - p);
- } : _easeInOutFromOut(easeOut);
- ease.config = function (overshoot) {
- return _configBack(type, overshoot);
- };
- return ease;
- };
- _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) {
- var power = i < 5 ? i + 1 : i;
- _insertEase(name + ",Power" + (power - 1), i ? function (p) {
- return Math.pow(p, power);
- } : function (p) {
- return p;
- }, function (p) {
- return 1 - Math.pow(1 - p, power);
- }, function (p) {
- return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2;
- });
- });
- _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
- _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
- (function (n, c) {
- var n1 = 1 / c,
- n2 = 2 * n1,
- n3 = 2.5 * n1,
- easeOut = function easeOut(p) {
- 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;
- };
- _insertEase("Bounce", function (p) {
- return 1 - easeOut(1 - p);
- }, easeOut);
- })(7.5625, 2.75);
- _insertEase("Expo", function (p) {
- return p ? Math.pow(2, 10 * (p - 1)) : 0;
- });
- _insertEase("Circ", function (p) {
- return -(_sqrt(1 - p * p) - 1);
- });
- _insertEase("Sine", function (p) {
- return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1;
- });
- _insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
- _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = {
- config: function config(steps, immediateStart) {
- if (steps === void 0) {
- steps = 1;
- }
- var p1 = 1 / steps,
- p2 = steps + (immediateStart ? 0 : 1),
- p3 = immediateStart ? 1 : 0,
- max = 1 - _tinyNum;
- return function (p) {
- return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
- };
- }
- };
- _defaults.ease = _easeMap["quad.out"];
- _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) {
- return _callbackNames += name + "," + name + "Params,";
- });
- var GSCache = function GSCache(target, harness) {
- this.id = _gsID++;
- target._gsap = this;
- this.target = target;
- this.harness = harness;
- this.get = harness ? harness.get : _getProperty;
- this.set = harness ? harness.getSetter : _getSetter;
- };
- var Animation = function () {
- function Animation(vars) {
- this.vars = vars;
- this._delay = +vars.delay || 0;
- if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) {
- this._rDelay = vars.repeatDelay || 0;
- this._yoyo = !!vars.yoyo || !!vars.yoyoEase;
- }
- this._ts = 1;
- _setDuration(this, +vars.duration, 1, 1);
- this.data = vars.data;
- if (_context) {
- this._ctx = _context;
- _context.data.push(this);
- }
- _tickerActive || _ticker.wake();
- }
- var _proto = Animation.prototype;
- _proto.delay = function delay(value) {
- if (value || value === 0) {
- this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
- this._delay = value;
- return this;
- }
- return this._delay;
- };
- _proto.duration = function duration(value) {
- return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur;
- };
- _proto.totalDuration = function totalDuration(value) {
- if (!arguments.length) {
- return this._tDur;
- }
- this._dirty = 0;
- return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1));
- };
- _proto.totalTime = function totalTime(_totalTime, suppressEvents) {
- _wake();
- if (!arguments.length) {
- return this._tTime;
- }
- var parent = this._dp;
- if (parent && parent.smoothChildTiming && this._ts) {
- _alignPlayhead(this, _totalTime);
- !parent._dp || parent.parent || _postAddChecks(parent, this);
- while (parent && parent.parent) {
- if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) {
- parent.totalTime(parent._tTime, true);
- }
- parent = parent.parent;
- }
- if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) {
- _addToTimeline(this._dp, this, this._start - this._delay);
- }
- }
- if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) {
- this._ts || (this._pTime = _totalTime);
- _lazySafeRender(this, _totalTime, suppressEvents);
- }
- return this;
- };
- _proto.time = function time(value, suppressEvents) {
- return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time;
- };
- _proto.totalProgress = function totalProgress(value, suppressEvents) {
- return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() > 0 ? 1 : 0;
- };
- _proto.progress = function progress(value, suppressEvents) {
- 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;
- };
- _proto.iteration = function iteration(value, suppressEvents) {
- var cycleDuration = this.duration() + this._rDelay;
- return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1;
- };
- _proto.timeScale = function timeScale(value, suppressEvents) {
- if (!arguments.length) {
- return this._rts === -_tinyNum ? 0 : this._rts;
- }
- if (this._rts === value) {
- return this;
- }
- var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime;
- this._rts = +value || 0;
- this._ts = this._ps || value === -_tinyNum ? 0 : this._rts;
- this.totalTime(_clamp(-Math.abs(this._delay), this._tDur, tTime), suppressEvents !== false);
- _setEnd(this);
- return _recacheAncestors(this);
- };
- _proto.paused = function paused(value) {
- if (!arguments.length) {
- return this._ps;
- }
- if (this._ps !== value) {
- this._ps = value;
- if (value) {
- this._pTime = this._tTime || Math.max(-this._delay, this.rawTime());
- this._ts = this._act = 0;
- } else {
- _wake();
- this._ts = this._rts;
- this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum));
- }
- }
- return this;
- };
- _proto.startTime = function startTime(value) {
- if (arguments.length) {
- this._start = value;
- var parent = this.parent || this._dp;
- parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay);
- return this;
- }
- return this._start;
- };
- _proto.endTime = function endTime(includeRepeats) {
- return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1);
- };
- _proto.rawTime = function rawTime(wrapRepeats) {
- var parent = this.parent || this._dp;
- 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);
- };
- _proto.revert = function revert(config) {
- if (config === void 0) {
- config = _revertConfig;
- }
- var prevIsReverting = _reverting;
- _reverting = config;
- if (this._initted || this._startAt) {
- this.timeline && this.timeline.revert(config);
- this.totalTime(-0.01, config.suppressEvents);
- }
- this.data !== "nested" && config.kill !== false && this.kill();
- _reverting = prevIsReverting;
- return this;
- };
- _proto.globalTime = function globalTime(rawTime) {
- var animation = this,
- time = arguments.length ? rawTime : animation.rawTime();
- while (animation) {
- time = animation._start + time / (Math.abs(animation._ts) || 1);
- animation = animation._dp;
- }
- return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time;
- };
- _proto.repeat = function repeat(value) {
- if (arguments.length) {
- this._repeat = value === Infinity ? -2 : value;
- return _onUpdateTotalDuration(this);
- }
- return this._repeat === -2 ? Infinity : this._repeat;
- };
- _proto.repeatDelay = function repeatDelay(value) {
- if (arguments.length) {
- var time = this._time;
- this._rDelay = value;
- _onUpdateTotalDuration(this);
- return time ? this.time(time) : this;
- }
- return this._rDelay;
- };
- _proto.yoyo = function yoyo(value) {
- if (arguments.length) {
- this._yoyo = value;
- return this;
- }
- return this._yoyo;
- };
- _proto.seek = function seek(position, suppressEvents) {
- return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
- };
- _proto.restart = function restart(includeDelay, suppressEvents) {
- return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents));
- };
- _proto.play = function play(from, suppressEvents) {
- from != null && this.seek(from, suppressEvents);
- return this.reversed(false).paused(false);
- };
- _proto.reverse = function reverse(from, suppressEvents) {
- from != null && this.seek(from || this.totalDuration(), suppressEvents);
- return this.reversed(true).paused(false);
- };
- _proto.pause = function pause(atTime, suppressEvents) {
- atTime != null && this.seek(atTime, suppressEvents);
- return this.paused(true);
- };
- _proto.resume = function resume() {
- return this.paused(false);
- };
- _proto.reversed = function reversed(value) {
- if (arguments.length) {
- !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0));
- return this;
- }
- return this._rts < 0;
- };
- _proto.invalidate = function invalidate() {
- this._initted = this._act = 0;
- this._zTime = -_tinyNum;
- return this;
- };
- _proto.isActive = function isActive() {
- var parent = this.parent || this._dp,
- start = this._start,
- rawTime;
- return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum);
- };
- _proto.eventCallback = function eventCallback(type, callback, params) {
- var vars = this.vars;
- if (arguments.length > 1) {
- if (!callback) {
- delete vars[type];
- } else {
- vars[type] = callback;
- params && (vars[type + "Params"] = params);
- type === "onUpdate" && (this._onUpdate = callback);
- }
- return this;
- }
- return vars[type];
- };
- _proto.then = function then(onFulfilled) {
- var self = this;
- return new Promise(function (resolve) {
- var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough,
- _resolve = function _resolve() {
- var _then = self.then;
- self.then = null;
- _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then);
- resolve(f);
- self.then = _then;
- };
- if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) {
- _resolve();
- } else {
- self._prom = _resolve;
- }
- });
- };
- _proto.kill = function kill() {
- _interrupt(this);
- };
- return Animation;
- }();
- _setDefaults(Animation.prototype, {
- _time: 0,
- _start: 0,
- _end: 0,
- _tTime: 0,
- _tDur: 0,
- _dirty: 0,
- _repeat: 0,
- _yoyo: false,
- parent: null,
- _initted: false,
- _rDelay: 0,
- _ts: 1,
- _dp: 0,
- ratio: 0,
- _zTime: -_tinyNum,
- _prom: 0,
- _ps: false,
- _rts: 1
- });
- var Timeline = function (_Animation) {
- _inheritsLoose(Timeline, _Animation);
- function Timeline(vars, position) {
- var _this;
- if (vars === void 0) {
- vars = {};
- }
- _this = _Animation.call(this, vars) || this;
- _this.labels = {};
- _this.smoothChildTiming = !!vars.smoothChildTiming;
- _this.autoRemoveChildren = !!vars.autoRemoveChildren;
- _this._sort = _isNotFalse(vars.sortChildren);
- _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position);
- vars.reversed && _this.reverse();
- vars.paused && _this.paused(true);
- vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
- return _this;
- }
- var _proto2 = Timeline.prototype;
- _proto2.to = function to(targets, vars, position) {
- _createTweenType(0, arguments, this);
- return this;
- };
- _proto2.from = function from(targets, vars, position) {
- _createTweenType(1, arguments, this);
- return this;
- };
- _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) {
- _createTweenType(2, arguments, this);
- return this;
- };
- _proto2.set = function set(targets, vars, position) {
- vars.duration = 0;
- vars.parent = this;
- _inheritDefaults(vars).repeatDelay || (vars.repeat = 0);
- vars.immediateRender = !!vars.immediateRender;
- new Tween(targets, vars, _parsePosition(this, position), 1);
- return this;
- };
- _proto2.call = function call(callback, params, position) {
- return _addToTimeline(this, Tween.delayedCall(0, callback, params), position);
- };
- _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
- vars.duration = duration;
- vars.stagger = vars.stagger || stagger;
- vars.onComplete = onCompleteAll;
- vars.onCompleteParams = onCompleteAllParams;
- vars.parent = this;
- new Tween(targets, vars, _parsePosition(this, position));
- return this;
- };
- _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
- vars.runBackwards = 1;
- _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender);
- return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
- };
- _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) {
- toVars.startAt = fromVars;
- _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender);
- return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
- };
- _proto2.render = function render(totalTime, suppressEvents, force) {
- var prevTime = this._time,
- tDur = this._dirty ? this.totalDuration() : this._tDur,
- dur = this._dur,
- tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime),
- crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur),
- time,
- child,
- next,
- iteration,
- cycleDuration,
- prevPaused,
- pauseTween,
- timeScale,
- prevStart,
- prevIteration,
- yoyo,
- isYoyo;
- this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur);
- if (tTime !== this._tTime || force || crossingStart) {
- if (prevTime !== this._time && dur) {
- tTime += this._time - prevTime;
- totalTime += this._time - prevTime;
- }
- time = tTime;
- prevStart = this._start;
- timeScale = this._ts;
- prevPaused = !timeScale;
- if (crossingStart) {
- dur || (prevTime = this._zTime);
- (totalTime || !suppressEvents) && (this._zTime = totalTime);
- }
- if (this._repeat) {
- yoyo = this._yoyo;
- cycleDuration = dur + this._rDelay;
- if (this._repeat < -1 && totalTime < 0) {
- return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
- }
- time = _roundPrecise(tTime % cycleDuration);
- if (tTime === tDur) {
- iteration = this._repeat;
- time = dur;
- } else {
- iteration = ~~(tTime / cycleDuration);
- if (iteration && iteration === tTime / cycleDuration) {
- time = dur;
- iteration--;
- }
- time > dur && (time = dur);
- }
- prevIteration = _animationCycle(this._tTime, cycleDuration);
- !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration);
- if (yoyo && iteration & 1) {
- time = dur - time;
- isYoyo = 1;
- }
- if (iteration !== prevIteration && !this._lock) {
- var rewinding = yoyo && prevIteration & 1,
- doesWrap = rewinding === (yoyo && iteration & 1);
- iteration < prevIteration && (rewinding = !rewinding);
- prevTime = rewinding ? 0 : tTime % dur ? dur : tTime;
- this._lock = 1;
- this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0;
- this._tTime = tTime;
- !suppressEvents && this.parent && _callback(this, "onRepeat");
- this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1);
- if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) {
- return this;
- }
- dur = this._dur;
- tDur = this._tDur;
- if (doesWrap) {
- this._lock = 2;
- prevTime = rewinding ? dur : -0.0001;
- this.render(prevTime, true);
- this.vars.repeatRefresh && !isYoyo && this.invalidate();
- }
- this._lock = 0;
- if (!this._ts && !prevPaused) {
- return this;
- }
- _propagateYoyoEase(this, isYoyo);
- }
- }
- if (this._hasPause && !this._forcing && this._lock < 2) {
- pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time));
- if (pauseTween) {
- tTime -= time - (time = pauseTween._start);
- }
- }
- this._tTime = tTime;
- this._time = time;
- this._act = !timeScale;
- if (!this._initted) {
- this._onUpdate = this.vars.onUpdate;
- this._initted = 1;
- this._zTime = totalTime;
- prevTime = 0;
- }
- if (!prevTime && time && !suppressEvents && !iteration) {
- _callback(this, "onStart");
- if (this._tTime !== tTime) {
- return this;
- }
- }
- if (time >= prevTime && totalTime >= 0) {
- child = this._first;
- while (child) {
- next = child._next;
- if ((child._act || time >= child._start) && child._ts && pauseTween !== child) {
- if (child.parent !== this) {
- return this.render(totalTime, suppressEvents, force);
- }
- child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
- if (time !== this._time || !this._ts && !prevPaused) {
- pauseTween = 0;
- next && (tTime += this._zTime = -_tinyNum);
- break;
- }
- }
- child = next;
- }
- } else {
- child = this._last;
- var adjustedTime = totalTime < 0 ? totalTime : time;
- while (child) {
- next = child._prev;
- if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) {
- if (child.parent !== this) {
- return this.render(totalTime, suppressEvents, force);
- }
- 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));
- if (time !== this._time || !this._ts && !prevPaused) {
- pauseTween = 0;
- next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum);
- break;
- }
- }
- child = next;
- }
- }
- if (pauseTween && !suppressEvents) {
- this.pause();
- pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
- if (this._ts) {
- this._start = prevStart;
- _setEnd(this);
- return this.render(totalTime, suppressEvents, force);
- }
- }
- this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true);
- if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) {
- (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
- if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) {
- _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true);
- this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
- }
- }
- }
- return this;
- };
- _proto2.add = function add(child, position) {
- var _this2 = this;
- _isNumber(position) || (position = _parsePosition(this, position, child));
- if (!(child instanceof Animation)) {
- if (_isArray(child)) {
- child.forEach(function (obj) {
- return _this2.add(obj, position);
- });
- return this;
- }
- if (_isString(child)) {
- return this.addLabel(child, position);
- }
- if (_isFunction(child)) {
- child = Tween.delayedCall(0, child);
- } else {
- return this;
- }
- }
- return this !== child ? _addToTimeline(this, child, position) : this;
- };
- _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) {
- if (nested === void 0) {
- nested = true;
- }
- if (tweens === void 0) {
- tweens = true;
- }
- if (timelines === void 0) {
- timelines = true;
- }
- if (ignoreBeforeTime === void 0) {
- ignoreBeforeTime = -_bigNum;
- }
- var a = [],
- child = this._first;
- while (child) {
- if (child._start >= ignoreBeforeTime) {
- if (child instanceof Tween) {
- tweens && a.push(child);
- } else {
- timelines && a.push(child);
- nested && a.push.apply(a, child.getChildren(true, tweens, timelines));
- }
- }
- child = child._next;
- }
- return a;
- };
- _proto2.getById = function getById(id) {
- var animations = this.getChildren(1, 1, 1),
- i = animations.length;
- while (i--) {
- if (animations[i].vars.id === id) {
- return animations[i];
- }
- }
- };
- _proto2.remove = function remove(child) {
- if (_isString(child)) {
- return this.removeLabel(child);
- }
- if (_isFunction(child)) {
- return this.killTweensOf(child);
- }
- _removeLinkedListItem(this, child);
- if (child === this._recent) {
- this._recent = this._last;
- }
- return _uncache(this);
- };
- _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) {
- if (!arguments.length) {
- return this._tTime;
- }
- this._forcing = 1;
- if (!this._dp && this._ts) {
- this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts));
- }
- _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
- this._forcing = 0;
- return this;
- };
- _proto2.addLabel = function addLabel(label, position) {
- this.labels[label] = _parsePosition(this, position);
- return this;
- };
- _proto2.removeLabel = function removeLabel(label) {
- delete this.labels[label];
- return this;
- };
- _proto2.addPause = function addPause(position, callback, params) {
- var t = Tween.delayedCall(0, callback || _emptyFunc, params);
- t.data = "isPause";
- this._hasPause = 1;
- return _addToTimeline(this, t, _parsePosition(this, position));
- };
- _proto2.removePause = function removePause(position) {
- var child = this._first;
- position = _parsePosition(this, position);
- while (child) {
- if (child._start === position && child.data === "isPause") {
- _removeFromParent(child);
- }
- child = child._next;
- }
- };
- _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
- var tweens = this.getTweensOf(targets, onlyActive),
- i = tweens.length;
- while (i--) {
- _overwritingTween !== tweens[i] && tweens[i].kill(targets, props);
- }
- return this;
- };
- _proto2.getTweensOf = function getTweensOf(targets, onlyActive) {
- var a = [],
- parsedTargets = toArray(targets),
- child = this._first,
- isGlobalTime = _isNumber(onlyActive),
- children;
- while (child) {
- if (child instanceof Tween) {
- if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) {
- a.push(child);
- }
- } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) {
- a.push.apply(a, children);
- }
- child = child._next;
- }
- return a;
- };
- _proto2.tweenTo = function tweenTo(position, vars) {
- vars = vars || {};
- var tl = this,
- endTime = _parsePosition(tl, position),
- _vars = vars,
- startAt = _vars.startAt,
- _onStart = _vars.onStart,
- onStartParams = _vars.onStartParams,
- immediateRender = _vars.immediateRender,
- initted,
- tween = Tween.to(tl, _setDefaults({
- ease: vars.ease || "none",
- lazy: false,
- immediateRender: false,
- time: endTime,
- overwrite: "auto",
- duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum,
- onStart: function onStart() {
- tl.pause();
- if (!initted) {
- var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale());
- tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true);
- initted = 1;
- }
- _onStart && _onStart.apply(tween, onStartParams || []);
- }
- }, vars));
- return immediateRender ? tween.render(0) : tween;
- };
- _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) {
- return this.tweenTo(toPosition, _setDefaults({
- startAt: {
- time: _parsePosition(this, fromPosition)
- }
- }, vars));
- };
- _proto2.recent = function recent() {
- return this._recent;
- };
- _proto2.nextLabel = function nextLabel(afterTime) {
- if (afterTime === void 0) {
- afterTime = this._time;
- }
- return _getLabelInDirection(this, _parsePosition(this, afterTime));
- };
- _proto2.previousLabel = function previousLabel(beforeTime) {
- if (beforeTime === void 0) {
- beforeTime = this._time;
- }
- return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
- };
- _proto2.currentLabel = function currentLabel(value) {
- return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum);
- };
- _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) {
- if (ignoreBeforeTime === void 0) {
- ignoreBeforeTime = 0;
- }
- var child = this._first,
- labels = this.labels,
- p;
- while (child) {
- if (child._start >= ignoreBeforeTime) {
- child._start += amount;
- child._end += amount;
- }
- child = child._next;
- }
- if (adjustLabels) {
- for (p in labels) {
- if (labels[p] >= ignoreBeforeTime) {
- labels[p] += amount;
- }
- }
- }
- return _uncache(this);
- };
- _proto2.invalidate = function invalidate(soft) {
- var child = this._first;
- this._lock = 0;
- while (child) {
- child.invalidate(soft);
- child = child._next;
- }
- return _Animation.prototype.invalidate.call(this, soft);
- };
- _proto2.clear = function clear(includeLabels) {
- if (includeLabels === void 0) {
- includeLabels = true;
- }
- var child = this._first,
- next;
- while (child) {
- next = child._next;
- this.remove(child);
- child = next;
- }
- this._dp && (this._time = this._tTime = this._pTime = 0);
- includeLabels && (this.labels = {});
- return _uncache(this);
- };
- _proto2.totalDuration = function totalDuration(value) {
- var max = 0,
- self = this,
- child = self._last,
- prevStart = _bigNum,
- prev,
- start,
- parent;
- if (arguments.length) {
- return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value));
- }
- if (self._dirty) {
- parent = self.parent;
- while (child) {
- prev = child._prev;
- child._dirty && child.totalDuration();
- start = child._start;
- if (start > prevStart && self._sort && child._ts && !self._lock) {
- self._lock = 1;
- _addToTimeline(self, child, start - child._delay, 1)._lock = 0;
- } else {
- prevStart = start;
- }
- if (start < 0 && child._ts) {
- max -= start;
- if (!parent && !self._dp || parent && parent.smoothChildTiming) {
- self._start += start / self._ts;
- self._time -= start;
- self._tTime -= start;
- }
- self.shiftChildren(-start, false, -1e999);
- prevStart = 0;
- }
- child._end > max && child._ts && (max = child._end);
- child = prev;
- }
- _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1);
- self._dirty = 0;
- }
- return self._tDur;
- };
- Timeline.updateRoot = function updateRoot(time) {
- if (_globalTimeline._ts) {
- _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
- _lastRenderedFrame = _ticker.frame;
- }
- if (_ticker.frame >= _nextGCFrame) {
- _nextGCFrame += _config.autoSleep || 120;
- var child = _globalTimeline._first;
- if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) {
- while (child && !child._ts) {
- child = child._next;
- }
- child || _ticker.sleep();
- }
- }
- };
- return Timeline;
- }(Animation);
- _setDefaults(Timeline.prototype, {
- _lock: 0,
- _hasPause: 0,
- _forcing: 0
- });
- var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) {
- var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter),
- index = 0,
- matchIndex = 0,
- result,
- startNums,
- color,
- endNum,
- chunk,
- startNum,
- hasRandom,
- a;
- pt.b = start;
- pt.e = end;
- start += "";
- end += "";
- if (hasRandom = ~end.indexOf("random(")) {
- end = _replaceRandom(end);
- }
- if (stringFilter) {
- a = [start, end];
- stringFilter(a, target, prop);
- start = a[0];
- end = a[1];
- }
- startNums = start.match(_complexStringNumExp) || [];
- while (result = _complexStringNumExp.exec(end)) {
- endNum = result[0];
- chunk = end.substring(index, result.index);
- if (color) {
- color = (color + 1) % 5;
- } else if (chunk.substr(-5) === "rgba(") {
- color = 1;
- }
- if (endNum !== startNums[matchIndex++]) {
- startNum = parseFloat(startNums[matchIndex - 1]) || 0;
- pt._pt = {
- _next: pt._pt,
- p: chunk || matchIndex === 1 ? chunk : ",",
- s: startNum,
- c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum,
- m: color && color < 4 ? Math.round : 0
- };
- index = _complexStringNumExp.lastIndex;
- }
- }
- pt.c = index < end.length ? end.substring(index, end.length) : "";
- pt.fp = funcParam;
- if (_relExp.test(end) || hasRandom) {
- pt.e = 0;
- }
- this._pt = pt;
- return pt;
- },
- _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) {
- _isFunction(end) && (end = end(index || 0, target, targets));
- var currentValue = target[prop],
- 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](),
- setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc,
- pt;
- if (_isString(end)) {
- if (~end.indexOf("random(")) {
- end = _replaceRandom(end);
- }
- if (end.charAt(1) === "=") {
- pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0);
- if (pt || pt === 0) {
- end = pt;
- }
- }
- }
- if (!optional || parsedStart !== end || _forceAllPropTweens) {
- if (!isNaN(parsedStart * end) && end !== "") {
- pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter);
- funcParam && (pt.fp = funcParam);
- modifier && pt.modifier(modifier, this, target);
- return this._pt = pt;
- }
- !currentValue && !(prop in target) && _missingPlugin(prop, end);
- return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam);
- }
- },
- _processVars = function _processVars(vars, index, target, targets, tween) {
- _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets));
- if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) {
- return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars;
- }
- var copy = {},
- p;
- for (p in vars) {
- copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets);
- }
- return copy;
- },
- _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) {
- var plugin, pt, ptLookup, i;
- if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) {
- tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
- if (tween !== _quickTween) {
- ptLookup = tween._ptLookup[tween._targets.indexOf(target)];
- i = plugin._props.length;
- while (i--) {
- ptLookup[plugin._props[i]] = pt;
- }
- }
- }
- return plugin;
- },
- _overwritingTween,
- _forceAllPropTweens,
- _initTween = function _initTween(tween, time, tTime) {
- var vars = tween.vars,
- ease = vars.ease,
- startAt = vars.startAt,
- immediateRender = vars.immediateRender,
- lazy = vars.lazy,
- onUpdate = vars.onUpdate,
- runBackwards = vars.runBackwards,
- yoyoEase = vars.yoyoEase,
- keyframes = vars.keyframes,
- autoRevert = vars.autoRevert,
- dur = tween._dur,
- prevStartAt = tween._startAt,
- targets = tween._targets,
- parent = tween.parent,
- fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets,
- autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites,
- tl = tween.timeline,
- cleanVars,
- i,
- p,
- pt,
- target,
- hasPriority,
- gsData,
- harness,
- plugin,
- ptLookup,
- index,
- harnessVars,
- overwritten;
- tl && (!keyframes || !ease) && (ease = "none");
- tween._ease = _parseEase(ease, _defaults.ease);
- tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0;
- if (yoyoEase && tween._yoyo && !tween._repeat) {
- yoyoEase = tween._yEase;
- tween._yEase = tween._ease;
- tween._ease = yoyoEase;
- }
- tween._from = !tl && !!vars.runBackwards;
- if (!tl || keyframes && !vars.stagger) {
- harness = targets[0] ? _getCache(targets[0]).harness : 0;
- harnessVars = harness && vars[harness.prop];
- cleanVars = _copyExcluding(vars, _reservedProps);
- if (prevStartAt) {
- prevStartAt._zTime < 0 && prevStartAt.progress(1);
- time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig);
- prevStartAt._lazy = 0;
- }
- if (startAt) {
- _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({
- data: "isStart",
- overwrite: false,
- parent: parent,
- immediateRender: true,
- lazy: !prevStartAt && _isNotFalse(lazy),
- startAt: null,
- delay: 0,
- onUpdate: onUpdate && function () {
- return _callback(tween, "onUpdate");
- },
- stagger: 0
- }, startAt)));
- tween._startAt._dp = 0;
- tween._startAt._sat = tween;
- time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill);
- if (immediateRender) {
- if (dur && time <= 0 && tTime <= 0) {
- time && (tween._zTime = time);
- return;
- }
- }
- } else if (runBackwards && dur) {
- if (!prevStartAt) {
- time && (immediateRender = false);
- p = _setDefaults({
- overwrite: false,
- data: "isFromStart",
- lazy: immediateRender && !prevStartAt && _isNotFalse(lazy),
- immediateRender: immediateRender,
- stagger: 0,
- parent: parent
- }, cleanVars);
- harnessVars && (p[harness.prop] = harnessVars);
- _removeFromParent(tween._startAt = Tween.set(targets, p));
- tween._startAt._dp = 0;
- tween._startAt._sat = tween;
- time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true));
- tween._zTime = time;
- if (!immediateRender) {
- _initTween(tween._startAt, _tinyNum, _tinyNum);
- } else if (!time) {
- return;
- }
- }
- }
- tween._pt = tween._ptCache = 0;
- lazy = dur && _isNotFalse(lazy) || lazy && !dur;
- for (i = 0; i < targets.length; i++) {
- target = targets[i];
- gsData = target._gsap || _harness(targets)[i]._gsap;
- tween._ptLookup[i] = ptLookup = {};
- _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender();
- index = fullTargets === targets ? i : fullTargets.indexOf(target);
- if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) {
- tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
- plugin._props.forEach(function (name) {
- ptLookup[name] = pt;
- });
- plugin.priority && (hasPriority = 1);
- }
- if (!harness || harnessVars) {
- for (p in cleanVars) {
- if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) {
- plugin.priority && (hasPriority = 1);
- } else {
- ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
- }
- }
- }
- tween._op && tween._op[i] && tween.kill(target, tween._op[i]);
- if (autoOverwrite && tween._pt) {
- _overwritingTween = tween;
- _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time));
- overwritten = !tween.parent;
- _overwritingTween = 0;
- }
- tween._pt && lazy && (_lazyLookup[gsData.id] = 1);
- }
- hasPriority && _sortPropTweensByPriority(tween);
- tween._onInit && tween._onInit(tween);
- }
- tween._onUpdate = onUpdate;
- tween._initted = (!tween._op || tween._pt) && !overwritten;
- keyframes && time <= 0 && tl.render(_bigNum, true, true);
- },
- _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) {
- var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property],
- pt,
- rootPT,
- lookup,
- i;
- if (!ptCache) {
- ptCache = tween._ptCache[property] = [];
- lookup = tween._ptLookup;
- i = tween._targets.length;
- while (i--) {
- pt = lookup[i][property];
- if (pt && pt.d && pt.d._pt) {
- pt = pt.d._pt;
- while (pt && pt.p !== property && pt.fp !== property) {
- pt = pt._next;
- }
- }
- if (!pt) {
- _forceAllPropTweens = 1;
- tween.vars[property] = "+=0";
- _initTween(tween, time);
- _forceAllPropTweens = 0;
- return skipRecursion ? _warn(property + " not eligible for reset") : 1;
- }
- ptCache.push(pt);
- }
- }
- i = ptCache.length;
- while (i--) {
- rootPT = ptCache[i];
- pt = rootPT._pt || rootPT;
- pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c;
- pt.c = value - pt.s;
- rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e));
- rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b));
- }
- },
- _addAliasesToVars = function _addAliasesToVars(targets, vars) {
- var harness = targets[0] ? _getCache(targets[0]).harness : 0,
- propertyAliases = harness && harness.aliases,
- copy,
- p,
- i,
- aliases;
- if (!propertyAliases) {
- return vars;
- }
- copy = _merge({}, vars);
- for (p in propertyAliases) {
- if (p in copy) {
- aliases = propertyAliases[p].split(",");
- i = aliases.length;
- while (i--) {
- copy[aliases[i]] = copy[p];
- }
- }
- }
- return copy;
- },
- _parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) {
- var ease = obj.ease || easeEach || "power1.inOut",
- p,
- a;
- if (_isArray(obj)) {
- a = allProps[prop] || (allProps[prop] = []);
- obj.forEach(function (value, i) {
- return a.push({
- t: i / (obj.length - 1) * 100,
- v: value,
- e: ease
- });
- });
- } else {
- for (p in obj) {
- a = allProps[p] || (allProps[p] = []);
- p === "ease" || a.push({
- t: parseFloat(prop),
- v: obj[p],
- e: ease
- });
- }
- }
- },
- _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) {
- return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value;
- },
- _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",
- _staggerPropsToSkip = {};
- _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function (name) {
- return _staggerPropsToSkip[name] = 1;
- });
- var Tween = function (_Animation2) {
- _inheritsLoose(Tween, _Animation2);
- function Tween(targets, vars, position, skipInherit) {
- var _this3;
- if (typeof vars === "number") {
- position.duration = vars;
- vars = position;
- position = null;
- }
- _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this;
- var _this3$vars = _this3.vars,
- duration = _this3$vars.duration,
- delay = _this3$vars.delay,
- immediateRender = _this3$vars.immediateRender,
- stagger = _this3$vars.stagger,
- overwrite = _this3$vars.overwrite,
- keyframes = _this3$vars.keyframes,
- defaults = _this3$vars.defaults,
- scrollTrigger = _this3$vars.scrollTrigger,
- yoyoEase = _this3$vars.yoyoEase,
- parent = vars.parent || _globalTimeline,
- parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets),
- tl,
- i,
- copy,
- l,
- p,
- curTarget,
- staggerFunc,
- staggerVarsToMerge;
- _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || [];
- _this3._ptLookup = [];
- _this3._overwrite = overwrite;
- if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
- vars = _this3.vars;
- tl = _this3.timeline = new Timeline({
- data: "nested",
- defaults: defaults || {},
- targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets
- });
- tl.kill();
- tl.parent = tl._dp = _assertThisInitialized(_this3);
- tl._start = 0;
- if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
- l = parsedTargets.length;
- staggerFunc = stagger && distribute(stagger);
- if (_isObject(stagger)) {
- for (p in stagger) {
- if (~_staggerTweenProps.indexOf(p)) {
- staggerVarsToMerge || (staggerVarsToMerge = {});
- staggerVarsToMerge[p] = stagger[p];
- }
- }
- }
- for (i = 0; i < l; i++) {
- copy = _copyExcluding(vars, _staggerPropsToSkip);
- copy.stagger = 0;
- yoyoEase && (copy.yoyoEase = yoyoEase);
- staggerVarsToMerge && _merge(copy, staggerVarsToMerge);
- curTarget = parsedTargets[i];
- copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
- copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay;
- if (!stagger && l === 1 && copy.delay) {
- _this3._delay = delay = copy.delay;
- _this3._start += delay;
- copy.delay = 0;
- }
- tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0);
- tl._ease = _easeMap.none;
- }
- tl.duration() ? duration = delay = 0 : _this3.timeline = 0;
- } else if (keyframes) {
- _inheritDefaults(_setDefaults(tl.vars.defaults, {
- ease: "none"
- }));
- tl._ease = _parseEase(keyframes.ease || vars.ease || "none");
- var time = 0,
- a,
- kf,
- v;
- if (_isArray(keyframes)) {
- keyframes.forEach(function (frame) {
- return tl.to(parsedTargets, frame, ">");
- });
- tl.duration();
- } else {
- copy = {};
- for (p in keyframes) {
- p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach);
- }
- for (p in copy) {
- a = copy[p].sort(function (a, b) {
- return a.t - b.t;
- });
- time = 0;
- for (i = 0; i < a.length; i++) {
- kf = a[i];
- v = {
- ease: kf.e,
- duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration
- };
- v[p] = kf.v;
- tl.to(parsedTargets, v, time);
- time += v.duration;
- }
- }
- tl.duration() < duration && tl.to({}, {
- duration: duration - tl.duration()
- });
- }
- }
- duration || _this3.duration(duration = tl.duration());
- } else {
- _this3.timeline = 0;
- }
- if (overwrite === true && !_suppressOverwrites) {
- _overwritingTween = _assertThisInitialized(_this3);
- _globalTimeline.killTweensOf(parsedTargets);
- _overwritingTween = 0;
- }
- _addToTimeline(parent, _assertThisInitialized(_this3), position);
- vars.reversed && _this3.reverse();
- vars.paused && _this3.paused(true);
- if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") {
- _this3._tTime = -_tinyNum;
- _this3.render(Math.max(0, -delay) || 0);
- }
- scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
- return _this3;
- }
- var _proto3 = Tween.prototype;
- _proto3.render = function render(totalTime, suppressEvents, force) {
- var prevTime = this._time,
- tDur = this._tDur,
- dur = this._dur,
- isNegative = totalTime < 0,
- tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime,
- time,
- pt,
- iteration,
- cycleDuration,
- prevIteration,
- isYoyo,
- ratio,
- timeline,
- yoyoEase;
- if (!dur) {
- _renderZeroDurationTween(this, totalTime, suppressEvents, force);
- } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative) {
- time = tTime;
- timeline = this.timeline;
- if (this._repeat) {
- cycleDuration = dur + this._rDelay;
- if (this._repeat < -1 && isNegative) {
- return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
- }
- time = _roundPrecise(tTime % cycleDuration);
- if (tTime === tDur) {
- iteration = this._repeat;
- time = dur;
- } else {
- iteration = ~~(tTime / cycleDuration);
- if (iteration && iteration === _roundPrecise(tTime / cycleDuration)) {
- time = dur;
- iteration--;
- }
- time > dur && (time = dur);
- }
- isYoyo = this._yoyo && iteration & 1;
- if (isYoyo) {
- yoyoEase = this._yEase;
- time = dur - time;
- }
- prevIteration = _animationCycle(this._tTime, cycleDuration);
- if (time === prevTime && !force && this._initted && iteration === prevIteration) {
- this._tTime = tTime;
- return this;
- }
- if (iteration !== prevIteration) {
- timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo);
- if (this.vars.repeatRefresh && !isYoyo && !this._lock && this._time !== dur && this._initted) {
- this._lock = force = 1;
- this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0;
- }
- }
- }
- if (!this._initted) {
- if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) {
- this._tTime = 0;
- return this;
- }
- if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) {
- return this;
- }
- if (dur !== this._dur) {
- return this.render(totalTime, suppressEvents, force);
- }
- }
- this._tTime = tTime;
- this._time = time;
- if (!this._act && this._ts) {
- this._act = 1;
- this._lazy = 0;
- }
- this.ratio = ratio = (yoyoEase || this._ease)(time / dur);
- if (this._from) {
- this.ratio = ratio = 1 - ratio;
- }
- if (time && !prevTime && !suppressEvents && !iteration) {
- _callback(this, "onStart");
- if (this._tTime !== tTime) {
- return this;
- }
- }
- pt = this._pt;
- while (pt) {
- pt.r(ratio, pt.d);
- pt = pt._next;
- }
- timeline && timeline.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime);
- if (this._onUpdate && !suppressEvents) {
- isNegative && _rewindStartAt(this, totalTime, suppressEvents, force);
- _callback(this, "onUpdate");
- }
- this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat");
- if ((tTime === this._tDur || !tTime) && this._tTime === tTime) {
- isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true);
- (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
- if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) {
- _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
- this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
- }
- }
- }
- return this;
- };
- _proto3.targets = function targets() {
- return this._targets;
- };
- _proto3.invalidate = function invalidate(soft) {
- (!soft || !this.vars.runBackwards) && (this._startAt = 0);
- this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0;
- this._ptLookup = [];
- this.timeline && this.timeline.invalidate(soft);
- return _Animation2.prototype.invalidate.call(this, soft);
- };
- _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) {
- _tickerActive || _ticker.wake();
- this._ts || this.play();
- var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts),
- ratio;
- this._initted || _initTween(this, time);
- ratio = this._ease(time / this._dur);
- if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) {
- return this.resetTo(property, value, start, startIsRelative, 1);
- }
- _alignPlayhead(this, 0);
- this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0);
- return this.render(0);
- };
- _proto3.kill = function kill(targets, vars) {
- if (vars === void 0) {
- vars = "all";
- }
- if (!targets && (!vars || vars === "all")) {
- this._lazy = this._pt = 0;
- return this.parent ? _interrupt(this) : this;
- }
- if (this.timeline) {
- var tDur = this.timeline.totalDuration();
- this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this);
- this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
- return this;
- }
- var parsedTargets = this._targets,
- killingTargets = targets ? toArray(targets) : parsedTargets,
- propTweenLookup = this._ptLookup,
- firstPT = this._pt,
- overwrittenProps,
- curLookup,
- curOverwriteProps,
- props,
- p,
- pt,
- i;
- if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) {
- vars === "all" && (this._pt = 0);
- return _interrupt(this);
- }
- overwrittenProps = this._op = this._op || [];
- if (vars !== "all") {
- if (_isString(vars)) {
- p = {};
- _forEachName(vars, function (name) {
- return p[name] = 1;
- });
- vars = p;
- }
- vars = _addAliasesToVars(parsedTargets, vars);
- }
- i = parsedTargets.length;
- while (i--) {
- if (~killingTargets.indexOf(parsedTargets[i])) {
- curLookup = propTweenLookup[i];
- if (vars === "all") {
- overwrittenProps[i] = vars;
- props = curLookup;
- curOverwriteProps = {};
- } else {
- curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {};
- props = vars;
- }
- for (p in props) {
- pt = curLookup && curLookup[p];
- if (pt) {
- if (!("kill" in pt.d) || pt.d.kill(p) === true) {
- _removeLinkedListItem(this, pt, "_pt");
- }
- delete curLookup[p];
- }
- if (curOverwriteProps !== "all") {
- curOverwriteProps[p] = 1;
- }
- }
- }
- }
- this._initted && !this._pt && firstPT && _interrupt(this);
- return this;
- };
- Tween.to = function to(targets, vars) {
- return new Tween(targets, vars, arguments[2]);
- };
- Tween.from = function from(targets, vars) {
- return _createTweenType(1, arguments);
- };
- Tween.delayedCall = function delayedCall(delay, callback, params, scope) {
- return new Tween(callback, 0, {
- immediateRender: false,
- lazy: false,
- overwrite: false,
- delay: delay,
- onComplete: callback,
- onReverseComplete: callback,
- onCompleteParams: params,
- onReverseCompleteParams: params,
- callbackScope: scope
- });
- };
- Tween.fromTo = function fromTo(targets, fromVars, toVars) {
- return _createTweenType(2, arguments);
- };
- Tween.set = function set(targets, vars) {
- vars.duration = 0;
- vars.repeatDelay || (vars.repeat = 0);
- return new Tween(targets, vars);
- };
- Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) {
- return _globalTimeline.killTweensOf(targets, props, onlyActive);
- };
- return Tween;
- }(Animation);
- _setDefaults(Tween.prototype, {
- _targets: [],
- _lazy: 0,
- _startAt: 0,
- _op: 0,
- _onInit: 0
- });
- _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) {
- Tween[name] = function () {
- var tl = new Timeline(),
- params = _slice.call(arguments, 0);
- params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0);
- return tl[name].apply(tl, params);
- };
- });
- var _setterPlain = function _setterPlain(target, property, value) {
- return target[property] = value;
- },
- _setterFunc = function _setterFunc(target, property, value) {
- return target[property](value);
- },
- _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) {
- return target[property](data.fp, value);
- },
- _setterAttribute = function _setterAttribute(target, property, value) {
- return target.setAttribute(property, value);
- },
- _getSetter = function _getSetter(target, property) {
- return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain;
- },
- _renderPlain = function _renderPlain(ratio, data) {
- return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data);
- },
- _renderBoolean = function _renderBoolean(ratio, data) {
- return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
- },
- _renderComplexString = function _renderComplexString(ratio, data) {
- var pt = data._pt,
- s = "";
- if (!ratio && data.b) {
- s = data.b;
- } else if (ratio === 1 && data.e) {
- s = data.e;
- } else {
- while (pt) {
- s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s;
- pt = pt._next;
- }
- s += data.c;
- }
- data.set(data.t, data.p, s, data);
- },
- _renderPropTweens = function _renderPropTweens(ratio, data) {
- var pt = data._pt;
- while (pt) {
- pt.r(ratio, pt.d);
- pt = pt._next;
- }
- },
- _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) {
- var pt = this._pt,
- next;
- while (pt) {
- next = pt._next;
- pt.p === property && pt.modifier(modifier, tween, target);
- pt = next;
- }
- },
- _killPropTweensOf = function _killPropTweensOf(property) {
- var pt = this._pt,
- hasNonDependentRemaining,
- next;
- while (pt) {
- next = pt._next;
- if (pt.p === property && !pt.op || pt.op === property) {
- _removeLinkedListItem(this, pt, "_pt");
- } else if (!pt.dep) {
- hasNonDependentRemaining = 1;
- }
- pt = next;
- }
- return !hasNonDependentRemaining;
- },
- _setterWithModifier = function _setterWithModifier(target, property, value, data) {
- data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
- },
- _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) {
- var pt = parent._pt,
- next,
- pt2,
- first,
- last;
- while (pt) {
- next = pt._next;
- pt2 = first;
- while (pt2 && pt2.pr > pt.pr) {
- pt2 = pt2._next;
- }
- if (pt._prev = pt2 ? pt2._prev : last) {
- pt._prev._next = pt;
- } else {
- first = pt;
- }
- if (pt._next = pt2) {
- pt2._prev = pt;
- } else {
- last = pt;
- }
- pt = next;
- }
- parent._pt = first;
- };
- var PropTween = function () {
- function PropTween(next, target, prop, start, change, renderer, data, setter, priority) {
- this.t = target;
- this.s = start;
- this.c = change;
- this.p = prop;
- this.r = renderer || _renderPlain;
- this.d = data || this;
- this.set = setter || _setterPlain;
- this.pr = priority || 0;
- this._next = next;
- if (next) {
- next._prev = this;
- }
- }
- var _proto4 = PropTween.prototype;
- _proto4.modifier = function modifier(func, tween, target) {
- this.mSet = this.mSet || this.set;
- this.set = _setterWithModifier;
- this.m = func;
- this.mt = target;
- this.tween = tween;
- };
- return PropTween;
- }();
- _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) {
- return _reservedProps[name] = 1;
- });
- _globals.TweenMax = _globals.TweenLite = Tween;
- _globals.TimelineLite = _globals.TimelineMax = Timeline;
- _globalTimeline = new Timeline({
- sortChildren: false,
- defaults: _defaults,
- autoRemoveChildren: true,
- id: "root",
- smoothChildTiming: true
- });
- _config.stringFilter = _colorStringFilter;
- var _media = [],
- _listeners = {},
- _emptyArray = [],
- _lastMediaTime = 0,
- _contextID = 0,
- _dispatch = function _dispatch(type) {
- return (_listeners[type] || _emptyArray).map(function (f) {
- return f();
- });
- },
- _onMediaChange = function _onMediaChange() {
- var time = Date.now(),
- matches = [];
- if (time - _lastMediaTime > 2) {
- _dispatch("matchMediaInit");
- _media.forEach(function (c) {
- var queries = c.queries,
- conditions = c.conditions,
- match,
- p,
- anyMatch,
- toggled;
- for (p in queries) {
- match = _win.matchMedia(queries[p]).matches;
- match && (anyMatch = 1);
- if (match !== conditions[p]) {
- conditions[p] = match;
- toggled = 1;
- }
- }
- if (toggled) {
- c.revert();
- anyMatch && matches.push(c);
- }
- });
- _dispatch("matchMediaRevert");
- matches.forEach(function (c) {
- return c.onMatch(c, function (func) {
- return c.add(null, func);
- });
- });
- _lastMediaTime = time;
- _dispatch("matchMedia");
- }
- };
- var Context = function () {
- function Context(func, scope) {
- this.selector = scope && selector(scope);
- this.data = [];
- this._r = [];
- this.isReverted = false;
- this.id = _contextID++;
- func && this.add(func);
- }
- var _proto5 = Context.prototype;
- _proto5.add = function add(name, func, scope) {
- if (_isFunction(name)) {
- scope = func;
- func = name;
- name = _isFunction;
- }
- var self = this,
- f = function f() {
- var prev = _context,
- prevSelector = self.selector,
- result;
- prev && prev !== self && prev.data.push(self);
- scope && (self.selector = selector(scope));
- _context = self;
- result = func.apply(self, arguments);
- _isFunction(result) && self._r.push(result);
- _context = prev;
- self.selector = prevSelector;
- self.isReverted = false;
- return result;
- };
- self.last = f;
- return name === _isFunction ? f(self, function (func) {
- return self.add(null, func);
- }) : name ? self[name] = f : f;
- };
- _proto5.ignore = function ignore(func) {
- var prev = _context;
- _context = null;
- func(this);
- _context = prev;
- };
- _proto5.getTweens = function getTweens() {
- var a = [];
- this.data.forEach(function (e) {
- return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e);
- });
- return a;
- };
- _proto5.clear = function clear() {
- this._r.length = this.data.length = 0;
- };
- _proto5.kill = function kill(revert, matchMedia) {
- var _this4 = this;
- if (revert) {
- (function () {
- var tweens = _this4.getTweens(),
- i = _this4.data.length,
- t;
- while (i--) {
- t = _this4.data[i];
- if (t.data === "isFlip") {
- t.revert();
- t.getChildren(true, true, false).forEach(function (tween) {
- return tweens.splice(tweens.indexOf(tween), 1);
- });
- }
- }
- tweens.map(function (t) {
- return {
- g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity,
- t: t
- };
- }).sort(function (a, b) {
- return b.g - a.g || -Infinity;
- }).forEach(function (o) {
- return o.t.revert(revert);
- });
- i = _this4.data.length;
- while (i--) {
- t = _this4.data[i];
- if (t instanceof Timeline) {
- if (t.data !== "nested") {
- t.scrollTrigger && t.scrollTrigger.revert();
- t.kill();
- }
- } else {
- !(t instanceof Tween) && t.revert && t.revert(revert);
- }
- }
- _this4._r.forEach(function (f) {
- return f(revert, _this4);
- });
- _this4.isReverted = true;
- })();
- } else {
- this.data.forEach(function (e) {
- return e.kill && e.kill();
- });
- }
- this.clear();
- if (matchMedia) {
- var i = _media.length;
- while (i--) {
- _media[i].id === this.id && _media.splice(i, 1);
- }
- }
- };
- _proto5.revert = function revert(config) {
- this.kill(config || {});
- };
- return Context;
- }();
- var MatchMedia = function () {
- function MatchMedia(scope) {
- this.contexts = [];
- this.scope = scope;
- }
- var _proto6 = MatchMedia.prototype;
- _proto6.add = function add(conditions, func, scope) {
- _isObject(conditions) || (conditions = {
- matches: conditions
- });
- var context = new Context(0, scope || this.scope),
- cond = context.conditions = {},
- mq,
- p,
- active;
- _context && !context.selector && (context.selector = _context.selector);
- this.contexts.push(context);
- func = context.add("onMatch", func);
- context.queries = conditions;
- for (p in conditions) {
- if (p === "all") {
- active = 1;
- } else {
- mq = _win.matchMedia(conditions[p]);
- if (mq) {
- _media.indexOf(context) < 0 && _media.push(context);
- (cond[p] = mq.matches) && (active = 1);
- mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange);
- }
- }
- }
- active && func(context, function (f) {
- return context.add(null, f);
- });
- return this;
- };
- _proto6.revert = function revert(config) {
- this.kill(config || {});
- };
- _proto6.kill = function kill(revert) {
- this.contexts.forEach(function (c) {
- return c.kill(revert, true);
- });
- };
- return MatchMedia;
- }();
- var _gsap = {
- registerPlugin: function registerPlugin() {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- args.forEach(function (config) {
- return _createPlugin(config);
- });
- },
- timeline: function timeline(vars) {
- return new Timeline(vars);
- },
- getTweensOf: function getTweensOf(targets, onlyActive) {
- return _globalTimeline.getTweensOf(targets, onlyActive);
- },
- getProperty: function getProperty(target, property, unit, uncache) {
- _isString(target) && (target = toArray(target)[0]);
- var getter = _getCache(target || {}).get,
- format = unit ? _passThrough : _numericIfPossible;
- unit === "native" && (unit = "");
- return !target ? target : !property ? function (property, unit, uncache) {
- return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
- } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
- },
- quickSetter: function quickSetter(target, property, unit) {
- target = toArray(target);
- if (target.length > 1) {
- var setters = target.map(function (t) {
- return gsap.quickSetter(t, property, unit);
- }),
- l = setters.length;
- return function (value) {
- var i = l;
- while (i--) {
- setters[i](value);
- }
- };
- }
- target = target[0] || {};
- var Plugin = _plugins[property],
- cache = _getCache(target),
- p = cache.harness && (cache.harness.aliases || {})[property] || property,
- setter = Plugin ? function (value) {
- var p = new Plugin();
- _quickTween._pt = 0;
- p.init(target, unit ? value + unit : value, _quickTween, 0, [target]);
- p.render(1, p);
- _quickTween._pt && _renderPropTweens(1, _quickTween);
- } : cache.set(target, p);
- return Plugin ? setter : function (value) {
- return setter(target, p, unit ? value + unit : value, cache, 1);
- };
- },
- quickTo: function quickTo(target, property, vars) {
- var _merge2;
- var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})),
- func = function func(value, start, startIsRelative) {
- return tween.resetTo(property, value, start, startIsRelative);
- };
- func.tween = tween;
- return func;
- },
- isTweening: function isTweening(targets) {
- return _globalTimeline.getTweensOf(targets, true).length > 0;
- },
- defaults: function defaults(value) {
- value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
- return _mergeDeep(_defaults, value || {});
- },
- config: function config(value) {
- return _mergeDeep(_config, value || {});
- },
- registerEffect: function registerEffect(_ref3) {
- var name = _ref3.name,
- effect = _ref3.effect,
- plugins = _ref3.plugins,
- defaults = _ref3.defaults,
- extendTimeline = _ref3.extendTimeline;
- (plugins || "").split(",").forEach(function (pluginName) {
- return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin.");
- });
- _effects[name] = function (targets, vars, tl) {
- return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl);
- };
- if (extendTimeline) {
- Timeline.prototype[name] = function (targets, vars, position) {
- return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position);
- };
- }
- },
- registerEase: function registerEase(name, ease) {
- _easeMap[name] = _parseEase(ease);
- },
- parseEase: function parseEase(ease, defaultEase) {
- return arguments.length ? _parseEase(ease, defaultEase) : _easeMap;
- },
- getById: function getById(id) {
- return _globalTimeline.getById(id);
- },
- exportRoot: function exportRoot(vars, includeDelayedCalls) {
- if (vars === void 0) {
- vars = {};
- }
- var tl = new Timeline(vars),
- child,
- next;
- tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming);
- _globalTimeline.remove(tl);
- tl._dp = 0;
- tl._time = tl._tTime = _globalTimeline._time;
- child = _globalTimeline._first;
- while (child) {
- next = child._next;
- if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
- _addToTimeline(tl, child, child._start - child._delay);
- }
- child = next;
- }
- _addToTimeline(_globalTimeline, tl, 0);
- return tl;
- },
- context: function context(func, scope) {
- return func ? new Context(func, scope) : _context;
- },
- matchMedia: function matchMedia(scope) {
- return new MatchMedia(scope);
- },
- matchMediaRefresh: function matchMediaRefresh() {
- return _media.forEach(function (c) {
- var cond = c.conditions,
- found,
- p;
- for (p in cond) {
- if (cond[p]) {
- cond[p] = false;
- found = 1;
- }
- }
- found && c.revert();
- }) || _onMediaChange();
- },
- addEventListener: function addEventListener(type, callback) {
- var a = _listeners[type] || (_listeners[type] = []);
- ~a.indexOf(callback) || a.push(callback);
- },
- removeEventListener: function removeEventListener(type, callback) {
- var a = _listeners[type],
- i = a && a.indexOf(callback);
- i >= 0 && a.splice(i, 1);
- },
- utils: {
- wrap: wrap,
- wrapYoyo: wrapYoyo,
- distribute: distribute,
- random: random,
- snap: snap,
- normalize: normalize,
- getUnit: getUnit,
- clamp: clamp,
- splitColor: splitColor,
- toArray: toArray,
- selector: selector,
- mapRange: mapRange,
- pipe: pipe,
- unitize: unitize,
- interpolate: interpolate,
- shuffle: shuffle
- },
- install: _install,
- effects: _effects,
- ticker: _ticker,
- updateRoot: Timeline.updateRoot,
- plugins: _plugins,
- globalTimeline: _globalTimeline,
- core: {
- PropTween: PropTween,
- globals: _addGlobal,
- Tween: Tween,
- Timeline: Timeline,
- Animation: Animation,
- getCache: _getCache,
- _removeLinkedListItem: _removeLinkedListItem,
- reverting: function reverting() {
- return _reverting;
- },
- context: function context(toAdd) {
- if (toAdd && _context) {
- _context.data.push(toAdd);
- toAdd._ctx = _context;
- }
- return _context;
- },
- suppressOverwrites: function suppressOverwrites(value) {
- return _suppressOverwrites = value;
- }
- }
- };
- _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) {
- return _gsap[name] = Tween[name];
- });
- _ticker.add(Timeline.updateRoot);
- _quickTween = _gsap.to({}, {
- duration: 0
- });
- var _getPluginPropTween = function _getPluginPropTween(plugin, prop) {
- var pt = plugin._pt;
- while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) {
- pt = pt._next;
- }
- return pt;
- },
- _addModifiers = function _addModifiers(tween, modifiers) {
- var targets = tween._targets,
- p,
- i,
- pt;
- for (p in modifiers) {
- i = targets.length;
- while (i--) {
- pt = tween._ptLookup[i][p];
- if (pt && (pt = pt.d)) {
- if (pt._pt) {
- pt = _getPluginPropTween(pt, p);
- }
- pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p);
- }
- }
- }
- },
- _buildModifierPlugin = function _buildModifierPlugin(name, modifier) {
- return {
- name: name,
- rawVars: 1,
- init: function init(target, vars, tween) {
- tween._onInit = function (tween) {
- var temp, p;
- if (_isString(vars)) {
- temp = {};
- _forEachName(vars, function (name) {
- return temp[name] = 1;
- });
- vars = temp;
- }
- if (modifier) {
- temp = {};
- for (p in vars) {
- temp[p] = modifier(vars[p]);
- }
- vars = temp;
- }
- _addModifiers(tween, vars);
- };
- }
- };
- };
- var gsap = _gsap.registerPlugin({
- name: "attr",
- init: function init(target, vars, tween, index, targets) {
- var p, pt, v;
- this.tween = tween;
- for (p in vars) {
- v = target.getAttribute(p) || "";
- pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p);
- pt.op = p;
- pt.b = v;
- this._props.push(p);
- }
- },
- render: function render(ratio, data) {
- var pt = data._pt;
- while (pt) {
- _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d);
- pt = pt._next;
- }
- }
- }, {
- name: "endArray",
- init: function init(target, value) {
- var i = value.length;
- while (i--) {
- this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1);
- }
- }
- }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
- Tween.version = Timeline.version = gsap.version = "3.12.4";
- _coreReady = 1;
- _windowExists() && _wake();
- var Power0 = _easeMap.Power0,
- Power1 = _easeMap.Power1,
- Power2 = _easeMap.Power2,
- Power3 = _easeMap.Power3,
- Power4 = _easeMap.Power4,
- Linear = _easeMap.Linear,
- Quad = _easeMap.Quad,
- Cubic = _easeMap.Cubic,
- Quart = _easeMap.Quart,
- Quint = _easeMap.Quint,
- Strong = _easeMap.Strong,
- Elastic = _easeMap.Elastic,
- Back = _easeMap.Back,
- SteppedEase = _easeMap.SteppedEase,
- Bounce = _easeMap.Bounce,
- Sine = _easeMap.Sine,
- Expo = _easeMap.Expo,
- Circ = _easeMap.Circ;
- var _win$1,
- _doc$1,
- _docElement,
- _pluginInitted,
- _tempDiv,
- _tempDivStyler,
- _recentSetterPlugin,
- _reverting$1,
- _windowExists$1 = function _windowExists() {
- return typeof window !== "undefined";
- },
- _transformProps = {},
- _RAD2DEG = 180 / Math.PI,
- _DEG2RAD = Math.PI / 180,
- _atan2 = Math.atan2,
- _bigNum$1 = 1e8,
- _capsExp = /([A-Z])/g,
- _horizontalExp = /(left|right|width|margin|padding|x)/i,
- _complexExp = /[\s,\(]\S/,
- _propertyAliases = {
- autoAlpha: "opacity,visibility",
- scale: "scaleX,scaleY",
- alpha: "opacity"
- },
- _renderCSSProp = function _renderCSSProp(ratio, data) {
- return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
- },
- _renderPropWithEnd = function _renderPropWithEnd(ratio, data) {
- return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
- },
- _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) {
- return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data);
- },
- _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) {
- var value = data.s + data.c * ratio;
- data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data);
- },
- _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) {
- return data.set(data.t, data.p, ratio ? data.e : data.b, data);
- },
- _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) {
- return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data);
- },
- _setterCSSStyle = function _setterCSSStyle(target, property, value) {
- return target.style[property] = value;
- },
- _setterCSSProp = function _setterCSSProp(target, property, value) {
- return target.style.setProperty(property, value);
- },
- _setterTransform = function _setterTransform(target, property, value) {
- return target._gsap[property] = value;
- },
- _setterScale = function _setterScale(target, property, value) {
- return target._gsap.scaleX = target._gsap.scaleY = value;
- },
- _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) {
- var cache = target._gsap;
- cache.scaleX = cache.scaleY = value;
- cache.renderTransform(ratio, cache);
- },
- _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) {
- var cache = target._gsap;
- cache[property] = value;
- cache.renderTransform(ratio, cache);
- },
- _transformProp = "transform",
- _transformOriginProp = _transformProp + "Origin",
- _saveStyle = function _saveStyle(property, isNotCSS) {
- var _this = this;
- var target = this.target,
- style = target.style,
- cache = target._gsap;
- if (property in _transformProps && style) {
- this.tfm = this.tfm || {};
- if (property !== "transform") {
- property = _propertyAliases[property] || property;
- ~property.indexOf(",") ? property.split(",").forEach(function (a) {
- return _this.tfm[a] = _get(target, a);
- }) : this.tfm[property] = cache.x ? cache[property] : _get(target, property);
- property === _transformOriginProp && (this.tfm.zOrigin = cache.zOrigin);
- } else {
- return _propertyAliases.transform.split(",").forEach(function (p) {
- return _saveStyle.call(_this, p, isNotCSS);
- });
- }
- if (this.props.indexOf(_transformProp) >= 0) {
- return;
- }
- if (cache.svg) {
- this.svgo = target.getAttribute("data-svg-origin");
- this.props.push(_transformOriginProp, isNotCSS, "");
- }
- property = _transformProp;
- }
- (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]);
- },
- _removeIndependentTransforms = function _removeIndependentTransforms(style) {
- if (style.translate) {
- style.removeProperty("translate");
- style.removeProperty("scale");
- style.removeProperty("rotate");
- }
- },
- _revertStyle = function _revertStyle() {
- var props = this.props,
- target = this.target,
- style = target.style,
- cache = target._gsap,
- i,
- p;
- for (i = 0; i < props.length; i += 3) {
- 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());
- }
- if (this.tfm) {
- for (p in this.tfm) {
- cache[p] = this.tfm[p];
- }
- if (cache.svg) {
- cache.renderTransform();
- target.setAttribute("data-svg-origin", this.svgo || "");
- }
- i = _reverting$1();
- if ((!i || !i.isStart) && !style[_transformProp]) {
- _removeIndependentTransforms(style);
- if (cache.zOrigin && style[_transformOriginProp]) {
- style[_transformOriginProp] += " " + cache.zOrigin + "px";
- cache.zOrigin = 0;
- cache.renderTransform();
- }
- cache.uncache = 1;
- }
- }
- },
- _getStyleSaver = function _getStyleSaver(target, properties) {
- var saver = {
- target: target,
- props: [],
- revert: _revertStyle,
- save: _saveStyle
- };
- target._gsap || gsap.core.getCache(target);
- properties && properties.split(",").forEach(function (p) {
- return saver.save(p);
- });
- return saver;
- },
- _supports3D,
- _createElement = function _createElement(type, ns) {
- var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type);
- return e && e.style ? e : _doc$1.createElement(type);
- },
- _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) {
- var cs = getComputedStyle(target);
- return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || "";
- },
- _prefixes = "O,Moz,ms,Ms,Webkit".split(","),
- _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) {
- var e = element || _tempDiv,
- s = e.style,
- i = 5;
- if (property in s && !preferPrefix) {
- return property;
- }
- property = property.charAt(0).toUpperCase() + property.substr(1);
- while (i-- && !(_prefixes[i] + property in s)) {}
- return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property;
- },
- _initCore = function _initCore() {
- if (_windowExists$1() && window.document) {
- _win$1 = window;
- _doc$1 = _win$1.document;
- _docElement = _doc$1.documentElement;
- _tempDiv = _createElement("div") || {
- style: {}
- };
- _tempDivStyler = _createElement("div");
- _transformProp = _checkPropPrefix(_transformProp);
- _transformOriginProp = _transformProp + "Origin";
- _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0";
- _supports3D = !!_checkPropPrefix("perspective");
- _reverting$1 = gsap.core.reverting;
- _pluginInitted = 1;
- }
- },
- _getBBoxHack = function _getBBoxHack(swapIfPossible) {
- var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"),
- oldParent = this.parentNode,
- oldSibling = this.nextSibling,
- oldCSS = this.style.cssText,
- bbox;
- _docElement.appendChild(svg);
- svg.appendChild(this);
- this.style.display = "block";
- if (swapIfPossible) {
- try {
- bbox = this.getBBox();
- this._gsapBBox = this.getBBox;
- this.getBBox = _getBBoxHack;
- } catch (e) {}
- } else if (this._gsapBBox) {
- bbox = this._gsapBBox();
- }
- if (oldParent) {
- if (oldSibling) {
- oldParent.insertBefore(this, oldSibling);
- } else {
- oldParent.appendChild(this);
- }
- }
- _docElement.removeChild(svg);
- this.style.cssText = oldCSS;
- return bbox;
- },
- _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) {
- var i = attributesArray.length;
- while (i--) {
- if (target.hasAttribute(attributesArray[i])) {
- return target.getAttribute(attributesArray[i]);
- }
- }
- },
- _getBBox = function _getBBox(target) {
- var bounds;
- try {
- bounds = target.getBBox();
- } catch (error) {
- bounds = _getBBoxHack.call(target, true);
- }
- bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true));
- return bounds && !bounds.width && !bounds.x && !bounds.y ? {
- x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0,
- y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0,
- width: 0,
- height: 0
- } : bounds;
- },
- _isSVG = function _isSVG(e) {
- return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e));
- },
- _removeProperty = function _removeProperty(target, property) {
- if (property) {
- var style = target.style,
- first2Chars;
- if (property in _transformProps && property !== _transformOriginProp) {
- property = _transformProp;
- }
- if (style.removeProperty) {
- first2Chars = property.substr(0, 2);
- if (first2Chars === "ms" || property.substr(0, 6) === "webkit") {
- property = "-" + property;
- }
- style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp, "-$1").toLowerCase());
- } else {
- style.removeAttribute(property);
- }
- }
- },
- _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) {
- var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue);
- plugin._pt = pt;
- pt.b = beginning;
- pt.e = end;
- plugin._props.push(property);
- return pt;
- },
- _nonConvertibleUnits = {
- deg: 1,
- rad: 1,
- turn: 1
- },
- _nonStandardLayouts = {
- grid: 1,
- flex: 1
- },
- _convertToUnit = function _convertToUnit(target, property, value, unit) {
- var curValue = parseFloat(value) || 0,
- curUnit = (value + "").trim().substr((curValue + "").length) || "px",
- style = _tempDiv.style,
- horizontal = _horizontalExp.test(property),
- isRootSVG = target.tagName.toLowerCase() === "svg",
- measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"),
- amount = 100,
- toPixels = unit === "px",
- toPercent = unit === "%",
- px,
- parent,
- cache,
- isSVG;
- if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) {
- return curValue;
- }
- curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px"));
- isSVG = target.getCTM && _isSVG(target);
- if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) {
- px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty];
- return _round(toPercent ? curValue / px * amount : curValue / 100 * px);
- }
- style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit);
- parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode;
- if (isSVG) {
- parent = (target.ownerSVGElement || {}).parentNode;
- }
- if (!parent || parent === _doc$1 || !parent.appendChild) {
- parent = _doc$1.body;
- }
- cache = parent._gsap;
- if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time && !cache.uncache) {
- return _round(curValue / cache.width * amount);
- } else {
- if (toPercent && (property === "height" || property === "width")) {
- var v = target.style[property];
- target.style[property] = amount + unit;
- px = target[measureProperty];
- v ? target.style[property] = v : _removeProperty(target, property);
- } else {
- (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position"));
- parent === target && (style.position = "static");
- parent.appendChild(_tempDiv);
- px = _tempDiv[measureProperty];
- parent.removeChild(_tempDiv);
- style.position = "absolute";
- }
- if (horizontal && toPercent) {
- cache = _getCache(parent);
- cache.time = _ticker.time;
- cache.width = parent[measureProperty];
- }
- }
- return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0);
- },
- _get = function _get(target, property, unit, uncache) {
- var value;
- _pluginInitted || _initCore();
- if (property in _propertyAliases && property !== "transform") {
- property = _propertyAliases[property];
- if (~property.indexOf(",")) {
- property = property.split(",")[0];
- }
- }
- if (_transformProps[property] && property !== "transform") {
- value = _parseTransform(target, uncache);
- value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px";
- } else {
- value = target.style[property];
- if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) {
- value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0);
- }
- }
- return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value;
- },
- _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) {
- if (!start || start === "none") {
- var p = _checkPropPrefix(prop, target, 1),
- s = p && _getComputedProperty(target, p, 1);
- if (s && s !== start) {
- prop = p;
- start = s;
- } else if (prop === "borderColor") {
- start = _getComputedProperty(target, "borderTopColor");
- }
- }
- var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString),
- index = 0,
- matchIndex = 0,
- a,
- result,
- startValues,
- startNum,
- color,
- startValue,
- endValue,
- endNum,
- chunk,
- endUnit,
- startUnit,
- endValues;
- pt.b = start;
- pt.e = end;
- start += "";
- end += "";
- if (end === "auto") {
- startValue = target.style[prop];
- target.style[prop] = end;
- end = _getComputedProperty(target, prop) || end;
- startValue ? target.style[prop] = startValue : _removeProperty(target, prop);
- }
- a = [start, end];
- _colorStringFilter(a);
- start = a[0];
- end = a[1];
- startValues = start.match(_numWithUnitExp) || [];
- endValues = end.match(_numWithUnitExp) || [];
- if (endValues.length) {
- while (result = _numWithUnitExp.exec(end)) {
- endValue = result[0];
- chunk = end.substring(index, result.index);
- if (color) {
- color = (color + 1) % 5;
- } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") {
- color = 1;
- }
- if (endValue !== (startValue = startValues[matchIndex++] || "")) {
- startNum = parseFloat(startValue) || 0;
- startUnit = startValue.substr((startNum + "").length);
- endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit);
- endNum = parseFloat(endValue);
- endUnit = endValue.substr((endNum + "").length);
- index = _numWithUnitExp.lastIndex - endUnit.length;
- if (!endUnit) {
- endUnit = endUnit || _config.units[prop] || startUnit;
- if (index === end.length) {
- end += endUnit;
- pt.e += endUnit;
- }
- }
- if (startUnit !== endUnit) {
- startNum = _convertToUnit(target, prop, startValue, endUnit) || 0;
- }
- pt._pt = {
- _next: pt._pt,
- p: chunk || matchIndex === 1 ? chunk : ",",
- s: startNum,
- c: endNum - startNum,
- m: color && color < 4 || prop === "zIndex" ? Math.round : 0
- };
- }
- }
- pt.c = index < end.length ? end.substring(index, end.length) : "";
- } else {
- pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue;
- }
- _relExp.test(end) && (pt.e = 0);
- this._pt = pt;
- return pt;
- },
- _keywordToPercent = {
- top: "0%",
- bottom: "100%",
- left: "0%",
- right: "100%",
- center: "50%"
- },
- _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) {
- var split = value.split(" "),
- x = split[0],
- y = split[1] || "50%";
- if (x === "top" || x === "bottom" || y === "left" || y === "right") {
- value = x;
- x = y;
- y = value;
- }
- split[0] = _keywordToPercent[x] || x;
- split[1] = _keywordToPercent[y] || y;
- return split.join(" ");
- },
- _renderClearProps = function _renderClearProps(ratio, data) {
- if (data.tween && data.tween._time === data.tween._dur) {
- var target = data.t,
- style = target.style,
- props = data.u,
- cache = target._gsap,
- prop,
- clearTransforms,
- i;
- if (props === "all" || props === true) {
- style.cssText = "";
- clearTransforms = 1;
- } else {
- props = props.split(",");
- i = props.length;
- while (--i > -1) {
- prop = props[i];
- if (_transformProps[prop]) {
- clearTransforms = 1;
- prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp;
- }
- _removeProperty(target, prop);
- }
- }
- if (clearTransforms) {
- _removeProperty(target, _transformProp);
- if (cache) {
- cache.svg && target.removeAttribute("transform");
- _parseTransform(target, 1);
- cache.uncache = 1;
- _removeIndependentTransforms(style);
- }
- }
- }
- },
- _specialProps = {
- clearProps: function clearProps(plugin, target, property, endValue, tween) {
- if (tween.data !== "isFromStart") {
- var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps);
- pt.u = endValue;
- pt.pr = -10;
- pt.tween = tween;
- plugin._props.push(property);
- return 1;
- }
- }
- },
- _identity2DMatrix = [1, 0, 0, 1, 0, 0],
- _rotationalProperties = {},
- _isNullTransform = function _isNullTransform(value) {
- return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value;
- },
- _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) {
- var matrixString = _getComputedProperty(target, _transformProp);
- return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round);
- },
- _getMatrix = function _getMatrix(target, force2D) {
- var cache = target._gsap || _getCache(target),
- style = target.style,
- matrix = _getComputedTransformMatrixAsArray(target),
- parent,
- nextSibling,
- temp,
- addedToDOM;
- if (cache.svg && target.getAttribute("transform")) {
- temp = target.transform.baseVal.consolidate().matrix;
- matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f];
- return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix;
- } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) {
- temp = style.display;
- style.display = "block";
- parent = target.parentNode;
- if (!parent || !target.offsetParent) {
- addedToDOM = 1;
- nextSibling = target.nextElementSibling;
- _docElement.appendChild(target);
- }
- matrix = _getComputedTransformMatrixAsArray(target);
- temp ? style.display = temp : _removeProperty(target, "display");
- if (addedToDOM) {
- nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target);
- }
- }
- return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix;
- },
- _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) {
- var cache = target._gsap,
- matrix = matrixArray || _getMatrix(target, true),
- xOriginOld = cache.xOrigin || 0,
- yOriginOld = cache.yOrigin || 0,
- xOffsetOld = cache.xOffset || 0,
- yOffsetOld = cache.yOffset || 0,
- a = matrix[0],
- b = matrix[1],
- c = matrix[2],
- d = matrix[3],
- tx = matrix[4],
- ty = matrix[5],
- originSplit = origin.split(" "),
- xOrigin = parseFloat(originSplit[0]) || 0,
- yOrigin = parseFloat(originSplit[1]) || 0,
- bounds,
- determinant,
- x,
- y;
- if (!originIsAbsolute) {
- bounds = _getBBox(target);
- xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin);
- yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin);
- } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) {
- x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant;
- y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant;
- xOrigin = x;
- yOrigin = y;
- }
- if (smooth || smooth !== false && cache.smooth) {
- tx = xOrigin - xOriginOld;
- ty = yOrigin - yOriginOld;
- cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx;
- cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty;
- } else {
- cache.xOffset = cache.yOffset = 0;
- }
- cache.xOrigin = xOrigin;
- cache.yOrigin = yOrigin;
- cache.smooth = !!smooth;
- cache.origin = origin;
- cache.originIsAbsolute = !!originIsAbsolute;
- target.style[_transformOriginProp] = "0px 0px";
- if (pluginToAddPropTweensTo) {
- _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin);
- _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin);
- _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset);
- _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset);
- }
- target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin);
- },
- _parseTransform = function _parseTransform(target, uncache) {
- var cache = target._gsap || new GSCache(target);
- if ("x" in cache && !uncache && !cache.uncache) {
- return cache;
- }
- var style = target.style,
- invertedScaleX = cache.scaleX < 0,
- px = "px",
- deg = "deg",
- cs = getComputedStyle(target),
- origin = _getComputedProperty(target, _transformOriginProp) || "0",
- x,
- y,
- z,
- scaleX,
- scaleY,
- rotation,
- rotationX,
- rotationY,
- skewX,
- skewY,
- perspective,
- xOrigin,
- yOrigin,
- matrix,
- angle,
- cos,
- sin,
- a,
- b,
- c,
- d,
- a12,
- a22,
- t1,
- t2,
- t3,
- a13,
- a23,
- a33,
- a42,
- a43,
- a32;
- x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0;
- scaleX = scaleY = 1;
- cache.svg = !!(target.getCTM && _isSVG(target));
- if (cs.translate) {
- if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") {
- 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] : "");
- }
- style.scale = style.rotate = style.translate = "none";
- }
- matrix = _getMatrix(target, cache.svg);
- if (cache.svg) {
- if (cache.uncache) {
- t2 = target.getBBox();
- origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px";
- t1 = "";
- } else {
- t1 = !uncache && target.getAttribute("data-svg-origin");
- }
- _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix);
- }
- xOrigin = cache.xOrigin || 0;
- yOrigin = cache.yOrigin || 0;
- if (matrix !== _identity2DMatrix) {
- a = matrix[0];
- b = matrix[1];
- c = matrix[2];
- d = matrix[3];
- x = a12 = matrix[4];
- y = a22 = matrix[5];
- if (matrix.length === 6) {
- scaleX = Math.sqrt(a * a + b * b);
- scaleY = Math.sqrt(d * d + c * c);
- rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0;
- skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0;
- skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD)));
- if (cache.svg) {
- x -= xOrigin - (xOrigin * a + yOrigin * c);
- y -= yOrigin - (xOrigin * b + yOrigin * d);
- }
- } else {
- a32 = matrix[6];
- a42 = matrix[7];
- a13 = matrix[8];
- a23 = matrix[9];
- a33 = matrix[10];
- a43 = matrix[11];
- x = matrix[12];
- y = matrix[13];
- z = matrix[14];
- angle = _atan2(a32, a33);
- rotationX = angle * _RAD2DEG;
- if (angle) {
- cos = Math.cos(-angle);
- sin = Math.sin(-angle);
- t1 = a12 * cos + a13 * sin;
- t2 = a22 * cos + a23 * sin;
- t3 = a32 * cos + a33 * sin;
- a13 = a12 * -sin + a13 * cos;
- a23 = a22 * -sin + a23 * cos;
- a33 = a32 * -sin + a33 * cos;
- a43 = a42 * -sin + a43 * cos;
- a12 = t1;
- a22 = t2;
- a32 = t3;
- }
- angle = _atan2(-c, a33);
- rotationY = angle * _RAD2DEG;
- if (angle) {
- cos = Math.cos(-angle);
- sin = Math.sin(-angle);
- t1 = a * cos - a13 * sin;
- t2 = b * cos - a23 * sin;
- t3 = c * cos - a33 * sin;
- a43 = d * sin + a43 * cos;
- a = t1;
- b = t2;
- c = t3;
- }
- angle = _atan2(b, a);
- rotation = angle * _RAD2DEG;
- if (angle) {
- cos = Math.cos(angle);
- sin = Math.sin(angle);
- t1 = a * cos + b * sin;
- t2 = a12 * cos + a22 * sin;
- b = b * cos - a * sin;
- a22 = a22 * cos - a12 * sin;
- a = t1;
- a12 = t2;
- }
- if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) {
- rotationX = rotation = 0;
- rotationY = 180 - rotationY;
- }
- scaleX = _round(Math.sqrt(a * a + b * b + c * c));
- scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32));
- angle = _atan2(a12, a22);
- skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0;
- perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0;
- }
- if (cache.svg) {
- t1 = target.getAttribute("transform");
- cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp));
- t1 && target.setAttribute("transform", t1);
- }
- }
- if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
- if (invertedScaleX) {
- scaleX *= -1;
- skewX += rotation <= 0 ? 180 : -180;
- rotation += rotation <= 0 ? 180 : -180;
- } else {
- scaleY *= -1;
- skewX += skewX <= 0 ? 180 : -180;
- }
- }
- uncache = uncache || cache.uncache;
- 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;
- 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;
- cache.z = z + px;
- cache.scaleX = _round(scaleX);
- cache.scaleY = _round(scaleY);
- cache.rotation = _round(rotation) + deg;
- cache.rotationX = _round(rotationX) + deg;
- cache.rotationY = _round(rotationY) + deg;
- cache.skewX = skewX + deg;
- cache.skewY = skewY + deg;
- cache.transformPerspective = perspective + px;
- if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache.zOrigin || 0) {
- style[_transformOriginProp] = _firstTwoOnly(origin);
- }
- cache.xOffset = cache.yOffset = 0;
- cache.force3D = _config.force3D;
- cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms;
- cache.uncache = 0;
- return cache;
- },
- _firstTwoOnly = function _firstTwoOnly(value) {
- return (value = value.split(" "))[0] + " " + value[1];
- },
- _addPxTranslate = function _addPxTranslate(target, start, value) {
- var unit = getUnit(start);
- return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit;
- },
- _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) {
- cache.z = "0px";
- cache.rotationY = cache.rotationX = "0deg";
- cache.force3D = 0;
- _renderCSSTransforms(ratio, cache);
- },
- _zeroDeg = "0deg",
- _zeroPx = "0px",
- _endParenthesis = ") ",
- _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) {
- var _ref = cache || this,
- xPercent = _ref.xPercent,
- yPercent = _ref.yPercent,
- x = _ref.x,
- y = _ref.y,
- z = _ref.z,
- rotation = _ref.rotation,
- rotationY = _ref.rotationY,
- rotationX = _ref.rotationX,
- skewX = _ref.skewX,
- skewY = _ref.skewY,
- scaleX = _ref.scaleX,
- scaleY = _ref.scaleY,
- transformPerspective = _ref.transformPerspective,
- force3D = _ref.force3D,
- target = _ref.target,
- zOrigin = _ref.zOrigin,
- transforms = "",
- use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true;
- if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) {
- var angle = parseFloat(rotationY) * _DEG2RAD,
- a13 = Math.sin(angle),
- a33 = Math.cos(angle),
- cos;
- angle = parseFloat(rotationX) * _DEG2RAD;
- cos = Math.cos(angle);
- x = _addPxTranslate(target, x, a13 * cos * -zOrigin);
- y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin);
- z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin);
- }
- if (transformPerspective !== _zeroPx) {
- transforms += "perspective(" + transformPerspective + _endParenthesis;
- }
- if (xPercent || yPercent) {
- transforms += "translate(" + xPercent + "%, " + yPercent + "%) ";
- }
- if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) {
- transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis;
- }
- if (rotation !== _zeroDeg) {
- transforms += "rotate(" + rotation + _endParenthesis;
- }
- if (rotationY !== _zeroDeg) {
- transforms += "rotateY(" + rotationY + _endParenthesis;
- }
- if (rotationX !== _zeroDeg) {
- transforms += "rotateX(" + rotationX + _endParenthesis;
- }
- if (skewX !== _zeroDeg || skewY !== _zeroDeg) {
- transforms += "skew(" + skewX + ", " + skewY + _endParenthesis;
- }
- if (scaleX !== 1 || scaleY !== 1) {
- transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis;
- }
- target.style[_transformProp] = transforms || "translate(0, 0)";
- },
- _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) {
- var _ref2 = cache || this,
- xPercent = _ref2.xPercent,
- yPercent = _ref2.yPercent,
- x = _ref2.x,
- y = _ref2.y,
- rotation = _ref2.rotation,
- skewX = _ref2.skewX,
- skewY = _ref2.skewY,
- scaleX = _ref2.scaleX,
- scaleY = _ref2.scaleY,
- target = _ref2.target,
- xOrigin = _ref2.xOrigin,
- yOrigin = _ref2.yOrigin,
- xOffset = _ref2.xOffset,
- yOffset = _ref2.yOffset,
- forceCSS = _ref2.forceCSS,
- tx = parseFloat(x),
- ty = parseFloat(y),
- a11,
- a21,
- a12,
- a22,
- temp;
- rotation = parseFloat(rotation);
- skewX = parseFloat(skewX);
- skewY = parseFloat(skewY);
- if (skewY) {
- skewY = parseFloat(skewY);
- skewX += skewY;
- rotation += skewY;
- }
- if (rotation || skewX) {
- rotation *= _DEG2RAD;
- skewX *= _DEG2RAD;
- a11 = Math.cos(rotation) * scaleX;
- a21 = Math.sin(rotation) * scaleX;
- a12 = Math.sin(rotation - skewX) * -scaleY;
- a22 = Math.cos(rotation - skewX) * scaleY;
- if (skewX) {
- skewY *= _DEG2RAD;
- temp = Math.tan(skewX - skewY);
- temp = Math.sqrt(1 + temp * temp);
- a12 *= temp;
- a22 *= temp;
- if (skewY) {
- temp = Math.tan(skewY);
- temp = Math.sqrt(1 + temp * temp);
- a11 *= temp;
- a21 *= temp;
- }
- }
- a11 = _round(a11);
- a21 = _round(a21);
- a12 = _round(a12);
- a22 = _round(a22);
- } else {
- a11 = scaleX;
- a22 = scaleY;
- a21 = a12 = 0;
- }
- if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) {
- tx = _convertToUnit(target, "x", x, "px");
- ty = _convertToUnit(target, "y", y, "px");
- }
- if (xOrigin || yOrigin || xOffset || yOffset) {
- tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset);
- ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset);
- }
- if (xPercent || yPercent) {
- temp = target.getBBox();
- tx = _round(tx + xPercent / 100 * temp.width);
- ty = _round(ty + yPercent / 100 * temp.height);
- }
- temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")";
- target.setAttribute("transform", temp);
- forceCSS && (target.style[_transformProp] = temp);
- },
- _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) {
- var cap = 360,
- isString = _isString(endValue),
- endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1),
- change = endNum - startNum,
- finalValue = startNum + change + "deg",
- direction,
- pt;
- if (isString) {
- direction = endValue.split("_")[1];
- if (direction === "short") {
- change %= cap;
- if (change !== change % (cap / 2)) {
- change += change < 0 ? cap : -cap;
- }
- }
- if (direction === "cw" && change < 0) {
- change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap;
- } else if (direction === "ccw" && change > 0) {
- change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap;
- }
- }
- plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd);
- pt.e = finalValue;
- pt.u = "deg";
- plugin._props.push(property);
- return pt;
- },
- _assign = function _assign(target, source) {
- for (var p in source) {
- target[p] = source[p];
- }
- return target;
- },
- _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) {
- var startCache = _assign({}, target._gsap),
- exclude = "perspective,force3D,transformOrigin,svgOrigin",
- style = target.style,
- endCache,
- p,
- startValue,
- endValue,
- startNum,
- endNum,
- startUnit,
- endUnit;
- if (startCache.svg) {
- startValue = target.getAttribute("transform");
- target.setAttribute("transform", "");
- style[_transformProp] = transforms;
- endCache = _parseTransform(target, 1);
- _removeProperty(target, _transformProp);
- target.setAttribute("transform", startValue);
- } else {
- startValue = getComputedStyle(target)[_transformProp];
- style[_transformProp] = transforms;
- endCache = _parseTransform(target, 1);
- style[_transformProp] = startValue;
- }
- for (p in _transformProps) {
- startValue = startCache[p];
- endValue = endCache[p];
- if (startValue !== endValue && exclude.indexOf(p) < 0) {
- startUnit = getUnit(startValue);
- endUnit = getUnit(endValue);
- startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue);
- endNum = parseFloat(endValue);
- plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp);
- plugin._pt.u = endUnit || 0;
- plugin._props.push(p);
- }
- }
- _assign(endCache, startCache);
- };
- _forEachName("padding,margin,Width,Radius", function (name, index) {
- var t = "Top",
- r = "Right",
- b = "Bottom",
- l = "Left",
- props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) {
- return index < 2 ? name + side : "border" + side + name;
- });
- _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) {
- var a, vars;
- if (arguments.length < 4) {
- a = props.map(function (prop) {
- return _get(plugin, prop, property);
- });
- vars = a.join(" ");
- return vars.split(a[0]).length === 5 ? a[0] : vars;
- }
- a = (endValue + "").split(" ");
- vars = {};
- props.forEach(function (prop, i) {
- return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0];
- });
- plugin.init(target, vars, tween);
- };
- });
- var CSSPlugin = {
- name: "css",
- register: _initCore,
- targetTest: function targetTest(target) {
- return target.style && target.nodeType;
- },
- init: function init(target, vars, tween, index, targets) {
- var props = this._props,
- style = target.style,
- startAt = tween.vars.startAt,
- startValue,
- endValue,
- endNum,
- startNum,
- type,
- specialProp,
- p,
- startUnit,
- endUnit,
- relative,
- isTransformRelated,
- transformPropTween,
- cache,
- smooth,
- hasPriority,
- inlineProps;
- _pluginInitted || _initCore();
- this.styles = this.styles || _getStyleSaver(target);
- inlineProps = this.styles.props;
- this.tween = tween;
- for (p in vars) {
- if (p === "autoRound") {
- continue;
- }
- endValue = vars[p];
- if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) {
- continue;
- }
- type = typeof endValue;
- specialProp = _specialProps[p];
- if (type === "function") {
- endValue = endValue.call(tween, index, target, targets);
- type = typeof endValue;
- }
- if (type === "string" && ~endValue.indexOf("random(")) {
- endValue = _replaceRandom(endValue);
- }
- if (specialProp) {
- specialProp(this, target, p, endValue, tween) && (hasPriority = 1);
- } else if (p.substr(0, 2) === "--") {
- startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim();
- endValue += "";
- _colorExp.lastIndex = 0;
- if (!_colorExp.test(startValue)) {
- startUnit = getUnit(startValue);
- endUnit = getUnit(endValue);
- }
- endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit);
- this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p);
- props.push(p);
- inlineProps.push(p, 0, style[p]);
- } else if (type !== "undefined") {
- if (startAt && p in startAt) {
- startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p];
- _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue));
- getUnit(startValue + "") || startValue === "auto" || (startValue += _config.units[p] || getUnit(_get(target, p)) || "");
- (startValue + "").charAt(1) === "=" && (startValue = _get(target, p));
- } else {
- startValue = _get(target, p);
- }
- startNum = parseFloat(startValue);
- relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2);
- relative && (endValue = endValue.substr(2));
- endNum = parseFloat(endValue);
- if (p in _propertyAliases) {
- if (p === "autoAlpha") {
- if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) {
- startNum = 0;
- }
- inlineProps.push("visibility", 0, style.visibility);
- _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum);
- }
- if (p !== "scale" && p !== "transform") {
- p = _propertyAliases[p];
- ~p.indexOf(",") && (p = p.split(",")[0]);
- }
- }
- isTransformRelated = p in _transformProps;
- if (isTransformRelated) {
- this.styles.save(p);
- if (!transformPropTween) {
- cache = target._gsap;
- cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform);
- smooth = vars.smoothOrigin !== false && cache.smooth;
- transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1);
- transformPropTween.dep = 1;
- }
- if (p === "scale") {
- this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp);
- this._pt.u = 0;
- props.push("scaleY", p);
- p += "X";
- } else if (p === "transformOrigin") {
- inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]);
- endValue = _convertKeywordsToPercentages(endValue);
- if (cache.svg) {
- _applySVGOrigin(target, endValue, 0, smooth, 0, this);
- } else {
- endUnit = parseFloat(endValue.split(" ")[2]) || 0;
- endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit);
- _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue));
- }
- continue;
- } else if (p === "svgOrigin") {
- _applySVGOrigin(target, endValue, 1, smooth, 0, this);
- continue;
- } else if (p in _rotationalProperties) {
- _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue);
- continue;
- } else if (p === "smoothOrigin") {
- _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue);
- continue;
- } else if (p === "force3D") {
- cache[p] = endValue;
- continue;
- } else if (p === "transform") {
- _addRawTransformPTs(this, endValue, target);
- continue;
- }
- } else if (!(p in style)) {
- p = _checkPropPrefix(p) || p;
- }
- if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) {
- startUnit = (startValue + "").substr((startNum + "").length);
- endNum || (endNum = 0);
- endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit);
- startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit));
- 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);
- this._pt.u = endUnit || 0;
- if (startUnit !== endUnit && endUnit !== "%") {
- this._pt.b = startValue;
- this._pt.r = _renderCSSPropWithBeginning;
- }
- } else if (!(p in style)) {
- if (p in target) {
- this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets);
- } else if (p !== "parseTransform") {
- _missingPlugin(p, endValue);
- continue;
- }
- } else {
- _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue);
- }
- isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : inlineProps.push(p, 1, startValue || target[p]));
- props.push(p);
- }
- }
- hasPriority && _sortPropTweensByPriority(this);
- },
- render: function render(ratio, data) {
- if (data.tween._time || !_reverting$1()) {
- var pt = data._pt;
- while (pt) {
- pt.r(ratio, pt.d);
- pt = pt._next;
- }
- } else {
- data.styles.revert();
- }
- },
- get: _get,
- aliases: _propertyAliases,
- getSetter: function getSetter(target, property, plugin) {
- var p = _propertyAliases[property];
- p && p.indexOf(",") < 0 && (property = p);
- 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);
- },
- core: {
- _removeProperty: _removeProperty,
- _getMatrix: _getMatrix
- }
- };
- gsap.utils.checkPrefix = _checkPropPrefix;
- gsap.core.getStyleSaver = _getStyleSaver;
- (function (positionAndScale, rotation, others, aliases) {
- var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) {
- _transformProps[name] = 1;
- });
- _forEachName(rotation, function (name) {
- _config.units[name] = "deg";
- _rotationalProperties[name] = 1;
- });
- _propertyAliases[all[13]] = positionAndScale + "," + rotation;
- _forEachName(aliases, function (name) {
- var split = name.split(":");
- _propertyAliases[split[1]] = all[split[0]];
- });
- })("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");
- _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) {
- _config.units[name] = "px";
- });
- gsap.registerPlugin(CSSPlugin);
- var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap,
- TweenMaxWithCSS = gsapWithCSS.core.Tween;
- exports.Back = Back;
- exports.Bounce = Bounce;
- exports.CSSPlugin = CSSPlugin;
- exports.Circ = Circ;
- exports.Cubic = Cubic;
- exports.Elastic = Elastic;
- exports.Expo = Expo;
- exports.Linear = Linear;
- exports.Power0 = Power0;
- exports.Power1 = Power1;
- exports.Power2 = Power2;
- exports.Power3 = Power3;
- exports.Power4 = Power4;
- exports.Quad = Quad;
- exports.Quart = Quart;
- exports.Quint = Quint;
- exports.Sine = Sine;
- exports.SteppedEase = SteppedEase;
- exports.Strong = Strong;
- exports.TimelineLite = Timeline;
- exports.TimelineMax = Timeline;
- exports.TweenLite = Tween;
- exports.TweenMax = TweenMaxWithCSS;
- exports.default = gsapWithCSS;
- exports.gsap = gsapWithCSS;
- if (typeof(window) === 'undefined' || window !== exports) {Object.defineProperty(exports, '__esModule', { value: true });} else {delete window.default;}
- })));
|