creator.d.ts 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069
  1. /** !#en
  2. The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.
  3. !#zh
  4. Cocos 引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。 */
  5. declare namespace cc {
  6. /** The current version of Cocos2d being used.<br/>
  7. Please DO NOT remove this String, it is an important flag for bug tracking.<br/>
  8. If you post a bug to forum, please attach this flag. */
  9. export var ENGINE_VERSION: string;
  10. /**
  11. !#en
  12. Creates the speed action which changes the speed of an action, making it take longer (speed > 1)
  13. or less (speed < 1) time. <br/>
  14. Useful to simulate 'slow motion' or 'fast forward' effect.
  15. !#zh 修改目标动作的速率。
  16. @param action action
  17. @param speed speed
  18. @example
  19. ```js
  20. // change the target action speed;
  21. var action = cc.scaleTo(0.2, 1, 0.6);
  22. var newAction = cc.speed(action, 0.5);
  23. ```
  24. */
  25. export function speed(action: ActionInterval, speed: number): Action;
  26. /**
  27. !#en Create a follow action which makes its target follows another node.
  28. !#zh 追踪目标节点的位置。
  29. @param followedNode followedNode
  30. @param rect rect
  31. @example
  32. ```js
  33. // example
  34. // creates the action with a set boundary
  35. var followAction = cc.follow(targetNode, cc.rect(0, 0, screenWidth * 2 - 100, screenHeight));
  36. node.runAction(followAction);
  37. // creates the action with no boundary set
  38. var followAction = cc.follow(targetNode);
  39. node.runAction(followAction);
  40. ```
  41. */
  42. export function follow(followedNode: Node, rect: Rect): Action;
  43. /**
  44. Points setter
  45. @param points points
  46. */
  47. export function setPoints(points: any[]): void;
  48. /**
  49. !#en Creates an action with a Cardinal Spline array of points and tension.
  50. !#zh 按基数样条曲线轨迹移动到目标位置。
  51. @param duration duration
  52. @param points array of control points
  53. @param tension tension
  54. @example
  55. ```js
  56. //create a cc.CardinalSplineTo
  57. var action1 = cc.cardinalSplineTo(3, array, 0);
  58. ```
  59. */
  60. export function cardinalSplineTo(duration: number, points: any[], tension: number): ActionInterval;
  61. /**
  62. update position of target
  63. @param newPos newPos
  64. */
  65. export function updatePosition(newPos: Vec2): void;
  66. /**
  67. !#en Creates an action with a Cardinal Spline array of points and tension.
  68. !#zh 按基数样条曲线轨迹移动指定的距离。
  69. @param duration duration
  70. @param points points
  71. @param tension tension
  72. */
  73. export function cardinalSplineBy(duration: number, points: any[], tension: number): ActionInterval;
  74. /**
  75. !#en Creates an action with a Cardinal Spline array of points and tension.
  76. !#zh 按 Catmull Rom 样条曲线轨迹移动到目标位置。
  77. @param dt dt
  78. @param points points
  79. @example
  80. ```js
  81. var action1 = cc.catmullRomTo(3, array);
  82. ```
  83. */
  84. export function catmullRomTo(dt: number, points: any[]): ActionInterval;
  85. /**
  86. !#en Creates an action with a Cardinal Spline array of points and tension.
  87. !#zh 按 Catmull Rom 样条曲线轨迹移动指定的距离。
  88. @param dt dt
  89. @param points points
  90. @example
  91. ```js
  92. var action1 = cc.catmullRomBy(3, array);
  93. ```
  94. */
  95. export function catmullRomBy(dt: number, points: any[]): ActionInterval;
  96. /**
  97. !#en
  98. Creates the action easing object with the rate parameter. <br />
  99. From slow to fast.
  100. !#zh 创建 easeIn 缓动对象,由慢到快。
  101. @param rate rate
  102. @example
  103. ```js
  104. action.easing(cc.easeIn(3.0));
  105. ```
  106. */
  107. export function easeIn(rate: number): any;
  108. /**
  109. !#en
  110. Creates the action easing object with the rate parameter. <br />
  111. From fast to slow.
  112. !#zh 创建 easeOut 缓动对象,由快到慢。
  113. @param rate rate
  114. @example
  115. ```js
  116. action.easing(cc.easeOut(3.0));
  117. ```
  118. */
  119. export function easeOut(rate: number): any;
  120. /**
  121. !#en
  122. Creates the action easing object with the rate parameter. <br />
  123. Slow to fast then to slow.
  124. !#zh 创建 easeInOut 缓动对象,慢到快,然后慢。
  125. @param rate rate
  126. @example
  127. ```js
  128. action.easing(cc.easeInOut(3.0));
  129. ```
  130. */
  131. export function easeInOut(rate: number): any;
  132. /**
  133. !#en
  134. Creates the action easing object with the rate parameter. <br />
  135. Reference easeInExpo: <br />
  136. http://www.zhihu.com/question/21981571/answer/19925418
  137. !#zh
  138. 创建 easeExponentialIn 缓动对象。<br />
  139. EaseExponentialIn 是按指数函数缓动进入的动作。<br />
  140. 参考 easeInExpo:http://www.zhihu.com/question/21981571/answer/19925418
  141. @example
  142. ```js
  143. action.easing(cc.easeExponentialIn());
  144. ```
  145. */
  146. export function easeExponentialIn(): any;
  147. /**
  148. !#en
  149. Creates the action easing object. <br />
  150. Reference easeOutExpo: <br />
  151. http://www.zhihu.com/question/21981571/answer/19925418
  152. !#zh
  153. 创建 easeExponentialOut 缓动对象。<br />
  154. EaseExponentialOut 是按指数函数缓动退出的动作。<br />
  155. 参考 easeOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  156. @example
  157. ```js
  158. action.easing(cc.easeExponentialOut());
  159. ```
  160. */
  161. export function easeExponentialOut(): any;
  162. /**
  163. !#en
  164. Creates an EaseExponentialInOut action easing object. <br />
  165. Reference easeInOutExpo: <br />
  166. http://www.zhihu.com/question/21981571/answer/19925418
  167. !#zh
  168. 创建 easeExponentialInOut 缓动对象。<br />
  169. EaseExponentialInOut 是按指数函数缓动进入并退出的动作。<br />
  170. 参考 easeInOutExpo:http://www.zhihu.com/question/21981571/answer/19925418
  171. @example
  172. ```js
  173. action.easing(cc.easeExponentialInOut());
  174. ```
  175. */
  176. export function easeExponentialInOut(): any;
  177. /**
  178. !#en
  179. Creates an EaseSineIn action. <br />
  180. Reference easeInSine: <br />
  181. http://www.zhihu.com/question/21981571/answer/19925418
  182. !#zh
  183. 创建 EaseSineIn 缓动对象。<br />
  184. EaseSineIn 是按正弦函数缓动进入的动作。<br />
  185. 参考 easeInSine:http://www.zhihu.com/question/21981571/answer/19925418
  186. @example
  187. ```js
  188. action.easing(cc.easeSineIn());
  189. ```
  190. */
  191. export function easeSineIn(): any;
  192. /**
  193. !#en
  194. Creates an EaseSineOut action easing object. <br />
  195. Reference easeOutSine: <br />
  196. http://www.zhihu.com/question/21981571/answer/19925418
  197. !#zh
  198. 创建 EaseSineOut 缓动对象。<br />
  199. EaseSineIn 是按正弦函数缓动退出的动作。<br />
  200. 参考 easeOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  201. @example
  202. ```js
  203. action.easing(cc.easeSineOut());
  204. ```
  205. */
  206. export function easeSineOut(): any;
  207. /**
  208. !#en
  209. Creates the action easing object. <br />
  210. Reference easeInOutSine: <br />
  211. http://www.zhihu.com/question/21981571/answer/19925418
  212. !#zh
  213. 创建 easeSineInOut 缓动对象。<br />
  214. EaseSineIn 是按正弦函数缓动进入并退出的动作。<br />
  215. 参考 easeInOutSine:http://www.zhihu.com/question/21981571/answer/19925418
  216. @example
  217. ```js
  218. action.easing(cc.easeSineInOut());
  219. ```
  220. */
  221. export function easeSineInOut(): any;
  222. /**
  223. !#en
  224. Creates the action easing object with the period in radians (default is 0.3). <br />
  225. Reference easeInElastic: <br />
  226. http://www.zhihu.com/question/21981571/answer/19925418
  227. !#zh
  228. 创建 easeElasticIn 缓动对象。<br />
  229. EaseElasticIn 是按弹性曲线缓动进入的动作。<br />
  230. 参数 easeInElastic:http://www.zhihu.com/question/21981571/answer/19925418
  231. @param period period
  232. @example
  233. ```js
  234. // example
  235. action.easing(cc.easeElasticIn(3.0));
  236. ```
  237. */
  238. export function easeElasticIn(period: number): any;
  239. /**
  240. !#en
  241. Creates the action easing object with the period in radians (default is 0.3). <br />
  242. Reference easeOutElastic: <br />
  243. http://www.zhihu.com/question/21981571/answer/19925418
  244. !#zh
  245. 创建 easeElasticOut 缓动对象。<br />
  246. EaseElasticOut 是按弹性曲线缓动退出的动作。<br />
  247. 参考 easeOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  248. @param period period
  249. @example
  250. ```js
  251. // example
  252. action.easing(cc.easeElasticOut(3.0));
  253. ```
  254. */
  255. export function easeElasticOut(period: number): any;
  256. /**
  257. !#en
  258. Creates the action easing object with the period in radians (default is 0.3). <br />
  259. Reference easeInOutElastic: <br />
  260. http://www.zhihu.com/question/21981571/answer/19925418
  261. !#zh
  262. 创建 easeElasticInOut 缓动对象。<br />
  263. EaseElasticInOut 是按弹性曲线缓动进入并退出的动作。<br />
  264. 参考 easeInOutElastic:http://www.zhihu.com/question/21981571/answer/19925418
  265. @param period period
  266. @example
  267. ```js
  268. // example
  269. action.easing(cc.easeElasticInOut(3.0));
  270. ```
  271. */
  272. export function easeElasticInOut(period: number): any;
  273. /**
  274. !#en
  275. Creates the action easing object. <br />
  276. Eased bounce effect at the beginning.
  277. !#zh
  278. 创建 easeBounceIn 缓动对象。<br />
  279. EaseBounceIn 是按弹跳动作缓动进入的动作。
  280. @example
  281. ```js
  282. // example
  283. action.easing(cc.easeBounceIn());
  284. ```
  285. */
  286. export function easeBounceIn(): any;
  287. /**
  288. !#en
  289. Creates the action easing object. <br />
  290. Eased bounce effect at the ending.
  291. !#zh
  292. 创建 easeBounceOut 缓动对象。<br />
  293. EaseBounceOut 是按弹跳动作缓动退出的动作。
  294. @example
  295. ```js
  296. // example
  297. action.easing(cc.easeBounceOut());
  298. ```
  299. */
  300. export function easeBounceOut(): any;
  301. /**
  302. !#en
  303. Creates the action easing object. <br />
  304. Eased bounce effect at the begining and ending.
  305. !#zh
  306. 创建 easeBounceInOut 缓动对象。<br />
  307. EaseBounceInOut 是按弹跳动作缓动进入并退出的动作。
  308. @example
  309. ```js
  310. // example
  311. action.easing(cc.easeBounceInOut());
  312. ```
  313. */
  314. export function easeBounceInOut(): any;
  315. /**
  316. !#en
  317. Creates the action easing object. <br />
  318. In the opposite direction to move slowly, and then accelerated to the right direction.
  319. !#zh
  320. 创建 easeBackIn 缓动对象。<br />
  321. easeBackIn 是在相反的方向缓慢移动,然后加速到正确的方向。<br />
  322. @example
  323. ```js
  324. // example
  325. action.easing(cc.easeBackIn());
  326. ```
  327. */
  328. export function easeBackIn(): any;
  329. /**
  330. !#en
  331. Creates the action easing object. <br />
  332. Fast moving more than the finish, and then slowly back to the finish.
  333. !#zh
  334. 创建 easeBackOut 缓动对象。<br />
  335. easeBackOut 快速移动超出目标,然后慢慢回到目标点。
  336. @example
  337. ```js
  338. // example
  339. action.easing(cc.easeBackOut());
  340. ```
  341. */
  342. export function easeBackOut(): any;
  343. /**
  344. !#en
  345. Creates the action easing object. <br />
  346. Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
  347. !#zh
  348. 创建 easeBackInOut 缓动对象。<br />
  349. @example
  350. ```js
  351. // example
  352. action.easing(cc.easeBackInOut());
  353. ```
  354. */
  355. export function easeBackInOut(): any;
  356. /**
  357. !#en
  358. Creates the action easing object. <br />
  359. Into the 4 reference point. <br />
  360. To calculate the motion curve.
  361. !#zh
  362. 创建 easeBezierAction 缓动对象。<br />
  363. EaseBezierAction 是按贝塞尔曲线缓动的动作。
  364. @param p0 The first bezier parameter
  365. @param p1 The second bezier parameter
  366. @param p2 The third bezier parameter
  367. @param p3 The fourth bezier parameter
  368. @example
  369. ```js
  370. // example
  371. action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
  372. ```
  373. */
  374. export function easeBezierAction(p0: number, p1: number, p2: number, p3: number): any;
  375. /**
  376. !#en
  377. Creates the action easing object. <br />
  378. Reference easeInQuad: <br />
  379. http://www.zhihu.com/question/21981571/answer/19925418
  380. !#zh
  381. 创建 easeQuadraticActionIn 缓动对象。<br />
  382. EaseQuadraticIn是按二次函数缓动进入的动作。<br />
  383. 参考 easeInQuad:http://www.zhihu.com/question/21981571/answer/19925418
  384. @example
  385. ```js
  386. //example
  387. action.easing(cc.easeQuadraticActionIn());
  388. ```
  389. */
  390. export function easeQuadraticActionIn(): any;
  391. /**
  392. !#en
  393. Creates the action easing object. <br />
  394. Reference easeOutQuad: <br />
  395. http://www.zhihu.com/question/21981571/answer/19925418
  396. !#zh
  397. 创建 easeQuadraticActionOut 缓动对象。<br />
  398. EaseQuadraticOut 是按二次函数缓动退出的动作。<br />
  399. 参考 easeOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  400. @example
  401. ```js
  402. //example
  403. action.easing(cc.easeQuadraticActionOut());
  404. ```
  405. */
  406. export function easeQuadraticActionOut(): any;
  407. /**
  408. !#en
  409. Creates the action easing object. <br />
  410. Reference easeInOutQuad: <br />
  411. http://www.zhihu.com/question/21981571/answer/19925418
  412. !#zh
  413. 创建 easeQuadraticActionInOut 缓动对象。<br />
  414. EaseQuadraticInOut 是按二次函数缓动进入并退出的动作。<br />
  415. 参考 easeInOutQuad:http://www.zhihu.com/question/21981571/answer/19925418
  416. @example
  417. ```js
  418. //example
  419. action.easing(cc.easeQuadraticActionInOut());
  420. ```
  421. */
  422. export function easeQuadraticActionInOut(): any;
  423. /**
  424. !#en
  425. Creates the action easing object. <br />
  426. Reference easeIntQuart: <br />
  427. http://www.zhihu.com/question/21981571/answer/19925418
  428. !#zh
  429. 创建 easeQuarticActionIn 缓动对象。<br />
  430. EaseQuarticIn 是按四次函数缓动进入的动作。<br />
  431. 参考 easeIntQuart:http://www.zhihu.com/question/21981571/answer/19925418
  432. @example
  433. ```js
  434. //example
  435. action.easing(cc.easeQuarticActionIn());
  436. ```
  437. */
  438. export function easeQuarticActionIn(): any;
  439. /**
  440. !#en
  441. Creates the action easing object. <br />
  442. Reference easeOutQuart: <br />
  443. http://www.zhihu.com/question/21981571/answer/19925418
  444. !#zh
  445. 创建 easeQuarticActionOut 缓动对象。<br />
  446. EaseQuarticOut 是按四次函数缓动退出的动作。<br />
  447. 参考 easeOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  448. @example
  449. ```js
  450. //example
  451. action.easing(cc.QuarticActionOut());
  452. ```
  453. */
  454. export function easeQuarticActionOut(): any;
  455. /**
  456. !#en
  457. Creates the action easing object. <br />
  458. Reference easeInOutQuart: <br />
  459. http://www.zhihu.com/question/21981571/answer/19925418
  460. !#zh
  461. 创建 easeQuarticActionInOut 缓动对象。<br />
  462. EaseQuarticInOut 是按四次函数缓动进入并退出的动作。<br />
  463. 参考 easeInOutQuart:http://www.zhihu.com/question/21981571/answer/19925418
  464. */
  465. export function easeQuarticActionInOut(): any;
  466. /**
  467. !#en
  468. Creates the action easing object. <br />
  469. Reference easeInQuint: <br />
  470. http://www.zhihu.com/question/21981571/answer/19925418
  471. !#zh
  472. 创建 easeQuinticActionIn 缓动对象。<br />
  473. EaseQuinticIn 是按五次函数缓动进的动作。<br />
  474. 参考 easeInQuint:http://www.zhihu.com/question/21981571/answer/19925418
  475. @example
  476. ```js
  477. //example
  478. action.easing(cc.easeQuinticActionIn());
  479. ```
  480. */
  481. export function easeQuinticActionIn(): any;
  482. /**
  483. !#en
  484. Creates the action easing object. <br />
  485. Reference easeOutQuint: <br />
  486. http://www.zhihu.com/question/21981571/answer/19925418
  487. !#zh
  488. 创建 easeQuinticActionOut 缓动对象。<br />
  489. EaseQuinticOut 是按五次函数缓动退出的动作
  490. 参考 easeOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  491. @example
  492. ```js
  493. //example
  494. action.easing(cc.easeQuadraticActionOut());
  495. ```
  496. */
  497. export function easeQuinticActionOut(): any;
  498. /**
  499. !#en
  500. Creates the action easing object. <br />
  501. Reference easeInOutQuint: <br />
  502. http://www.zhihu.com/question/21981571/answer/19925418
  503. !#zh
  504. 创建 easeQuinticActionInOut 缓动对象。<br />
  505. EaseQuinticInOut是按五次函数缓动进入并退出的动作。<br />
  506. 参考 easeInOutQuint:http://www.zhihu.com/question/21981571/answer/19925418
  507. @example
  508. ```js
  509. //example
  510. action.easing(cc.easeQuinticActionInOut());
  511. ```
  512. */
  513. export function easeQuinticActionInOut(): any;
  514. /**
  515. !#en
  516. Creates the action easing object. <br />
  517. Reference easeInCirc: <br />
  518. http://www.zhihu.com/question/21981571/answer/19925418
  519. !#zh
  520. 创建 easeCircleActionIn 缓动对象。<br />
  521. EaseCircleIn是按圆形曲线缓动进入的动作。<br />
  522. 参考 easeInCirc:http://www.zhihu.com/question/21981571/answer/19925418
  523. @example
  524. ```js
  525. //example
  526. action.easing(cc.easeCircleActionIn());
  527. ```
  528. */
  529. export function easeCircleActionIn(): any;
  530. /**
  531. !#en
  532. Creates the action easing object. <br />
  533. Reference easeOutCirc: <br />
  534. http://www.zhihu.com/question/21981571/answer/19925418
  535. !#zh
  536. 创建 easeCircleActionOut 缓动对象。<br />
  537. EaseCircleOut是按圆形曲线缓动退出的动作。<br />
  538. 参考 easeOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  539. @example
  540. ```js
  541. //example
  542. actioneasing(cc.easeCircleActionOut());
  543. ```
  544. */
  545. export function easeCircleActionOut(): any;
  546. /**
  547. !#en
  548. Creates the action easing object. <br />
  549. Reference easeInOutCirc: <br />
  550. http://www.zhihu.com/question/21981571/answer/19925418
  551. !#zh
  552. 创建 easeCircleActionInOut 缓动对象。<br />
  553. EaseCircleInOut 是按圆形曲线缓动进入并退出的动作。<br />
  554. 参考 easeInOutCirc:http://www.zhihu.com/question/21981571/answer/19925418
  555. @example
  556. ```js
  557. //example
  558. action.easing(cc.easeCircleActionInOut());
  559. ```
  560. */
  561. export function easeCircleActionInOut(): any;
  562. /**
  563. !#en
  564. Creates the action easing object. <br />
  565. Reference easeInCubic: <br />
  566. http://www.zhihu.com/question/21981571/answer/19925418
  567. !#zh
  568. 创建 easeCubicActionIn 缓动对象。<br />
  569. EaseCubicIn 是按三次函数缓动进入的动作。<br />
  570. 参考 easeInCubic:http://www.zhihu.com/question/21981571/answer/19925418
  571. @example
  572. ```js
  573. //example
  574. action.easing(cc.easeCubicActionIn());
  575. ```
  576. */
  577. export function easeCubicActionIn(): any;
  578. /**
  579. !#en
  580. Creates the action easing object. <br />
  581. Reference easeOutCubic: <br />
  582. http://www.zhihu.com/question/21981571/answer/19925418
  583. !#zh
  584. 创建 easeCubicActionOut 缓动对象。<br />
  585. EaseCubicOut 是按三次函数缓动退出的动作。<br />
  586. 参考 easeOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  587. @example
  588. ```js
  589. //example
  590. action.easing(cc.easeCubicActionOut());
  591. ```
  592. */
  593. export function easeCubicActionOut(): any;
  594. /**
  595. !#en
  596. Creates the action easing object. <br />
  597. Reference easeInOutCubic: <br />
  598. http://www.zhihu.com/question/21981571/answer/19925418
  599. !#zh
  600. 创建 easeCubicActionInOut 缓动对象。<br />
  601. EaseCubicInOut是按三次函数缓动进入并退出的动作。<br />
  602. 参考 easeInOutCubic:http://www.zhihu.com/question/21981571/answer/19925418
  603. */
  604. export function easeCubicActionInOut(): any;
  605. /**
  606. !#en Show the Node.
  607. !#zh 立即显示。
  608. @example
  609. ```js
  610. // example
  611. var showAction = cc.show();
  612. ```
  613. */
  614. export function show(): ActionInstant;
  615. /**
  616. !#en Hide the node.
  617. !#zh 立即隐藏。
  618. @example
  619. ```js
  620. // example
  621. var hideAction = cc.hide();
  622. ```
  623. */
  624. export function hide(): ActionInstant;
  625. /**
  626. !#en Toggles the visibility of a node.
  627. !#zh 显隐状态切换。
  628. @example
  629. ```js
  630. // example
  631. var toggleVisibilityAction = cc.toggleVisibility();
  632. ```
  633. */
  634. export function toggleVisibility(): ActionInstant;
  635. /**
  636. !#en Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
  637. !#zh 从父节点移除自身。
  638. @param isNeedCleanUp isNeedCleanUp
  639. @example
  640. ```js
  641. // example
  642. var removeSelfAction = cc.removeSelf();
  643. ```
  644. */
  645. export function removeSelf(isNeedCleanUp ?: boolean): ActionInstant;
  646. /**
  647. !#en Destroy self
  648. !#zh 创建一个销毁自身的动作。
  649. @example
  650. ```js
  651. var destroySelfAction = cc.destroySelf();
  652. ```
  653. */
  654. export function destroySelf(): ActionInstant;
  655. /**
  656. !#en Create a FlipX action to flip or unflip the target.
  657. !#zh X轴翻转。
  658. @param flip Indicate whether the target should be flipped or not
  659. @example
  660. ```js
  661. var flipXAction = cc.flipX(true);
  662. ```
  663. */
  664. export function flipX(flip: boolean): ActionInstant;
  665. /**
  666. !#en Create a FlipY action to flip or unflip the target.
  667. !#zh Y轴翻转。
  668. @param flip flip
  669. @example
  670. ```js
  671. var flipYAction = cc.flipY(true);
  672. ```
  673. */
  674. export function flipY(flip: boolean): ActionInstant;
  675. /**
  676. !#en Creates a Place action with a position.
  677. !#zh 放置在目标位置。
  678. @param pos pos
  679. @param y y
  680. @example
  681. ```js
  682. // example
  683. var placeAction = cc.place(cc.v2(200, 200));
  684. var placeAction = cc.place(200, 200);
  685. ```
  686. */
  687. export function place(pos: Vec2|number, y?: number): ActionInstant;
  688. /**
  689. !#en Creates the action with the callback.
  690. !#zh 执行回调函数。
  691. @param selector selector
  692. @param selectorTarget selectorTarget
  693. @param data data for function, it accepts all data types.
  694. @example
  695. ```js
  696. // example
  697. // CallFunc without data
  698. var finish = cc.callFunc(this.removeSprite, this);
  699. // CallFunc with data
  700. var finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini, true);
  701. ```
  702. */
  703. export function callFunc(selector: Function, selectorTarget?: any, data?: any): ActionInstant;
  704. /**
  705. !#en
  706. Helper constructor to create an array of sequenceable actions
  707. The created action will run actions sequentially, one after another.
  708. !#zh 顺序执行动作,创建的动作将按顺序依次运行。
  709. @param actionOrActionArray actionOrActionArray
  710. @param tempArray tempArray
  711. @example
  712. ```js
  713. // example
  714. // create sequence with actions
  715. var seq = cc.sequence(act1, act2);
  716. // create sequence with array
  717. var seq = cc.sequence(actArray);
  718. ```
  719. */
  720. export function sequence(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): ActionInterval;
  721. /**
  722. !#en Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
  723. !#zh 重复动作,可以按一定次数重复一个动,如果想永远重复一个动作请使用 repeatForever 动作来完成。
  724. @param action action
  725. @param times times
  726. @example
  727. ```js
  728. // example
  729. var rep = cc.repeat(cc.sequence(jump2, jump1), 5);
  730. ```
  731. */
  732. export function repeat(action: FiniteTimeAction, times: number): ActionInterval;
  733. /**
  734. !#en Create a acton which repeat forever, as it runs forever, it can't be added into cc.sequence and cc.spawn.
  735. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 repeat 动作,由于这个动作不会停止,所以不能被添加到 cc.sequence 或 cc.spawn 中。
  736. @param action action
  737. @example
  738. ```js
  739. // example
  740. var repeat = cc.repeatForever(cc.rotateBy(1.0, 360));
  741. ```
  742. */
  743. export function repeatForever(action: FiniteTimeAction): ActionInterval;
  744. /**
  745. !#en Create a spawn action which runs several actions in parallel.
  746. !#zh 同步执行动作,同步执行一组动作。
  747. @param actionOrActionArray actionOrActionArray
  748. @param tempArray tempArray
  749. @example
  750. ```js
  751. // example
  752. var action = cc.spawn(cc.jumpBy(2, cc.v2(300, 0), 50, 4), cc.rotateBy(2, 720));
  753. todo: It should be the direct use new
  754. ```
  755. */
  756. export function spawn(actionOrActionArray: FiniteTimeAction|FiniteTimeAction[], ...tempArray: FiniteTimeAction[]): FiniteTimeAction;
  757. /**
  758. !#en
  759. Rotates a Node object to a certain angle by modifying its angle property. <br/>
  760. The direction will be decided by the shortest angle.
  761. !#zh 旋转到目标角度,通过逐帧修改它的 angle 属性,旋转方向将由最短的角度决定。
  762. @param duration duration in seconds
  763. @param dstAngle dstAngle in degrees.
  764. @example
  765. ```js
  766. // example
  767. var rotateTo = cc.rotateTo(2, 61.0);
  768. ```
  769. */
  770. export function rotateTo(duration: number, dstAngle: number): ActionInterval;
  771. /**
  772. !#en
  773. Rotates a Node object clockwise a number of degrees by modifying its angle property.
  774. Relative to its properties to modify.
  775. !#zh 旋转指定的角度。
  776. @param duration duration in seconds
  777. @param deltaAngle deltaAngle in degrees
  778. @example
  779. ```js
  780. // example
  781. var actionBy = cc.rotateBy(2, 360);
  782. ```
  783. */
  784. export function rotateBy(duration: number, deltaAngle: number): ActionInterval;
  785. /**
  786. !#en
  787. Moves a Node object x,y pixels by modifying its position property. <br/>
  788. x and y are relative to the position of the object. <br/>
  789. Several MoveBy actions can be concurrently called, and the resulting <br/>
  790. movement will be the sum of individual movements.
  791. !#zh 移动指定的距离。
  792. @param duration duration in seconds
  793. @param deltaPos deltaPos
  794. @param deltaY deltaY
  795. @example
  796. ```js
  797. // example
  798. var actionTo = cc.moveBy(2, cc.v2(windowSize.width - 40, windowSize.height - 40));
  799. ```
  800. */
  801. export function moveBy(duration: number, deltaPos: Vec2|number, deltaY?: number): ActionInterval;
  802. /**
  803. !#en
  804. Moves a Node object to the position x,y. x and y are absolute coordinates by modifying its position property. <br/>
  805. Several MoveTo actions can be concurrently called, and the resulting <br/>
  806. movement will be the sum of individual movements.
  807. !#zh 移动到目标位置。
  808. @param duration duration in seconds
  809. @param position position
  810. @param y y
  811. @example
  812. ```js
  813. // example
  814. var actionBy = cc.moveTo(2, cc.v2(80, 80));
  815. ```
  816. */
  817. export function moveTo(duration: number, position: Vec2|number, y?: number): ActionInterval;
  818. /**
  819. !#en
  820. Create a action which skews a Node object to given angles by modifying its skewX and skewY properties.
  821. Changes to the specified value.
  822. !#zh 偏斜到目标角度。
  823. @param t time in seconds
  824. @param sx sx
  825. @param sy sy
  826. @example
  827. ```js
  828. // example
  829. var actionTo = cc.skewTo(2, 37.2, -37.2);
  830. ```
  831. */
  832. export function skewTo(t: number, sx: number, sy: number): ActionInterval;
  833. /**
  834. !#en
  835. Skews a Node object by skewX and skewY degrees. <br />
  836. Relative to its property modification.
  837. !#zh 偏斜指定的角度。
  838. @param t time in seconds
  839. @param sx sx skew in degrees for X axis
  840. @param sy sy skew in degrees for Y axis
  841. @example
  842. ```js
  843. // example
  844. var actionBy = cc.skewBy(2, 0, -90);
  845. ```
  846. */
  847. export function skewBy(t: number, sx: number, sy: number): ActionInterval;
  848. /**
  849. !#en
  850. Moves a Node object simulating a parabolic jump movement by modifying it's position property.
  851. Relative to its movement.
  852. !#zh 用跳跃的方式移动指定的距离。
  853. @param duration duration
  854. @param position position
  855. @param y y
  856. @param height height
  857. @param jumps jumps
  858. @example
  859. ```js
  860. // example
  861. var actionBy = cc.jumpBy(2, cc.v2(300, 0), 50, 4);
  862. var actionBy = cc.jumpBy(2, 300, 0, 50, 4);
  863. ```
  864. */
  865. export function jumpBy(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  866. /**
  867. !#en
  868. Moves a Node object to a parabolic position simulating a jump movement by modifying its position property. <br />
  869. Jump to the specified location.
  870. !#zh 用跳跃的方式移动到目标位置。
  871. @param duration duration
  872. @param position position
  873. @param y y
  874. @param height height
  875. @param jumps jumps
  876. @example
  877. ```js
  878. // example
  879. var actionTo = cc.jumpTo(2, cc.v2(300, 300), 50, 4);
  880. var actionTo = cc.jumpTo(2, 300, 300, 50, 4);
  881. ```
  882. */
  883. export function jumpTo(duration: number, position: Vec2|number, y?: number, height?: number, jumps?: number): ActionInterval;
  884. /**
  885. !#en
  886. An action that moves the target with a cubic Bezier curve by a certain distance.
  887. Relative to its movement.
  888. !#zh 按贝赛尔曲线轨迹移动指定的距离。
  889. @param t time in seconds
  890. @param c Array of points
  891. @example
  892. ```js
  893. // example
  894. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  895. var bezierForward = cc.bezierBy(3, bezier);
  896. ```
  897. */
  898. export function bezierBy(t: number, c: Vec2[]): ActionInterval;
  899. /**
  900. !#en An action that moves the target with a cubic Bezier curve to a destination point.
  901. !#zh 按贝赛尔曲线轨迹移动到目标位置。
  902. @param t t
  903. @param c Array of points
  904. @example
  905. ```js
  906. // example
  907. var bezier = [cc.v2(0, windowSize.height / 2), cc.v2(300, -windowSize.height / 2), cc.v2(300, 100)];
  908. var bezierTo = cc.bezierTo(2, bezier);
  909. ```
  910. */
  911. export function bezierTo(t: number, c: Vec2[]): ActionInterval;
  912. /**
  913. !#en Scales a Node object to a zoom factor by modifying it's scale property.
  914. !#zh 将节点大小缩放到指定的倍数。
  915. @param duration duration
  916. @param sx scale parameter in X
  917. @param sy scale parameter in Y, if Null equal to sx
  918. @example
  919. ```js
  920. // example
  921. // It scales to 0.5 in both X and Y.
  922. var actionTo = cc.scaleTo(2, 0.5);
  923. // It scales to 0.5 in x and 2 in Y
  924. var actionTo = cc.scaleTo(2, 0.5, 2);
  925. ```
  926. */
  927. export function scaleTo(duration: number, sx: number, sy?: number): ActionInterval;
  928. /**
  929. !#en
  930. Scales a Node object a zoom factor by modifying it's scale property.
  931. Relative to its changes.
  932. !#zh 按指定的倍数缩放节点大小。
  933. @param duration duration in seconds
  934. @param sx sx scale parameter in X
  935. @param sy sy scale parameter in Y, if Null equal to sx
  936. @example
  937. ```js
  938. // example without sy, it scales by 2 both in X and Y
  939. var actionBy = cc.scaleBy(2, 2);
  940. //example with sy, it scales by 0.25 in X and 4.5 in Y
  941. var actionBy2 = cc.scaleBy(2, 0.25, 4.5);
  942. ```
  943. */
  944. export function scaleBy(duration: number, sx: number, sy?: number|void): ActionInterval;
  945. /**
  946. !#en Blinks a Node object by modifying it's visible property.
  947. !#zh 闪烁(基于透明度)。
  948. @param duration duration in seconds
  949. @param blinks blinks in times
  950. @example
  951. ```js
  952. // example
  953. var action = cc.blink(2, 10);
  954. ```
  955. */
  956. export function blink(duration: number, blinks: number): ActionInterval;
  957. /**
  958. !#en
  959. Fades an object that implements the cc.RGBAProtocol protocol.
  960. It modifies the opacity from the current value to a custom one.
  961. !#zh 修改透明度到指定值。
  962. @param duration duration
  963. @param opacity 0-255, 0 is transparent
  964. @example
  965. ```js
  966. // example
  967. var action = cc.fadeTo(1.0, 0);
  968. ```
  969. */
  970. export function fadeTo(duration: number, opacity: number): ActionInterval;
  971. /**
  972. !#en Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
  973. !#zh 渐显效果。
  974. @param duration duration in seconds
  975. @example
  976. ```js
  977. //example
  978. var action = cc.fadeIn(1.0);
  979. ```
  980. */
  981. export function fadeIn(duration: number): ActionInterval;
  982. /**
  983. !#en Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
  984. !#zh 渐隐效果。
  985. @param d duration in seconds
  986. @example
  987. ```js
  988. // example
  989. var action = cc.fadeOut(1.0);
  990. ```
  991. */
  992. export function fadeOut(d: number): ActionInterval;
  993. /**
  994. !#en Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  995. !#zh 修改颜色到指定值。
  996. @param duration duration
  997. @param red 0-255
  998. @param green 0-255
  999. @param blue 0-255
  1000. @example
  1001. ```js
  1002. // example
  1003. var action = cc.tintTo(2, 255, 0, 255);
  1004. ```
  1005. */
  1006. export function tintTo(duration: number, red: number, green: number, blue: number): ActionInterval;
  1007. /**
  1008. !#en
  1009. Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one.
  1010. Relative to their own color change.
  1011. !#zh 按照指定的增量修改颜色。
  1012. @param duration duration in seconds
  1013. @param deltaRed deltaRed
  1014. @param deltaGreen deltaGreen
  1015. @param deltaBlue deltaBlue
  1016. @example
  1017. ```js
  1018. // example
  1019. var action = cc.tintBy(2, -127, -255, -127);
  1020. ```
  1021. */
  1022. export function tintBy(duration: number, deltaRed: number, deltaGreen: number, deltaBlue: number): ActionInterval;
  1023. /**
  1024. !#en Delays the action a certain amount of seconds.
  1025. !#zh 延迟指定的时间量。
  1026. @param d duration in seconds
  1027. @example
  1028. ```js
  1029. // example
  1030. var delay = cc.delayTime(1);
  1031. ```
  1032. */
  1033. export function delayTime(d: number): ActionInterval;
  1034. /**
  1035. !#en Executes an action in reverse order, from time=duration to time=0.
  1036. !#zh 反转目标动作的时间轴。
  1037. @param action action
  1038. @example
  1039. ```js
  1040. // example
  1041. var reverse = cc.reverseTime(this);
  1042. ```
  1043. */
  1044. export function reverseTime(action: FiniteTimeAction): ActionInterval;
  1045. /**
  1046. !#en Create an action with the specified action and forced target.
  1047. !#zh 用已有动作和一个新的目标节点创建动作。
  1048. @param target target
  1049. @param action action
  1050. */
  1051. export function targetedAction(target: Node, action: FiniteTimeAction): ActionInterval;
  1052. /**
  1053. @param target the target to animate
  1054. */
  1055. export function tween<T> (target?: T) : Tween<T>;
  1056. /** !#en This is a Easing instance.
  1057. !#zh 这是一个 Easing 类实例。 */
  1058. export var easing: Easing;
  1059. /**
  1060. !#en
  1061. Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>
  1062. - In Cocos Creator, error is red.<br/>
  1063. - In Chrome, error have a red icon along with red message text.<br/>
  1064. !#zh
  1065. 输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>
  1066. - 在 Cocos Creator 中,错误信息显示是红色的。<br/>
  1067. - 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
  1068. @param msg A JavaScript string containing zero or more substitution strings.
  1069. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1070. */
  1071. export function error(msg: any, ...subst: any[]): void;
  1072. /**
  1073. !#en
  1074. Outputs a warning message to the Cocos Creator Console (editor) or Web Console (runtime).
  1075. - In Cocos Creator, warning is yellow.
  1076. - In Chrome, warning have a yellow warning icon with the message text.
  1077. !#zh
  1078. 输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。<br/>
  1079. - 在 Cocos Creator 中,警告信息显示是黄色的。<br/>
  1080. - 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。<br/>
  1081. @param msg A JavaScript string containing zero or more substitution strings.
  1082. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1083. */
  1084. export function warn(msg: any, ...subst: any[]): void;
  1085. /**
  1086. !#en Outputs a message to the Cocos Creator Console (editor) or Web Console (runtime).
  1087. !#zh 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。
  1088. @param msg A JavaScript string containing zero or more substitution strings.
  1089. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  1090. */
  1091. export function log(msg: string|any, ...subst: any[]): void;
  1092. /** !#en Director
  1093. !#zh 导演类。 */
  1094. export var director: Director;
  1095. /** !#en This is a Game instance.
  1096. !#zh 这是一个 Game 类的实例,包含游戏主体信息并负责驱动游戏的游戏对象。。 */
  1097. export var game: Game;
  1098. export var assetManager: AssetManager;
  1099. /** !#en
  1100. cc.resources is a bundle and controls all asset under assets/resources
  1101. !#zh
  1102. cc.resources 是一个 bundle,用于管理所有在 assets/resources 下的资源 */
  1103. export var resources: AssetManager.Bundle;
  1104. /**
  1105. !#en
  1106. Rotates a Node object to a certain angle by modifying its quternion property. <br/>
  1107. The direction will be decided by the shortest angle.
  1108. !#zh 旋转到目标角度,通过逐帧修改它的 quternion 属性,旋转方向将由最短的角度决定。
  1109. @param duration duration in seconds
  1110. @param dstAngleX dstAngleX in degrees.
  1111. @param dstAngleY dstAngleY in degrees.
  1112. @param dstAngleZ dstAngleZ in degrees.
  1113. @example
  1114. ```js
  1115. // example
  1116. var rotate3DTo = cc.rotate3DTo(2, cc.v3(0, 180, 0));
  1117. ```
  1118. */
  1119. export function rotate3DTo(duration: number, dstAngleX: number|Vec3|Quat, dstAngleY?: number, dstAngleZ?: number): ActionInterval;
  1120. /**
  1121. !#en
  1122. Rotates a Node object counter clockwise a number of degrees by modifying its quaternion property.
  1123. Relative to its properties to modify.
  1124. !#zh 旋转指定的 3D 角度。
  1125. @param duration duration in seconds
  1126. @param deltaAngleX deltaAngleX in degrees
  1127. @param deltaAngleY deltaAngleY in degrees
  1128. @param deltaAngleZ deltaAngleZ in degrees
  1129. @example
  1130. ```js
  1131. // example
  1132. var actionBy = cc.rotate3DBy(2, cc.v3(0, 360, 0));
  1133. ```
  1134. */
  1135. export function rotate3DBy(duration: number, deltaAngleX: number|Vec3, deltaAngleY?: number, deltaAngleZ?: number): ActionInterval;
  1136. /** !#en The System event singleton for global usage
  1137. !#zh 系统事件单例,方便全局使用 */
  1138. export var systemEvent: SystemEvent;
  1139. /**
  1140. !#en Defines a CCClass using the given specification, please see [Class](/docs/editors_and_tools/creator-chapters/scripting/class.html) for details.
  1141. !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/docs/creator/scripting/class.html)。
  1142. @param options options
  1143. @example
  1144. ```js
  1145. // define base class
  1146. var Node = cc.Class();
  1147. // define sub class
  1148. var Sprite = cc.Class({
  1149. name: 'Sprite',
  1150. extends: Node,
  1151. ctor: function () {
  1152. this.url = "";
  1153. this.id = 0;
  1154. },
  1155. statics: {
  1156. // define static members
  1157. count: 0,
  1158. getBounds: function (spriteList) {
  1159. // compute bounds...
  1160. }
  1161. },
  1162. properties {
  1163. width: {
  1164. default: 128,
  1165. type: cc.Integer,
  1166. tooltip: 'The width of sprite'
  1167. },
  1168. height: 128,
  1169. size: {
  1170. get: function () {
  1171. return cc.v2(this.width, this.height);
  1172. }
  1173. }
  1174. },
  1175. load: function () {
  1176. // load this.url...
  1177. };
  1178. });
  1179. // instantiate
  1180. var obj = new Sprite();
  1181. obj.url = 'sprite.png';
  1182. obj.load();
  1183. ```
  1184. */
  1185. export function Class(options?: {name?: string; extends?: Function; ctor?: Function; __ctor__?: Function; properties?: any; statics?: any; mixins?: Function[]; editor?: {executeInEditMode?: boolean; requireComponent?: Function; menu?: string; executionOrder?: number; disallowMultiple?: boolean; playOnFocus?: boolean; inspector?: string; icon?: string; help?: string; }; update?: Function; lateUpdate?: Function; onLoad?: Function; start?: Function; onEnable?: Function; onDisable?: Function; onDestroy?: Function; onFocusInEditor?: Function; onLostFocusInEditor?: Function; resetInEditor?: Function; onRestore?: Function; _getLocalBounds?: Function; }): Function;
  1186. /**
  1187. !#en
  1188. Define an enum type. <br/>
  1189. If a enum item has a value of -1, it will be given an Integer number according to it's order in the list.<br/>
  1190. Otherwise it will use the value specified by user who writes the enum definition.
  1191. !#zh
  1192. 定义一个枚举类型。<br/>
  1193. 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
  1194. @param obj a JavaScript literal object containing enum names and values, or a TypeScript enum type
  1195. @example
  1196. ```js
  1197. // JavaScript:
  1198. var WrapMode = cc.Enum({
  1199. Repeat: -1,
  1200. Clamp: -1
  1201. });
  1202. // Texture.WrapMode.Repeat == 0
  1203. // Texture.WrapMode.Clamp == 1
  1204. // Texture.WrapMode[0] == "Repeat"
  1205. // Texture.WrapMode[1] == "Clamp"
  1206. var FlagType = cc.Enum({
  1207. Flag1: 1,
  1208. Flag2: 2,
  1209. Flag3: 4,
  1210. Flag4: 8,
  1211. });
  1212. var AtlasSizeList = cc.Enum({
  1213. 128: 128,
  1214. 256: 256,
  1215. 512: 512,
  1216. 1024: 1024,
  1217. });
  1218. // TypeScript:
  1219. // If used in TypeScript, just define a TypeScript enum:
  1220. enum Direction {
  1221. Up,
  1222. Down,
  1223. Left,
  1224. Right
  1225. }
  1226. // If you need to inspect the enum in Properties panel, you can call cc.Enum:
  1227. const {ccclass, property} = cc._decorator;
  1228. @ccclass
  1229. class NewScript extends cc.Component {
  1230. @property({
  1231. type: cc.Enum(Direction) // call cc.Enum
  1232. })
  1233. direction: Direction = Direction.Up;
  1234. }
  1235. ```
  1236. */
  1237. export function Enum<T>(obj: T): T;
  1238. /**
  1239. @param touches touches
  1240. */
  1241. export function handleTouchesBegin(touches: any[]): void;
  1242. /**
  1243. @param touches touches
  1244. */
  1245. export function handleTouchesMove(touches: any[]): void;
  1246. /**
  1247. @param touches touches
  1248. */
  1249. export function handleTouchesEnd(touches: any[]): void;
  1250. /**
  1251. @param touches touches
  1252. */
  1253. export function handleTouchesCancel(touches: any[]): void;
  1254. /**
  1255. @param touches touches
  1256. */
  1257. export function getSetOfTouchesEndOrCancel(touches: any[]): any[];
  1258. /**
  1259. @param touch touch
  1260. */
  1261. export function getPreTouch(touch: Touch): Touch;
  1262. /**
  1263. @param touch touch
  1264. */
  1265. export function setPreTouch(touch: Touch): void;
  1266. /**
  1267. @param tx tx
  1268. @param ty ty
  1269. @param pos pos
  1270. */
  1271. export function getTouchByXY(tx: number, ty: number, pos: Vec2): Touch;
  1272. /**
  1273. @param location location
  1274. @param pos pos
  1275. @param eventType eventType
  1276. */
  1277. export function getMouseEvent(location: Vec2, pos: Vec2, eventType: number): Event.EventMouse;
  1278. /**
  1279. @param event event
  1280. @param pos pos
  1281. */
  1282. export function getPointByEvent(event: Touch, pos: Vec2): Vec2;
  1283. /**
  1284. @param event event
  1285. @param pos pos
  1286. */
  1287. export function getTouchesByEvent(event: Touch, pos: Vec2): any[];
  1288. /**
  1289. @param element element
  1290. */
  1291. export function registerSystemEvent(element: HTMLElement): void;
  1292. /**
  1293. @param dt dt
  1294. */
  1295. export function update(dt: number): void;
  1296. /**
  1297. !#en
  1298. Checks whether the object is non-nil and not yet destroyed.<br>
  1299. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  1300. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  1301. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  1302. but this is often caused by a particular logical requirements, which is not normally required.
  1303. !#zh
  1304. 检查该对象是否不为 null 并且尚未销毁。<br>
  1305. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
  1306. @param value value
  1307. @param strictMode If true, Object called destroy() in this frame will also treated as invalid.
  1308. @example
  1309. ```js
  1310. var node = new cc.Node();
  1311. cc.log(cc.isValid(node)); // true
  1312. node.destroy();
  1313. cc.log(cc.isValid(node)); // true, still valid in this frame
  1314. // after a frame...
  1315. cc.log(cc.isValid(node)); // false, destroyed in the end of last frame
  1316. ```
  1317. */
  1318. export function isValid(value: any, strictMode?: boolean): boolean;
  1319. /** !#en cc.view is the shared view object.
  1320. !#zh cc.view 是全局的视图对象。 */
  1321. export var view: View;
  1322. /** !#en cc.winSize is the alias object for the size of the current game window.
  1323. !#zh cc.winSize 为当前的游戏窗口的大小。 */
  1324. export var winSize: Size;
  1325. /** Specify that the input value must be integer in Inspector.
  1326. Also used to indicates that the elements in array should be type integer. */
  1327. export var Integer: string;
  1328. /** Indicates that the elements in array should be type double. */
  1329. export var Float: string;
  1330. /** Indicates that the elements in array should be type boolean. */
  1331. export var Boolean: string;
  1332. /** Indicates that the elements in array should be type string. */
  1333. export var String: string;
  1334. /**
  1335. !#en Deserialize json to cc.Asset
  1336. !#zh 将 JSON 反序列化为对象实例。
  1337. @param data the serialized cc.Asset json string or json object.
  1338. @param details additional loading result
  1339. @param options options
  1340. */
  1341. export function deserialize(data: string|any, details?: Details, options?: any): any;
  1342. /**
  1343. !#en Clones the object `original` and returns the clone, or instantiate a node from the Prefab.
  1344. !#zh 克隆指定的任意类型的对象,或者从 Prefab 实例化出新节点。
  1345. (Instantiate 时,function 和 dom 等非可序列化对象会直接保留原有引用,Asset 会直接进行浅拷贝,可序列化类型会进行深拷贝。)
  1346. @param original An existing object that you want to make a copy of.
  1347. @example
  1348. ```js
  1349. // instantiate node from prefab
  1350. var scene = cc.director.getScene();
  1351. var node = cc.instantiate(prefabAsset);
  1352. node.parent = scene;
  1353. // clone node
  1354. var scene = cc.director.getScene();
  1355. var node = cc.instantiate(targetNode);
  1356. node.parent = scene;
  1357. ```
  1358. */
  1359. export function instantiate(original: Prefab): Node;
  1360. export function instantiate<T>(original: T): T;
  1361. /**
  1362. Finds a node by hierarchy path, the path is case-sensitive.
  1363. It will traverse the hierarchy by splitting the path using '/' character.
  1364. This function will still returns the node even if it is inactive.
  1365. It is recommended to not use this function every frame instead cache the result at startup.
  1366. @param path path
  1367. @param referenceNode referenceNode
  1368. */
  1369. export function find(path: string, referenceNode?: Node): Node;
  1370. /**
  1371. !#en
  1372. The convenience method to create a new {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}}
  1373. Alpha channel is optional. Default value is 255.
  1374. !#zh
  1375. 通过该方法来创建一个新的 {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}} 对象。
  1376. Alpha 通道是可选的。默认值是 255。
  1377. @param r r
  1378. @param g g
  1379. @param b b
  1380. @param a a
  1381. @example
  1382. ```js
  1383. -----------------------
  1384. // 1. All channels seperately as parameters
  1385. var color1 = new cc.Color(255, 255, 255, 255);
  1386. // 2. Convert a hex string to a color
  1387. var color2 = new cc.Color("#000000");
  1388. // 3. An color object as parameter
  1389. var color3 = new cc.Color({r: 255, g: 255, b: 255, a: 255});
  1390. ```
  1391. */
  1392. export function color(r?: number, g?: number, b?: number, a?: number): Color;
  1393. /**
  1394. !#en The convenience method to create a new {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}}.
  1395. !#zh 通过该简便的函数进行创建 {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}} 对象。
  1396. @param m00 Component in column 0, row 0 position (index 0)
  1397. @param m01 Component in column 0, row 1 position (index 1)
  1398. @param m02 Component in column 0, row 2 position (index 2)
  1399. @param m03 Component in column 0, row 3 position (index 3)
  1400. @param m10 Component in column 1, row 0 position (index 4)
  1401. @param m11 Component in column 1, row 1 position (index 5)
  1402. @param m12 Component in column 1, row 2 position (index 6)
  1403. @param m13 Component in column 1, row 3 position (index 7)
  1404. @param m20 Component in column 2, row 0 position (index 8)
  1405. @param m21 Component in column 2, row 1 position (index 9)
  1406. @param m22 Component in column 2, row 2 position (index 10)
  1407. @param m23 Component in column 2, row 3 position (index 11)
  1408. @param m30 Component in column 3, row 0 position (index 12)
  1409. @param m31 Component in column 3, row 1 position (index 13)
  1410. @param m32 Component in column 3, row 2 position (index 14)
  1411. @param m33 Component in column 3, row 3 position (index 15)
  1412. */
  1413. export function mat4(m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number, m30?: number, m31?: number, m32?: number, m33?: number): Mat4;
  1414. /**
  1415. !#en The convenience method to create a new {{#crossLink "Quat"}}cc.Quat{{/crossLink}}.
  1416. !#zh 通过该简便的函数进行创建 {{#crossLink "Quat"}}cc.Quat{{/crossLink}} 对象。
  1417. @param x x
  1418. @param y y
  1419. @param z z
  1420. @param w w
  1421. */
  1422. export function quat(x?: number|any, y?: number, z?: number, w?: number): Quat;
  1423. /**
  1424. !#en
  1425. The convenience method to create a new Rect.
  1426. see {{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1427. !#zh
  1428. 该方法用来快速创建一个新的矩形。{{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1429. @param x x
  1430. @param y y
  1431. @param w w
  1432. @param h h
  1433. @example
  1434. ```js
  1435. var a = new cc.Rect(0 , 0, 10, 0);
  1436. ```
  1437. */
  1438. export function rect(x?: number, y?: number, w?: number, h?: number): Rect;
  1439. /**
  1440. !#en
  1441. Helper function that creates a cc.Size.<br/>
  1442. Please use cc.p or cc.v2 instead, it will soon replace cc.Size.
  1443. !#zh
  1444. 创建一个 cc.Size 对象的帮助函数。<br/>
  1445. 注意:可以使用 cc.p 或者是 cc.v2 代替,它们将很快取代 cc.Size。
  1446. @param w width or a size object
  1447. @param h height
  1448. @example
  1449. ```js
  1450. var size1 = cc.size();
  1451. var size2 = cc.size(100,100);
  1452. var size3 = cc.size(size2);
  1453. var size4 = cc.size({width: 100, height: 100});
  1454. ```
  1455. */
  1456. export function size(w: number|Size, h?: number): Size;
  1457. export var EPSILON: number;
  1458. /**
  1459. Clamps a value between a minimum float and maximum float value.
  1460. @param val val
  1461. @param min min
  1462. @param max max
  1463. */
  1464. export function clamp(val: number, min: number, max: number): number;
  1465. /**
  1466. Clamps a value between 0 and 1.
  1467. @param val val
  1468. */
  1469. export function clamp01(val: number): number;
  1470. /**
  1471. @param from from
  1472. @param to to
  1473. @param ratio the interpolation coefficient
  1474. */
  1475. export function lerp(from: number, to: number, ratio: number): number;
  1476. export function random(): void;
  1477. /**
  1478. Returns a floating-point random number between min (inclusive) and max (exclusive).
  1479. @param min min
  1480. @param max max
  1481. */
  1482. export function randomRange(min: number, max: number): number;
  1483. /**
  1484. Returns a random integer between min (inclusive) and max (exclusive).
  1485. @param min min
  1486. @param max max
  1487. */
  1488. export function randomRangeInt(min: number, max: number): number;
  1489. /**
  1490. Linear congruential generator using Hull-Dobell Theorem.
  1491. @param seed the random seed
  1492. */
  1493. export function pseudoRandom(seed: number): number;
  1494. /**
  1495. Returns a floating-point pseudo-random number between min (inclusive) and max (exclusive).
  1496. @param seed seed
  1497. @param min min
  1498. @param max max
  1499. */
  1500. export function pseudoRandomRange(seed: number, min: number, max: number): number;
  1501. /**
  1502. Returns a pseudo-random integer between min (inclusive) and max (exclusive).
  1503. @param seed seed
  1504. @param min min
  1505. @param max max
  1506. */
  1507. export function pseudoRandomRangeInt(seed: number, min: number, max: number): number;
  1508. /**
  1509. Returns the next power of two for the value
  1510. @param val val
  1511. */
  1512. export function nextPow2(val: number): number;
  1513. /**
  1514. Returns float remainder for t / length
  1515. @param t time start at 0
  1516. @param length time of one cycle
  1517. */
  1518. export function repeat(t: number, length: number): number;
  1519. /**
  1520. Returns time wrapped in ping-pong mode
  1521. @param t time start at 0
  1522. @param length time of one cycle
  1523. */
  1524. export function repeat(t: number, length: number): number;
  1525. /**
  1526. Returns ratio of a value within a given range
  1527. @param from start value
  1528. @param to end value
  1529. @param value given value
  1530. */
  1531. export function repeat(from: number, to: number, value: number): number;
  1532. /**
  1533. Returns -1, 0, +1 depending on sign of x.
  1534. @param v v
  1535. */
  1536. export function sign(v: number): void;
  1537. /**
  1538. !#en The convenience method to create a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
  1539. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}} 对象。
  1540. @param x x
  1541. @param y y
  1542. @example
  1543. ```js
  1544. var v1 = cc.v2();
  1545. var v2 = cc.v2(0, 0);
  1546. var v3 = cc.v2(v2);
  1547. var v4 = cc.v2({x: 100, y: 100});
  1548. ```
  1549. */
  1550. export function v2(x?: number|any, y?: number): Vec2;
  1551. /**
  1552. !#en The convenience method to create a new {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}}.
  1553. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}} 对象。
  1554. @param x x
  1555. @param y y
  1556. @param z z
  1557. @example
  1558. ```js
  1559. var v1 = cc.v3();
  1560. var v2 = cc.v3(0, 0, 0);
  1561. var v3 = cc.v3(v2);
  1562. var v4 = cc.v3({x: 100, y: 100, z: 0});
  1563. ```
  1564. */
  1565. export function v3(x?: number|any, y?: number, z?: number): Vec3;
  1566. export var dynamicAtlasManager: DynamicAtlasManager;
  1567. /** !#en The matrix storage */
  1568. export var matrix: any[];
  1569. /**
  1570. !#en Get an element
  1571. @param i i
  1572. @param j j
  1573. */
  1574. export function get(i: number, j: number): number;
  1575. /**
  1576. !#en Set an element
  1577. @param i i
  1578. @param j j
  1579. @param value value
  1580. */
  1581. export function set(i: number, j: number, value: boolean): void;
  1582. /**
  1583. !#en Sets all elements to zero
  1584. */
  1585. export function reset(): void;
  1586. /** !#en Base class cc.Action for action classes.
  1587. !#zh Action 类是所有动作类型的基类。 */
  1588. export class Action {
  1589. /**
  1590. !#en
  1591. to copy object with deep copy.
  1592. returns a clone of action.
  1593. !#zh 返回一个克隆的动作。
  1594. */
  1595. clone(): Action;
  1596. /**
  1597. !#en
  1598. return true if the action has finished.
  1599. !#zh 如果动作已完成就返回 true。
  1600. */
  1601. isDone(): boolean;
  1602. /**
  1603. !#en get the target.
  1604. !#zh 获取当前目标节点。
  1605. */
  1606. getTarget(): Node;
  1607. /**
  1608. !#en The action will modify the target properties.
  1609. !#zh 设置目标节点。
  1610. @param target target
  1611. */
  1612. setTarget(target: Node): void;
  1613. /**
  1614. !#en get the original target.
  1615. !#zh 获取原始目标节点。
  1616. */
  1617. getOriginalTarget(): Node;
  1618. /**
  1619. !#en get tag number.
  1620. !#zh 获取用于识别动作的标签。
  1621. */
  1622. getTag(): number;
  1623. /**
  1624. !#en set tag number.
  1625. !#zh 设置标签,用于识别动作。
  1626. @param tag tag
  1627. */
  1628. setTag(tag: number): void;
  1629. /** !#en Default Action tag.
  1630. !#zh 默认动作标签。 */
  1631. static TAG_INVALID: number;
  1632. }
  1633. /** !#en
  1634. Base class actions that do have a finite time duration. <br/>
  1635. Possible actions: <br/>
  1636. - An action with a duration of 0 seconds. <br/>
  1637. - An action with a duration of 35.5 seconds.
  1638. Infinite time actions are valid
  1639. !#zh 有限时间动作,这种动作拥有时长 duration 属性。 */
  1640. export class FiniteTimeAction extends Action {
  1641. /**
  1642. !#en get duration of the action. (seconds).
  1643. !#zh 获取动作以秒为单位的持续时间。
  1644. */
  1645. getDuration(): number;
  1646. /**
  1647. !#en set duration of the action. (seconds).
  1648. !#zh 设置动作以秒为单位的持续时间。
  1649. @param duration duration
  1650. */
  1651. setDuration(duration: number): void;
  1652. /**
  1653. !#en
  1654. Returns a reversed action. <br />
  1655. For example: <br />
  1656. - The action will be x coordinates of 0 move to 100. <br />
  1657. - The reversed action will be x of 100 move to 0.
  1658. - Will be rewritten
  1659. !#zh 返回一个新的动作,执行与原动作完全相反的动作。
  1660. */
  1661. reverse(): void;
  1662. /**
  1663. !#en
  1664. to copy object with deep copy.
  1665. returns a clone of action.
  1666. !#zh 返回一个克隆的动作。
  1667. */
  1668. clone(): FiniteTimeAction;
  1669. }
  1670. /** !#en Instant actions are immediate actions. They don't have a duration like the ActionInterval actions.
  1671. !#zh 即时动作,这种动作立即就会执行,继承自 FiniteTimeAction。 */
  1672. export class ActionInstant extends FiniteTimeAction {
  1673. }
  1674. /** !#en
  1675. <p> An interval action is an action that takes place within a certain period of time. <br/>
  1676. It has an start time, and a finish time. The finish time is the parameter<br/>
  1677. duration plus the start time.</p>
  1678. <p>These CCActionInterval actions have some interesting properties, like:<br/>
  1679. - They can run normally (default) <br/>
  1680. - They can run reversed with the reverse method <br/>
  1681. - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions. </p>
  1682. <p>For example, you can simulate a Ping Pong effect running the action normally and<br/>
  1683. then running it again in Reverse mode. </p>
  1684. !#zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。 */
  1685. export class ActionInterval extends FiniteTimeAction {
  1686. /**
  1687. !#en Implementation of ease motion.
  1688. !#zh 缓动运动。
  1689. @param easeObj easeObj
  1690. @example
  1691. ```js
  1692. action.easing(cc.easeIn(3.0));
  1693. ```
  1694. */
  1695. easing(easeObj: any): ActionInterval;
  1696. /**
  1697. !#en
  1698. Repeats an action a number of times.
  1699. To repeat an action forever use the CCRepeatForever action.
  1700. !#zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。
  1701. @param times times
  1702. */
  1703. repeat(times: number): ActionInterval;
  1704. /**
  1705. !#en
  1706. Repeats an action for ever. <br/>
  1707. To repeat the an action for a limited number of times use the Repeat action. <br/>
  1708. !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。
  1709. */
  1710. repeatForever(): ActionInterval;
  1711. }
  1712. /** !#en
  1713. cc.ActionManager is a class that can manage actions.<br/>
  1714. Normally you won't need to use this class directly. 99% of the cases you will use the CCNode interface,
  1715. which uses this class's singleton object.
  1716. But there are some cases where you might need to use this class. <br/>
  1717. Examples:<br/>
  1718. - When you want to run an action where the target is different from a CCNode.<br/>
  1719. - When you want to pause / resume the actions<br/>
  1720. !#zh
  1721. cc.ActionManager 是可以管理动作的单例类。<br/>
  1722. 通常你并不需要直接使用这个类,99%的情况您将使用 CCNode 的接口。<br/>
  1723. 但也有一些情况下,您可能需要使用这个类。 <br/>
  1724. 例如:
  1725. - 当你想要运行一个动作,但目标不是 CCNode 类型时。 <br/>
  1726. - 当你想要暂停/恢复动作时。 <br/> */
  1727. export class ActionManager {
  1728. /**
  1729. !#en
  1730. Adds an action with a target.<br/>
  1731. If the target is already present, then the action will be added to the existing target.
  1732. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
  1733. When the target is paused, the queued actions won't be 'ticked'.
  1734. !#zh
  1735. 增加一个动作,同时还需要提供动作的目标对象,目标对象是否暂停作为参数。<br/>
  1736. 如果目标已存在,动作将会被直接添加到现有的节点中。<br/>
  1737. 如果目标不存在,将为这一目标创建一个新的实例,并将动作添加进去。<br/>
  1738. 当目标状态的 paused 为 true,动作将不会被执行
  1739. @param action action
  1740. @param target target
  1741. @param paused paused
  1742. */
  1743. addAction(action: Action, target: Node, paused: boolean): void;
  1744. /**
  1745. !#en Removes all actions from all the targets.
  1746. !#zh 移除所有对象的所有动作。
  1747. */
  1748. removeAllActions(): void;
  1749. /**
  1750. !#en
  1751. Removes all actions from a certain target. <br/>
  1752. All the actions that belongs to the target will be removed.
  1753. !#zh
  1754. 移除指定对象上的所有动作。<br/>
  1755. 属于该目标的所有的动作将被删除。
  1756. @param target target
  1757. @param forceDelete forceDelete
  1758. */
  1759. removeAllActionsFromTarget(target: Node, forceDelete: boolean): void;
  1760. /**
  1761. !#en Removes an action given an action reference.
  1762. !#zh 移除指定的动作。
  1763. @param action action
  1764. */
  1765. removeAction(action: Action): void;
  1766. /**
  1767. !#en Removes an action given its tag and the target.
  1768. !#zh 删除指定对象下特定标签的一个动作,将删除首个匹配到的动作。
  1769. @param tag tag
  1770. @param target target
  1771. */
  1772. removeActionByTag(tag: number, target?: Node): void;
  1773. /**
  1774. !#en Gets an action given its tag an a target.
  1775. !#zh 通过目标对象和标签获取一个动作。
  1776. @param tag tag
  1777. @param target target
  1778. */
  1779. getActionByTag(tag: number, target: Node): Action;
  1780. /**
  1781. !#en
  1782. Returns the numbers of actions that are running in a certain target. <br/>
  1783. Composable actions are counted as 1 action. <br/>
  1784. Example: <br/>
  1785. - If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  1786. - If you are running 7 Sequences of 2 actions, it will return 7.
  1787. !#zh
  1788. 返回指定对象下所有正在运行的动作数量。 <br/>
  1789. 组合动作被算作一个动作。<br/>
  1790. 例如:<br/>
  1791. - 如果您正在运行 7 个动作组成的序列动作(Sequence),这个函数将返回 1。<br/>
  1792. - 如果你正在运行 2 个序列动作(Sequence)和 5 个普通动作,这个函数将返回 7。<br/>
  1793. @param target target
  1794. */
  1795. getNumberOfRunningActionsInTarget(target: Node): number;
  1796. /**
  1797. !#en Pauses the target: all running actions and newly added actions will be paused.
  1798. !#zh 暂停指定对象:所有正在运行的动作和新添加的动作都将会暂停。
  1799. @param target target
  1800. */
  1801. pauseTarget(target: Node): void;
  1802. /**
  1803. !#en Resumes the target. All queued actions will be resumed.
  1804. !#zh 让指定目标恢复运行。在执行序列中所有被暂停的动作将重新恢复运行。
  1805. @param target target
  1806. */
  1807. resumeTarget(target: Node): void;
  1808. /**
  1809. !#en Pauses all running actions, returning a list of targets whose actions were paused.
  1810. !#zh 暂停所有正在运行的动作,返回一个包含了那些动作被暂停了的目标对象的列表。
  1811. */
  1812. pauseAllRunningActions(): any[];
  1813. /**
  1814. !#en Resume a set of targets (convenience function to reverse a pauseAllRunningActions or pauseTargets call).
  1815. !#zh 让一组指定对象恢复运行(用来逆转 pauseAllRunningActions 效果的便捷函数)。
  1816. @param targetsToResume targetsToResume
  1817. */
  1818. resumeTargets(targetsToResume: any[]): void;
  1819. /**
  1820. !#en Pause a set of targets.
  1821. !#zh 暂停一组指定对象。
  1822. @param targetsToPause targetsToPause
  1823. */
  1824. pauseTargets(targetsToPause: any[]): void;
  1825. /**
  1826. !#en
  1827. purges the shared action manager. It releases the retained instance. <br/>
  1828. because it uses this, so it can not be static.
  1829. !#zh
  1830. 清除共用的动作管理器。它释放了持有的实例。 <br/>
  1831. 因为它使用 this,因此它不能是静态的。
  1832. */
  1833. purgeSharedManager(): void;
  1834. /**
  1835. !#en The ActionManager update。
  1836. !#zh ActionManager 主循环。
  1837. @param dt delta time in seconds
  1838. */
  1839. update(dt: number): void;
  1840. }
  1841. /** !#en
  1842. Tween provide a simple and flexible way to create action. Tween's api is more flexible than `cc.Action`:
  1843. - Support creating an action sequence in chained api.
  1844. - Support animate any objects' any properties, not limited to node's properties. By contrast, `cc.Action` needs to create a new action class to support new node property.
  1845. - Support working with `cc.Action`.
  1846. - Support easing and progress function.
  1847. !#zh
  1848. Tween 提供了一个简单灵活的方法来创建 action。相对于 Cocos 传统的 `cc.Action`,`cc.Tween` 在创建动画上要灵活非常多:
  1849. - 支持以链式结构的方式创建一个动画序列。
  1850. - 支持对任意对象的任意属性进行缓动,不再局限于节点上的属性,而 `cc.Action` 添加一个属性的支持时还需要添加一个新的 action 类型。
  1851. - 支持与 `cc.Action` 混用。
  1852. - 支持设置 {{#crossLink "Easing"}}{{/crossLink}} 或者 progress 函数。 */
  1853. export class Tween<T = any> {
  1854. /**
  1855. @param target target
  1856. */
  1857. constructor(target?: any);
  1858. /**
  1859. !#en Stop all tweens
  1860. !#zh 停止所有缓动
  1861. */
  1862. static stopAll(): void;
  1863. /**
  1864. !#en Stop all tweens by tag
  1865. !#zh 停止所有指定标签的缓动
  1866. @param tag tag
  1867. */
  1868. static stopAllByTag(tag: number): void;
  1869. /**
  1870. !#en Stop all tweens by target
  1871. !#zh 停止所有指定对象的缓动
  1872. @param target target
  1873. */
  1874. static stopAllByTarget(target: any): void;
  1875. /**
  1876. !#en
  1877. Insert an action or tween to this sequence
  1878. !#zh
  1879. 插入一个 action 或者 tween 到队列中
  1880. @param other other
  1881. */
  1882. then(other: Action|Tween<T>): Tween<T>;
  1883. /**
  1884. !#en
  1885. Set tween target
  1886. !#zh
  1887. 设置 tween 的 target
  1888. @param target target
  1889. */
  1890. target(target: any): Tween<T>;
  1891. /**
  1892. !#en
  1893. Start this tween
  1894. !#zh
  1895. 运行当前 tween
  1896. */
  1897. start(): Tween<T>;
  1898. /**
  1899. !#en
  1900. Stop this tween
  1901. !#zh
  1902. 停止当前 tween
  1903. */
  1904. stop(): Tween<T>;
  1905. /**
  1906. !#en Sets tween tag
  1907. !#zh 设置缓动的标签
  1908. @param tag tag
  1909. */
  1910. tag(tag: number): Tween<T>;
  1911. /**
  1912. !#en
  1913. Clone a tween
  1914. !#zh
  1915. 克隆当前 tween
  1916. @param target target
  1917. */
  1918. clone(target?: any): Tween<T>;
  1919. /**
  1920. !#en
  1921. Integrate all previous actions to an action.
  1922. !#zh
  1923. 将之前所有的 action 整合为一个 action。
  1924. */
  1925. union(): Tween;
  1926. /**
  1927. !#en Sets target's position property according to the bezier curve.
  1928. !#zh 按照贝塞尔路径设置目标的 position 属性。
  1929. @param duration duration
  1930. @param c1 c1
  1931. @param c2 c2
  1932. @param to to
  1933. */
  1934. bezierTo(duration: number, c1: Vec2, c2: Vec2, to: Vec2): Tween<T>;
  1935. /**
  1936. !#en Sets target's position property according to the bezier curve.
  1937. !#zh 按照贝塞尔路径设置目标的 position 属性。
  1938. @param duration duration
  1939. @param c1 c1
  1940. @param c2 c2
  1941. @param to to
  1942. */
  1943. bezierBy(duration: number, c1: Vec2, c2: Vec2, to: Vec2): Tween<T>;
  1944. /**
  1945. !#en Flips target's scaleX
  1946. !#zh 翻转目标的 scaleX 属性
  1947. */
  1948. flipX(): Tween<T>;
  1949. /**
  1950. !#en Flips target's scaleY
  1951. !#zh 翻转目标的 scaleY 属性
  1952. */
  1953. flipY(): Tween<T>;
  1954. /**
  1955. !#en Blinks target by set target's opacity property
  1956. !#zh 通过设置目标的 opacity 属性达到闪烁效果
  1957. @param duration duration
  1958. @param times times
  1959. @param opts opts
  1960. */
  1961. blink(duration: number, times: number, opts?: {progress?: Function; easing?: Function|string; }): Tween<T>;
  1962. /**
  1963. !#en
  1964. Add an action which calculate with absolute value
  1965. !#zh
  1966. 添加一个对属性进行绝对值计算的 action
  1967. @param duration duration
  1968. @param props {scale: 2, position: cc.v3(100, 100, 100)}
  1969. @param opts opts
  1970. */
  1971. to <OPTS extends Partial<{progress: Function, easing: Function|String}>> (duration: number, props: ConstructorType<T>, opts?: OPTS) : Tween<T>;
  1972. /**
  1973. !#en
  1974. Add an action which calculate with relative value
  1975. !#zh
  1976. 添加一个对属性进行相对值计算的 action
  1977. @param duration duration
  1978. @param props {scale: 2, position: cc.v3(100, 100, 100)}
  1979. @param opts opts
  1980. */
  1981. by <OPTS extends Partial<{progress: Function, easing: Function|String}>> (duration: number, props: ConstructorType<T>, opts?: OPTS) : Tween<T>;
  1982. /**
  1983. !#en
  1984. Directly set target properties
  1985. !#zh
  1986. 直接设置 target 的属性
  1987. @param props props
  1988. */
  1989. set (props: ConstructorType<T>) : Tween<T>;
  1990. /**
  1991. !#en
  1992. Add an delay action
  1993. !#zh
  1994. 添加一个延时 action
  1995. @param duration duration
  1996. */
  1997. delay(duration: number): Tween<T>;
  1998. /**
  1999. !#en
  2000. Add an callback action
  2001. !#zh
  2002. 添加一个回调 action
  2003. @param callback callback
  2004. */
  2005. call(callback: Function): Tween<T>;
  2006. /**
  2007. !#en
  2008. Add an hide action
  2009. !#zh
  2010. 添加一个隐藏 action
  2011. */
  2012. hide(): Tween<T>;
  2013. /**
  2014. !#en
  2015. Add an show action
  2016. !#zh
  2017. 添加一个显示 action
  2018. */
  2019. show(): Tween<T>;
  2020. /**
  2021. !#en
  2022. Add an removeSelf action
  2023. !#zh
  2024. 添加一个移除自己 action
  2025. */
  2026. removeSelf(): Tween<T>;
  2027. /**
  2028. !#en
  2029. Add an sequence action
  2030. !#zh
  2031. 添加一个队列 action
  2032. @param action action
  2033. @param actions actions
  2034. */
  2035. sequence(action: Action|Tween<T>, ...actions: (Action|Tween<T>)[]): Tween<T>;
  2036. /**
  2037. !#en
  2038. Add an parallel action
  2039. !#zh
  2040. 添加一个并行 action
  2041. @param action action
  2042. @param actions actions
  2043. */
  2044. parallel(action: Action|Tween<T>, ...actions: (Action|Tween<T>)[]): Tween<T>;
  2045. /**
  2046. !#en
  2047. Add an repeat action. This action will integrate before actions to a sequence action as their parameters.
  2048. !#zh
  2049. 添加一个重复 action,这个 action 会将前一个动作作为他的参数。
  2050. @param repeatTimes repeatTimes
  2051. @param action action
  2052. */
  2053. repeat(repeatTimes: number, action?: Action|Tween<T>): Tween<T>;
  2054. /**
  2055. !#en
  2056. Add an repeat forever action. This action will integrate before actions to a sequence action as their parameters.
  2057. !#zh
  2058. 添加一个永久重复 action,这个 action 会将前一个动作作为他的参数。
  2059. @param action action
  2060. */
  2061. repeatForever(action?: Action|Tween<T>): Tween<T>;
  2062. /**
  2063. !#en
  2064. Add an reverse time action. This action will integrate before actions to a sequence action as their parameters.
  2065. !#zh
  2066. 添加一个倒置时间 action,这个 action 会将前一个动作作为他的参数。
  2067. @param action action
  2068. */
  2069. reverseTime(action?: Action|Tween<T>): Tween<T>;
  2070. }
  2071. /** !#en Class for animation data handling.
  2072. !#zh 动画剪辑,用于存储动画数据。 */
  2073. export class AnimationClip extends Asset {
  2074. /** !#en Duration of this animation.
  2075. !#zh 动画的持续时间。 */
  2076. duration: number;
  2077. /** !#en FrameRate of this animation.
  2078. !#zh 动画的帧速率。 */
  2079. sample: number;
  2080. /** !#en Speed of this animation.
  2081. !#zh 动画的播放速度。 */
  2082. speed: number;
  2083. /** !#en WrapMode of this animation.
  2084. !#zh 动画的循环模式。 */
  2085. wrapMode: WrapMode;
  2086. /** !#en Curve data.
  2087. !#zh 曲线数据。 */
  2088. curveData: any;
  2089. /** !#en Event data.
  2090. !#zh 事件数据。 */
  2091. events: {frame: number, func: string, params: string[]}[];
  2092. /**
  2093. !#en Crate clip with a set of sprite frames
  2094. !#zh 使用一组序列帧图片来创建动画剪辑
  2095. @param spriteFrames spriteFrames
  2096. @param sample sample
  2097. @example
  2098. ```js
  2099. var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);
  2100. ```
  2101. */
  2102. static createWithSpriteFrames(spriteFrames: SpriteFrame[], sample: number): AnimationClip;
  2103. }
  2104. /** !#en
  2105. The AnimationState gives full control over animation playback process.
  2106. In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
  2107. !#zh
  2108. AnimationState 完全控制动画播放过程。<br/>
  2109. 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。 */
  2110. export class AnimationState extends Playable {
  2111. /**
  2112. @param clip clip
  2113. @param name name
  2114. */
  2115. constructor(clip: AnimationClip, name?: string);
  2116. /** !#en The curves list.
  2117. !#zh 曲线列表。 */
  2118. curves: any[];
  2119. /** !#en The start delay which represents the number of seconds from an animation's start time to the start of
  2120. the active interval.
  2121. !#zh 延迟多少秒播放。 */
  2122. delay: number;
  2123. /** !#en The animation's iteration count property.
  2124. A real number greater than or equal to zero (including positive infinity) representing the number of times
  2125. to repeat the animation node.
  2126. Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
  2127. calculations.
  2128. !#zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半) */
  2129. repeatCount: number;
  2130. /** !#en The iteration duration of this animation in seconds. (length)
  2131. !#zh 单次动画的持续时间,秒。 */
  2132. duration: number;
  2133. /** !#en The animation's playback speed. 1 is normal playback speed.
  2134. !#zh 播放速率。 */
  2135. speed: number;
  2136. /** !#en
  2137. Wrapping mode of the playing animation.
  2138. Notice : dynamic change wrapMode will reset time and repeatCount property
  2139. !#zh
  2140. 动画循环方式。
  2141. 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount */
  2142. wrapMode: WrapMode;
  2143. /** !#en The current time of this animation in seconds.
  2144. !#zh 动画当前的时间,秒。 */
  2145. time: number;
  2146. /** !#en The clip that is being played by this animation state.
  2147. !#zh 此动画状态正在播放的剪辑。 */
  2148. clip: AnimationClip;
  2149. /** !#en The name of the playing animation.
  2150. !#zh 动画的名字 */
  2151. name: string;
  2152. }
  2153. /** !#en
  2154. This class provide easing methods for {{#crossLink "tween"}}{{/crossLink}} class.<br>
  2155. Demonstratio: https://easings.net/
  2156. !#zh
  2157. 缓动函数类,为 {{#crossLink "Tween"}}{{/crossLink}} 提供缓动效果函数。<br>
  2158. 函数效果演示: https://easings.net/ */
  2159. export class Easing {
  2160. /**
  2161. !#en Easing in with quadratic formula. From slow to fast.
  2162. !#zh 平方曲线缓入函数。运动由慢到快。
  2163. @param t The current time as a percentage of the total time.
  2164. */
  2165. quadIn(t: number): number;
  2166. /**
  2167. !#en Easing out with quadratic formula. From fast to slow.
  2168. !#zh 平方曲线缓出函数。运动由快到慢。
  2169. @param t The current time as a percentage of the total time.
  2170. */
  2171. quadOut(t: number): number;
  2172. /**
  2173. !#en Easing in and out with quadratic formula. From slow to fast, then back to slow.
  2174. !#zh 平方曲线缓入缓出函数。运动由慢到快再到慢。
  2175. @param t The current time as a percentage of the total time.
  2176. */
  2177. quadInOut(t: number): number;
  2178. /**
  2179. !#en Easing in with cubic formula. From slow to fast.
  2180. !#zh 立方曲线缓入函数。运动由慢到快。
  2181. @param t The current time as a percentage of the total time.
  2182. */
  2183. cubicIn(t: number): number;
  2184. /**
  2185. !#en Easing out with cubic formula. From slow to fast.
  2186. !#zh 立方曲线缓出函数。运动由快到慢。
  2187. @param t The current time as a percentage of the total time.
  2188. */
  2189. cubicOut(t: number): number;
  2190. /**
  2191. !#en Easing in and out with cubic formula. From slow to fast, then back to slow.
  2192. !#zh 立方曲线缓入缓出函数。运动由慢到快再到慢。
  2193. @param t The current time as a percentage of the total time.
  2194. */
  2195. cubicInOut(t: number): number;
  2196. /**
  2197. !#en Easing in with quartic formula. From slow to fast.
  2198. !#zh 四次方曲线缓入函数。运动由慢到快。
  2199. @param t The current time as a percentage of the total time.
  2200. */
  2201. quartIn(t: number): number;
  2202. /**
  2203. !#en Easing out with quartic formula. From fast to slow.
  2204. !#zh 四次方曲线缓出函数。运动由快到慢。
  2205. @param t The current time as a percentage of the total time.
  2206. */
  2207. quartOut(t: number): number;
  2208. /**
  2209. !#en Easing in and out with quartic formula. From slow to fast, then back to slow.
  2210. !#zh 四次方曲线缓入缓出函数。运动由慢到快再到慢。
  2211. @param t The current time as a percentage of the total time.
  2212. */
  2213. quartInOut(t: number): number;
  2214. /**
  2215. !#en Easing in with quintic formula. From slow to fast.
  2216. !#zh 五次方曲线缓入函数。运动由慢到快。
  2217. @param t The current time as a percentage of the total time.
  2218. */
  2219. quintIn(t: number): number;
  2220. /**
  2221. !#en Easing out with quintic formula. From fast to slow.
  2222. !#zh 五次方曲线缓出函数。运动由快到慢。
  2223. @param t The current time as a percentage of the total time.
  2224. */
  2225. quintOut(t: number): number;
  2226. /**
  2227. !#en Easing in and out with quintic formula. From slow to fast, then back to slow.
  2228. !#zh 五次方曲线缓入缓出函数。运动由慢到快再到慢。
  2229. @param t The current time as a percentage of the total time.
  2230. */
  2231. quintInOut(t: number): number;
  2232. /**
  2233. !#en Easing in and out with sine formula. From slow to fast.
  2234. !#zh 正弦曲线缓入函数。运动由慢到快。
  2235. @param t The current time as a percentage of the total time.
  2236. */
  2237. sineIn(t: number): number;
  2238. /**
  2239. !#en Easing in and out with sine formula. From fast to slow.
  2240. !#zh 正弦曲线缓出函数。运动由快到慢。
  2241. @param t The current time as a percentage of the total time.
  2242. */
  2243. sineOut(t: number): number;
  2244. /**
  2245. !#en Easing in and out with sine formula. From slow to fast, then back to slow.
  2246. !#zh 正弦曲线缓入缓出函数。运动由慢到快再到慢。
  2247. @param t The current time as a percentage of the total time.
  2248. */
  2249. sineInOut(t: number): number;
  2250. /**
  2251. !#en Easing in and out with exponential formula. From slow to fast.
  2252. !#zh 指数曲线缓入函数。运动由慢到快。
  2253. @param t The current time as a percentage of the total time.
  2254. */
  2255. expoIn(t: number): number;
  2256. /**
  2257. !#en Easing in and out with exponential formula. From fast to slow.
  2258. !#zh 指数曲线缓出函数。运动由快到慢。
  2259. @param t The current time as a percentage of the total time.
  2260. */
  2261. expoOut(t: number): number;
  2262. /**
  2263. !#en Easing in and out with exponential formula. From slow to fast.
  2264. !#zh 指数曲线缓入和缓出函数。运动由慢到很快再到慢。
  2265. @param t The current time as a percentage of the total time, then back to slow.
  2266. */
  2267. expoInOut(t: number): number;
  2268. /**
  2269. !#en Easing in and out with circular formula. From slow to fast.
  2270. !#zh 循环公式缓入函数。运动由慢到快。
  2271. @param t The current time as a percentage of the total time.
  2272. */
  2273. circIn(t: number): number;
  2274. /**
  2275. !#en Easing in and out with circular formula. From fast to slow.
  2276. !#zh 循环公式缓出函数。运动由快到慢。
  2277. @param t The current time as a percentage of the total time.
  2278. */
  2279. circOut(t: number): number;
  2280. /**
  2281. !#en Easing in and out with circular formula. From slow to fast.
  2282. !#zh 指数曲线缓入缓出函数。运动由慢到很快再到慢。
  2283. @param t The current time as a percentage of the total time, then back to slow.
  2284. */
  2285. circInOut(t: number): number;
  2286. /**
  2287. !#en Easing in action with a spring oscillating effect.
  2288. !#zh 弹簧回震效果的缓入函数。
  2289. @param t The current time as a percentage of the total time.
  2290. */
  2291. elasticIn(t: number): number;
  2292. /**
  2293. !#en Easing out action with a spring oscillating effect.
  2294. !#zh 弹簧回震效果的缓出函数。
  2295. @param t The current time as a percentage of the total time.
  2296. */
  2297. elasticOut(t: number): number;
  2298. /**
  2299. !#en Easing in and out action with a spring oscillating effect.
  2300. !#zh 弹簧回震效果的缓入缓出函数。
  2301. @param t The current time as a percentage of the total time.
  2302. */
  2303. elasticInOut(t: number): number;
  2304. /**
  2305. !#en Easing in action with "back up" behavior.
  2306. !#zh 回退效果的缓入函数。
  2307. @param t The current time as a percentage of the total time.
  2308. */
  2309. backIn(t: number): number;
  2310. /**
  2311. !#en Easing out action with "back up" behavior.
  2312. !#zh 回退效果的缓出函数。
  2313. @param t The current time as a percentage of the total time.
  2314. */
  2315. backOut(t: number): number;
  2316. /**
  2317. !#en Easing in and out action with "back up" behavior.
  2318. !#zh 回退效果的缓入缓出函数。
  2319. @param t The current time as a percentage of the total time.
  2320. */
  2321. backInOut(t: number): number;
  2322. /**
  2323. !#en Easing in action with bouncing effect.
  2324. !#zh 弹跳效果的缓入函数。
  2325. @param t The current time as a percentage of the total time.
  2326. */
  2327. bounceIn(t: number): number;
  2328. /**
  2329. !#en Easing out action with bouncing effect.
  2330. !#zh 弹跳效果的缓出函数。
  2331. @param t The current time as a percentage of the total time.
  2332. */
  2333. bounceOut(t: number): number;
  2334. /**
  2335. !#en Easing in and out action with bouncing effect.
  2336. !#zh 弹跳效果的缓入缓出函数。
  2337. @param t The current time as a percentage of the total time.
  2338. */
  2339. bounceInOut(t: number): number;
  2340. /**
  2341. !#en Target will run action with smooth effect.
  2342. !#zh 平滑效果函数。
  2343. @param t The current time as a percentage of the total time.
  2344. */
  2345. smooth(t: number): number;
  2346. /**
  2347. !#en Target will run action with fade effect.
  2348. !#zh 渐褪效果函数。
  2349. @param t The current time as a percentage of the total time.
  2350. */
  2351. fade(t: number): number;
  2352. }
  2353. /** undefined */
  2354. export class Playable {
  2355. /** !#en Is playing or paused in play mode?
  2356. !#zh 当前是否正在播放。 */
  2357. isPlaying: boolean;
  2358. /** !#en Is currently paused? This can be true even if in edit mode(isPlaying == false).
  2359. !#zh 当前是否正在暂停 */
  2360. isPaused: boolean;
  2361. /**
  2362. !#en Play this animation.
  2363. !#zh 播放动画。
  2364. */
  2365. play(): void;
  2366. /**
  2367. !#en Stop this animation.
  2368. !#zh 停止动画播放。
  2369. */
  2370. stop(): void;
  2371. /**
  2372. !#en Pause this animation.
  2373. !#zh 暂停动画。
  2374. */
  2375. pause(): void;
  2376. /**
  2377. !#en Resume this animation.
  2378. !#zh 重新播放动画。
  2379. */
  2380. resume(): void;
  2381. /**
  2382. !#en Perform a single frame step.
  2383. !#zh 执行一帧动画。
  2384. */
  2385. step(): void;
  2386. }
  2387. /** !#en Specifies how time is treated when it is outside of the keyframe range of an Animation.
  2388. !#zh 动画使用的循环模式。 */
  2389. export enum WrapMode {
  2390. Default = 0,
  2391. Normal = 0,
  2392. Reverse = 0,
  2393. Loop = 0,
  2394. LoopReverse = 0,
  2395. PingPong = 0,
  2396. PingPongReverse = 0,
  2397. }
  2398. /** !#en `cc.audioEngine` is the singleton object, it provide simple audio APIs.
  2399. !#zh
  2400. cc.audioengine是单例对象。<br/>
  2401. 主要用来播放音频,播放的时候会返回一个 audioID,之后都可以通过这个 audioID 来操作这个音频对象。<br/>
  2402. 不使用的时候,请使用 `cc.audioEngine.uncache(filePath);` 进行资源释放 <br/>
  2403. 注意:<br/>
  2404. 在 Android 系统浏览器上,不同浏览器,不同版本的效果不尽相同。<br/>
  2405. 比如说:大多数浏览器都需要用户物理交互才可以开始播放音效,有一些不支持 WebAudio,有一些不支持多音轨播放。总之如果对音乐依赖比较强,请做尽可能多的测试。 */
  2406. export class audioEngine {
  2407. /**
  2408. !#en Play audio.
  2409. !#zh 播放音频
  2410. @param clip The audio clip to play.
  2411. @param loop Whether the music loop or not.
  2412. @param volume Volume size.
  2413. @example
  2414. ```js
  2415. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2416. var audioID = cc.audioEngine.play(clip, false, 0.5);
  2417. });
  2418. ```
  2419. */
  2420. static play(clip: AudioClip, loop: boolean, volume: number): number;
  2421. /**
  2422. !#en Set audio loop.
  2423. !#zh 设置音频是否循环。
  2424. @param audioID audio id.
  2425. @param loop Whether cycle.
  2426. @example
  2427. ```js
  2428. cc.audioEngine.setLoop(id, true);
  2429. ```
  2430. */
  2431. static setLoop(audioID: number, loop: boolean): void;
  2432. /**
  2433. !#en Get audio cycle state.
  2434. !#zh 获取音频的循环状态。
  2435. @param audioID audio id.
  2436. @example
  2437. ```js
  2438. cc.audioEngine.isLoop(id);
  2439. ```
  2440. */
  2441. static isLoop(audioID: number): boolean;
  2442. /**
  2443. !#en Set the volume of audio.
  2444. !#zh 设置音量(0.0 ~ 1.0)。
  2445. @param audioID audio id.
  2446. @param volume Volume must be in 0.0~1.0 .
  2447. @example
  2448. ```js
  2449. cc.audioEngine.setVolume(id, 0.5);
  2450. ```
  2451. */
  2452. static setVolume(audioID: number, volume: number): void;
  2453. /**
  2454. !#en The volume of the music max value is 1.0,the min value is 0.0 .
  2455. !#zh 获取音量(0.0 ~ 1.0)。
  2456. @param audioID audio id.
  2457. @example
  2458. ```js
  2459. var volume = cc.audioEngine.getVolume(id);
  2460. ```
  2461. */
  2462. static getVolume(audioID: number): number;
  2463. /**
  2464. !#en Set current time
  2465. !#zh 设置当前的音频时间。
  2466. @param audioID audio id.
  2467. @param sec current time.
  2468. @example
  2469. ```js
  2470. cc.audioEngine.setCurrentTime(id, 2);
  2471. ```
  2472. */
  2473. static setCurrentTime(audioID: number, sec: number): boolean;
  2474. /**
  2475. !#en Get current time
  2476. !#zh 获取当前的音频播放时间。
  2477. @param audioID audio id.
  2478. @example
  2479. ```js
  2480. var time = cc.audioEngine.getCurrentTime(id);
  2481. ```
  2482. */
  2483. static getCurrentTime(audioID: number): number;
  2484. /**
  2485. !#en Get audio duration
  2486. !#zh 获取音频总时长。
  2487. @param audioID audio id.
  2488. @example
  2489. ```js
  2490. var time = cc.audioEngine.getDuration(id);
  2491. ```
  2492. */
  2493. static getDuration(audioID: number): number;
  2494. /**
  2495. !#en Get audio state
  2496. !#zh 获取音频状态。
  2497. @param audioID audio id.
  2498. @example
  2499. ```js
  2500. var state = cc.audioEngine.getState(id);
  2501. ```
  2502. */
  2503. static getState(audioID: number): audioEngine.AudioState;
  2504. /**
  2505. !#en Set Audio finish callback
  2506. !#zh 设置一个音频结束后的回调
  2507. @param audioID audio id.
  2508. @param callback loaded callback.
  2509. @example
  2510. ```js
  2511. cc.audioEngine.setFinishCallback(id, function () {});
  2512. ```
  2513. */
  2514. static setFinishCallback(audioID: number, callback: Function): void;
  2515. /**
  2516. !#en Pause playing audio.
  2517. !#zh 暂停正在播放音频。
  2518. @param audioID The return value of function play.
  2519. @example
  2520. ```js
  2521. cc.audioEngine.pause(audioID);
  2522. ```
  2523. */
  2524. static pause(audioID: number): void;
  2525. /**
  2526. !#en Pause all playing audio
  2527. !#zh 暂停现在正在播放的所有音频。
  2528. @example
  2529. ```js
  2530. cc.audioEngine.pauseAll();
  2531. ```
  2532. */
  2533. static pauseAll(): void;
  2534. /**
  2535. !#en Resume playing audio.
  2536. !#zh 恢复播放指定的音频。
  2537. @param audioID The return value of function play.
  2538. @example
  2539. ```js
  2540. cc.audioEngine.resume(audioID);
  2541. ```
  2542. */
  2543. static resume(audioID: number): void;
  2544. /**
  2545. !#en Resume all playing audio.
  2546. !#zh 恢复播放所有之前暂停的所有音频。
  2547. @example
  2548. ```js
  2549. cc.audioEngine.resumeAll();
  2550. ```
  2551. */
  2552. static resumeAll(): void;
  2553. /**
  2554. !#en Stop playing audio.
  2555. !#zh 停止播放指定音频。
  2556. @param audioID The return value of function play.
  2557. @example
  2558. ```js
  2559. cc.audioEngine.stop(audioID);
  2560. ```
  2561. */
  2562. static stop(audioID: number): void;
  2563. /**
  2564. !#en Stop all playing audio.
  2565. !#zh 停止正在播放的所有音频。
  2566. @example
  2567. ```js
  2568. cc.audioEngine.stopAll();
  2569. ```
  2570. */
  2571. static stopAll(): void;
  2572. /**
  2573. !#en Set up an audio can generate a few examples.
  2574. !#zh 设置一个音频可以设置几个实例
  2575. @param num a number of instances to be created from within an audio
  2576. @example
  2577. ```js
  2578. cc.audioEngine.setMaxAudioInstance(20);
  2579. ```
  2580. */
  2581. static setMaxAudioInstance(num: number): void;
  2582. /**
  2583. !#en Getting audio can produce several examples.
  2584. !#zh 获取一个音频可以设置几个实例
  2585. @example
  2586. ```js
  2587. cc.audioEngine.getMaxAudioInstance();
  2588. ```
  2589. */
  2590. static getMaxAudioInstance(): number;
  2591. /**
  2592. !#en Unload the preloaded audio from internal buffer.
  2593. !#zh 卸载预加载的音频。
  2594. @param clip clip
  2595. @example
  2596. ```js
  2597. cc.audioEngine.uncache(filePath);
  2598. ```
  2599. */
  2600. static uncache(clip: AudioClip): void;
  2601. /**
  2602. !#en Unload all audio from internal buffer.
  2603. !#zh 卸载所有音频。
  2604. @example
  2605. ```js
  2606. cc.audioEngine.uncacheAll();
  2607. ```
  2608. */
  2609. static uncacheAll(): void;
  2610. /**
  2611. !#en Play background music
  2612. !#zh 播放背景音乐
  2613. @param clip The audio clip to play.
  2614. @param loop Whether the music loop or not.
  2615. @example
  2616. ```js
  2617. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2618. var audioID = cc.audioEngine.playMusic(clip, false);
  2619. });
  2620. ```
  2621. */
  2622. static playMusic(clip: AudioClip, loop: boolean): number;
  2623. /**
  2624. !#en Stop background music.
  2625. !#zh 停止播放背景音乐。
  2626. @example
  2627. ```js
  2628. cc.audioEngine.stopMusic();
  2629. ```
  2630. */
  2631. static stopMusic(): void;
  2632. /**
  2633. !#en Pause the background music.
  2634. !#zh 暂停播放背景音乐。
  2635. @example
  2636. ```js
  2637. cc.audioEngine.pauseMusic();
  2638. ```
  2639. */
  2640. static pauseMusic(): void;
  2641. /**
  2642. !#en Resume playing background music.
  2643. !#zh 恢复播放背景音乐。
  2644. @example
  2645. ```js
  2646. cc.audioEngine.resumeMusic();
  2647. ```
  2648. */
  2649. static resumeMusic(): void;
  2650. /**
  2651. !#en Get the volume(0.0 ~ 1.0).
  2652. !#zh 获取音量(0.0 ~ 1.0)。
  2653. @example
  2654. ```js
  2655. var volume = cc.audioEngine.getMusicVolume();
  2656. ```
  2657. */
  2658. static getMusicVolume(): number;
  2659. /**
  2660. !#en Set the background music volume.
  2661. !#zh 设置背景音乐音量(0.0 ~ 1.0)。
  2662. @param volume Volume must be in 0.0~1.0.
  2663. @example
  2664. ```js
  2665. cc.audioEngine.setMusicVolume(0.5);
  2666. ```
  2667. */
  2668. static setMusicVolume(volume: number): void;
  2669. /**
  2670. !#en Background music playing state
  2671. !#zh 背景音乐是否正在播放
  2672. @example
  2673. ```js
  2674. cc.audioEngine.isMusicPlaying();
  2675. ```
  2676. */
  2677. static isMusicPlaying(): boolean;
  2678. /**
  2679. !#en Play effect audio.
  2680. !#zh 播放音效
  2681. @param clip The audio clip to play.
  2682. @param loop Whether the music loop or not.
  2683. @example
  2684. ```js
  2685. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2686. var audioID = cc.audioEngine.playEffect(clip, false);
  2687. });
  2688. ```
  2689. */
  2690. static playEffect(clip: AudioClip, loop: boolean): number;
  2691. /**
  2692. !#en Set the volume of effect audio.
  2693. !#zh 设置音效音量(0.0 ~ 1.0)。
  2694. @param volume Volume must be in 0.0~1.0.
  2695. @example
  2696. ```js
  2697. cc.audioEngine.setEffectsVolume(0.5);
  2698. ```
  2699. */
  2700. static setEffectsVolume(volume: number): void;
  2701. /**
  2702. !#en The volume of the effect audio max value is 1.0,the min value is 0.0 .
  2703. !#zh 获取音效音量(0.0 ~ 1.0)。
  2704. @example
  2705. ```js
  2706. var volume = cc.audioEngine.getEffectsVolume();
  2707. ```
  2708. */
  2709. static getEffectsVolume(): number;
  2710. /**
  2711. !#en Pause effect audio.
  2712. !#zh 暂停播放音效。
  2713. @param audioID audio id.
  2714. @example
  2715. ```js
  2716. cc.audioEngine.pauseEffect(audioID);
  2717. ```
  2718. */
  2719. static pauseEffect(audioID: number): void;
  2720. /**
  2721. !#en Stop playing all the sound effects.
  2722. !#zh 暂停播放所有音效。
  2723. @example
  2724. ```js
  2725. cc.audioEngine.pauseAllEffects();
  2726. ```
  2727. */
  2728. static pauseAllEffects(): void;
  2729. /**
  2730. !#en Resume effect audio.
  2731. !#zh 恢复播放音效音频。
  2732. @param audioID The return value of function play.
  2733. @example
  2734. ```js
  2735. cc.audioEngine.resumeEffect(audioID);
  2736. ```
  2737. */
  2738. static resumeEffect(audioID: number): void;
  2739. /**
  2740. !#en Resume all effect audio.
  2741. !#zh 恢复播放所有之前暂停的音效。
  2742. @example
  2743. ```js
  2744. cc.audioEngine.resumeAllEffects();
  2745. ```
  2746. */
  2747. static resumeAllEffects(): void;
  2748. /**
  2749. !#en Stop playing the effect audio.
  2750. !#zh 停止播放音效。
  2751. @param audioID audio id.
  2752. @example
  2753. ```js
  2754. cc.audioEngine.stopEffect(id);
  2755. ```
  2756. */
  2757. static stopEffect(audioID: number): void;
  2758. /**
  2759. !#en Stop playing all the effects.
  2760. !#zh 停止播放所有音效。
  2761. @example
  2762. ```js
  2763. cc.audioEngine.stopAllEffects();
  2764. ```
  2765. */
  2766. static stopAllEffects(): void;
  2767. }
  2768. /** !#en An object to boot the game.
  2769. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  2770. export class debug {
  2771. /**
  2772. !#en Gets error message with the error id and possible parameters.
  2773. !#zh 通过 error id 和必要的参数来获取错误信息。
  2774. @param errorId errorId
  2775. @param param param
  2776. */
  2777. static getError(errorId: string, param?: any): string;
  2778. /**
  2779. !#en Returns whether or not to display the FPS informations.
  2780. !#zh 是否显示 FPS 信息。
  2781. */
  2782. static isDisplayStats(): boolean;
  2783. /**
  2784. !#en Sets whether display the FPS on the bottom-left corner.
  2785. !#zh 设置是否在左下角显示 FPS。
  2786. @param displayStats displayStats
  2787. */
  2788. static setDisplayStats(displayStats: boolean): void;
  2789. }
  2790. /** !#en
  2791. <p>
  2792. ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>
  2793. cc.director is a singleton object which manage your game's logic flow.<br/>
  2794. Since the cc.director is a singleton, you don't need to call any constructor or create functions,<br/>
  2795. the standard way to use it is by calling:<br/>
  2796. - cc.director.methodName(); <br/>
  2797. It creates and handle the main Window and manages how and when to execute the Scenes.<br/>
  2798. <br/>
  2799. The cc.director is also responsible for:<br/>
  2800. - initializing the OpenGL context<br/>
  2801. - setting the OpenGL pixel format (default on is RGB565)<br/>
  2802. - setting the OpenGL buffer depth (default on is 0-bit)<br/>
  2803. - setting the color for clear screen (default one is BLACK)<br/>
  2804. - setting the projection (default one is 3D)<br/>
  2805. - setting the orientation (default one is Portrait)<br/>
  2806. <br/>
  2807. <br/>
  2808. The cc.director also sets the default OpenGL context:<br/>
  2809. - GL_TEXTURE_2D is enabled<br/>
  2810. - GL_VERTEX_ARRAY is enabled<br/>
  2811. - GL_COLOR_ARRAY is enabled<br/>
  2812. - GL_TEXTURE_COORD_ARRAY is enabled<br/>
  2813. </p>
  2814. <p>
  2815. cc.director also synchronizes timers with the refresh rate of the display.<br/>
  2816. Features and Limitations:<br/>
  2817. - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>
  2818. - Only supports animation intervals of 1/60 1/30 & 1/15<br/>
  2819. </p>
  2820. !#zh
  2821. <p>
  2822. 注意:用 cc.director 代替 cc.Director。<br/>
  2823. cc.director 一个管理你的游戏的逻辑流程的单例对象。<br/>
  2824. 由于 cc.director 是一个单例,你不需要调用任何构造函数或创建函数,<br/>
  2825. 使用它的标准方法是通过调用:<br/>
  2826. - cc.director.methodName();
  2827. <br/>
  2828. 它创建和处理主窗口并且管理什么时候执行场景。<br/>
  2829. <br/>
  2830. cc.director 还负责:<br/>
  2831. - 初始化 OpenGL 环境。<br/>
  2832. - 设置OpenGL像素格式。(默认是 RGB565)<br/>
  2833. - 设置OpenGL缓冲区深度 (默认是 0-bit)<br/>
  2834. - 设置空白场景的颜色 (默认是 黑色)<br/>
  2835. - 设置投影 (默认是 3D)<br/>
  2836. - 设置方向 (默认是 Portrait)<br/>
  2837. <br/>
  2838. cc.director 设置了 OpenGL 默认环境 <br/>
  2839. - GL_TEXTURE_2D 启用。<br/>
  2840. - GL_VERTEX_ARRAY 启用。<br/>
  2841. - GL_COLOR_ARRAY 启用。<br/>
  2842. - GL_TEXTURE_COORD_ARRAY 启用。<br/>
  2843. </p>
  2844. <p>
  2845. cc.director 也同步定时器与显示器的刷新速率。
  2846. <br/>
  2847. 特点和局限性: <br/>
  2848. - 将计时器 & 渲染与显示器的刷新频率同步。<br/>
  2849. - 只支持动画的间隔 1/60 1/30 & 1/15。<br/>
  2850. </p> */
  2851. export class Director extends EventTarget {
  2852. /**
  2853. !#en
  2854. Converts a view coordinate to an WebGL coordinate<br/>
  2855. Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)<br/>
  2856. Implementation can be found in CCDirectorWebGL.
  2857. !#zh 将触摸点的屏幕坐标转换为 WebGL View 下的坐标。
  2858. @param uiPoint uiPoint
  2859. */
  2860. convertToGL(uiPoint: Vec2): Vec2;
  2861. /**
  2862. !#en
  2863. Converts an OpenGL coordinate to a view coordinate<br/>
  2864. Useful to convert node points to window points for calls such as glScissor<br/>
  2865. Implementation can be found in CCDirectorWebGL.
  2866. !#zh 将触摸点的 WebGL View 坐标转换为屏幕坐标。
  2867. @param glPoint glPoint
  2868. */
  2869. convertToUI(glPoint: Vec2): Vec2;
  2870. /**
  2871. End the life of director in the next frame
  2872. */
  2873. end(): void;
  2874. /**
  2875. !#en
  2876. Returns the size of the WebGL view in points.<br/>
  2877. It takes into account any possible rotation (device orientation) of the window.
  2878. !#zh 获取视图的大小,以点为单位。
  2879. */
  2880. getWinSize(): Size;
  2881. /**
  2882. !#en
  2883. Returns the size of the OpenGL view in pixels.<br/>
  2884. It takes into account any possible rotation (device orientation) of the window.<br/>
  2885. On Mac winSize and winSizeInPixels return the same value.
  2886. (The pixel here refers to the resource resolution. If you want to get the physics resolution of device, you need to use cc.view.getFrameSize())
  2887. !#zh
  2888. 获取视图大小,以像素为单位(这里的像素指的是资源分辨率。
  2889. 如果要获取屏幕物理分辨率,需要用 cc.view.getFrameSize())
  2890. */
  2891. getWinSizeInPixels(): Size;
  2892. /**
  2893. !#en Pause the director's ticker, only involve the game logic execution.
  2894. It won't pause the rendering process nor the event manager.
  2895. If you want to pause the entier game including rendering, audio and event,
  2896. please use {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}
  2897. !#zh 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应。
  2898. 如果想要更彻底得暂停游戏,包含渲染,音频和事件,请使用 {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}。
  2899. */
  2900. pause(): void;
  2901. /**
  2902. !#en
  2903. Run a scene. Replaces the running scene with a new one or enter the first scene.<br/>
  2904. The new scene will be launched immediately.
  2905. !#zh 立刻切换指定场景。
  2906. @param scene The need run scene.
  2907. @param onBeforeLoadScene The function invoked at the scene before loading.
  2908. @param onLaunched The function invoked at the scene after launch.
  2909. */
  2910. runSceneImmediate(scene: Scene|SceneAsset, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  2911. /**
  2912. !#en
  2913. Run a scene. Replaces the running scene with a new one or enter the first scene.
  2914. The new scene will be launched at the end of the current frame.
  2915. !#zh 运行指定场景。
  2916. @param scene The need run scene.
  2917. @param onBeforeLoadScene The function invoked at the scene before loading.
  2918. @param onLaunched The function invoked at the scene after launch.
  2919. */
  2920. runScene(scene: Scene|SceneAsset, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  2921. /**
  2922. !#en Loads the scene by its name.
  2923. !#zh 通过场景名称进行加载场景。
  2924. @param sceneName The name of the scene to load.
  2925. @param onLaunched callback, will be called after scene launched.
  2926. */
  2927. loadScene(sceneName: string, onLaunched?: Function): boolean;
  2928. /**
  2929. !#en
  2930. Preloads the scene to reduces loading time. You can call this method at any time you want.
  2931. After calling this method, you still need to launch the scene by `cc.director.loadScene`.
  2932. It will be totally fine to call `cc.director.loadScene` at any time even if the preloading is not
  2933. yet finished, the scene will be launched after loaded automatically.
  2934. !#zh 预加载场景,你可以在任何时候调用这个方法。
  2935. 调用完后,你仍然需要通过 `cc.director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。
  2936. 就算预加载还没完成,你也可以直接调用 `cc.director.loadScene`,加载完成后场景就会启动。
  2937. @param sceneName The name of the scene to preload.
  2938. @param onProgress callback, will be called when the load progression change.
  2939. @param onLoaded callback, will be called after scene loaded.
  2940. */
  2941. preloadScene(sceneName: string, onProgress?: (completedCount: number, totalCount: number, item: any) => void, onLoaded?: (error: Error) => void): void;
  2942. /**
  2943. !#en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
  2944. !#zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
  2945. */
  2946. resume(): void;
  2947. /**
  2948. !#en
  2949. Enables or disables WebGL depth test.<br/>
  2950. Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
  2951. !#zh 启用/禁用深度测试(在 Canvas 渲染模式下不会生效)。
  2952. @param on on
  2953. */
  2954. setDepthTest(on: boolean): void;
  2955. /**
  2956. !#en
  2957. Set color for clear screen.<br/>
  2958. (Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js)
  2959. !#zh
  2960. 设置场景的默认擦除颜色。<br/>
  2961. 支持全透明,但不支持透明度为中间值。要支持全透明需手工开启 cc.macro.ENABLE_TRANSPARENT_CANVAS。
  2962. @param clearColor clearColor
  2963. */
  2964. setClearColor(clearColor: Color): void;
  2965. /**
  2966. !#en Returns current logic Scene.
  2967. !#zh 获取当前逻辑场景。
  2968. @example
  2969. ```js
  2970. // This will help you to get the Canvas node in scene
  2971. cc.director.getScene().getChildByName('Canvas');
  2972. ```
  2973. */
  2974. getScene(): Scene;
  2975. /**
  2976. !#en Returns the FPS value. Please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} to control animation interval.
  2977. !#zh 获取单位帧执行时间。请使用 {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} 来控制游戏帧率。
  2978. */
  2979. getAnimationInterval(): number;
  2980. /**
  2981. Sets animation interval, this doesn't control the main loop.
  2982. To control the game's frame rate overall, please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}}
  2983. @param value The animation interval desired.
  2984. */
  2985. setAnimationInterval(value: number): void;
  2986. /**
  2987. !#en Returns the delta time since last frame.
  2988. !#zh 获取上一帧的增量时间。
  2989. */
  2990. getDeltaTime(): number;
  2991. /**
  2992. !#en Returns the total passed time since game start, unit: ms
  2993. !#zh 获取从游戏开始到现在总共经过的时间,单位为 ms
  2994. */
  2995. getTotalTime(): number;
  2996. /**
  2997. !#en Returns how many frames were called since the director started.
  2998. !#zh 获取 director 启动以来游戏运行的总帧数。
  2999. */
  3000. getTotalFrames(): number;
  3001. /**
  3002. !#en Returns whether or not the Director is paused.
  3003. !#zh 是否处于暂停状态。
  3004. */
  3005. isPaused(): boolean;
  3006. /**
  3007. !#en Returns the cc.Scheduler associated with this director.
  3008. !#zh 获取和 director 相关联的 cc.Scheduler。
  3009. */
  3010. getScheduler(): Scheduler;
  3011. /**
  3012. !#en Sets the cc.Scheduler associated with this director.
  3013. !#zh 设置和 director 相关联的 cc.Scheduler。
  3014. @param scheduler scheduler
  3015. */
  3016. setScheduler(scheduler: Scheduler): void;
  3017. /**
  3018. !#en Returns the cc.ActionManager associated with this director.
  3019. !#zh 获取和 director 相关联的 cc.ActionManager(动作管理器)。
  3020. */
  3021. getActionManager(): ActionManager;
  3022. /**
  3023. !#en Sets the cc.ActionManager associated with this director.
  3024. !#zh 设置和 director 相关联的 cc.ActionManager(动作管理器)。
  3025. @param actionManager actionManager
  3026. */
  3027. setActionManager(actionManager: ActionManager): void;
  3028. /**
  3029. !#en Returns the cc.CollisionManager associated with this director.
  3030. !#zh 获取和 director 相关联的 cc.CollisionManager (碰撞管理器)。
  3031. */
  3032. getCollisionManager(): CollisionManager;
  3033. /**
  3034. !#en Returns the cc.PhysicsManager associated with this director.
  3035. !#zh 返回与 director 相关联的 cc.PhysicsManager (物理管理器)。
  3036. */
  3037. getPhysicsManager(): PhysicsManager;
  3038. /**
  3039. !#en Returns the cc.Physics3DManager associated with this director.
  3040. !#zh 返回与 director 相关联的 cc.Physics3DManager (物理管理器)。
  3041. */
  3042. getPhysics3DManager(): Physics3DManager;
  3043. /** !#en The event projection changed of cc.Director. This event will not get triggered since v2.0
  3044. !#zh cc.Director 投影变化的事件。从 v2.0 开始这个事件不会再被触发 */
  3045. static EVENT_PROJECTION_CHANGED: string;
  3046. /** !#en The event which will be triggered before loading a new scene.
  3047. !#zh 加载新场景之前所触发的事件。 */
  3048. static EVENT_BEFORE_SCENE_LOADING: string;
  3049. /** !#en The event which will be triggered before launching a new scene.
  3050. !#zh 运行新场景之前所触发的事件。 */
  3051. static EVENT_BEFORE_SCENE_LAUNCH: string;
  3052. /** !#en The event which will be triggered after launching a new scene.
  3053. !#zh 运行新场景之后所触发的事件。 */
  3054. static EVENT_AFTER_SCENE_LAUNCH: string;
  3055. /** !#en The event which will be triggered at the beginning of every frame.
  3056. !#zh 每个帧的开始时所触发的事件。 */
  3057. static EVENT_BEFORE_UPDATE: string;
  3058. /** !#en The event which will be triggered after engine and components update logic.
  3059. !#zh 将在引擎和组件 “update” 逻辑之后所触发的事件。 */
  3060. static EVENT_AFTER_UPDATE: string;
  3061. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  3062. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  3063. static EVENT_BEFORE_VISIT: string;
  3064. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  3065. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  3066. static EVENT_AFTER_VISIT: string;
  3067. /** !#en The event which will be triggered before the rendering process.
  3068. !#zh 渲染过程之前所触发的事件。 */
  3069. static EVENT_BEFORE_DRAW: string;
  3070. /** !#en The event which will be triggered after the rendering process.
  3071. !#zh 渲染过程之后所触发的事件。 */
  3072. static EVENT_AFTER_DRAW: string;
  3073. /** Constant for 2D projection (orthogonal projection) */
  3074. static PROJECTION_2D: number;
  3075. /** Constant for 3D projection with a fovy=60, znear=0.5f and zfar=1500. */
  3076. static PROJECTION_3D: number;
  3077. /** Constant for custom projection, if cc.Director's projection set to it, it calls "updateProjection" on the projection delegate. */
  3078. static PROJECTION_CUSTOM: number;
  3079. /** Constant for default projection of cc.Director, default projection is 2D projection */
  3080. static PROJECTION_DEFAULT: number;
  3081. }
  3082. /** !#en An object to boot the game.
  3083. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  3084. export class Game extends EventTarget {
  3085. /** !#en Event triggered when game hide to background.
  3086. Please note that this event is not 100% guaranteed to be fired on Web platform,
  3087. on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
  3088. !#zh 游戏进入后台时触发的事件。
  3089. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  3090. 在原生平台,它对应的是应用被切换到后台事件,下拉菜单和上拉状态栏等不一定会触发这个事件,这取决于系统行为。 */
  3091. EVENT_HIDE: string;
  3092. /** !#en Event triggered when game back to foreground
  3093. Please note that this event is not 100% guaranteed to be fired on Web platform,
  3094. on native platforms, it corresponds to enter foreground event.
  3095. !#zh 游戏进入前台运行时触发的事件。
  3096. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  3097. 在原生平台,它对应的是应用被切换到前台事件。 */
  3098. EVENT_SHOW: string;
  3099. /** !#en Event triggered when game restart
  3100. !#zh 调用restart后,触发事件。 */
  3101. EVENT_RESTART: string;
  3102. /** Event triggered after game inited, at this point all engine objects and game scripts are loaded */
  3103. EVENT_GAME_INITED: string;
  3104. /** Event triggered after engine inited, at this point you will be able to use all engine classes.
  3105. It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0 */
  3106. EVENT_ENGINE_INITED: string;
  3107. /** Web Canvas 2d API as renderer backend */
  3108. RENDER_TYPE_CANVAS: number;
  3109. /** WebGL API as renderer backend */
  3110. RENDER_TYPE_WEBGL: number;
  3111. /** OpenGL API as renderer backend */
  3112. RENDER_TYPE_OPENGL: number;
  3113. /** !#en The outer frame of the game canvas, parent of game container.
  3114. !#zh 游戏画布的外框,container 的父容器。 */
  3115. frame: any;
  3116. /** !#en The container of game canvas.
  3117. !#zh 游戏画布的容器。 */
  3118. container: HTMLDivElement;
  3119. /** !#en The canvas of the game.
  3120. !#zh 游戏的画布。 */
  3121. canvas: HTMLCanvasElement;
  3122. /** !#en The renderer backend of the game.
  3123. !#zh 游戏的渲染器类型。 */
  3124. renderType: number;
  3125. /** !#en
  3126. The current game configuration, including:<br/>
  3127. 1. debugMode<br/>
  3128. "debugMode" possible values :<br/>
  3129. 0 - No message will be printed. <br/>
  3130. 1 - cc.error, cc.assert, cc.warn, cc.log will print in console. <br/>
  3131. 2 - cc.error, cc.assert, cc.warn will print in console. <br/>
  3132. 3 - cc.error, cc.assert will print in console. <br/>
  3133. 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.<br/>
  3134. 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web. <br/>
  3135. 6 - cc.error, cc.assert will print on canvas, available only on web. <br/>
  3136. 2. showFPS<br/>
  3137. Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.<br/>
  3138. 3. exposeClassName<br/>
  3139. Expose class name to chrome debug tools, the class intantiate performance is a little bit slower when exposed.<br/>
  3140. 4. frameRate<br/>
  3141. "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.<br/>
  3142. 5. id<br/>
  3143. "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.<br/>
  3144. 6. renderMode<br/>
  3145. "renderMode" sets the renderer type, only useful on web :<br/>
  3146. 0 - Automatically chosen by engine<br/>
  3147. 1 - Forced to use canvas renderer<br/>
  3148. 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers<br/>
  3149. <br/>
  3150. Please DO NOT modify this object directly, it won't have any effect.<br/>
  3151. !#zh
  3152. 当前的游戏配置,包括: <br/>
  3153. 1. debugMode(debug 模式,但是在浏览器中这个选项会被忽略) <br/>
  3154. "debugMode" 各种设置选项的意义。 <br/>
  3155. 0 - 没有消息被打印出来。 <br/>
  3156. 1 - cc.error,cc.assert,cc.warn,cc.log 将打印在 console 中。 <br/>
  3157. 2 - cc.error,cc.assert,cc.warn 将打印在 console 中。 <br/>
  3158. 3 - cc.error,cc.assert 将打印在 console 中。 <br/>
  3159. 4 - cc.error,cc.assert,cc.warn,cc.log 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3160. 5 - cc.error,cc.assert,cc.warn 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3161. 6 - cc.error,cc.assert 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3162. 2. showFPS(显示 FPS) <br/>
  3163. 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。 <br/>
  3164. 3. exposeClassName <br/>
  3165. 暴露类名让 Chrome DevTools 可以识别,如果开启会稍稍降低类的创建过程的性能,但对对象构造没有影响。 <br/>
  3166. 4. frameRate (帧率) <br/>
  3167. “frameRate” 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。 <br/>
  3168. 5. id <br/>
  3169. "gameCanvas" Web 页面上的 Canvas Element ID,仅适用于 web 端。 <br/>
  3170. 6. renderMode(渲染模式) <br/>
  3171. “renderMode” 设置渲染器类型,仅适用于 web 端: <br/>
  3172. 0 - 通过引擎自动选择。 <br/>
  3173. 1 - 强制使用 canvas 渲染。
  3174. 2 - 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。 <br/>
  3175. <br/>
  3176. 注意:请不要直接修改这个对象,它不会有任何效果。 */
  3177. config: any;
  3178. /**
  3179. !#en Callback when the scripts of engine have been load.
  3180. !#zh 当引擎完成启动后的回调函数。
  3181. */
  3182. onStart(): void;
  3183. /**
  3184. !#en Set frame rate of game.
  3185. !#zh 设置游戏帧率。
  3186. @param frameRate frameRate
  3187. */
  3188. setFrameRate(frameRate: number): void;
  3189. /**
  3190. !#en Get frame rate set for the game, it doesn't represent the real frame rate.
  3191. !#zh 获取设置的游戏帧率(不等同于实际帧率)。
  3192. */
  3193. getFrameRate(): number;
  3194. /**
  3195. !#en Run the game frame by frame.
  3196. !#zh 执行一帧游戏循环。
  3197. */
  3198. step(): void;
  3199. /**
  3200. !#en Pause the game main loop. This will pause:
  3201. game logic execution, rendering process, event manager, background music and all audio effects.
  3202. This is different with cc.director.pause which only pause the game logic execution.
  3203. !#zh 暂停游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。这点和只暂停游戏逻辑的 cc.director.pause 不同。
  3204. */
  3205. pause(): void;
  3206. /**
  3207. !#en Resume the game from pause. This will resume:
  3208. game logic execution, rendering process, event manager, background music and all audio effects.
  3209. !#zh 恢复游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。
  3210. */
  3211. resume(): void;
  3212. /**
  3213. !#en Check whether the game is paused.
  3214. !#zh 判断游戏是否暂停。
  3215. */
  3216. isPaused(): boolean;
  3217. /**
  3218. !#en Restart game.
  3219. !#zh 重新开始游戏
  3220. */
  3221. restart(): void;
  3222. /**
  3223. !#en End game, it will close the game window
  3224. !#zh 退出游戏
  3225. */
  3226. end(): void;
  3227. /**
  3228. !#en
  3229. Register an callback of a specific event type on the game object.
  3230. This type of event should be triggered via `emit`.
  3231. !#zh
  3232. 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  3233. @param type A string representing the event type to listen for.
  3234. @param callback The callback that will be invoked when the event is dispatched.
  3235. The callback is ignored if it is a duplicate (the callbacks are unique).
  3236. @param target The target (this object) to invoke the callback, can be null
  3237. */
  3238. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3239. /**
  3240. !#en
  3241. Register an callback of a specific event type on the game object,
  3242. the callback will remove itself after the first time it is triggered.
  3243. !#zh
  3244. 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3245. @param type A string representing the event type to listen for.
  3246. @param callback The callback that will be invoked when the event is dispatched.
  3247. The callback is ignored if it is a duplicate (the callbacks are unique).
  3248. @param target The target (this object) to invoke the callback, can be null
  3249. */
  3250. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  3251. /**
  3252. !#en Prepare game.
  3253. !#zh 准备引擎,请不要直接调用这个函数。
  3254. @param cb cb
  3255. */
  3256. prepare(cb: Function): void;
  3257. /**
  3258. !#en Run game with configuration object and onStart function.
  3259. !#zh 运行游戏,并且指定引擎配置和 onStart 的回调。
  3260. @param config Pass configuration object or onStart function
  3261. @param onStart function to be executed after game initialized
  3262. */
  3263. run(config: any, onStart: Function): void;
  3264. /**
  3265. !#en
  3266. Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br/>
  3267. The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  3268. !#zh
  3269. 声明常驻根节点,该节点不会被在场景切换中被销毁。<br/>
  3270. 目标节点必须位于为层级的根节点,否则无效。
  3271. @param node The node to be made persistent
  3272. */
  3273. addPersistRootNode(node: Node): void;
  3274. /**
  3275. !#en Remove a persistent root node.
  3276. !#zh 取消常驻根节点。
  3277. @param node The node to be removed from persistent node list
  3278. */
  3279. removePersistRootNode(node: Node): void;
  3280. /**
  3281. !#en Check whether the node is a persistent root node.
  3282. !#zh 检查节点是否是常驻根节点。
  3283. @param node The node to be checked
  3284. */
  3285. isPersistRootNode(node: Node): boolean;
  3286. }
  3287. /** !#en
  3288. Class of all entities in Cocos Creator scenes.<br/>
  3289. For events supported by Node, please refer to {{#crossLink "Node.EventType"}}{{/crossLink}}
  3290. !#zh
  3291. Cocos Creator 场景中的所有节点类。<br/>
  3292. 支持的节点事件,请参阅 {{#crossLink "Node.EventType"}}{{/crossLink}}。 */
  3293. export class Node extends _BaseNode {
  3294. /** !#en
  3295. Group index of node.<br/>
  3296. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  3297. !#zh
  3298. 节点的分组索引。<br/>
  3299. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  3300. groupIndex: number;
  3301. /** !#en
  3302. Group of node.<br/>
  3303. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  3304. !#zh
  3305. 节点的分组。<br/>
  3306. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  3307. group: string;
  3308. /** !#en The position (x, y) of the node in its parent's coordinates.
  3309. !#zh 节点在父节点坐标系中的位置(x, y)。 */
  3310. position: Vec3;
  3311. /** !#en x axis position of node.
  3312. !#zh 节点 X 轴坐标。 */
  3313. x: number;
  3314. /** !#en y axis position of node.
  3315. !#zh 节点 Y 轴坐标。 */
  3316. y: number;
  3317. /** !#en z axis position of node.
  3318. !#zh 节点 Z 轴坐标。 */
  3319. z: number;
  3320. /** !#en Rotation of node.
  3321. !#zh 该节点旋转角度。 */
  3322. rotation: number;
  3323. /** !#en
  3324. Angle of node, the positive value is anti-clockwise direction.
  3325. !#zh
  3326. 该节点的旋转角度,正值为逆时针方向。 */
  3327. angle: number;
  3328. /** !#en The rotation as Euler angles in degrees, used in 3D node.
  3329. !#zh 该节点的欧拉角度,用于 3D 节点。 */
  3330. eulerAngles: Vec3;
  3331. /** !#en Rotation on x axis.
  3332. !#zh 该节点 X 轴旋转角度。 */
  3333. rotationX: number;
  3334. /** !#en Rotation on y axis.
  3335. !#zh 该节点 Y 轴旋转角度。 */
  3336. rotationY: number;
  3337. /** !#en The local scale relative to the parent.
  3338. !#zh 节点相对父节点的缩放。 */
  3339. scale: number;
  3340. /** !#en Scale on x axis.
  3341. !#zh 节点 X 轴缩放。 */
  3342. scaleX: number;
  3343. /** !#en Scale on y axis.
  3344. !#zh 节点 Y 轴缩放。 */
  3345. scaleY: number;
  3346. /** !#en Scale on z axis.
  3347. !#zh 节点 Z 轴缩放。 */
  3348. scaleZ: number;
  3349. /** !#en Skew x
  3350. !#zh 该节点 X 轴倾斜角度。 */
  3351. skewX: number;
  3352. /** !#en Skew y
  3353. !#zh 该节点 Y 轴倾斜角度。 */
  3354. skewY: number;
  3355. /** !#en Opacity of node, default value is 255.
  3356. !#zh 节点透明度,默认值为 255。 */
  3357. opacity: number;
  3358. /** !#en Color of node, default value is white: (255, 255, 255).
  3359. !#zh 节点颜色。默认为白色,数值为:(255,255,255)。 */
  3360. color: Color;
  3361. /** !#en Anchor point's position on x axis.
  3362. !#zh 节点 X 轴锚点位置。 */
  3363. anchorX: number;
  3364. /** !#en Anchor point's position on y axis.
  3365. !#zh 节点 Y 轴锚点位置。 */
  3366. anchorY: number;
  3367. /** !#en Width of node.
  3368. !#zh 节点宽度。 */
  3369. width: number;
  3370. /** !#en Height of node.
  3371. !#zh 节点高度。 */
  3372. height: number;
  3373. /** !#en zIndex is the 'key' used to sort the node relative to its siblings.<br/>
  3374. The value of zIndex should be in the range between cc.macro.MIN_ZINDEX and cc.macro.MAX_ZINDEX.<br/>
  3375. The Node's parent will sort all its children based on the zIndex value and the arrival order.<br/>
  3376. Nodes with greater zIndex will be sorted after nodes with smaller zIndex.<br/>
  3377. If two nodes have the same zIndex, then the node that was added first to the children's array will be in front of the other node in the array.<br/>
  3378. Node's order in children list will affect its rendering order. Parent is always rendering before all children.
  3379. !#zh zIndex 是用来对节点进行排序的关键属性,它决定一个节点在兄弟节点之间的位置。<br/>
  3380. zIndex 的取值应该介于 cc.macro.MIN_ZINDEX 和 cc.macro.MAX_ZINDEX 之间
  3381. 父节点主要根据节点的 zIndex 和添加次序来排序,拥有更高 zIndex 的节点将被排在后面,如果两个节点的 zIndex 一致,先添加的节点会稳定排在另一个节点之前。<br/>
  3382. 节点在 children 中的顺序决定了其渲染顺序。父节点永远在所有子节点之前被渲染 */
  3383. zIndex: number;
  3384. /** !#en
  3385. Switch 2D/3D node. The 2D nodes will run faster.
  3386. !#zh
  3387. 切换 2D/3D 节点,2D 节点会有更高的运行效率 */
  3388. is3DNode: boolean;
  3389. /** !#en Returns a normalized vector representing the up direction (Y axis) of the node in world space.
  3390. !#zh 获取节点正上方(y 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3391. up: Vec3;
  3392. /** !#en Returns a normalized vector representing the right direction (X axis) of the node in world space.
  3393. !#zh 获取节点正右方(x 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3394. right: Vec3;
  3395. /** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
  3396. !#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3397. forward: Vec3;
  3398. /**
  3399. @param name name
  3400. */
  3401. constructor(name?: string);
  3402. /**
  3403. !#en
  3404. Register a callback of a specific event type on Node.<br/>
  3405. Use this method to register touch or mouse event permit propagation based on scene graph,<br/>
  3406. These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:<br/>
  3407. 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target<br/>
  3408. 2. At target phase: dispatch to the listeners of the real target<br/>
  3409. 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root<br/>
  3410. In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.<br/>
  3411. It's the recommended way to register touch/mouse event for Node,<br/>
  3412. please do not use cc.eventManager directly for Node.<br/>
  3413. You can also register custom event and use `emit` to trigger custom event on Node.<br/>
  3414. For such events, there won't be capturing and bubbling phase, your event will be dispatched directly to its listeners registered on the same node.<br/>
  3415. You can also pass event callback parameters with `emit` by passing parameters after `type`.
  3416. !#zh
  3417. 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。<br/>
  3418. 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:<br/>
  3419. 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。<br/>
  3420. 2. 目标阶段:派发给目标节点的监听器。<br/>
  3421. 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发直到根节点。<br/>
  3422. 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>
  3423. 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。<br/>
  3424. 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器<br/>
  3425. 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
  3426. @param type A string representing the event type to listen for.<br>See {{#crossLink "Node/EventTyupe/POSITION_CHANGED"}}Node Events{{/crossLink}} for all builtin events.
  3427. @param callback The callback that will be invoked when the event is dispatched. The callback is ignored if it is a duplicate (the callbacks are unique).
  3428. @param target The target (this object) to invoke the callback, can be null
  3429. @param useCapture When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
  3430. @example
  3431. ```js
  3432. this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
  3433. node.on(cc.Node.EventType.TOUCH_START, callback, this);
  3434. node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
  3435. node.on(cc.Node.EventType.TOUCH_END, callback, this);
  3436. node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
  3437. node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3438. node.on(cc.Node.EventType.COLOR_CHANGED, callback);
  3439. ```
  3440. */
  3441. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3442. /**
  3443. !#en
  3444. Register an callback of a specific event type on the Node,
  3445. the callback will remove itself after the first time it is triggered.
  3446. !#zh
  3447. 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3448. @param type A string representing the event type to listen for.
  3449. @param callback The callback that will be invoked when the event is dispatched.
  3450. The callback is ignored if it is a duplicate (the callbacks are unique).
  3451. @param target The target (this object) to invoke the callback, can be null
  3452. @example
  3453. ```js
  3454. node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3455. ```
  3456. */
  3457. once<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3458. /**
  3459. !#en
  3460. Removes the callback previously registered with the same type, callback, target and or useCapture.
  3461. This method is merely an alias to removeEventListener.
  3462. !#zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
  3463. @param type A string representing the event type being removed.
  3464. @param callback The callback to remove.
  3465. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  3466. @param useCapture When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.
  3467. @example
  3468. ```js
  3469. this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
  3470. node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
  3471. node.off(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
  3472. ```
  3473. */
  3474. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  3475. /**
  3476. !#en Removes all callbacks previously registered with the same target.
  3477. !#zh 移除目标上的所有注册事件。
  3478. @param target The target to be searched for all related callbacks
  3479. @example
  3480. ```js
  3481. node.targetOff(target);
  3482. ```
  3483. */
  3484. targetOff(target: any): void;
  3485. /**
  3486. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  3487. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  3488. @param type The type of event.
  3489. */
  3490. hasEventListener(type: string): boolean;
  3491. /**
  3492. !#en
  3493. Trigger an event directly with the event name and necessary arguments.
  3494. !#zh
  3495. 通过事件名发送自定义事件
  3496. @param type event type
  3497. @param arg1 First argument in callback
  3498. @param arg2 Second argument in callback
  3499. @param arg3 Third argument in callback
  3500. @param arg4 Fourth argument in callback
  3501. @param arg5 Fifth argument in callback
  3502. @example
  3503. ```js
  3504. eventTarget.emit('fire', event);
  3505. eventTarget.emit('fire', message, emitter);
  3506. ```
  3507. */
  3508. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  3509. /**
  3510. !#en
  3511. Dispatches an event into the event flow.
  3512. The event target is the EventTarget object upon which the dispatchEvent() method is called.
  3513. !#zh 分发事件到事件流中。
  3514. @param event The Event object that is dispatched into the event flow
  3515. */
  3516. dispatchEvent(event: Event): void;
  3517. /**
  3518. !#en Pause node related system events registered with the current Node. Node system events includes touch and mouse events.
  3519. If recursive is set to true, then this API will pause the node system events for the node and all nodes in its sub node tree.
  3520. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3521. !#zh 暂停当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3522. 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
  3523. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3524. @param recursive Whether to pause node system events on the sub node tree.
  3525. @example
  3526. ```js
  3527. node.pauseSystemEvents(true);
  3528. ```
  3529. */
  3530. pauseSystemEvents(recursive: boolean): void;
  3531. /**
  3532. !#en Resume node related system events registered with the current Node. Node system events includes touch and mouse events.
  3533. If recursive is set to true, then this API will resume the node system events for the node and all nodes in its sub node tree.
  3534. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3535. !#zh 恢复当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3536. 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
  3537. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3538. @param recursive Whether to resume node system events on the sub node tree.
  3539. @example
  3540. ```js
  3541. node.resumeSystemEvents(true);
  3542. ```
  3543. */
  3544. resumeSystemEvents(recursive: boolean): void;
  3545. /**
  3546. !#en
  3547. Executes an action, and returns the action that is executed.<br/>
  3548. The node becomes the action's target. Refer to cc.Action's getTarget() <br/>
  3549. Calling runAction while the node is not active won't have any effect. <br/>
  3550. Note:You shouldn't modify the action after runAction, that won't take any effect.<br/>
  3551. if you want to modify, when you define action plus.
  3552. !#zh
  3553. 执行并返回该执行的动作。该节点将会变成动作的目标。<br/>
  3554. 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/>
  3555. 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。
  3556. @param action action
  3557. @example
  3558. ```js
  3559. var action = cc.scaleTo(0.2, 1, 0.6);
  3560. node.runAction(action);
  3561. node.runAction(action).repeatForever(); // fail
  3562. node.runAction(action.repeatForever()); // right
  3563. ```
  3564. */
  3565. runAction(action: Action): Action;
  3566. /**
  3567. !#en Pause all actions running on the current node. Equals to `cc.director.getActionManager().pauseTarget(node)`.
  3568. !#zh 暂停本节点上所有正在运行的动作。和 `cc.director.getActionManager().pauseTarget(node);` 等价。
  3569. @example
  3570. ```js
  3571. node.pauseAllActions();
  3572. ```
  3573. */
  3574. pauseAllActions(): void;
  3575. /**
  3576. !#en Resume all paused actions on the current node. Equals to `cc.director.getActionManager().resumeTarget(node)`.
  3577. !#zh 恢复运行本节点上所有暂停的动作。和 `cc.director.getActionManager().resumeTarget(node);` 等价。
  3578. @example
  3579. ```js
  3580. node.resumeAllActions();
  3581. ```
  3582. */
  3583. resumeAllActions(): void;
  3584. /**
  3585. !#en Stops and removes all actions from the running action list .
  3586. !#zh 停止并且移除所有正在运行的动作列表。
  3587. @example
  3588. ```js
  3589. node.stopAllActions();
  3590. ```
  3591. */
  3592. stopAllActions(): void;
  3593. /**
  3594. !#en Stops and removes an action from the running action list.
  3595. !#zh 停止并移除指定的动作。
  3596. @param action An action object to be removed.
  3597. @example
  3598. ```js
  3599. var action = cc.scaleTo(0.2, 1, 0.6);
  3600. node.stopAction(action);
  3601. ```
  3602. */
  3603. stopAction(action: Action): void;
  3604. /**
  3605. !#en Removes an action from the running action list by its tag.
  3606. !#zh 停止并且移除指定标签的动作。
  3607. @param tag A tag that indicates the action to be removed.
  3608. @example
  3609. ```js
  3610. node.stopActionByTag(1);
  3611. ```
  3612. */
  3613. stopActionByTag(tag: number): void;
  3614. /**
  3615. !#en Returns an action from the running action list by its tag.
  3616. !#zh 通过标签获取指定动作。
  3617. @param tag tag
  3618. @example
  3619. ```js
  3620. var action = node.getActionByTag(1);
  3621. ```
  3622. */
  3623. getActionByTag(tag: number): Action;
  3624. /**
  3625. !#en
  3626. Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>
  3627. Composable actions are counted as 1 action. Example:<br/>
  3628. If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  3629. If you are running 7 Sequences of 2 actions, it will return 7.</p>
  3630. !#zh
  3631. 获取运行着的动作加上正在调度运行的动作的总数。<br/>
  3632. 例如:<br/>
  3633. - 如果你正在运行 7 个动作中的 1 个 Sequence,它将返回 1。<br/>
  3634. - 如果你正在运行 2 个动作中的 7 个 Sequence,它将返回 7。<br/>
  3635. @example
  3636. ```js
  3637. var count = node.getNumberOfRunningActions();
  3638. cc.log("Running Action Count: " + count);
  3639. ```
  3640. */
  3641. getNumberOfRunningActions(): number;
  3642. /**
  3643. !#en
  3644. Returns a copy of the position (x, y, z) of the node in its parent's coordinates.
  3645. You can pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3646. !#zh
  3647. 获取节点在父节点坐标系中的位置(x, y, z)。
  3648. 你可以传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3649. @param out The return value to receive position
  3650. @example
  3651. ```js
  3652. cc.log("Node Position: " + node.getPosition());
  3653. ```
  3654. */
  3655. getPosition(out?: Vec2|Vec3): Vec2;
  3656. /**
  3657. !#en
  3658. Sets the position (x, y, z) of the node in its parent's coordinates.<br/>
  3659. Usually we use cc.v2(x, y) to compose cc.Vec2 object, in this case, position.z will become 0.<br/>
  3660. and passing two numbers (x, y) is more efficient than passing cc.Vec2 object, in this case, position.z will remain unchanged.
  3661. For 3D node we can use cc.v3(x, y, z) to compose cc.Vec3 object,<br/>
  3662. and passing three numbers (x, y, z) is more efficient than passing cc.Vec3 object.
  3663. !#zh
  3664. 设置节点在父节点坐标系中的位置。<br/>
  3665. 可以通过下面的方式设置坐标点:<br/>
  3666. 1. 传入 2 个数值 x, y (此时不会改变 position.z 的值)。<br/>
  3667. 2. 传入 cc.v2(x, y) 类型为 cc.Vec2 的对象 (此时 position.z 的值将被设置为0)。
  3668. 3. 对于 3D 节点可以传入 3 个数值 x, y, z。<br/>
  3669. 4. 对于 3D 节点可以传入 cc.v3(x, y, z) 类型为 cc.Vec3 的对象。
  3670. @param x X coordinate for position or the position object
  3671. @param y Y coordinate for position
  3672. @param z Z coordinate for position
  3673. */
  3674. setPosition(x: Vec2|Vec3|number, y?: number, z?: number): void;
  3675. /**
  3676. !#en
  3677. Returns the scale factor of the node.
  3678. Need pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3679. !#zh 获取节点的缩放,需要传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3680. @param out out
  3681. @example
  3682. ```js
  3683. cc.log("Node Scale: " + node.getScale(cc.v3()));
  3684. ```
  3685. */
  3686. getScale(out: Vec2|Vec3): Vec2;
  3687. /**
  3688. !#en
  3689. Sets the scale of axis in local coordinates of the node.
  3690. You can operate 2 axis in 2D node, and 3 axis in 3D node.
  3691. When only (x, y) is passed, the value of scale.z will not be changed.
  3692. When a Vec2 is passed in, the value of scale.z will be set to 0.
  3693. !#zh
  3694. 设置节点在本地坐标系中坐标轴上的缩放比例。
  3695. 2D 节点可以操作两个坐标轴,而 3D 节点可以操作三个坐标轴。
  3696. 当只传入 (x, y) 时,scale.z 的值不会被改变。
  3697. 当只传入 Vec2 对象时,scale.z 的值将被设置为0。
  3698. @param x scaleX or scale object
  3699. @param y y
  3700. @param z z
  3701. @example
  3702. ```js
  3703. node.setScale(cc.v2(2, 2)); // Notice: scaleZ will be 0
  3704. node.setScale(cc.v3(2, 2, 2)); // for 3D node
  3705. node.setScale(2);
  3706. ```
  3707. */
  3708. setScale(x: number|Vec2|Vec3, y?: number, z?: number): void;
  3709. /**
  3710. !#en
  3711. Get rotation of node (in quaternion).
  3712. Need pass a cc.Quat as the argument to receive the return values.
  3713. !#zh
  3714. 获取该节点的 quaternion 旋转角度,需要传一个 cc.Quat 作为参数来接收返回值。
  3715. @param out out
  3716. */
  3717. getRotation(out: Quat): Quat;
  3718. /**
  3719. !#en Set rotation of node (in quaternion).
  3720. !#zh 设置该节点的 quaternion 旋转角度。
  3721. @param quat Quaternion object represents the rotation or the x value of quaternion
  3722. @param y y value of quternion
  3723. @param z z value of quternion
  3724. @param w w value of quternion
  3725. */
  3726. setRotation(quat: Quat|number, y?: number, z?: number, w?: number): void;
  3727. /**
  3728. !#en
  3729. Returns a copy the untransformed size of the node. <br/>
  3730. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3731. All nodes has a size. Layer and Scene has the same size of the screen by default. <br/>
  3732. !#zh 获取节点自身大小,不受该节点是否被缩放或者旋转的影响。
  3733. @example
  3734. ```js
  3735. cc.log("Content Size: " + node.getContentSize());
  3736. ```
  3737. */
  3738. getContentSize(): Size;
  3739. /**
  3740. !#en
  3741. Sets the untransformed size of the node.<br/>
  3742. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3743. All nodes has a size. Layer and Scene has the same size of the screen.
  3744. !#zh 设置节点原始大小,不受该节点是否被缩放或者旋转的影响。
  3745. @param size The untransformed size of the node or The untransformed size's width of the node.
  3746. @param height The untransformed size's height of the node.
  3747. @example
  3748. ```js
  3749. node.setContentSize(cc.size(100, 100));
  3750. node.setContentSize(100, 100);
  3751. ```
  3752. */
  3753. setContentSize(size: Size|number, height?: number): void;
  3754. /**
  3755. !#en
  3756. Returns a copy of the anchor point.<br/>
  3757. Anchor point is the point around which all transformations and positioning manipulations take place.<br/>
  3758. It's like a pin in the node where it is "attached" to its parent. <br/>
  3759. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
  3760. But you can use values higher than (1,1) and lower than (0,0) too. <br/>
  3761. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3762. !#zh
  3763. 获取节点锚点,用百分比表示。<br/>
  3764. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3765. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3766. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3767. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3768. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3769. @example
  3770. ```js
  3771. cc.log("Node AnchorPoint: " + node.getAnchorPoint());
  3772. ```
  3773. */
  3774. getAnchorPoint(): Vec2;
  3775. /**
  3776. !#en
  3777. Sets the anchor point in percent. <br/>
  3778. anchor point is the point around which all transformations and positioning manipulations take place. <br/>
  3779. It's like a pin in the node where it is "attached" to its parent. <br/>
  3780. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>
  3781. But you can use values higher than (1,1) and lower than (0,0) too.<br/>
  3782. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3783. !#zh
  3784. 设置锚点的百分比。<br/>
  3785. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3786. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3787. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3788. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3789. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3790. @param point The anchor point of node or The x axis anchor of node.
  3791. @param y The y axis anchor of node.
  3792. @example
  3793. ```js
  3794. node.setAnchorPoint(cc.v2(1, 1));
  3795. node.setAnchorPoint(1, 1);
  3796. ```
  3797. */
  3798. setAnchorPoint(point: Vec2|number, y?: number): void;
  3799. /**
  3800. !#en Set rotation by lookAt target point, normally used by Camera Node
  3801. !#zh 通过观察目标来设置 rotation,一般用于 Camera Node 上
  3802. @param pos pos
  3803. @param up default is (0,1,0)
  3804. */
  3805. lookAt(pos: Vec3, up?: Vec3): void;
  3806. /**
  3807. !#en
  3808. Get the local transform matrix (4x4), based on parent node coordinates
  3809. !#zh 返回局部空间坐标系的矩阵,基于父节点坐标系。
  3810. @param out The matrix object to be filled with data
  3811. @example
  3812. ```js
  3813. let mat4 = cc.mat4();
  3814. node.getLocalMatrix(mat4);
  3815. ```
  3816. */
  3817. getLocalMatrix(out: Mat4): Mat4;
  3818. /**
  3819. !#en
  3820. Get the world transform matrix (4x4)
  3821. !#zh 返回世界空间坐标系的矩阵。
  3822. @param out The matrix object to be filled with data
  3823. @example
  3824. ```js
  3825. let mat4 = cc.mat4();
  3826. node.getWorldMatrix(mat4);
  3827. ```
  3828. */
  3829. getWorldMatrix(out: Mat4): Mat4;
  3830. /**
  3831. !#en
  3832. Converts a Point to node (local) space coordinates.
  3833. !#zh
  3834. 将一个点转换到节点 (局部) 空间坐标系。
  3835. @param worldPoint worldPoint
  3836. @param out out
  3837. @example
  3838. ```js
  3839. var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
  3840. var newVec3 = node.convertToNodeSpaceAR(cc.v3(100, 100, 100));
  3841. ```
  3842. */
  3843. convertToNodeSpaceAR<T extends cc.Vec2 | cc.Vec3>(worldPoint: T, out?: T): T;
  3844. /**
  3845. !#en
  3846. Converts a Point in node coordinates to world space coordinates.
  3847. !#zh
  3848. 将节点坐标系下的一个点转换到世界空间坐标系。
  3849. @param nodePoint nodePoint
  3850. @param out out
  3851. @example
  3852. ```js
  3853. var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
  3854. var newVec3 = node.convertToWorldSpaceAR(cc.v3(100, 100, 100));
  3855. ```
  3856. */
  3857. convertToWorldSpaceAR<T extends cc.Vec2 | cc.Vec3>(nodePoint: T, out?: T): T;
  3858. /**
  3859. !#en Converts a Point to node (local) space coordinates then add the anchor point position.
  3860. So the return position will be related to the left bottom corner of the node's bounding box.
  3861. This equals to the API behavior of cocos2d-x, you probably want to use convertToNodeSpaceAR instead
  3862. !#zh 将一个点转换到节点 (局部) 坐标系,并加上锚点的坐标。<br/>
  3863. 也就是说返回的坐标是相对于节点包围盒左下角的坐标。<br/>
  3864. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToNodeSpaceAR。
  3865. @param worldPoint worldPoint
  3866. @example
  3867. ```js
  3868. var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
  3869. ```
  3870. */
  3871. convertToNodeSpace(worldPoint: Vec2): Vec2;
  3872. /**
  3873. !#en Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates.
  3874. This equals to the API behavior of cocos2d-x, you probably want to use convertToWorldSpaceAR instead
  3875. !#zh 将一个相对于节点左下角的坐标位置转换到世界空间坐标系。
  3876. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToWorldSpaceAR
  3877. @param nodePoint nodePoint
  3878. @example
  3879. ```js
  3880. var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
  3881. ```
  3882. */
  3883. convertToWorldSpace(nodePoint: Vec2): Vec2;
  3884. /**
  3885. !#en
  3886. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  3887. The matrix is in Pixels.
  3888. !#zh 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。
  3889. @param out The affine transform object to be filled with data
  3890. @example
  3891. ```js
  3892. let affineTransform = cc.AffineTransform.create();
  3893. node.getNodeToParentTransform(affineTransform);
  3894. ```
  3895. */
  3896. getNodeToParentTransform(out?: AffineTransform): AffineTransform;
  3897. /**
  3898. !#en
  3899. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  3900. The matrix is in Pixels.<br/>
  3901. This method is AR (Anchor Relative).
  3902. !#zh
  3903. 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。<br/>
  3904. 这个矩阵以像素为单位。<br/>
  3905. 该方法基于节点坐标。
  3906. @param out The affine transform object to be filled with data
  3907. @example
  3908. ```js
  3909. let affineTransform = cc.AffineTransform.create();
  3910. node.getNodeToParentTransformAR(affineTransform);
  3911. ```
  3912. */
  3913. getNodeToParentTransformAR(out?: AffineTransform): AffineTransform;
  3914. /**
  3915. !#en Returns the world affine transform matrix. The matrix is in Pixels.
  3916. !#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。
  3917. @param out The affine transform object to be filled with data
  3918. @example
  3919. ```js
  3920. let affineTransform = cc.AffineTransform.create();
  3921. node.getNodeToWorldTransform(affineTransform);
  3922. ```
  3923. */
  3924. getNodeToWorldTransform(out?: AffineTransform): AffineTransform;
  3925. /**
  3926. !#en
  3927. Returns the world affine transform matrix. The matrix is in Pixels.<br/>
  3928. This method is AR (Anchor Relative).
  3929. !#zh
  3930. 返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。<br/>
  3931. 该方法基于节点坐标。
  3932. @param out The affine transform object to be filled with data
  3933. @example
  3934. ```js
  3935. let affineTransform = cc.AffineTransform.create();
  3936. node.getNodeToWorldTransformAR(affineTransform);
  3937. ```
  3938. */
  3939. getNodeToWorldTransformAR(out?: AffineTransform): AffineTransform;
  3940. /**
  3941. !#en
  3942. Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>
  3943. The matrix is in Pixels. The returned transform is readonly and cannot be changed.
  3944. !#zh
  3945. 返回将父节点的坐标系转换成节点(局部)的空间坐标系的矩阵。<br/>
  3946. 该矩阵以像素为单位。返回的矩阵是只读的,不能更改。
  3947. @param out The affine transform object to be filled with data
  3948. @example
  3949. ```js
  3950. let affineTransform = cc.AffineTransform.create();
  3951. node.getParentToNodeTransform(affineTransform);
  3952. ```
  3953. */
  3954. getParentToNodeTransform(out?: AffineTransform): AffineTransform;
  3955. /**
  3956. !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.
  3957. !#en 返回世界坐标系到节点坐标系的逆矩阵。
  3958. @param out The affine transform object to be filled with data
  3959. @example
  3960. ```js
  3961. let affineTransform = cc.AffineTransform.create();
  3962. node.getWorldToNodeTransform(affineTransform);
  3963. ```
  3964. */
  3965. getWorldToNodeTransform(out?: AffineTransform): AffineTransform;
  3966. /**
  3967. !#en convenience methods which take a cc.Touch instead of cc.Vec2.
  3968. !#zh 将触摸点转换成本地坐标系中位置。
  3969. @param touch The touch object
  3970. @example
  3971. ```js
  3972. var newVec2 = node.convertTouchToNodeSpace(touch);
  3973. ```
  3974. */
  3975. convertTouchToNodeSpace(touch: Touch): Vec2;
  3976. /**
  3977. !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
  3978. !#zh 转换一个 cc.Touch(世界坐标)到一个局部坐标,该方法基于节点坐标。
  3979. @param touch The touch object
  3980. @example
  3981. ```js
  3982. var newVec2 = node.convertTouchToNodeSpaceAR(touch);
  3983. ```
  3984. */
  3985. convertTouchToNodeSpaceAR(touch: Touch): Vec2;
  3986. /**
  3987. !#en
  3988. Returns a "local" axis aligned bounding box of the node. <br/>
  3989. The returned box is relative only to its parent.
  3990. !#zh 返回父节坐标系下的轴向对齐的包围盒。
  3991. @example
  3992. ```js
  3993. var boundingBox = node.getBoundingBox();
  3994. ```
  3995. */
  3996. getBoundingBox(): Rect;
  3997. /**
  3998. !#en
  3999. Returns a "world" axis aligned bounding box of the node.<br/>
  4000. The bounding box contains self and active children's world bounding box.
  4001. !#zh
  4002. 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。<br/>
  4003. 该边框包含自身和已激活的子节点的世界边框。
  4004. @example
  4005. ```js
  4006. var newRect = node.getBoundingBoxToWorld();
  4007. ```
  4008. */
  4009. getBoundingBoxToWorld(): Rect;
  4010. /**
  4011. !#en
  4012. Adds a child to the node with z order and name.
  4013. !#zh
  4014. 添加子节点,并且可以修改该节点的 局部 Z 顺序和名字。
  4015. @param child A child node
  4016. @param zIndex Z order for drawing priority. Please refer to zIndex property
  4017. @param name A name to identify the node easily. Please refer to name property
  4018. @example
  4019. ```js
  4020. node.addChild(newNode, 1, "node");
  4021. ```
  4022. */
  4023. addChild(child: Node, zIndex?: number, name?: string): void;
  4024. /**
  4025. !#en Stops all running actions and schedulers.
  4026. !#zh 停止所有正在播放的动作和计时器。
  4027. @example
  4028. ```js
  4029. node.cleanup();
  4030. ```
  4031. */
  4032. cleanup(): void;
  4033. /**
  4034. !#en Sorts the children array depends on children's zIndex and arrivalOrder,
  4035. normally you won't need to invoke this function.
  4036. !#zh 根据子节点的 zIndex 和 arrivalOrder 进行排序,正常情况下开发者不需要手动调用这个函数。
  4037. */
  4038. sortAllChildren(): void;
  4039. /**
  4040. !#en
  4041. Returns the displayed opacity of Node,
  4042. the difference between displayed opacity and opacity is that displayed opacity is calculated based on opacity and parent node's opacity when cascade opacity enabled.
  4043. !#zh
  4044. 获取节点显示透明度,
  4045. 显示透明度和透明度之间的不同之处在于当启用级连透明度时,
  4046. 显示透明度是基于自身透明度和父节点透明度计算的。
  4047. */
  4048. getDisplayedOpacity(): number;
  4049. /**
  4050. !#en
  4051. Returns the displayed color of Node,
  4052. the difference between displayed color and color is that displayed color is calculated based on color and parent node's color when cascade color enabled.
  4053. !#zh
  4054. 获取节点的显示颜色,
  4055. 显示颜色和颜色之间的不同之处在于当启用级连颜色时,
  4056. 显示颜色是基于自身颜色和父节点颜色计算的。
  4057. */
  4058. getDisplayedColor(): Color;
  4059. /** !#en Cascade opacity is removed from v2.0
  4060. Indicate whether node's opacity value affect its child nodes, default value is true.
  4061. !#zh 透明度级联功能从 v2.0 开始已移除
  4062. 节点的不透明度值是否影响其子节点,默认值为 true。 */
  4063. cascadeOpacity: boolean;
  4064. /**
  4065. !#en Cascade opacity is removed from v2.0
  4066. Returns whether node's opacity value affect its child nodes.
  4067. !#zh 透明度级联功能从 v2.0 开始已移除
  4068. 返回节点的不透明度值是否影响其子节点。
  4069. */
  4070. isCascadeOpacityEnabled(): boolean;
  4071. /**
  4072. !#en Cascade opacity is removed from v2.0
  4073. Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
  4074. !#zh 透明度级联功能从 v2.0 开始已移除
  4075. 启用或禁用级连不透明度,如果级连启用,子节点的不透明度将是父不透明度乘上它自己的不透明度。
  4076. @param cascadeOpacityEnabled cascadeOpacityEnabled
  4077. */
  4078. setCascadeOpacityEnabled(cascadeOpacityEnabled: boolean): void;
  4079. /**
  4080. !#en Opacity modify RGB have been removed since v2.0
  4081. Set whether color should be changed with the opacity value,
  4082. useless in ccsg.Node, but this function is override in some class to have such behavior.
  4083. !#zh 透明度影响颜色配置已经被废弃
  4084. 设置更改透明度时是否修改RGB值,
  4085. @param opacityValue opacityValue
  4086. */
  4087. setOpacityModifyRGB(opacityValue: boolean): void;
  4088. /**
  4089. !#en Opacity modify RGB have been removed since v2.0
  4090. Get whether color should be changed with the opacity value.
  4091. !#zh 透明度影响颜色配置已经被废弃
  4092. 获取更改透明度时是否修改RGB值。
  4093. */
  4094. isOpacityModifyRGB(): boolean;
  4095. }
  4096. /** !#en
  4097. Class of private entities in Cocos Creator scenes.<br/>
  4098. The PrivateNode is hidden in editor, and completely transparent to users.<br/>
  4099. It's normally used as Node's private content created by components in parent node.<br/>
  4100. So in theory private nodes are not children, they are part of the parent node.<br/>
  4101. Private node have two important characteristics:<br/>
  4102. 1. It has the minimum z index and cannot be modified, because they can't be displayed over real children.<br/>
  4103. 2. The positioning of private nodes is also special, they will consider the left bottom corner of the parent node's bounding box as the origin of local coordinates.<br/>
  4104. In this way, they can be easily kept inside the bounding box.<br/>
  4105. Currently, it's used by RichText component and TileMap component.
  4106. !#zh
  4107. Cocos Creator 场景中的私有节点类。<br/>
  4108. 私有节点在编辑器中不可见,对用户透明。<br/>
  4109. 通常私有节点是被一些特殊的组件创建出来作为父节点的一部分而存在的,理论上来说,它们不是子节点,而是父节点的组成部分。<br/>
  4110. 私有节点有两个非常重要的特性:<br/>
  4111. 1. 它有着最小的渲染排序的 Z 轴深度,并且无法被更改,因为它们不能被显示在其他正常子节点之上。<br/>
  4112. 2. 它的定位也是特殊的,对于私有节点来说,父节点包围盒的左下角是它的局部坐标系原点,这个原点相当于父节点的位置减去它锚点的偏移。这样私有节点可以比较容易被控制在包围盒之中。<br/>
  4113. 目前在引擎中,RichText 和 TileMap 都有可能生成私有节点。 */
  4114. export class PrivateNode extends Node {
  4115. /**
  4116. @param name name
  4117. */
  4118. constructor(name?: string);
  4119. }
  4120. /** !#en
  4121. cc.Scene is a subclass of cc.Node that is used only as an abstract concept.<br/>
  4122. cc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.
  4123. !#zh
  4124. cc.Scene 是 cc.Node 的子类,仅作为一个抽象的概念。<br/>
  4125. cc.Scene 和 cc.Node 有点不同,用户不应直接修改 cc.Scene。 */
  4126. export class Scene extends Node {
  4127. /** !#en Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.
  4128. !#zh 指示该场景中直接或间接静态引用到的所有资源是否默认在场景切换后自动释放。 */
  4129. autoReleaseAssets: boolean;
  4130. }
  4131. /** !#en
  4132. Scheduler is responsible of triggering the scheduled callbacks.<br/>
  4133. You should not use NSTimer. Instead use this class.<br/>
  4134. <br/>
  4135. There are 2 different types of callbacks (selectors):<br/>
  4136. - update callback: the 'update' callback will be called every frame. You can customize the priority.<br/>
  4137. - custom callback: A custom callback will be called every frame, or with a custom interval of time<br/>
  4138. <br/>
  4139. The 'custom selectors' should be avoided when possible. It is faster,
  4140. and consumes less memory to use the 'update callback'. *
  4141. !#zh
  4142. Scheduler 是负责触发回调函数的类。<br/>
  4143. 通常情况下,建议使用 cc.director.getScheduler() 来获取系统定时器。<br/>
  4144. 有两种不同类型的定时器:<br/>
  4145. - update 定时器:每一帧都会触发。您可以自定义优先级。<br/>
  4146. - 自定义定时器:自定义定时器可以每一帧或者自定义的时间间隔触发。<br/>
  4147. 如果希望每帧都触发,应该使用 update 定时器,使用 update 定时器更快,而且消耗更少的内存。 */
  4148. export class Scheduler {
  4149. /**
  4150. !#en This method should be called for any target which needs to schedule tasks, and this method should be called before any scheduler API usage.
  4151. This method will add a `_id` property if it doesn't exist.
  4152. !#zh 任何需要用 Scheduler 管理任务的对象主体都应该调用这个方法,并且应该在调用任何 Scheduler API 之前调用这个方法。
  4153. 这个方法会给对象添加一个 `_id` 属性,如果这个属性不存在的话。
  4154. @param target target
  4155. */
  4156. enableForTarget(target: any): void;
  4157. /**
  4158. !#en
  4159. Modifies the time of all scheduled callbacks.<br/>
  4160. You can use this property to create a 'slow motion' or 'fast forward' effect.<br/>
  4161. Default is 1.0. To create a 'slow motion' effect, use values below 1.0.<br/>
  4162. To create a 'fast forward' effect, use values higher than 1.0.<br/>
  4163. Note:It will affect EVERY scheduled selector / action.
  4164. !#zh
  4165. 设置时间间隔的缩放比例。<br/>
  4166. 您可以使用这个方法来创建一个 “slow motion(慢动作)” 或 “fast forward(快进)” 的效果。<br/>
  4167. 默认是 1.0。要创建一个 “slow motion(慢动作)” 效果,使用值低于 1.0。<br/>
  4168. 要使用 “fast forward(快进)” 效果,使用值大于 1.0。<br/>
  4169. 注意:它影响该 Scheduler 下管理的所有定时器。
  4170. @param timeScale timeScale
  4171. */
  4172. setTimeScale(timeScale: number): void;
  4173. /**
  4174. !#en Returns time scale of scheduler.
  4175. !#zh 获取时间间隔的缩放比例。
  4176. */
  4177. getTimeScale(): number;
  4178. /**
  4179. !#en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)
  4180. !#zh update 调度函数。(不应该直接调用这个方法,除非完全了解这么做的结果)
  4181. @param dt delta time
  4182. */
  4183. update(dt: number): void;
  4184. /**
  4185. !#en
  4186. <p>
  4187. The scheduled method will be called every 'interval' seconds.<br/>
  4188. If paused is YES, then it won't be called until it is resumed.<br/>
  4189. If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>
  4190. If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>
  4191. repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>
  4192. delay is the amount of time the action will wait before it'll start<br/>
  4193. </p>
  4194. !#zh
  4195. 指定回调函数,调用对象等信息来添加一个新的定时器。<br/>
  4196. 如果 paused 值为 true,那么直到 resume 被调用才开始计时。<br/>
  4197. 当时间间隔达到指定值时,设置的回调函数将会被调用。<br/>
  4198. 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,
  4199. 建议使用 scheduleUpdateForTarget 代替。<br/>
  4200. 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。<br/>
  4201. repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER
  4202. 可以让定时器一直循环触发。<br/>
  4203. delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时。
  4204. @param callback callback
  4205. @param target target
  4206. @param interval interval
  4207. @param repeat repeat
  4208. @param delay delay
  4209. @param paused paused
  4210. @example
  4211. ```js
  4212. //register a schedule to scheduler
  4213. cc.director.getScheduler().schedule(callback, this, interval, !this._isRunning);
  4214. ```
  4215. */
  4216. schedule(callback: Function, target: any, interval: number, repeat: number, delay: number, paused?: boolean): void;
  4217. schedule(callback: Function, target: any, interval: number, paused?: boolean): void;
  4218. /**
  4219. !#en
  4220. Schedules the update callback for a given target,
  4221. During every frame after schedule started, the "update" function of target will be invoked.
  4222. !#zh
  4223. 使用指定的优先级为指定的对象设置 update 定时器。
  4224. update 定时器每一帧都会被触发,触发时自动调用指定对象的 "update" 函数。
  4225. 优先级的值越低,定时器被触发的越早。
  4226. @param target target
  4227. @param priority priority
  4228. @param paused paused
  4229. */
  4230. scheduleUpdate(target: any, priority: number, paused: boolean): void;
  4231. /**
  4232. !#en
  4233. Unschedules a callback for a callback and a given target.
  4234. If you want to unschedule the "update", use `unscheduleUpdate()`
  4235. !#zh
  4236. 取消指定对象定时器。
  4237. 如果需要取消 update 定时器,请使用 unscheduleUpdate()。
  4238. @param callback The callback to be unscheduled
  4239. @param target The target bound to the callback.
  4240. */
  4241. unschedule(callback: Function, target: any): void;
  4242. /**
  4243. !#en Unschedules the update callback for a given target.
  4244. !#zh 取消指定对象的 update 定时器。
  4245. @param target The target to be unscheduled.
  4246. */
  4247. unscheduleUpdate(target: any): void;
  4248. /**
  4249. !#en
  4250. Unschedules all scheduled callbacks for a given target.
  4251. This also includes the "update" callback.
  4252. !#zh 取消指定对象的所有定时器,包括 update 定时器。
  4253. @param target The target to be unscheduled.
  4254. */
  4255. unscheduleAllForTarget(target: any): void;
  4256. /**
  4257. !#en
  4258. Unschedules all scheduled callbacks from all targets including the system callbacks.<br/>
  4259. You should NEVER call this method, unless you know what you are doing.
  4260. !#zh
  4261. 取消所有对象的所有定时器,包括系统定时器。<br/>
  4262. 不要调用此函数,除非你确定你在做什么。
  4263. */
  4264. unscheduleAll(): void;
  4265. /**
  4266. !#en
  4267. Unschedules all callbacks from all targets with a minimum priority.<br/>
  4268. You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
  4269. !#zh
  4270. 取消所有优先级的值大于指定优先级的定时器。<br/>
  4271. 你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  4272. @param minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which
  4273. priority is higher than minPriority will be unscheduled.
  4274. */
  4275. unscheduleAllWithMinPriority(minPriority: number): void;
  4276. /**
  4277. !#en Checks whether a callback for a given target is scheduled.
  4278. !#zh 检查指定的回调函数和回调对象组合是否存在定时器。
  4279. @param callback The callback to check.
  4280. @param target The target of the callback.
  4281. */
  4282. isScheduled(callback: Function, target: any): boolean;
  4283. /**
  4284. !#en
  4285. Pause all selectors from all targets.<br/>
  4286. You should NEVER call this method, unless you know what you are doing.
  4287. !#zh
  4288. 暂停所有对象的所有定时器。<br/>
  4289. 不要调用这个方法,除非你知道你正在做什么。
  4290. */
  4291. pauseAllTargets(): void;
  4292. /**
  4293. !#en
  4294. Pause all selectors from all targets with a minimum priority. <br/>
  4295. You should only call this with kCCPriorityNonSystemMin or higher.
  4296. !#zh
  4297. 暂停所有优先级的值大于指定优先级的定时器。<br/>
  4298. 你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  4299. @param minPriority minPriority
  4300. */
  4301. pauseAllTargetsWithMinPriority(minPriority: number): void;
  4302. /**
  4303. !#en
  4304. Resume selectors on a set of targets.<br/>
  4305. This can be useful for undoing a call to pauseAllCallbacks.
  4306. !#zh
  4307. 恢复指定数组中所有对象的定时器。<br/>
  4308. 这个函数是 pauseAllCallbacks 的逆操作。
  4309. @param targetsToResume targetsToResume
  4310. */
  4311. resumeTargets(targetsToResume: any[]): void;
  4312. /**
  4313. !#en
  4314. Pauses the target.<br/>
  4315. All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>
  4316. If the target is not present, nothing happens.
  4317. !#zh
  4318. 暂停指定对象的定时器。<br/>
  4319. 指定对象的所有定时器都会被暂停。<br/>
  4320. 如果指定的对象没有定时器,什么也不会发生。
  4321. @param target target
  4322. */
  4323. pauseTarget(target: any): void;
  4324. /**
  4325. !#en
  4326. Resumes the target.<br/>
  4327. The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>
  4328. If the target is not present, nothing happens.
  4329. !#zh
  4330. 恢复指定对象的所有定时器。<br/>
  4331. 指定对象的所有定时器将继续工作。<br/>
  4332. 如果指定的对象没有定时器,什么也不会发生。
  4333. @param target target
  4334. */
  4335. resumeTarget(target: any): void;
  4336. /**
  4337. !#en Returns whether or not the target is paused.
  4338. !#zh 返回指定对象的定时器是否暂停了。
  4339. @param target target
  4340. */
  4341. isTargetPaused(target: any): boolean;
  4342. /** !#en Priority level reserved for system services.
  4343. !#zh 系统服务的优先级。 */
  4344. static PRIORITY_SYSTEM: number;
  4345. /** !#en Minimum priority level for user scheduling.
  4346. !#zh 用户调度最低优先级。 */
  4347. static PRIORITY_NON_SYSTEM: number;
  4348. }
  4349. /** Class for particle asset handling. */
  4350. export class ParticleAsset extends Asset {
  4351. }
  4352. /** Particle System base class. <br/>
  4353. Attributes of a Particle System:<br/>
  4354. - emmision rate of the particles<br/>
  4355. - Gravity Mode (Mode A): <br/>
  4356. - gravity <br/>
  4357. - direction <br/>
  4358. - speed +- variance <br/>
  4359. - tangential acceleration +- variance<br/>
  4360. - radial acceleration +- variance<br/>
  4361. - Radius Mode (Mode B): <br/>
  4362. - startRadius +- variance <br/>
  4363. - endRadius +- variance <br/>
  4364. - rotate +- variance <br/>
  4365. - Properties common to all modes: <br/>
  4366. - life +- life variance <br/>
  4367. - start spin +- variance <br/>
  4368. - end spin +- variance <br/>
  4369. - start size +- variance <br/>
  4370. - end size +- variance <br/>
  4371. - start color +- variance <br/>
  4372. - end color +- variance <br/>
  4373. - life +- variance <br/>
  4374. - blending function <br/>
  4375. - texture <br/>
  4376. <br/>
  4377. cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>
  4378. 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d, <br/>
  4379. cocos2d uses a another approach, but the results are almost identical.<br/>
  4380. cocos2d supports all the variables used by Particle Designer plus a bit more: <br/>
  4381. - spinning particles (supported when using ParticleSystem) <br/>
  4382. - tangential acceleration (Gravity mode) <br/>
  4383. - radial acceleration (Gravity mode) <br/>
  4384. - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>
  4385. It is possible to customize any of the above mentioned properties in runtime. Example: <br/> */
  4386. export class ParticleSystem extends RenderComponent implements BlendFunc {
  4387. /** !#en Play particle in edit mode.
  4388. !#zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。 */
  4389. preview: boolean;
  4390. /** !#en
  4391. If set custom to true, then use custom properties insteadof read particle file.
  4392. !#zh 是否自定义粒子属性。 */
  4393. custom: boolean;
  4394. /** !#en The plist file.
  4395. !#zh plist 格式的粒子配置文件。 */
  4396. file: ParticleAsset;
  4397. /** !#en SpriteFrame used for particles display
  4398. !#zh 用于粒子呈现的 SpriteFrame */
  4399. spriteFrame: SpriteFrame;
  4400. /** !#en Texture of Particle System, readonly, please use spriteFrame to setup new texture。
  4401. !#zh 粒子贴图,只读属性,请使用 spriteFrame 属性来替换贴图。 */
  4402. texture: string;
  4403. /** !#en Current quantity of particles that are being simulated.
  4404. !#zh 当前播放的粒子数量。 */
  4405. particleCount: number;
  4406. /** !#en Indicate whether the system simulation have stopped.
  4407. !#zh 指示粒子播放是否完毕。 */
  4408. stopped: boolean;
  4409. /** !#en If set to true, the particle system will automatically start playing on onLoad.
  4410. !#zh 如果设置为 true 运行时会自动发射粒子。 */
  4411. playOnLoad: boolean;
  4412. /** !#en Indicate whether the owner node will be auto-removed when it has no particles left.
  4413. !#zh 粒子播放完毕后自动销毁所在的节点。 */
  4414. autoRemoveOnFinish: boolean;
  4415. /** !#en Indicate whether the particle system is activated.
  4416. !#zh 是否激活粒子。 */
  4417. active: boolean;
  4418. /** !#en Maximum particles of the system.
  4419. !#zh 粒子最大数量。 */
  4420. totalParticles: number;
  4421. /** !#en How many seconds the emitter wil run. -1 means 'forever'.
  4422. !#zh 发射器生存时间,单位秒,-1表示持续发射。 */
  4423. duration: number;
  4424. /** !#en Emission rate of the particles.
  4425. !#zh 每秒发射的粒子数目。 */
  4426. emissionRate: number;
  4427. /** !#en Life of each particle setter.
  4428. !#zh 粒子的运行时间。 */
  4429. life: number;
  4430. /** !#en Variation of life.
  4431. !#zh 粒子的运行时间变化范围。 */
  4432. lifeVar: number;
  4433. /** !#en Start color of each particle.
  4434. !#zh 粒子初始颜色。 */
  4435. startColor: Color;
  4436. /** !#en Variation of the start color.
  4437. !#zh 粒子初始颜色变化范围。 */
  4438. startColorVar: Color;
  4439. /** !#en Ending color of each particle.
  4440. !#zh 粒子结束颜色。 */
  4441. endColor: Color;
  4442. /** !#en Variation of the end color.
  4443. !#zh 粒子结束颜色变化范围。 */
  4444. endColorVar: Color;
  4445. /** !#en Angle of each particle setter.
  4446. !#zh 粒子角度。 */
  4447. angle: number;
  4448. /** !#en Variation of angle of each particle setter.
  4449. !#zh 粒子角度变化范围。 */
  4450. angleVar: number;
  4451. /** !#en Start size in pixels of each particle.
  4452. !#zh 粒子的初始大小。 */
  4453. startSize: number;
  4454. /** !#en Variation of start size in pixels.
  4455. !#zh 粒子初始大小的变化范围。 */
  4456. startSizeVar: number;
  4457. /** !#en End size in pixels of each particle.
  4458. !#zh 粒子结束时的大小。 */
  4459. endSize: number;
  4460. /** !#en Variation of end size in pixels.
  4461. !#zh 粒子结束大小的变化范围。 */
  4462. endSizeVar: number;
  4463. /** !#en Start angle of each particle.
  4464. !#zh 粒子开始自旋角度。 */
  4465. startSpin: number;
  4466. /** !#en Variation of start angle.
  4467. !#zh 粒子开始自旋角度变化范围。 */
  4468. startSpinVar: number;
  4469. /** !#en End angle of each particle.
  4470. !#zh 粒子结束自旋角度。 */
  4471. endSpin: number;
  4472. /** !#en Variation of end angle.
  4473. !#zh 粒子结束自旋角度变化范围。 */
  4474. endSpinVar: number;
  4475. /** !#en Source position of the emitter.
  4476. !#zh 发射器位置。 */
  4477. sourcePos: Vec2;
  4478. /** !#en Variation of source position.
  4479. !#zh 发射器位置的变化范围。(横向和纵向) */
  4480. posVar: Vec2;
  4481. /** !#en Particles movement type.
  4482. !#zh 粒子位置类型。 */
  4483. positionType: ParticleSystem.PositionType;
  4484. /** !#en Particles emitter modes.
  4485. !#zh 发射器类型。 */
  4486. emitterMode: ParticleSystem.EmitterMode;
  4487. /** !#en Gravity of the emitter.
  4488. !#zh 重力。 */
  4489. gravity: Vec2;
  4490. /** !#en Speed of the emitter.
  4491. !#zh 速度。 */
  4492. speed: number;
  4493. /** !#en Variation of the speed.
  4494. !#zh 速度变化范围。 */
  4495. speedVar: number;
  4496. /** !#en Tangential acceleration of each particle. Only available in 'Gravity' mode.
  4497. !#zh 每个粒子的切向加速度,即垂直于重力方向的加速度,只有在重力模式下可用。 */
  4498. tangentialAccel: number;
  4499. /** !#en Variation of the tangential acceleration.
  4500. !#zh 每个粒子的切向加速度变化范围。 */
  4501. tangentialAccelVar: number;
  4502. /** !#en Acceleration of each particle. Only available in 'Gravity' mode.
  4503. !#zh 粒子径向加速度,即平行于重力方向的加速度,只有在重力模式下可用。 */
  4504. radialAccel: number;
  4505. /** !#en Variation of the radial acceleration.
  4506. !#zh 粒子径向加速度变化范围。 */
  4507. radialAccelVar: number;
  4508. /** !#en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
  4509. !#zh 每个粒子的旋转是否等于其方向,只有在重力模式下可用。 */
  4510. rotationIsDir: boolean;
  4511. /** !#en Starting radius of the particles. Only available in 'Radius' mode.
  4512. !#zh 初始半径,表示粒子出生时相对发射器的距离,只有在半径模式下可用。 */
  4513. startRadius: number;
  4514. /** !#en Variation of the starting radius.
  4515. !#zh 初始半径变化范围。 */
  4516. startRadiusVar: number;
  4517. /** !#en Ending radius of the particles. Only available in 'Radius' mode.
  4518. !#zh 结束半径,只有在半径模式下可用。 */
  4519. endRadius: number;
  4520. /** !#en Variation of the ending radius.
  4521. !#zh 结束半径变化范围。 */
  4522. endRadiusVar: number;
  4523. /** !#en Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
  4524. !#zh 粒子每秒围绕起始点的旋转角度,只有在半径模式下可用。 */
  4525. rotatePerS: number;
  4526. /** !#en Variation of the degress to rotate a particle around the source pos per second.
  4527. !#zh 粒子每秒围绕起始点的旋转角度变化范围。 */
  4528. rotatePerSVar: number;
  4529. /** !#en The Particle emitter lives forever.
  4530. !#zh 表示发射器永久存在 */
  4531. static DURATION_INFINITY: number;
  4532. /** !#en The starting size of the particle is equal to the ending size.
  4533. !#zh 表示粒子的起始大小等于结束大小。 */
  4534. static START_SIZE_EQUAL_TO_END_SIZE: number;
  4535. /** !#en The starting radius of the particle is equal to the ending radius.
  4536. !#zh 表示粒子的起始半径等于结束半径。 */
  4537. static START_RADIUS_EQUAL_TO_END_RADIUS: number;
  4538. /**
  4539. !#en Stop emitting particles. Running particles will continue to run until they die.
  4540. !#zh 停止发射器发射粒子,发射出去的粒子将继续运行,直至粒子生命结束。
  4541. @example
  4542. ```js
  4543. // stop particle system.
  4544. myParticleSystem.stopSystem();
  4545. ```
  4546. */
  4547. stopSystem(): void;
  4548. /**
  4549. !#en Kill all living particles.
  4550. !#zh 杀死所有存在的粒子,然后重新启动粒子发射器。
  4551. @example
  4552. ```js
  4553. // play particle system.
  4554. myParticleSystem.resetSystem();
  4555. ```
  4556. */
  4557. resetSystem(): void;
  4558. /**
  4559. !#en Whether or not the system is full.
  4560. !#zh 发射器中粒子是否大于等于设置的总粒子数量。
  4561. */
  4562. isFull(): boolean;
  4563. /**
  4564. !#en Sets a new texture with a rect. The rect is in texture position and size.
  4565. Please use spriteFrame property instead, this function is deprecated since v1.9
  4566. !#zh 设置一张新贴图和关联的矩形。
  4567. 请直接设置 spriteFrame 属性,这个函数从 v1.9 版本开始已经被废弃
  4568. @param texture texture
  4569. @param rect rect
  4570. */
  4571. setTextureWithRect(texture: Texture2D, rect: Rect): void;
  4572. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  4573. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  4574. srcBlendFactor: macro.BlendFactor;
  4575. /** !#en specify the destination Blend Factor.
  4576. !#zh 指定目标的混合模式 */
  4577. dstBlendFactor: macro.BlendFactor;
  4578. }
  4579. /** !#en cc.VideoPlayer is a component for playing videos, you can use it for showing videos in your game. Because different platforms have different authorization, API and control methods for VideoPlayer component. And have not yet formed a unified standard, only Web, iOS, and Android platforms are currently supported.
  4580. !#zh Video 组件,用于在游戏中播放视频。由于不同平台对于 VideoPlayer 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。 */
  4581. export class VideoPlayer extends Component {
  4582. /** !#en The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.
  4583. !#zh 视频来源:REMOTE 表示远程视频 URL,LOCAL 表示本地视频地址。 */
  4584. resourceType: VideoPlayer.ResourceType;
  4585. /** !#en The remote URL of video.
  4586. !#zh 远程视频的 URL */
  4587. remoteURL: string;
  4588. /** !#en The local video full path.
  4589. !#zh 本地视频的 URL */
  4590. clip: string;
  4591. /** !#en The current playback time of the now playing item in seconds, you could also change the start playback time.
  4592. !#zh 指定视频从什么时间点开始播放,单位是秒,也可以用来获取当前视频播放的时间进度。 */
  4593. currentTime: number;
  4594. /** !#en The volume of the video.
  4595. !#zh 视频的音量(0.0 ~ 1.0) */
  4596. volume: number;
  4597. /** !#en Mutes the VideoPlayer. Mute sets the volume=0, Un-Mute restore the original volume.
  4598. !#zh 是否静音视频。静音时设置音量为 0,取消静音是恢复原来的音量。 */
  4599. mute: boolean;
  4600. /** !#en Whether keep the aspect ration of the original video.
  4601. !#zh 是否保持视频原来的宽高比 */
  4602. keepAspectRatio: boolean;
  4603. /** !#en Whether play video in fullscreen mode.
  4604. !#zh 是否全屏播放视频 */
  4605. isFullscreen: boolean;
  4606. /** !#en Always below the game view (only useful on Web. Note: The specific effects are not guaranteed to be consistent, depending on whether each browser supports or restricts).
  4607. !#zh 永远在游戏视图最底层(这个属性只有在 Web 平台上有效果。注意:具体效果无法保证一致,跟各个浏览器是否支持与限制有关) */
  4608. stayOnBottom: boolean;
  4609. /** !#en the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.
  4610. !#zh 视频播放回调函数,该回调函数会在特定情况被触发,比如播放中,暂时,停止和完成播放。 */
  4611. videoPlayerEvent: Component.EventHandler[];
  4612. /**
  4613. !#en If a video is paused, call this method could resume playing. If a video is stopped, call this method to play from scratch.
  4614. !#zh 如果视频被暂停播放了,调用这个接口可以继续播放。如果视频被停止播放了,调用这个接口可以从头开始播放。
  4615. */
  4616. play(): void;
  4617. /**
  4618. !#en If a video is paused, call this method to resume playing.
  4619. !#zh 如果一个视频播放被暂停播放了,调用这个接口可以继续播放。
  4620. */
  4621. resume(): void;
  4622. /**
  4623. !#en If a video is playing, call this method to pause playing.
  4624. !#zh 如果一个视频正在播放,调用这个接口可以暂停播放。
  4625. */
  4626. pause(): void;
  4627. /**
  4628. !#en If a video is playing, call this method to stop playing immediately.
  4629. !#zh 如果一个视频正在播放,调用这个接口可以立马停止播放。
  4630. */
  4631. stop(): void;
  4632. /**
  4633. !#en Gets the duration of the video
  4634. !#zh 获取视频文件的播放总时长
  4635. */
  4636. getDuration(): number;
  4637. /**
  4638. !#en Determine whether video is playing or not.
  4639. !#zh 判断当前视频是否处于播放状态
  4640. */
  4641. isPlaying(): boolean;
  4642. /**
  4643. !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should
  4644. call the destroy method on this component or the associated node explicitly.
  4645. Otherwise, the created DOM element won't be removed from web page.
  4646. !#zh
  4647. 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  4648. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  4649. @example
  4650. ```js
  4651. videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false);
  4652. // when you don't need videoplayer anymore
  4653. videoplayer.node.destroy();
  4654. ```
  4655. */
  4656. destroy(): boolean;
  4657. }
  4658. /** cc.TMXLayerInfo contains the information about the layers like:
  4659. - Layer name
  4660. - Layer size
  4661. - Layer opacity at creation time (it can be modified at runtime)
  4662. - Whether the layer is visible (if it's not visible, then the CocosNode won't be created)
  4663. This information is obtained from the TMX file. */
  4664. export class TMXLayerInfo {
  4665. /** Properties of the layer info. */
  4666. properties: any;
  4667. }
  4668. /** cc.TMXImageLayerInfo contains the information about the image layers.
  4669. This information is obtained from the TMX file. */
  4670. export class TMXImageLayerInfo {
  4671. }
  4672. /** <p>cc.TMXObjectGroupInfo contains the information about the object group like:
  4673. - group name
  4674. - group size
  4675. - group opacity at creation time (it can be modified at runtime)
  4676. - Whether the group is visible
  4677. This information is obtained from the TMX file.</p> */
  4678. export class TMXObjectGroupInfo {
  4679. /** Properties of the ObjectGroup info. */
  4680. properties: any[];
  4681. }
  4682. /** <p>cc.TMXTilesetInfo contains the information about the tilesets like: <br />
  4683. - Tileset name<br />
  4684. - Tileset spacing<br />
  4685. - Tileset margin<br />
  4686. - size of the tiles<br />
  4687. - Image used for the tiles<br />
  4688. - Image size<br />
  4689. This information is obtained from the TMX file. </p> */
  4690. export class TMXTilesetInfo {
  4691. /** Tileset name */
  4692. name: string;
  4693. /** First grid */
  4694. firstGid: number;
  4695. /** Spacing */
  4696. spacing: number;
  4697. /** Margin */
  4698. margin: number;
  4699. /** Texture containing the tiles (should be sprite sheet / texture atlas) */
  4700. sourceImage: any;
  4701. /** Size in pixels of the image */
  4702. imageSize: Size;
  4703. }
  4704. /** <p>cc.TMXMapInfo contains the information about the map like: <br/>
  4705. - Map orientation (hexagonal, isometric or orthogonal)<br/>
  4706. - Tile size<br/>
  4707. - Map size</p>
  4708. <p>And it also contains: <br/>
  4709. - Layers (an array of TMXLayerInfo objects)<br/>
  4710. - Tilesets (an array of TMXTilesetInfo objects) <br/>
  4711. - ObjectGroups (an array of TMXObjectGroupInfo objects) </p>
  4712. <p>This information is obtained from the TMX file. </p> */
  4713. export class TMXMapInfo {
  4714. /** Properties of the map info. */
  4715. properties: any[];
  4716. /** Map orientation. */
  4717. orientation: number;
  4718. /** Parent element. */
  4719. parentElement: any;
  4720. /** Parent GID. */
  4721. parentGID: number;
  4722. /** Layer attributes. */
  4723. layerAttrs: any;
  4724. /** Is reading storing characters stream. */
  4725. storingCharacters: boolean;
  4726. /** Current string stored from characters stream. */
  4727. currentString: string;
  4728. /** Width of the map */
  4729. mapWidth: number;
  4730. /** Height of the map */
  4731. mapHeight: number;
  4732. /** Width of a tile */
  4733. tileWidth: number;
  4734. /** Height of a tile */
  4735. tileHeight: number;
  4736. static ATTRIB_NONE: number;
  4737. static ATTRIB_BASE64: number;
  4738. static ATTRIB_GZIP: number;
  4739. static ATTRIB_ZLIB: number;
  4740. }
  4741. /** !#en Render the TMX layer.
  4742. !#zh 渲染 TMX layer。 */
  4743. export class TiledLayer extends Component {
  4744. /**
  4745. !#en enable or disable culling
  4746. !#zh 开启或关闭裁剪。
  4747. @param value value
  4748. */
  4749. enableCulling(value: any): void;
  4750. /**
  4751. !#en Adds user's node into layer.
  4752. !#zh 添加用户节点。
  4753. @param node node
  4754. */
  4755. addUserNode(node: Node): boolean;
  4756. /**
  4757. !#en Removes user's node.
  4758. !#zh 移除用户节点。
  4759. @param node node
  4760. */
  4761. removeUserNode(node: Node): boolean;
  4762. /**
  4763. !#en Destroy user's node.
  4764. !#zh 销毁用户节点。
  4765. @param node node
  4766. */
  4767. destroyUserNode(node: Node): void;
  4768. /**
  4769. !#en Gets the layer name.
  4770. !#zh 获取层的名称。
  4771. @example
  4772. ```js
  4773. let layerName = tiledLayer.getLayerName();
  4774. cc.log(layerName);
  4775. ```
  4776. */
  4777. getLayerName(): string;
  4778. /**
  4779. !#en Set the layer name.
  4780. !#zh 设置层的名称
  4781. @param layerName layerName
  4782. @example
  4783. ```js
  4784. tiledLayer.setLayerName("New Layer");
  4785. ```
  4786. */
  4787. SetLayerName(layerName: string): void;
  4788. /**
  4789. !#en Return the value for the specific property name.
  4790. !#zh 获取指定属性名的值。
  4791. @param propertyName propertyName
  4792. @example
  4793. ```js
  4794. let property = tiledLayer.getProperty("info");
  4795. cc.log(property);
  4796. ```
  4797. */
  4798. getProperty(propertyName: string): any;
  4799. /**
  4800. !#en Returns the position in pixels of a given tile coordinate.
  4801. !#zh 获取指定 tile 的像素坐标。
  4802. @param pos position or x
  4803. @param y y
  4804. @example
  4805. ```js
  4806. let pos = tiledLayer.getPositionAt(cc.v2(0, 0));
  4807. cc.log("Pos: " + pos);
  4808. let pos = tiledLayer.getPositionAt(0, 0);
  4809. cc.log("Pos: " + pos);
  4810. ```
  4811. */
  4812. getPositionAt(pos: Vec2|number, y?: number): Vec2;
  4813. /**
  4814. !#en
  4815. Sets the tiles gid (gid = tile global id) at a given tiles rect.
  4816. !#zh
  4817. 设置给定区域的 tile 的 gid (gid = tile 全局 id),
  4818. @param gids an array contains gid
  4819. @param beginCol begin col number
  4820. @param beginRow begin row number
  4821. @param totalCols count of column
  4822. @example
  4823. ```js
  4824. tiledLayer.setTilesGIDAt([1, 1, 1, 1], 10, 10, 2)
  4825. ```
  4826. */
  4827. setTilesGIDAt(gids: any[], beginCol: number, beginRow: number, totalCols: number): void;
  4828. /**
  4829. !#en
  4830. Sets the tile gid (gid = tile global id) at a given tile coordinate.<br />
  4831. The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor . Tileset Mgr +1.<br />
  4832. If a tile is already placed at that position, then it will be removed.
  4833. !#zh
  4834. 设置给定坐标的 tile 的 gid (gid = tile 全局 id),
  4835. tile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />
  4836. 如果一个 tile 已经放在那个位置,那么它将被删除。
  4837. @param gid gid
  4838. @param posOrX position or x
  4839. @param flagsOrY flags or y
  4840. @param flags flags
  4841. @example
  4842. ```js
  4843. tiledLayer.setTileGIDAt(1001, 10, 10, 1)
  4844. ```
  4845. */
  4846. setTileGIDAt(gid: number, posOrX: Vec2|number, flagsOrY: number, flags?: number): void;
  4847. /**
  4848. !#en
  4849. Returns the tiles data.An array fill with GIDs. <br />
  4850. !#zh
  4851. 返回 tiles 数据. 由GID构成的一个数组. <br />
  4852. */
  4853. getTiles(): number[];
  4854. /**
  4855. !#en
  4856. Returns the tile gid at a given tile coordinate. <br />
  4857. if it returns 0, it means that the tile is empty. <br />
  4858. !#zh
  4859. 通过给定的 tile 坐标、flags(可选)返回 tile 的 GID. <br />
  4860. 如果它返回 0,则表示该 tile 为空。<br />
  4861. @param pos or x
  4862. @param y y
  4863. @example
  4864. ```js
  4865. let tileGid = tiledLayer.getTileGIDAt(0, 0);
  4866. ```
  4867. */
  4868. getTileGIDAt(pos: Vec2|number, y?: number): number;
  4869. /**
  4870. !#en Layer orientation, which is the same as the map orientation.
  4871. !#zh 获取 Layer 方向(同地图方向)。
  4872. @example
  4873. ```js
  4874. let orientation = tiledLayer.getLayerOrientation();
  4875. cc.log("Layer Orientation: " + orientation);
  4876. ```
  4877. */
  4878. getLayerOrientation(): number;
  4879. /**
  4880. !#en properties from the layer. They can be added using Tiled.
  4881. !#zh 获取 layer 的属性,可以使用 Tiled 编辑器添加属性。
  4882. @example
  4883. ```js
  4884. let properties = tiledLayer.getProperties();
  4885. cc.log("Properties: " + properties);
  4886. ```
  4887. */
  4888. getProperties(): any;
  4889. /**
  4890. !#en
  4891. Get the TiledTile with the tile coordinate.<br/>
  4892. If there is no tile in the specified coordinate and forceCreate parameter is true, <br/>
  4893. then will create a new TiledTile at the coordinate.
  4894. The renderer will render the tile with the rotation, scale, position and color property of the TiledTile.
  4895. !#zh
  4896. 通过指定的 tile 坐标获取对应的 TiledTile。 <br/>
  4897. 如果指定的坐标没有 tile,并且设置了 forceCreate 那么将会在指定的坐标创建一个新的 TiledTile 。<br/>
  4898. 在渲染这个 tile 的时候,将会使用 TiledTile 的节点的旋转、缩放、位移、颜色属性。<br/>
  4899. @param x x
  4900. @param y y
  4901. @param forceCreate forceCreate
  4902. @example
  4903. ```js
  4904. let tile = tiledLayer.getTiledTileAt(100, 100, true);
  4905. cc.log(tile);
  4906. ```
  4907. */
  4908. getTiledTileAt(x: number, y: number, forceCreate: boolean): TiledTile;
  4909. /**
  4910. !#en
  4911. Change tile to TiledTile at the specified coordinate.
  4912. !#zh
  4913. 将指定的 tile 坐标替换为指定的 TiledTile。
  4914. @param x x
  4915. @param y y
  4916. @param tiledTile tiledTile
  4917. */
  4918. setTiledTileAt(x: number, y: number, tiledTile: TiledTile): TiledTile;
  4919. /**
  4920. !#en Return texture.
  4921. !#zh 获取纹理。
  4922. @param index The index of textures
  4923. */
  4924. getTexture(index: any): Texture2D;
  4925. /**
  4926. !#en Return texture.
  4927. !#zh 获取纹理。
  4928. */
  4929. getTextures(): Texture2D;
  4930. /**
  4931. !#en Set the texture.
  4932. !#zh 设置纹理。
  4933. @param texture texture
  4934. */
  4935. setTexture(texture: Texture2D): void;
  4936. /**
  4937. !#en Set the texture.
  4938. !#zh 设置纹理。
  4939. @param textures textures
  4940. */
  4941. setTexture(textures: Texture2D): void;
  4942. /**
  4943. !#en Gets layer size.
  4944. !#zh 获得层大小。
  4945. @example
  4946. ```js
  4947. let size = tiledLayer.getLayerSize();
  4948. cc.log("layer size: " + size);
  4949. ```
  4950. */
  4951. getLayerSize(): Size;
  4952. /**
  4953. !#en Size of the map's tile (could be different from the tile's size).
  4954. !#zh 获取 tile 的大小( tile 的大小可能会有所不同)。
  4955. @example
  4956. ```js
  4957. let mapTileSize = tiledLayer.getMapTileSize();
  4958. cc.log("MapTile size: " + mapTileSize);
  4959. ```
  4960. */
  4961. getMapTileSize(): Size;
  4962. /**
  4963. !#en Gets Tile set first information for the layer.
  4964. !#zh 获取 layer 索引位置为0的 Tileset 信息。
  4965. @param index The index of tilesets
  4966. */
  4967. getTileSet(index: any): TMXTilesetInfo;
  4968. /**
  4969. !#en Gets tile set all information for the layer.
  4970. !#zh 获取 layer 所有的 Tileset 信息。
  4971. */
  4972. getTileSet(): TMXTilesetInfo;
  4973. /**
  4974. !#en Sets tile set information for the layer.
  4975. !#zh 设置 layer 的 tileset 信息。
  4976. @param tileset tileset
  4977. */
  4978. setTileSet(tileset: TMXTilesetInfo): void;
  4979. /**
  4980. !#en Sets Tile set information for the layer.
  4981. !#zh 设置 layer 的 Tileset 信息。
  4982. @param tilesets tilesets
  4983. */
  4984. setTileSets(tilesets: TMXTilesetInfo): void;
  4985. }
  4986. /** !#en Renders a TMX Tile Map in the scene.
  4987. !#zh 在场景中渲染一个 tmx 格式的 Tile Map。 */
  4988. export class TiledMap extends Component {
  4989. /** !#en The TiledMap Asset.
  4990. !#zh TiledMap 资源。 */
  4991. tmxAsset: TiledMapAsset;
  4992. /**
  4993. !#en Gets the map size.
  4994. !#zh 获取地图大小。
  4995. @example
  4996. ```js
  4997. let mapSize = tiledMap.getMapSize();
  4998. cc.log("Map Size: " + mapSize);
  4999. ```
  5000. */
  5001. getMapSize(): Size;
  5002. /**
  5003. !#en Gets the tile size.
  5004. !#zh 获取地图背景中 tile 元素的大小。
  5005. @example
  5006. ```js
  5007. let tileSize = tiledMap.getTileSize();
  5008. cc.log("Tile Size: " + tileSize);
  5009. ```
  5010. */
  5011. getTileSize(): Size;
  5012. /**
  5013. !#en map orientation.
  5014. !#zh 获取地图方向。
  5015. @example
  5016. ```js
  5017. let mapOrientation = tiledMap.getMapOrientation();
  5018. cc.log("Map Orientation: " + mapOrientation);
  5019. ```
  5020. */
  5021. getMapOrientation(): number;
  5022. /**
  5023. !#en object groups.
  5024. !#zh 获取所有的对象层。
  5025. @example
  5026. ```js
  5027. let objGroups = titledMap.getObjectGroups();
  5028. for (let i = 0; i < objGroups.length; ++i) {
  5029. cc.log("obj: " + objGroups[i]);
  5030. }
  5031. ```
  5032. */
  5033. getObjectGroups(): TiledObjectGroup[];
  5034. /**
  5035. !#en Return the TMXObjectGroup for the specific group.
  5036. !#zh 获取指定的 TMXObjectGroup。
  5037. @param groupName groupName
  5038. @example
  5039. ```js
  5040. let group = titledMap.getObjectGroup("Players");
  5041. cc.log("ObjectGroup: " + group);
  5042. ```
  5043. */
  5044. getObjectGroup(groupName: string): TiledObjectGroup;
  5045. /**
  5046. !#en enable or disable culling
  5047. !#zh 开启或关闭裁剪。
  5048. @param value value
  5049. */
  5050. enableCulling(value: any): void;
  5051. /**
  5052. !#en Gets the map properties.
  5053. !#zh 获取地图的属性。
  5054. @example
  5055. ```js
  5056. let properties = titledMap.getProperties();
  5057. for (let i = 0; i < properties.length; ++i) {
  5058. cc.log("Properties: " + properties[i]);
  5059. }
  5060. ```
  5061. */
  5062. getProperties(): any[];
  5063. /**
  5064. !#en Return All layers array.
  5065. !#zh 返回包含所有 layer 的数组。
  5066. @example
  5067. ```js
  5068. let layers = titledMap.getLayers();
  5069. for (let i = 0; i < layers.length; ++i) {
  5070. cc.log("Layers: " + layers[i]);
  5071. }
  5072. ```
  5073. */
  5074. getLayers(): TiledLayer[];
  5075. /**
  5076. !#en return the cc.TiledLayer for the specific layer.
  5077. !#zh 获取指定名称的 layer。
  5078. @param layerName layerName
  5079. @example
  5080. ```js
  5081. let layer = titledMap.getLayer("Player");
  5082. cc.log(layer);
  5083. ```
  5084. */
  5085. getLayer(layerName: string): TiledLayer;
  5086. /**
  5087. !#en Return the value for the specific property name.
  5088. !#zh 通过属性名称,获取指定的属性。
  5089. @param propertyName propertyName
  5090. @example
  5091. ```js
  5092. let property = titledMap.getProperty("info");
  5093. cc.log("Property: " + property);
  5094. ```
  5095. */
  5096. getProperty(propertyName: string): string;
  5097. /**
  5098. !#en Return properties dictionary for tile GID.
  5099. !#zh 通过 GID ,获取指定的属性。
  5100. @param GID GID
  5101. @example
  5102. ```js
  5103. let properties = titledMap.getPropertiesForGID(GID);
  5104. cc.log("Properties: " + properties);
  5105. ```
  5106. */
  5107. getPropertiesForGID(GID: number): any;
  5108. }
  5109. /** Class for tiled map asset handling. */
  5110. export class TiledMapAsset extends Asset {
  5111. textures: Texture2D[];
  5112. textureNames: string[];
  5113. textureSizes: Size[];
  5114. imageLayerTextures: Texture2D[];
  5115. imageLayerTextureNames: string[];
  5116. }
  5117. /** !#en Renders the TMX object group.
  5118. !#zh 渲染 tmx object group。 */
  5119. export class TiledObjectGroup extends Component {
  5120. /**
  5121. !#en Offset position of child objects.
  5122. !#zh 获取子对象的偏移位置。
  5123. @example
  5124. ```js
  5125. let offset = tMXObjectGroup.getPositionOffset();
  5126. ```
  5127. */
  5128. getPositionOffset(): Vec2;
  5129. /**
  5130. !#en List of properties stored in a dictionary.
  5131. !#zh 以映射的形式获取属性列表。
  5132. @example
  5133. ```js
  5134. let offset = tMXObjectGroup.getProperties();
  5135. ```
  5136. */
  5137. getProperties(): any;
  5138. /**
  5139. !#en Gets the Group name.
  5140. !#zh 获取组名称。
  5141. @example
  5142. ```js
  5143. let groupName = tMXObjectGroup.getGroupName;
  5144. ```
  5145. */
  5146. getGroupName(): string;
  5147. /**
  5148. !#en
  5149. Return the object for the specific object name. <br />
  5150. It will return the 1st object found on the array for the given name.
  5151. !#zh 获取指定的对象。
  5152. @param objectName objectName
  5153. @example
  5154. ```js
  5155. let object = tMXObjectGroup.getObject("Group");
  5156. ```
  5157. */
  5158. getObject(objectName: string): any;
  5159. /**
  5160. !#en Gets the objects.
  5161. !#zh 获取对象数组。
  5162. @example
  5163. ```js
  5164. let objects = tMXObjectGroup.getObjects();
  5165. ```
  5166. */
  5167. getObjects(): any[];
  5168. }
  5169. /** !#en TiledTile can control the specified map tile.
  5170. It will apply the node rotation, scale, translate to the map tile.
  5171. You can change the TiledTile's gid to change the map tile's style.
  5172. !#zh TiledTile 可以单独对某一个地图块进行操作。
  5173. 他会将节点的旋转,缩放,平移操作应用在这个地图块上,并可以通过更换当前地图块的 gid 来更换地图块的显示样式。 */
  5174. export class TiledTile extends Component {
  5175. /** !#en Specify the TiledTile horizontal coordinate,use map tile as the unit.
  5176. !#zh 指定 TiledTile 的横向坐标,以地图块为单位 */
  5177. x: number;
  5178. /** !#en Specify the TiledTile vertical coordinate,use map tile as the unit.
  5179. !#zh 指定 TiledTile 的纵向坐标,以地图块为单位 */
  5180. y: number;
  5181. /** !#en Specify the TiledTile gid.
  5182. !#zh 指定 TiledTile 的 gid 值 */
  5183. gid: number;
  5184. }
  5185. /** !#en cc.WebView is a component for display web pages in the game. Because different platforms have different authorization, API and control methods for WebView component. And have not yet formed a unified standard, only Web, iOS, and Android platforms are currently supported.
  5186. !#zh WebView 组件,用于在游戏中显示网页。由于不同平台对于 WebView 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。 */
  5187. export class WebView extends Component {
  5188. /** !#en A given URL to be loaded by the WebView, it should have a http or https prefix.
  5189. !#zh 指定 WebView 加载的网址,它应该是一个 http 或者 https 开头的字符串 */
  5190. url: string;
  5191. /** !#en The webview's event callback , it will be triggered when certain webview event occurs.
  5192. !#zh WebView 的回调事件,当网页加载过程中,加载完成后或者加载出错时都会回调此函数 */
  5193. webviewLoadedEvents: Component.EventHandler[];
  5194. /**
  5195. !#en
  5196. Set javascript interface scheme (see also setOnJSCallback). <br/>
  5197. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  5198. Please refer to the official documentation for more details.
  5199. !#zh
  5200. 设置 JavaScript 接口方案(与 'setOnJSCallback' 配套使用)。<br/>
  5201. 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。<br/>
  5202. 详情请参阅官方文档
  5203. @param scheme scheme
  5204. */
  5205. setJavascriptInterfaceScheme(scheme: string): void;
  5206. /**
  5207. !#en
  5208. This callback called when load URL that start with javascript
  5209. interface scheme (see also setJavascriptInterfaceScheme). <br/>
  5210. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  5211. Please refer to the official documentation for more details.
  5212. !#zh
  5213. 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。<br/>
  5214. 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。
  5215. 详情请参阅官方文档
  5216. @param callback callback
  5217. */
  5218. setOnJSCallback(callback: Function): void;
  5219. /**
  5220. !#en
  5221. Evaluates JavaScript in the context of the currently displayed page. <br/>
  5222. Please refer to the official document for more details <br/>
  5223. Note: Cross domain issues need to be resolved by yourself <br/>
  5224. !#zh
  5225. 执行 WebView 内部页面脚本(详情请参阅官方文档) <br/>
  5226. 注意:需要自行解决跨域问题
  5227. @param str str
  5228. */
  5229. evaluateJS(str: string): void;
  5230. /**
  5231. !#en if you don't need the WebView and it isn't in any running Scene, you should
  5232. call the destroy method on this component or the associated node explicitly.
  5233. Otherwise, the created DOM element won't be removed from web page.
  5234. !#zh
  5235. 如果你不再使用 WebView,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  5236. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  5237. @example
  5238. ```js
  5239. webview.node.parent = null; // or webview.node.removeFromParent(false);
  5240. // when you don't need webview anymore
  5241. webview.node.destroy();
  5242. ```
  5243. */
  5244. destroy(): boolean;
  5245. }
  5246. /** !#en
  5247. cc.NodePool is the cache pool designed for node type.<br/>
  5248. It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  5249. It's recommended to create cc.NodePool instances by node type, the type corresponds to node type in game design, not the class,
  5250. for example, a prefab is a specific node type. <br/>
  5251. When you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>
  5252. Some common use case is :<br/>
  5253. 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
  5254. 2. Blocks in candy crash (massive creation and recreation)<br/>
  5255. etc...
  5256. !#zh
  5257. cc.NodePool 是用于管理节点对象的对象缓存池。<br/>
  5258. 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
  5259. 以前 cocos2d-x 中的 cc.pool 和新的节点事件注册系统不兼容,因此请使用 cc.NodePool 来代替。
  5260. 新的 NodePool 需要实例化之后才能使用,每种不同的节点对象池需要一个不同的对象池实例,这里的种类对应于游戏中的节点设计,一个 prefab 相当于一个种类的节点。<br/>
  5261. 在创建缓冲池时,可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>
  5262. 一些常见的用例是:<br/>
  5263. 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
  5264. 2.糖果粉碎传奇中的木块(频繁创建)。
  5265. 等等.... */
  5266. export class NodePool {
  5267. /**
  5268. !#en
  5269. Constructor for creating a pool for a specific node template (usually a prefab). You can pass a component (type or name) argument for handling event for reusing and recycling node.
  5270. !#zh
  5271. 使用构造函数来创建一个节点专用的对象池,您可以传递一个组件类型或名称,用于处理节点回收和复用时的事件逻辑。
  5272. @param poolHandlerComp !#en The constructor or the class name of the component to control the unuse/reuse logic. !#zh 处理节点回收和复用事件逻辑的组件类型或名称。
  5273. @example
  5274. ```js
  5275. properties: {
  5276. template: cc.Prefab
  5277. },
  5278. onLoad () {
  5279. // MyTemplateHandler is a component with 'unuse' and 'reuse' to handle events when node is reused or recycled.
  5280. this.myPool = new cc.NodePool('MyTemplateHandler');
  5281. }
  5282. ```
  5283. */
  5284. constructor(poolHandlerComp?: {prototype: Component}|string);
  5285. /** !#en The pool handler component, it could be the class name or the constructor.
  5286. !#zh 缓冲池处理组件,用于节点的回收和复用逻辑,这个属性可以是组件类名或组件的构造函数。 */
  5287. poolHandlerComp: Function|string;
  5288. /**
  5289. !#en The current available size in the pool
  5290. !#zh 获取当前缓冲池的可用对象数量
  5291. */
  5292. size(): number;
  5293. /**
  5294. !#en Destroy all cached nodes in the pool
  5295. !#zh 销毁对象池中缓存的所有节点
  5296. */
  5297. clear(): void;
  5298. /**
  5299. !#en Put a new Node into the pool.
  5300. It will automatically remove the node from its parent without cleanup.
  5301. It will also invoke unuse method of the poolHandlerComp if exist.
  5302. !#zh 向缓冲池中存入一个不再需要的节点对象。
  5303. 这个函数会自动将目标节点从父节点上移除,但是不会进行 cleanup 操作。
  5304. 这个函数会调用 poolHandlerComp 的 unuse 函数,如果组件和函数都存在的话。
  5305. @param obj obj
  5306. @example
  5307. ```js
  5308. let myNode = cc.instantiate(this.template);
  5309. this.myPool.put(myNode);
  5310. ```
  5311. */
  5312. put(obj: Node): void;
  5313. /**
  5314. !#en Get a obj from pool, if no available object in pool, null will be returned.
  5315. This function will invoke the reuse function of poolHandlerComp if exist.
  5316. !#zh 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  5317. 这个函数会调用 poolHandlerComp 的 reuse 函数,如果组件和函数都存在的话。
  5318. @param params !#en Params to pass to 'reuse' method in poolHandlerComp !#zh 向 poolHandlerComp 中的 'reuse' 函数传递的参数
  5319. @example
  5320. ```js
  5321. let newNode = this.myPool.get();
  5322. ```
  5323. */
  5324. get(...params: any[]): Node;
  5325. }
  5326. /** !#en
  5327. Camera is usefull when making reel game or other games which need scroll screen.
  5328. Using camera will be more efficient than moving node to scroll screen.
  5329. Camera
  5330. !#zh
  5331. 摄像机在制作卷轴或是其他需要移动屏幕的游戏时比较有用,使用摄像机将会比移动节点来移动屏幕更加高效。 */
  5332. export class Camera extends Component {
  5333. /** !#en
  5334. The camera zoom ratio, only support 2D camera.
  5335. !#zh
  5336. 摄像机缩放比率, 只支持 2D camera。 */
  5337. zoomRatio: number;
  5338. /** !#en
  5339. Field of view. The width of the Camera’s view angle, measured in degrees along the local Y axis.
  5340. !#zh
  5341. 决定摄像机视角的宽度,当摄像机处于透视投影模式下这个属性才会生效。 */
  5342. fov: number;
  5343. /** !#en
  5344. The viewport size of the Camera when set to orthographic projection.
  5345. !#zh
  5346. 摄像机在正交投影模式下的视窗大小。 */
  5347. orthoSize: number;
  5348. /** !#en
  5349. The near clipping plane.
  5350. !#zh
  5351. 摄像机的近剪裁面。 */
  5352. nearClip: number;
  5353. /** !#en
  5354. The far clipping plane.
  5355. !#zh
  5356. 摄像机的远剪裁面。 */
  5357. farClip: number;
  5358. /** !#en
  5359. Is the camera orthographic (true) or perspective (false)?
  5360. !#zh
  5361. 设置摄像机的投影模式是正交还是透视模式。 */
  5362. ortho: boolean;
  5363. /** !#en
  5364. Four values (0 ~ 1) that indicate where on the screen this camera view will be drawn.
  5365. !#zh
  5366. 决定摄像机绘制在屏幕上哪个位置,值为(0 ~ 1)。 */
  5367. rect: Rect;
  5368. /** !#en
  5369. This is used to render parts of the scene selectively.
  5370. !#zh
  5371. 决定摄像机会渲染场景的哪一部分。 */
  5372. cullingMask: number;
  5373. /** !#en
  5374. Determining what to clear when camera rendering.
  5375. !#zh
  5376. 决定摄像机渲染时会清除哪些状态。 */
  5377. clearFlags: Camera.ClearFlags;
  5378. /** !#en
  5379. The color with which the screen will be cleared.
  5380. !#zh
  5381. 摄像机用于清除屏幕的背景色。 */
  5382. backgroundColor: Color;
  5383. /** !#en
  5384. Camera's depth in the camera rendering order. Cameras with higher depth are rendered after cameras with lower depth.
  5385. !#zh
  5386. 摄像机深度。用于决定摄像机的渲染顺序,值越大渲染在越上层。 */
  5387. depth: number;
  5388. /** !#en
  5389. Destination render texture.
  5390. Usually cameras render directly to screen, but for some effects it is useful to make a camera render into a texture.
  5391. !#zh
  5392. 摄像机渲染的目标 RenderTexture。
  5393. 一般摄像机会直接渲染到屏幕上,但是有一些效果可以使用摄像机渲染到 RenderTexture 上再对 RenderTexture 进行处理来实现。 */
  5394. targetTexture: RenderTexture;
  5395. /** !#en
  5396. Sets the camera's render stages.
  5397. !#zh
  5398. 设置摄像机渲染的阶段 */
  5399. renderStages: number;
  5400. /** !#en Whether auto align camera viewport to screen
  5401. !#zh 是否自动将摄像机的视口对准屏幕 */
  5402. alignWithScreen: boolean;
  5403. /** !#en
  5404. The primary camera in the scene. Returns the rear most rendered camera, which is the camera with the lowest depth.
  5405. !#zh
  5406. 当前场景中激活的主摄像机。将会返回渲染在屏幕最底层,也就是 depth 最小的摄像机。 */
  5407. static main: Camera;
  5408. /** !#en
  5409. All enabled cameras.
  5410. !#zh
  5411. 当前激活的所有摄像机。 */
  5412. static cameras: Camera[];
  5413. /**
  5414. !#en
  5415. Get the first camera which the node belong to.
  5416. !#zh
  5417. 获取节点所在的第一个摄像机。
  5418. @param node node
  5419. */
  5420. static findCamera(node: Node): Camera;
  5421. /**
  5422. !#en
  5423. Get the screen to world matrix, only support 2D camera which alignWithScreen is true.
  5424. !#zh
  5425. 获取屏幕坐标系到世界坐标系的矩阵,只适用于 alignWithScreen 为 true 的 2D 摄像机。
  5426. @param out the matrix to receive the result
  5427. */
  5428. getScreenToWorldMatrix2D(out: Mat4): Mat4;
  5429. /**
  5430. !#en
  5431. Get the world to camera matrix, only support 2D camera which alignWithScreen is true.
  5432. !#zh
  5433. 获取世界坐标系到摄像机坐标系的矩阵,只适用于 alignWithScreen 为 true 的 2D 摄像机。
  5434. @param out the matrix to receive the result
  5435. */
  5436. getWorldToScreenMatrix2D(out: Mat4): Mat4;
  5437. /**
  5438. !#en
  5439. Convert point from screen to world.
  5440. !#zh
  5441. 将坐标从屏幕坐标系转换到世界坐标系。
  5442. @param screenPosition screenPosition
  5443. @param out out
  5444. */
  5445. getScreenToWorldPoint(screenPosition: Vec3|Vec2, out?: Vec3|Vec2): Vec3;
  5446. /**
  5447. !#en
  5448. Convert point from world to screen.
  5449. !#zh
  5450. 将坐标从世界坐标系转化到屏幕坐标系。
  5451. @param worldPosition worldPosition
  5452. @param out out
  5453. */
  5454. getWorldToScreenPoint(worldPosition: Vec3|Vec2, out?: Vec3|Vec2): Vec3;
  5455. /**
  5456. !#en
  5457. Get a ray from screen position
  5458. !#zh
  5459. 从屏幕坐标获取一条射线
  5460. @param screenPos screenPos
  5461. */
  5462. getRay(screenPos: Vec2): geomUtils.Ray;
  5463. /**
  5464. !#en
  5465. Check whether the node is in the camera.
  5466. !#zh
  5467. 检测节点是否被此摄像机影响
  5468. @param node the node which need to check
  5469. */
  5470. containsNode(node: Node): boolean;
  5471. /**
  5472. !#en
  5473. Render the camera manually.
  5474. !#zh
  5475. 手动渲染摄像机。
  5476. @param rootNode rootNode
  5477. */
  5478. render(rootNode?: Node): void;
  5479. /**
  5480. !#en
  5481. Returns the matrix that transform the node's (local) space coordinates into the camera's space coordinates.
  5482. !#zh
  5483. 返回一个将节点坐标系转换到摄像机坐标系下的矩阵
  5484. @param node the node which should transform
  5485. */
  5486. getNodeToCameraTransform(node: Node): AffineTransform;
  5487. /**
  5488. !#en
  5489. Conver a camera coordinates point to world coordinates.
  5490. !#zh
  5491. 将一个摄像机坐标系下的点转换到世界坐标系下。
  5492. @param point the point which should transform
  5493. @param out the point to receive the result
  5494. */
  5495. getCameraToWorldPoint(point: Vec2, out?: Vec2): Vec2;
  5496. /**
  5497. !#en
  5498. Conver a world coordinates point to camera coordinates.
  5499. !#zh
  5500. 将一个世界坐标系下的点转换到摄像机坐标系下。
  5501. @param point point
  5502. @param out the point to receive the result
  5503. */
  5504. getWorldToCameraPoint(point: Vec2, out?: Vec2): Vec2;
  5505. /**
  5506. !#en
  5507. Get the camera to world matrix
  5508. !#zh
  5509. 获取摄像机坐标系到世界坐标系的矩阵
  5510. @param out the matrix to receive the result
  5511. */
  5512. getCameraToWorldMatrix(out: Mat4): Mat4;
  5513. /**
  5514. !#en
  5515. Get the world to camera matrix
  5516. !#zh
  5517. 获取世界坐标系到摄像机坐标系的矩阵
  5518. @param out the matrix to receive the result
  5519. */
  5520. getWorldToCameraMatrix(out: Mat4): Mat4;
  5521. }
  5522. /** !#en
  5523. This module controls asset's behaviors and information, include loading, releasing etc. it is a singleton
  5524. All member can be accessed with `cc.assetManager`.
  5525. !#zh
  5526. 此模块管理资源的行为和信息,包括加载,释放等,这是一个单例,所有成员能够通过 `cc.assetManager` 调用 */
  5527. export class AssetManager {
  5528. /** !#en
  5529. Normal loading pipeline
  5530. !#zh
  5531. 正常加载管线 */
  5532. pipeline: cc.AssetManager.Pipeline;
  5533. /** !#en
  5534. Fetching pipeline
  5535. !#zh
  5536. 下载管线 */
  5537. fetchPipeline: cc.AssetManager.Pipeline;
  5538. /** !#en
  5539. Url transformer
  5540. !#zh
  5541. Url 转换器 */
  5542. transformPipeline: cc.AssetManager.Pipeline;
  5543. /** !#en
  5544. The collection of bundle which is already loaded, you can remove cache with {{#crossLink "AssetManager/removeBundle:method"}}{{/crossLink}}
  5545. !#zh
  5546. 已加载 bundle 的集合, 你能通过 {{#crossLink "AssetManager/removeBundle:method"}}{{/crossLink}} 来移除缓存 */
  5547. bundles: AssetManager.Cache<AssetManager.Bundle>;
  5548. /** !#en
  5549. The collection of asset which is already loaded, you can remove cache with {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  5550. !#zh
  5551. 已加载资源的集合, 你能通过 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} 来移除缓存 */
  5552. assets: AssetManager.Cache<cc.Asset>;
  5553. /** !#en
  5554. Manage relationship between asset and its dependencies
  5555. !#zh
  5556. 管理资源依赖关系 */
  5557. dependUtil: cc.AssetManager.DependUtil;
  5558. /** !#en
  5559. Whether or not cache the loaded asset
  5560. !#zh
  5561. 是否缓存已加载的资源 */
  5562. cacheAsset: boolean;
  5563. /** !#en
  5564. Whether or not load asset forcely, if it is true, asset will be loaded regardless of error
  5565. !#zh
  5566. 是否强制加载资源, 如果为 true ,加载资源将会忽略报错 */
  5567. force: boolean;
  5568. /** !#en
  5569. Some useful function
  5570. !#zh
  5571. 一些有用的方法 */
  5572. utils: cc.AssetManager.Helper;
  5573. /** !#en
  5574. Manage all downloading task
  5575. !#zh
  5576. 管理所有下载任务 */
  5577. downloader: cc.AssetManager.Downloader;
  5578. /** !#en
  5579. Manage all parsing task
  5580. !#zh
  5581. 管理所有解析任务 */
  5582. parser: cc.AssetManager.Parser;
  5583. /** !#en
  5584. Manage internal asset
  5585. !#zh
  5586. 管理内置资源 */
  5587. builtins: cc.AssetManager.Builtins;
  5588. /** !#en
  5589. Manage all packed asset
  5590. !#zh
  5591. 管理所有合并后的资源 */
  5592. packManager: cc.AssetManager.PackManager;
  5593. /** !#en
  5594. Cache manager is a module which controls all caches downloaded from server in non-web platform.
  5595. !#zh
  5596. 缓存管理器是一个模块,在非 WEB 平台上,用于管理所有从服务器上下载下来的缓存 */
  5597. cacheManager: cc.AssetManager.CacheManager|null;
  5598. /** !#en
  5599. The preset of options
  5600. !#zh
  5601. 可选参数的预设集 */
  5602. presets: Record<string, Record<string, any>>;
  5603. /** !#en
  5604. The builtin 'main' bundle
  5605. !#zh
  5606. 内置 main 包 */
  5607. main: cc.AssetManager.Bundle;
  5608. /** !#en
  5609. The builtin 'resources' bundle
  5610. !#zh
  5611. 内置 resources 包 */
  5612. resources: cc.AssetManager.Bundle;
  5613. /** !#en
  5614. The builtin 'internal' bundle
  5615. !#zh
  5616. 内置 internal 包 */
  5617. internal: cc.AssetManager.Bundle;
  5618. /**
  5619. !#en
  5620. Initialize assetManager with options
  5621. !#zh
  5622. 初始化资源管理器
  5623. @param options options
  5624. */
  5625. init(options: Record<string, any>): void;
  5626. /**
  5627. !#en
  5628. Get the bundle which has been loaded
  5629. !#zh
  5630. 获取已加载的分包
  5631. @param name The name of bundle
  5632. @example
  5633. ```js
  5634. // ${project}/assets/test1
  5635. cc.assetManager.getBundle('test1');
  5636. cc.assetManager.getBundle('resources');
  5637. ```
  5638. */
  5639. getBundle (name: string): cc.AssetManager.Bundle;
  5640. /**
  5641. !#en
  5642. Remove this bundle. NOTE: The asset whthin this bundle will not be released automatically, you can call {{#crossLink "Bundle/releaseAll:method"}}{{/crossLink}} manually before remove it if you need
  5643. !#zh
  5644. 移除此包, 注意:这个包内的资源不会自动释放, 如果需要的话你可以在摧毁之前手动调用 {{#crossLink "Bundle/releaseAll:method"}}{{/crossLink}} 进行释放
  5645. @param bundle The bundle to be removed
  5646. */
  5647. removeBundle(bundle: cc.AssetManager.Bundle): void;
  5648. /**
  5649. !#en
  5650. General interface used to load assets with a progression callback and a complete callback. You can achieve almost all effect you want with combination of `requests` and `options`.
  5651. It is highly recommended that you use more simple API, such as `load`, `loadDir` etc. Every custom parameter in `options` will be distribute to each of `requests`.
  5652. if request already has same one, the parameter in request will be given priority. Besides, if request has dependencies, `options` will distribute to dependencies too.
  5653. Every custom parameter in `requests` will be tranfered to handler of `downloader` and `parser` as `options`.
  5654. You can register you own handler downloader or parser to collect these custom parameters for some effect.
  5655. Reserved Keyword: `uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`, `maxConcurrency`, `maxRequestsPerFrame`
  5656. `maxRetryCount`, `version`, `responseType`, `withCredentials`, `mimeType`, `timeout`, `header`, `reload`, `cacheAsset`, `cacheEnabled`,
  5657. Please DO NOT use these words as custom options!
  5658. !#zh
  5659. 通用加载资源接口,可传入进度回调以及完成回调,通过组合 `request` 和 `options` 参数,几乎可以实现和扩展所有想要的加载效果。非常建议你使用更简单的API,例如 `load`、`loadDir` 等。
  5660. `options` 中的自定义参数将会分发到 `requests` 的每一项中,如果request中已存在同名的参数则以 `requests` 中为准,同时如果有其他
  5661. 依赖资源,则 `options` 中的参数会继续向依赖项中分发。request中的自定义参数都会以 `options` 形式传入加载流程中的 `downloader`, `parser` 的方法中, 你可以
  5662. 扩展 `downloader`, `parser` 收集参数完成想实现的效果。
  5663. 保留关键字: `uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`, `maxConcurrency`, `maxRequestsPerFrame`
  5664. `maxRetryCount`, `version`, `responseType`, `withCredentials`, `mimeType`, `timeout`, `header`, `reload`, `cacheAsset`, `cacheEnabled`,
  5665. 请不要使用这些字段为自定义参数!
  5666. @param requests The request you want to load
  5667. @param options Optional parameters
  5668. @param onProgress Callback invoked when progression change
  5669. @param onComplete Callback invoked when finish loading
  5670. @example
  5671. ```js
  5672. cc.assetManager.loadAny({url: 'http://example.com/a.png'}, (err, img) => cc.log(img));
  5673. cc.assetManager.loadAny(['60sVXiTH1D/6Aft4MRt9VC'], (err, assets) => cc.log(assets));
  5674. cc.assetManager.loadAny([{ uuid: '0cbZa5Y71CTZAccaIFluuZ'}, {url: 'http://example.com/a.png'}], (err, assets) => cc.log(assets));
  5675. cc.assetManager.downloader.register('.asset', (url, options, onComplete) => {
  5676. url += '?userName=' + options.userName + "&password=" + options.password;
  5677. cc.assetManager.downloader.downloadFile(url, null, onComplete);
  5678. });
  5679. cc.assetManager.parser.register('.asset', (file, options, onComplete) => {
  5680. var json = JSON.parse(file);
  5681. var skin = json[options.skin];
  5682. var model = json[options.model];
  5683. onComplete(null, {skin, model});
  5684. });
  5685. cc.assetManager.loadAny({ url: 'http://example.com/my.asset', skin: 'xxx', model: 'xxx', userName: 'xxx', password: 'xxx' });
  5686. ```
  5687. */
  5688. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>, onProgress: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete: (err: Error, data: any) => void): void;
  5689. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onProgress: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete: (err: Error, data: any) => void): void;
  5690. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>, onComplete: (err: Error, data: any) => void): void;
  5691. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onComplete: (err: Error, data: any) => void): void;
  5692. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>): void;
  5693. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[]): void;
  5694. /**
  5695. !#en
  5696. General interface used to preload assets with a progression callback and a complete callback.It is highly recommended that you use more simple API, such as `preloadRes`, `preloadResDir` etc.
  5697. Everything about preload is just likes `cc.assetManager.loadAny`, the difference is `cc.assetManager.preloadAny` will only download asset but not parse asset. You need to invoke `cc.assetManager.loadAny(preloadTask)`
  5698. to finish loading asset
  5699. !#zh
  5700. 通用预加载资源接口,可传入进度回调以及完成回调,非常建议你使用更简单的 API ,例如 `preloadRes`, `preloadResDir` 等。`preloadAny` 和 `loadAny` 几乎一样,区别在于 `preloadAny` 只会下载资源,不会去解析资源,你需要调用 `cc.assetManager.loadAny(preloadTask)`
  5701. 来完成资源加载。
  5702. @param requests The request you want to preload
  5703. @param options Optional parameters
  5704. @param onProgress Callback invoked when progression change
  5705. @param onComplete Callback invoked when finish preloading
  5706. @example
  5707. ```js
  5708. cc.assetManager.preloadAny('0cbZa5Y71CTZAccaIFluuZ', (err) => cc.assetManager.loadAny('0cbZa5Y71CTZAccaIFluuZ'));
  5709. ```
  5710. */
  5711. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>, onProgress: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete: (err: Error, items: cc.AssetManager.RequestItem[]) => void): void;
  5712. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onProgress: (finished: number, total: number, item: cc.AssetManager.RequestItem) => void, onComplete: (err: Error, items: cc.AssetManager.RequestItem[]) => void): void;
  5713. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>, onComplete: (err: Error, items: cc.AssetManager.RequestItem[]) => void): void;
  5714. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onComplete: (err: Error, items: cc.AssetManager.RequestItem[]) => void): void;
  5715. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>): void;
  5716. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[]): void;
  5717. /**
  5718. !#en
  5719. Load native file of asset, if you check the option 'Async Load Assets', you may need to load native file with this before you use the asset
  5720. !#zh
  5721. 加载资源的原生文件,如果你勾选了'延迟加载资源'选项,你可能需要在使用资源之前调用此方法来加载原生文件
  5722. @param asset The asset
  5723. @param options Some optional parameters
  5724. @param onComplete Callback invoked when finish loading
  5725. @example
  5726. ```js
  5727. cc.assetManager.postLoadNative(texture, (err) => console.log(err));
  5728. ```
  5729. */
  5730. postLoadNative(asset: cc.Asset, options: Record<string, any>, onComplete: (err: Error) => void): void;
  5731. postLoadNative(asset: cc.Asset, onComplete: (err: Error) => void): void;
  5732. postLoadNative(asset: cc.Asset, options: Record<string, any>): void;
  5733. postLoadNative(asset: cc.Asset): void;
  5734. /**
  5735. !#en
  5736. Load remote asset with url, such as audio, image, text and so on.
  5737. !#zh
  5738. 使用 url 加载远程资源,例如音频,图片,文本等等。
  5739. @param url The url of asset
  5740. @param options Some optional parameters
  5741. @param onComplete Callback invoked when finish loading
  5742. @example
  5743. ```js
  5744. cc.assetManager.loadRemote('http://www.cloud.com/test1.jpg', (err, texture) => console.log(err));
  5745. cc.assetManager.loadRemote('http://www.cloud.com/test2.mp3', (err, audioClip) => console.log(err));
  5746. cc.assetManager.loadRemote('http://www.cloud.com/test3', { ext: '.png' }, (err, texture) => console.log(err));
  5747. ```
  5748. */
  5749. loadRemote<T extends cc.Asset>(url: string, options: Record<string, any>, onComplete: (err: Error, asset: T) => void): void;
  5750. loadRemote<T extends cc.Asset>(url: string, onComplete: (err: Error, asset: T) => void): void;
  5751. loadRemote<T extends cc.Asset>(url: string, options: Record<string, any>): void;
  5752. loadRemote<T extends cc.Asset>(url: string): void;
  5753. /**
  5754. !#en
  5755. Load script
  5756. !#zh
  5757. 加载脚本
  5758. @param url Url of the script
  5759. @param options Some optional paramters
  5760. @param onComplete Callback when script loaded or failed
  5761. @example
  5762. ```js
  5763. loadScript('http://localhost:8080/index.js', null, (err) => console.log(err));
  5764. ```
  5765. */
  5766. loadScript(url: string|string[], options: Record<string, any>, onComplete: (err: Error) => void): void;;
  5767. loadScript(url: string|string[], onComplete: (err: Error) => void): void;;
  5768. loadScript(url: string|string[], options: Record<string, any>): void;;
  5769. loadScript(url: string|string[]): void;;
  5770. /**
  5771. !#en
  5772. load bundle
  5773. !#zh
  5774. 加载资源包
  5775. @param nameOrUrl The name or root path of bundle
  5776. @param options Some optional paramter, same like downloader.downloadFile
  5777. @param onComplete Callback when bundle loaded or failed
  5778. @example
  5779. ```js
  5780. loadBundle('http://localhost:8080/test', null, (err, bundle) => console.log(err));
  5781. ```
  5782. */
  5783. loadBundle(nameOrUrl: string, options: Record<string, any>, onComplete: (err: Error, bundle: cc.AssetManager.Bundle) => void): void;
  5784. loadBundle(nameOrUrl: string, onComplete: (err: Error, bundle: cc.AssetManager.Bundle) => void): void;
  5785. loadBundle(nameOrUrl: string, options: Record<string, any>): void;
  5786. loadBundle(nameOrUrl: string): void;
  5787. /**
  5788. !#en
  5789. Release asset and it's dependencies.
  5790. This method will not only remove the cache of the asset in assetManager, but also clean up its content.
  5791. For example, if you release a texture, the texture asset and its gl texture data will be freed up.
  5792. Notice, this method may cause the texture to be unusable, if there are still other nodes use the same texture, they may turn to black and report gl errors.
  5793. !#zh
  5794. 释放资源以及其依赖资源, 这个方法不仅会从 assetManager 中删除资源的缓存引用,还会清理它的资源内容。
  5795. 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。
  5796. 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。
  5797. @param asset The asset to be released
  5798. @example
  5799. ```js
  5800. // release a texture which is no longer need
  5801. cc.assetManager.releaseAsset(texture);
  5802. ```
  5803. */
  5804. releaseAsset(asset: cc.Asset): void;
  5805. /**
  5806. !#en
  5807. Release all assets. Refer to {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} for detailed informations.
  5808. !#zh
  5809. 释放所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  5810. */
  5811. releaseAll(): void;
  5812. }
  5813. /** `cc.loader` is deprecated, please backup your project and upgrade to {{#crossLink "AssetManager"}}{{/crossLink}} */
  5814. export class loader {
  5815. /** `cc.loader.onProgress` is deprecated, please transfer onProgress to API as a parameter */
  5816. static onProgress: any;
  5817. /**
  5818. `cc.loader.load` is deprecated, please use {{#crossLink "AssetManager/loadAny:method"}}{{/crossLink}} instead
  5819. @param resources Url list in an array
  5820. @param progressCallback Callback invoked when progression change
  5821. @param completeCallback Callback invoked when all resources loaded
  5822. */
  5823. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, completeCallback?: Function): void;
  5824. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: Function|null): void;
  5825. /**
  5826. `cc.loader.getXMLHttpRequest` is deprecated, please use `XMLHttpRequest` directly
  5827. */
  5828. static getXMLHttpRequest(): XMLHttpRequest;
  5829. /**
  5830. `cc.loader.getItem` is deprecated, please use `cc.assetManager.asset.get` instead
  5831. @param id The id of the item
  5832. */
  5833. static getItem(id: any): any;
  5834. /**
  5835. `cc.loader.loadRes` is deprecated, please use {{#crossLink "Bundle/load:method"}}{{/crossLink}} instead
  5836. @param url Url of the target resource.
  5837. The url is relative to the "resources" folder, extensions must be omitted.
  5838. @param type Only asset of type will be loaded if this argument is supplied.
  5839. @param progressCallback Callback invoked when progression change.
  5840. @param completeCallback Callback invoked when the resource loaded.
  5841. */
  5842. static loadRes(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  5843. static loadRes(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any) => void): void;
  5844. static loadRes(url: string, type: typeof cc.Asset): void;
  5845. static loadRes(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  5846. static loadRes(url: string, completeCallback: (error: Error, resource: any) => void): void;
  5847. static loadRes(url: string): void;
  5848. /**
  5849. `cc.loader.loadResArray` is deprecated, please use {{#crossLink "Bundle/load:method"}}{{/crossLink}} instead
  5850. @param urls Array of URLs of the target resource.
  5851. The url is relative to the "resources" folder, extensions must be omitted.
  5852. @param type Only asset of type will be loaded if this argument is supplied.
  5853. @param progressCallback Callback invoked when progression change.
  5854. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  5855. */
  5856. static loadResArray(url: string[], type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  5857. static loadResArray(url: string[], type: typeof cc.Asset, completeCallback: (error: Error, resource: any[]) => void): void;
  5858. static loadResArray(url: string[], type: typeof cc.Asset): void;
  5859. static loadResArray(url: string[], progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  5860. static loadResArray(url: string[], completeCallback: (error: Error, resource: any[]) => void): void;
  5861. static loadResArray(url: string[]): void;
  5862. static loadResArray(url: string[], type: typeof cc.Asset[]): void;
  5863. /**
  5864. `cc.loader.loadResDir` is deprecated, please use {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} instead
  5865. @param url Url of the target folder.
  5866. The url is relative to the "resources" folder, extensions must be omitted.
  5867. @param type Only asset of type will be loaded if this argument is supplied.
  5868. @param progressCallback Callback invoked when progression change.
  5869. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  5870. */
  5871. static loadResDir(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  5872. static loadResDir(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  5873. static loadResDir(url: string, type: typeof cc.Asset): void;
  5874. static loadResDir(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  5875. static loadResDir(url: string, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  5876. static loadResDir(url: string): void;
  5877. /**
  5878. `cc.loader.getRes` is deprecated, please use {{#crossLink "Bundle/get:method"}}{{/crossLink}} instead
  5879. @param url url
  5880. @param type Only asset of type will be returned if this argument is supplied.
  5881. */
  5882. static getRes(url: string, type?: Function): any;
  5883. /**
  5884. `cc.loader.getDependsRecursively` is deprecated, please use use {{#crossLink "DependUtil/getDepsRecursively:method"}}{{/crossLink}} instead
  5885. @param owner The owner asset or the resource url or the asset's uuid
  5886. */
  5887. static getDependsRecursively(owner: Asset|string): any[];
  5888. /** `cc.loader.assetLoader` was removed, assetLoader and md5Pipe were merged into {{#crossLink "AssetManager/transformPipeline:property"}}{{/crossLink}} */
  5889. static assetLoader: any;
  5890. /** `cc.loader.md5Pipe` is deprecated, assetLoader and md5Pipe were merged into {{#crossLink "AssetManager/transformPipeline:property"}}{{/crossLink}} */
  5891. static md5Pipe: any;
  5892. /** `cc.loader.downloader` is deprecated, please use {{#crossLink "AssetManager/downloader:property"}}{{/crossLink}} instead */
  5893. static downloader: any;
  5894. /** `cc.loader.loader` is deprecated, please use {{#crossLink "AssetManager/parser:property"}}{{/crossLink}} instead */
  5895. static loader: any;
  5896. /**
  5897. `cc.loader.addDownloadHandlers` is deprecated, please use `cc.assetManager.downloader.register` instead
  5898. @param extMap Custom supported types with corresponded handler
  5899. */
  5900. static addDownloadHandlers(extMap: any): void;
  5901. /**
  5902. `cc.loader.addLoadHandlers` is deprecated, please use `cc.assetManager.parser.register` instead
  5903. @param extMap Custom supported types with corresponded handler
  5904. */
  5905. static addLoadHandlers(extMap: any): void;
  5906. /**
  5907. `cc.loader.release` is deprecated, please use {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} instead
  5908. @param asset asset
  5909. */
  5910. static release(asset: Asset|string|any[]): void;
  5911. /**
  5912. `cc.loader.releaseAsset` is deprecated, please use {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} instead
  5913. @param asset asset
  5914. */
  5915. static releaseAsset(asset: Asset): void;
  5916. /**
  5917. `cc.loader.releaseRes` is deprecated, please use {{#crossLink "AssetManager/releaseRes:method"}}{{/crossLink}} instead
  5918. @param url url
  5919. @param type Only asset of type will be released if this argument is supplied.
  5920. */
  5921. static releaseRes(url: string, type?: Function): void;
  5922. /**
  5923. `cc.loader.releaseResDir` was removed, please use {{#crossLink "AssetManager/releaseRes:method"}}{{/crossLink}} instead
  5924. */
  5925. static releaseResDir(): void;
  5926. /**
  5927. `cc.loader.releaseAll` is deprecated, please use {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}} instead
  5928. */
  5929. static releaseAll(): void;
  5930. /**
  5931. `cc.loader.removeItem` is deprecated, please use `cc.assetManager.assets.remove` instead
  5932. @param id The id of the item
  5933. */
  5934. static removeItem(id: any): boolean;
  5935. /**
  5936. `cc.loader.setAutoRelease` is deprecated, if you want to prevent some asset from auto releasing, please use {{#crossLink "Asset/addRef:method"}}{{/crossLink}} instead
  5937. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  5938. @param autoRelease indicates whether should release automatically
  5939. */
  5940. static setAutoRelease(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  5941. /**
  5942. `cc.loader.setAutoReleaseRecursively` is deprecated, if you want to prevent some asset from auto releasing, please use {{#crossLink "Asset/addRef:method"}}{{/crossLink}} instead
  5943. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  5944. @param autoRelease indicates whether should release automatically
  5945. */
  5946. static setAutoReleaseRecursively(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  5947. /**
  5948. `cc.loader.isAutoRelease` is deprecated
  5949. @param assetOrUrl asset object or the raw asset's url
  5950. */
  5951. static isAutoRelease(assetOrUrl: Asset|string): boolean;
  5952. }
  5953. /** `cc.url` is deprecated */
  5954. export class url {
  5955. /**
  5956. `cc.url.raw` is deprecated, please use `cc.resources.load` directly, or use `Asset.nativeUrl` instead.
  5957. @param url url
  5958. */
  5959. static raw(url: string): string;
  5960. }
  5961. /** `cc.LoadingItems` was removed, please use {{#crossLink "Task"}}{{/crossLink}} instead */
  5962. export class LoadingItems {
  5963. }
  5964. /** !#en
  5965. Base class for handling assets used in Creator.<br/>
  5966. You may want to override:<br/>
  5967. - createNode<br/>
  5968. - getset functions of _nativeAsset<br/>
  5969. - cc.Object._serialize<br/>
  5970. - cc.Object._deserialize<br/>
  5971. !#zh
  5972. Creator 中的资源基类。<br/>
  5973. 您可能需要重写:<br/>
  5974. - createNode <br/>
  5975. - _nativeAsset 的 getset 方法<br/>
  5976. - cc.Object._serialize<br/>
  5977. - cc.Object._deserialize<br/> */
  5978. export class Asset extends Object {
  5979. /** `cc.Asset.url` is deprecated, please use {{#crossLink "Asset/nativeUrl:property"}}{{/crossLink}} instead */
  5980. url: string;
  5981. /** !#en
  5982. Whether the asset is loaded or not.
  5983. !#zh
  5984. 该资源是否已经成功加载。 */
  5985. loaded: boolean;
  5986. /** !#en
  5987. Returns the url of this asset's native object, if none it will returns an empty string.
  5988. !#zh
  5989. 返回该资源对应的目标平台资源的 URL,如果没有将返回一个空字符串。 */
  5990. nativeUrl: string;
  5991. /** !#en
  5992. The number of reference
  5993. !#zh
  5994. 引用的数量 */
  5995. refCount: number;
  5996. /** !#en Indicates whether its dependent raw assets can support deferred load if the owner scene (or prefab) is marked as `asyncLoadAssets`.
  5997. !#zh 当场景或 Prefab 被标记为 `asyncLoadAssets`,禁止延迟加载该资源所依赖的其它原始资源。 */
  5998. static preventDeferredLoadDependents: boolean;
  5999. /** !#en Indicates whether its native object should be preloaded from native url.
  6000. !#zh 禁止预加载原生对象。 */
  6001. static preventPreloadNativeObject: boolean;
  6002. /**
  6003. !#en
  6004. Returns the asset's url.
  6005. The `Asset` object overrides the `toString()` method of the `Object` object.
  6006. For `Asset` objects, the `toString()` method returns a string representation of the object.
  6007. JavaScript calls the `toString()` method automatically when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.
  6008. !#zh
  6009. 返回资源的 URL。
  6010. Asset 对象将会重写 Object 对象的 `toString()` 方法。
  6011. 对于 Asset 对象,`toString()` 方法返回该对象的字符串表示形式。
  6012. 当资源要表示为文本值时或在字符串连接时引用时,JavaScript 会自动调用 `toString()` 方法。
  6013. */
  6014. toString(): string;
  6015. /**
  6016. !#en
  6017. Create a new node using this asset in the scene.<br/>
  6018. If this type of asset dont have its corresponding node type, this method should be null.
  6019. !#zh
  6020. 使用该资源在场景中创建一个新节点。<br/>
  6021. 如果这类资源没有相应的节点类型,该方法应该是空的。
  6022. @param callback callback
  6023. */
  6024. createNode(callback: (error: string, node: any) => void): void;
  6025. /**
  6026. !#en
  6027. Add references of asset
  6028. !#zh
  6029. 增加资源的引用
  6030. */
  6031. addRef(): cc.Asset;
  6032. /**
  6033. !#en
  6034. Reduce references of asset and it will be auto released when refCount equals 0.
  6035. !#zh
  6036. 减少资源的引用并尝试进行自动释放。
  6037. */
  6038. decRef(): cc.Asset;
  6039. }
  6040. /** Predefined constants */
  6041. export class macro {
  6042. /** `cc.macro.DOWNLOAD_MAX_CONCURRENT` is deprecated now, please use {{#crossLink "Downloader/maxConcurrency:property"}}{{/crossLink}} instead */
  6043. static DOWNLOAD_MAX_CONCURRENT: number;
  6044. /** PI / 180 */
  6045. static RAD: number;
  6046. /** One degree */
  6047. static DEG: number;
  6048. static REPEAT_FOREVER: number;
  6049. static FLT_EPSILON: number;
  6050. /** Minimum z index value for node */
  6051. static MIN_ZINDEX: number;
  6052. /** Maximum z index value for node */
  6053. static MAX_ZINDEX: number;
  6054. static ONE: number;
  6055. static ZERO: number;
  6056. static SRC_ALPHA: number;
  6057. static SRC_ALPHA_SATURATE: number;
  6058. static SRC_COLOR: number;
  6059. static DST_ALPHA: number;
  6060. static DST_COLOR: number;
  6061. static ONE_MINUS_SRC_ALPHA: number;
  6062. static ONE_MINUS_SRC_COLOR: number;
  6063. static ONE_MINUS_DST_ALPHA: number;
  6064. static ONE_MINUS_DST_COLOR: number;
  6065. static ONE_MINUS_CONSTANT_ALPHA: number;
  6066. static ONE_MINUS_CONSTANT_COLOR: number;
  6067. /** Oriented vertically */
  6068. static ORIENTATION_PORTRAIT: number;
  6069. /** Oriented horizontally */
  6070. static ORIENTATION_LANDSCAPE: number;
  6071. /** Oriented automatically */
  6072. static ORIENTATION_AUTO: number;
  6073. /** <p>
  6074. If enabled, the texture coordinates will be calculated by using this formula: <br/>
  6075. - texCoord.left = (rect.x*2+1) / (texture.wide*2); <br/>
  6076. - texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2); <br/>
  6077. <br/>
  6078. The same for bottom and top. <br/>
  6079. <br/>
  6080. This formula prevents artifacts by using 99% of the texture. <br/>
  6081. The "correct" way to prevent artifacts is by expand the texture's border with the same color by 1 pixel<br/>
  6082. <br/>
  6083. Affected component: <br/>
  6084. - cc.TMXLayer <br/>
  6085. <br/>
  6086. Enabled by default. To disabled set it to 0. <br/>
  6087. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
  6088. </p> */
  6089. static FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: number;
  6090. /** Position of the FPS (Default: 0,0 (bottom-left corner))<br/>
  6091. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h */
  6092. static DIRECTOR_STATS_POSITION: Vec2;
  6093. /** <p>
  6094. If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked. <br/>
  6095. If you run 2 or more 'position' actions at the same time on a node, then end position will be the sum of all the positions. <br/>
  6096. If disabled, only the last run action will take effect.
  6097. </p> */
  6098. static ENABLE_STACKABLE_ACTIONS: number;
  6099. /** !#en
  6100. The timeout to determine whether a touch is no longer active and should be removed.
  6101. The reason to add this timeout is due to an issue in X5 browser core,
  6102. when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
  6103. no touch cancel event is triggered, and the touch will be considered active forever.
  6104. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
  6105. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
  6106. Though it might remove a real touch if it's just not moving for the last 5 seconds which is not easy with the sensibility of mobile touch screen.
  6107. You can modify this value to have a better behavior if you find it's not enough.
  6108. !#zh
  6109. 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
  6110. 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
  6111. 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
  6112. 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
  6113. 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
  6114. 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
  6115. 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。 */
  6116. static TOUCH_TIMEOUT: number;
  6117. /** !#en
  6118. The maximum vertex count for a single batched draw call.
  6119. !#zh
  6120. 最大可以被单次批处理渲染的顶点数量。 */
  6121. static BATCH_VERTEX_COUNT: number;
  6122. /** !#en
  6123. Whether or not enabled tiled map auto culling. If you set the TiledMap skew or rotation, then need to manually disable this, otherwise, the rendering will be wrong.
  6124. !#zh
  6125. 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 或者采用了摄像机的话,需要手动关闭,否则渲染会出错。 */
  6126. static ENABLE_TILEDMAP_CULLING: boolean;
  6127. /** !#en
  6128. Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.
  6129. Though if you want to make your canvas background transparent and show other dom elements at the background,
  6130. you can set it to true before `cc.game.run`.
  6131. Web only.
  6132. !#zh
  6133. 用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。
  6134. 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 `cc.game.run` 之前将这个值设为 true。
  6135. 仅支持 Web */
  6136. static ENABLE_TRANSPARENT_CANVAS: boolean;
  6137. /** !#en
  6138. Boolean that indicates if the WebGL context is created with `antialias` option turned on, default value is false.
  6139. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated.
  6140. Whether to use this really depend on your game design and targeted platform,
  6141. device with retina display usually have good detail on graphics with or without this option,
  6142. you probably don't want antialias if your game style is pixel art based.
  6143. Also, it could have great performance impact with some browser / device using software MSAA.
  6144. You can set it to true before `cc.game.run`.
  6145. Web only.
  6146. !#zh
  6147. 用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。
  6148. 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。
  6149. 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。
  6150. 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。
  6151. 你可以在 `cc.game.run` 之前设置这个值,否则它不会生效。
  6152. 仅支持 Web */
  6153. static ENABLE_WEBGL_ANTIALIAS: boolean;
  6154. /** !#en
  6155. Whether or not enable auto culling.
  6156. This feature have been removed in v2.0 new renderer due to overall performance consumption.
  6157. We have no plan currently to re-enable auto culling.
  6158. If your game have more dynamic objects, we suggest to disable auto culling.
  6159. If your game have more static objects, we suggest to enable auto culling.
  6160. !#zh
  6161. 是否开启自动裁减功能,开启裁减功能将会把在屏幕外的物体从渲染队列中去除掉。
  6162. 这个功能在 v2.0 的新渲染器中被移除了,因为它在大多数游戏中所带来的损耗要高于性能的提升,目前我们没有计划重新支持自动裁剪。
  6163. 如果游戏中的动态物体比较多的话,建议将此选项关闭。
  6164. 如果游戏中的静态物体比较多的话,建议将此选项打开。 */
  6165. static ENABLE_CULLING: boolean;
  6166. /** !#en
  6167. Whether to clear the original image cache after uploaded a texture to GPU. If cleared, [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) will not be supported.
  6168. Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory.
  6169. But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage.
  6170. So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU.
  6171. !#zh
  6172. 是否在将贴图上传至 GPU 之后删除原始图片缓存,删除之后图片将无法进行 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。
  6173. 在 Web 平台,你通常不需要开启这个选项,因为在 Web 平台 Image 对象所占用的内存很小。
  6174. 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
  6175. 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 */
  6176. static CLEANUP_IMAGE_CACHE: boolean;
  6177. /** !#en
  6178. Whether or not show mesh wire frame.
  6179. !#zh
  6180. 是否显示网格的线框。 */
  6181. static SHOW_MESH_WIREFRAME: boolean;
  6182. /** !#en
  6183. Whether or not show mesh normal.
  6184. !#zh
  6185. 是否显示网格的法线。 */
  6186. static SHOW_MESH_NORMAL: boolean;
  6187. /** !#en
  6188. Whether to enable multi-touch.
  6189. !#zh
  6190. 是否开启多点触摸 */
  6191. static ENABLE_MULTI_TOUCH: boolean;
  6192. /** References:
  6193. https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap
  6194. https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
  6195. !#en
  6196. Whether to use image bitmap first. If enabled, memory usage will increase.
  6197. !#zh
  6198. 是否优先使用 image bitmap,启用之后,内存占用会变高 */
  6199. static ALLOW_IMAGE_BITMAP: boolean;
  6200. /** !#en
  6201. Whether to use native TTF renderer which is faster but layout slightly different.
  6202. !#zh
  6203. 是否使用原生的文本渲染机制, 布局和编辑器有差异. */
  6204. static ENABLE_NATIVE_TTF_RENDERER: boolean;
  6205. /** !#en
  6206. The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types.
  6207. Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
  6208. !#zh
  6209. 引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。
  6210. 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。 */
  6211. static SUPPORT_TEXTURE_FORMATS: string[];
  6212. }
  6213. /** !#en The Light Component
  6214. !#zh 光源组件 */
  6215. export class Light extends Component {
  6216. }
  6217. /** !#en Class for audio data handling.
  6218. !#zh 音频资源类。 */
  6219. export class AudioClip extends Asset implements EventTarget {
  6220. /** !#en Get the audio clip duration
  6221. !#zh 获取音频剪辑的长度 */
  6222. duration: number;
  6223. /**
  6224. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6225. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6226. @param type The type of event.
  6227. */
  6228. hasEventListener(type: string): boolean;
  6229. /**
  6230. !#en
  6231. Register an callback of a specific event type on the EventTarget.
  6232. This type of event should be triggered via `emit`.
  6233. !#zh
  6234. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6235. @param type A string representing the event type to listen for.
  6236. @param callback The callback that will be invoked when the event is dispatched.
  6237. The callback is ignored if it is a duplicate (the callbacks are unique).
  6238. @param target The target (this object) to invoke the callback, can be null
  6239. @example
  6240. ```js
  6241. eventTarget.on('fire', function () {
  6242. cc.log("fire in the hole");
  6243. }, node);
  6244. ```
  6245. */
  6246. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6247. /**
  6248. !#en
  6249. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6250. if only type is passed as parameter, all listeners registered with that type will be removed.
  6251. !#zh
  6252. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6253. @param type A string representing the event type being removed.
  6254. @param callback The callback to remove.
  6255. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6256. @example
  6257. ```js
  6258. // register fire eventListener
  6259. var callback = eventTarget.on('fire', function () {
  6260. cc.log("fire in the hole");
  6261. }, target);
  6262. // remove fire event listener
  6263. eventTarget.off('fire', callback, target);
  6264. // remove all fire event listeners
  6265. eventTarget.off('fire');
  6266. ```
  6267. */
  6268. off(type: string, callback?: Function, target?: any): void;
  6269. /**
  6270. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6271. This is not for removing all listeners in the current event target,
  6272. and this is not for removing all listeners the target parameter have registered.
  6273. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6274. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6275. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6276. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6277. @param target The target to be searched for all related listeners
  6278. */
  6279. targetOff(target: any): void;
  6280. /**
  6281. !#en
  6282. Register an callback of a specific event type on the EventTarget,
  6283. the callback will remove itself after the first time it is triggered.
  6284. !#zh
  6285. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6286. @param type A string representing the event type to listen for.
  6287. @param callback The callback that will be invoked when the event is dispatched.
  6288. The callback is ignored if it is a duplicate (the callbacks are unique).
  6289. @param target The target (this object) to invoke the callback, can be null
  6290. @example
  6291. ```js
  6292. eventTarget.once('fire', function () {
  6293. cc.log("this is the callback and will be invoked only once");
  6294. }, node);
  6295. ```
  6296. */
  6297. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6298. /**
  6299. !#en
  6300. Send an event with the event object.
  6301. !#zh
  6302. 通过事件对象派发事件
  6303. @param event event
  6304. */
  6305. dispatchEvent(event: Event): void;
  6306. /**
  6307. !#en
  6308. Destroy all callbackInfos.
  6309. !#zh
  6310. 销毁记录的事件
  6311. */
  6312. clear(): void;
  6313. }
  6314. /** !#en Class for BitmapFont handling.
  6315. !#zh 位图字体资源类。 */
  6316. export class BitmapFont extends Font {
  6317. }
  6318. /** undefined */
  6319. export class BufferAsset extends Asset {
  6320. }
  6321. /** !#en Class for Font handling.
  6322. !#zh 字体资源类。 */
  6323. export class Font extends Asset {
  6324. }
  6325. /** !#en
  6326. Class for JSON file. When the JSON file is loaded, this object is returned.
  6327. The parsed JSON object can be accessed through the `json` attribute in it.<br>
  6328. If you want to get the original JSON text, you should modify the extname to `.txt`
  6329. so that it is loaded as a `TextAsset` instead of a `JsonAsset`.
  6330. !#zh
  6331. JSON 资源类。JSON 文件加载后,将会返回该对象。可以通过其中的 `json` 属性访问解析后的 JSON 对象。<br>
  6332. 如果你想要获得 JSON 的原始文本,那么应该修改源文件的后缀为 `.txt`,这样就会加载为一个 `TextAsset` 而不是 `JsonAsset`。 */
  6333. export class JsonAsset extends Asset {
  6334. /** The loaded JSON object. */
  6335. json: any;
  6336. }
  6337. /** !#en Class for LabelAtlas handling.
  6338. !#zh 艺术数字字体资源类。 */
  6339. export class LabelAtlas extends BitmapFont {
  6340. }
  6341. /** !#en Class for prefab handling.
  6342. !#zh 预制资源类。 */
  6343. export class Prefab extends Asset {
  6344. /** the main cc.Node in the prefab */
  6345. data: Node;
  6346. /** !#zh
  6347. 设置实例化这个 prefab 时所用的优化策略。根据使用情况设置为合适的值,能优化该 prefab 实例化所用的时间。
  6348. !#en
  6349. Indicates the optimization policy for instantiating this prefab.
  6350. Set to a suitable value based on usage, can optimize the time it takes to instantiate this prefab. */
  6351. optimizationPolicy: Prefab.OptimizationPolicy;
  6352. /** !#en Indicates the raw assets of this prefab can be load after prefab loaded.
  6353. !#zh 指示该 Prefab 依赖的资源可否在 Prefab 加载后再延迟加载。 */
  6354. asyncLoadAssets: boolean;
  6355. readonly: boolean;
  6356. /**
  6357. Dynamically translation prefab data into minimized code.<br/>
  6358. This method will be called automatically before the first time the prefab being instantiated,
  6359. but you can re-call to refresh the create function once you modified the original prefab data in script.
  6360. */
  6361. compileCreateFunction(): void;
  6362. }
  6363. /** Render textures are textures that can be rendered to. */
  6364. export class RenderTexture extends Texture2D {
  6365. /**
  6366. !#en
  6367. Init the render texture with size.
  6368. !#zh
  6369. 初始化 render texture
  6370. @param width width
  6371. @param height height
  6372. @param depthStencilFormat depthStencilFormat
  6373. */
  6374. initWithSize(width?: number, height?: number, depthStencilFormat?: number): void;
  6375. /**
  6376. !#en
  6377. Get pixels from render texture, the pixels data stores in a RGBA Uint8Array.
  6378. It will return a new (width * height * 4) length Uint8Array by default。
  6379. You can specify a data to store the pixels to reuse the data,
  6380. you and can specify other params to specify the texture region to read.
  6381. !#zh
  6382. 从 render texture 读取像素数据,数据类型为 RGBA 格式的 Uint8Array 数组。
  6383. 默认每次调用此函数会生成一个大小为 (长 x 高 x 4) 的 Uint8Array。
  6384. 你可以通过传入 data 来接收像素数据,也可以通过传参来指定需要读取的区域的像素。
  6385. @param data data
  6386. @param x x
  6387. @param y y
  6388. @param w w
  6389. @param h h
  6390. */
  6391. readPixels(data?: Uint8Array, x?: number, y?: number, w?: number, h?: number): Uint8Array;
  6392. }
  6393. /** !#en Class for scene handling.
  6394. !#zh 场景资源类。 */
  6395. export class SceneAsset extends Asset {
  6396. scene: Scene;
  6397. /** !#en Indicates the raw assets of this scene can be load after scene launched.
  6398. !#zh 指示该场景依赖的资源可否在场景切换后再延迟加载。 */
  6399. asyncLoadAssets: boolean;
  6400. }
  6401. /** !#en Class for script handling.
  6402. !#zh Script 资源类。 */
  6403. export class _Script extends Asset {
  6404. }
  6405. /** !#en Class for JavaScript handling.
  6406. !#zh JavaScript 资源类。 */
  6407. export class _JavaScript extends Asset {
  6408. }
  6409. /** !#en Class for TypeScript handling.
  6410. !#zh TypeScript 资源类。 */
  6411. export class TypeScript extends Asset {
  6412. }
  6413. /** !#en Class for sprite atlas handling.
  6414. !#zh 精灵图集资源类。 */
  6415. export class SpriteAtlas extends Asset {
  6416. /**
  6417. Returns the texture of the sprite atlas
  6418. */
  6419. getTexture(): Texture2D;
  6420. /**
  6421. Returns the sprite frame correspond to the given key in sprite atlas.
  6422. @param key key
  6423. */
  6424. getSpriteFrame(key: string): SpriteFrame;
  6425. /**
  6426. Returns the sprite frames in sprite atlas.
  6427. */
  6428. getSpriteFrames(): SpriteFrame[];
  6429. }
  6430. /** !#en
  6431. A cc.SpriteFrame has:<br/>
  6432. - texture: A cc.Texture2D that will be used by render components<br/>
  6433. - rectangle: A rectangle of the texture
  6434. !#zh
  6435. 一个 SpriteFrame 包含:<br/>
  6436. - 纹理:会被渲染组件使用的 Texture2D 对象。<br/>
  6437. - 矩形:在纹理中的矩形区域。 */
  6438. export class SpriteFrame extends Asset implements EventTarget {
  6439. /** !#en Top border of the sprite
  6440. !#zh sprite 的顶部边框 */
  6441. insetTop: number;
  6442. /** !#en Bottom border of the sprite
  6443. !#zh sprite 的底部边框 */
  6444. insetBottom: number;
  6445. /** !#en Left border of the sprite
  6446. !#zh sprite 的左边边框 */
  6447. insetLeft: number;
  6448. /** !#en Right border of the sprite
  6449. !#zh sprite 的左边边框 */
  6450. insetRight: number;
  6451. /**
  6452. !#en
  6453. Constructor of SpriteFrame class.
  6454. !#zh
  6455. SpriteFrame 类的构造函数。
  6456. @param filename filename
  6457. @param rect rect
  6458. @param rotated Whether the frame is rotated in the texture
  6459. @param offset The offset of the frame in the texture
  6460. @param originalSize The size of the frame in the texture
  6461. */
  6462. constructor(filename?: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size);
  6463. /**
  6464. !#en Returns whether the texture have been loaded
  6465. !#zh 返回是否已加载纹理
  6466. */
  6467. textureLoaded(): boolean;
  6468. /**
  6469. !#en Returns whether the sprite frame is rotated in the texture.
  6470. !#zh 获取 SpriteFrame 是否旋转
  6471. */
  6472. isRotated(): boolean;
  6473. /**
  6474. !#en Set whether the sprite frame is rotated in the texture.
  6475. !#zh 设置 SpriteFrame 是否旋转
  6476. @param bRotated bRotated
  6477. */
  6478. setRotated(bRotated: boolean): void;
  6479. /**
  6480. !#en Returns whether the sprite frame is flip x axis in the texture.
  6481. !#zh 获取 SpriteFrame 是否反转 x 轴
  6482. */
  6483. isFlipX(): boolean;
  6484. /**
  6485. !#en Returns whether the sprite frame is flip y axis in the texture.
  6486. !#zh 获取 SpriteFrame 是否反转 y 轴
  6487. */
  6488. isFlipY(): boolean;
  6489. /**
  6490. !#en Set whether the sprite frame is flip x axis in the texture.
  6491. !#zh 设置 SpriteFrame 是否翻转 x 轴
  6492. @param flipX flipX
  6493. */
  6494. setFlipX(flipX: boolean): void;
  6495. /**
  6496. !#en Set whether the sprite frame is flip y axis in the texture.
  6497. !#zh 设置 SpriteFrame 是否翻转 y 轴
  6498. @param flipY flipY
  6499. */
  6500. setFlipY(flipY: boolean): void;
  6501. /**
  6502. !#en Returns the rect of the sprite frame in the texture.
  6503. !#zh 获取 SpriteFrame 的纹理矩形区域
  6504. */
  6505. getRect(): Rect;
  6506. /**
  6507. !#en Sets the rect of the sprite frame in the texture.
  6508. !#zh 设置 SpriteFrame 的纹理矩形区域
  6509. @param rect rect
  6510. */
  6511. setRect(rect: Rect): void;
  6512. /**
  6513. !#en Returns the original size of the trimmed image.
  6514. !#zh 获取修剪前的原始大小
  6515. */
  6516. getOriginalSize(): Size;
  6517. /**
  6518. !#en Sets the original size of the trimmed image.
  6519. !#zh 设置修剪前的原始大小
  6520. @param size size
  6521. */
  6522. setOriginalSize(size: Size): void;
  6523. /**
  6524. !#en Returns the texture of the frame.
  6525. !#zh 获取使用的纹理实例
  6526. */
  6527. getTexture(): Texture2D;
  6528. /**
  6529. !#en Returns the offset of the frame in the texture.
  6530. !#zh 获取偏移量
  6531. */
  6532. getOffset(): Vec2;
  6533. /**
  6534. !#en Sets the offset of the frame in the texture.
  6535. !#zh 设置偏移量
  6536. @param offsets offsets
  6537. */
  6538. setOffset(offsets: Vec2): void;
  6539. /**
  6540. !#en Clone the sprite frame.
  6541. !#zh 克隆 SpriteFrame
  6542. */
  6543. clone(): SpriteFrame;
  6544. /**
  6545. !#en Set SpriteFrame with Texture, rect, rotated, offset and originalSize.<br/>
  6546. !#zh 通过 Texture,rect,rotated,offset 和 originalSize 设置 SpriteFrame。
  6547. @param texture texture
  6548. @param rect rect
  6549. @param rotated rotated
  6550. @param offset offset
  6551. @param originalSize originalSize
  6552. */
  6553. setTexture(texture: Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size): boolean;
  6554. /**
  6555. !#en If a loading scene (or prefab) is marked as `asyncLoadAssets`, all the textures of the SpriteFrame which
  6556. associated by user's custom Components in the scene, will not preload automatically.
  6557. These textures will be load when Sprite component is going to render the SpriteFrames.
  6558. You can call this method if you want to load the texture early.
  6559. !#zh 当加载中的场景或 Prefab 被标记为 `asyncLoadAssets` 时,用户在场景中由自定义组件关联到的所有 SpriteFrame 的贴图都不会被提前加载。
  6560. 只有当 Sprite 组件要渲染这些 SpriteFrame 时,才会检查贴图是否加载。如果你希望加载过程提前,你可以手工调用这个方法。
  6561. @example
  6562. ```js
  6563. if (spriteFrame.textureLoaded()) {
  6564. this._onSpriteFrameLoaded();
  6565. }
  6566. else {
  6567. spriteFrame.once('load', this._onSpriteFrameLoaded, this);
  6568. spriteFrame.ensureLoadTexture();
  6569. }
  6570. ```
  6571. */
  6572. ensureLoadTexture(): void;
  6573. /**
  6574. !#en
  6575. If you do not need to use the SpriteFrame temporarily, you can call this method so that its texture could be garbage collected. Then when you need to render the SpriteFrame, you should call `ensureLoadTexture` manually to reload texture.
  6576. !#zh
  6577. 当你暂时不再使用这个 SpriteFrame 时,可以调用这个方法来保证引用的贴图对象能被 GC。然后当你要渲染 SpriteFrame 时,你需要手动调用 `ensureLoadTexture` 来重新加载贴图。
  6578. */
  6579. clearTexture(): void;
  6580. /**
  6581. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6582. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6583. @param type The type of event.
  6584. */
  6585. hasEventListener(type: string): boolean;
  6586. /**
  6587. !#en
  6588. Register an callback of a specific event type on the EventTarget.
  6589. This type of event should be triggered via `emit`.
  6590. !#zh
  6591. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6592. @param type A string representing the event type to listen for.
  6593. @param callback The callback that will be invoked when the event is dispatched.
  6594. The callback is ignored if it is a duplicate (the callbacks are unique).
  6595. @param target The target (this object) to invoke the callback, can be null
  6596. @example
  6597. ```js
  6598. eventTarget.on('fire', function () {
  6599. cc.log("fire in the hole");
  6600. }, node);
  6601. ```
  6602. */
  6603. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6604. /**
  6605. !#en
  6606. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6607. if only type is passed as parameter, all listeners registered with that type will be removed.
  6608. !#zh
  6609. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6610. @param type A string representing the event type being removed.
  6611. @param callback The callback to remove.
  6612. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6613. @example
  6614. ```js
  6615. // register fire eventListener
  6616. var callback = eventTarget.on('fire', function () {
  6617. cc.log("fire in the hole");
  6618. }, target);
  6619. // remove fire event listener
  6620. eventTarget.off('fire', callback, target);
  6621. // remove all fire event listeners
  6622. eventTarget.off('fire');
  6623. ```
  6624. */
  6625. off(type: string, callback?: Function, target?: any): void;
  6626. /**
  6627. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6628. This is not for removing all listeners in the current event target,
  6629. and this is not for removing all listeners the target parameter have registered.
  6630. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6631. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6632. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6633. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6634. @param target The target to be searched for all related listeners
  6635. */
  6636. targetOff(target: any): void;
  6637. /**
  6638. !#en
  6639. Register an callback of a specific event type on the EventTarget,
  6640. the callback will remove itself after the first time it is triggered.
  6641. !#zh
  6642. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6643. @param type A string representing the event type to listen for.
  6644. @param callback The callback that will be invoked when the event is dispatched.
  6645. The callback is ignored if it is a duplicate (the callbacks are unique).
  6646. @param target The target (this object) to invoke the callback, can be null
  6647. @example
  6648. ```js
  6649. eventTarget.once('fire', function () {
  6650. cc.log("this is the callback and will be invoked only once");
  6651. }, node);
  6652. ```
  6653. */
  6654. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6655. /**
  6656. !#en
  6657. Send an event with the event object.
  6658. !#zh
  6659. 通过事件对象派发事件
  6660. @param event event
  6661. */
  6662. dispatchEvent(event: Event): void;
  6663. /**
  6664. !#en
  6665. Destroy all callbackInfos.
  6666. !#zh
  6667. 销毁记录的事件
  6668. */
  6669. clear(): void;
  6670. }
  6671. /** !#en Class for TTFFont handling.
  6672. !#zh TTF 字体资源类。 */
  6673. export class TTFFont extends Font {
  6674. }
  6675. /** !#en Class for text file.
  6676. !#zh 文本资源类。 */
  6677. export class TextAsset extends Asset {
  6678. /** The text contents of the resource. */
  6679. text: string;
  6680. }
  6681. /** This class allows to easily create OpenGL or Canvas 2D textures from images or raw data. */
  6682. export class Texture2D extends Asset implements EventTarget {
  6683. /** !#en Sets whether generate mipmaps for the texture
  6684. !#zh 是否为纹理设置生成 mipmaps。 */
  6685. genMipmaps: boolean;
  6686. /** !#en
  6687. Sets whether texture can be packed into texture atlas.
  6688. If need use texture uv in custom Effect, please sets packable to false.
  6689. !#zh
  6690. 设置纹理是否允许参与合图。
  6691. 如果需要在自定义 Effect 中使用纹理 UV,需要禁止该选项。 */
  6692. packable: boolean;
  6693. /** !#en
  6694. Whether the texture is loaded or not
  6695. !#zh
  6696. 贴图是否已经成功加载 */
  6697. loaded: boolean;
  6698. /** !#en
  6699. Texture width in pixel
  6700. !#zh
  6701. 贴图像素宽度 */
  6702. width: number;
  6703. /** !#en
  6704. Texture height in pixel
  6705. !#zh
  6706. 贴图像素高度 */
  6707. height: number;
  6708. /**
  6709. !#en
  6710. Get renderer texture implementation object
  6711. extended from render.Texture2D
  6712. !#zh 返回渲染器内部贴图对象
  6713. */
  6714. getImpl(): void;
  6715. /**
  6716. Update texture options, not available in Canvas render mode.
  6717. image, format, premultiplyAlpha can not be updated in native.
  6718. @param options options
  6719. */
  6720. update(options: {image: DOMImageElement; genMipmaps: boolean; format: Texture2D.PixelFormat; minFilter: Texture2D.Filter; magFilter: Texture2D.Filter; wrapS: WrapMode; wrapT: WrapMode; premultiplyAlpha: boolean; }): void;
  6721. /**
  6722. !#en
  6723. Init with HTML element.
  6724. !#zh 用 HTML Image 或 Canvas 对象初始化贴图。
  6725. @param element element
  6726. @example
  6727. ```js
  6728. var img = new Image();
  6729. img.src = dataURL;
  6730. texture.initWithElement(img);
  6731. ```
  6732. */
  6733. initWithElement(element: HTMLImageElement|HTMLCanvasElement): void;
  6734. /**
  6735. !#en
  6736. Intializes with texture data in ArrayBufferView.
  6737. !#zh 使用一个存储在 ArrayBufferView 中的图像数据(raw data)初始化数据。
  6738. @param data data
  6739. @param pixelFormat pixelFormat
  6740. @param pixelsWidth pixelsWidth
  6741. @param pixelsHeight pixelsHeight
  6742. */
  6743. initWithData(data: ArrayBufferView, pixelFormat: number, pixelsWidth: number, pixelsHeight: number): boolean;
  6744. /**
  6745. !#en
  6746. HTMLElement Object getter, available only on web.<br/>
  6747. Note: texture is packed into texture atlas by default<br/>
  6748. you should set texture.packable as false before getting Html element object.
  6749. !#zh 获取当前贴图对应的 HTML Image 或 Canvas 对象,只在 Web 平台下有效。<br/>
  6750. 注意:<br/>
  6751. texture 默认参与动态合图,如果需要获取到正确的 Html 元素对象,需要先设置 texture.packable 为 false
  6752. */
  6753. getHtmlElementObj(): HTMLImageElement;
  6754. /**
  6755. !#en
  6756. Destory this texture and immediately release its video memory. (Inherit from cc.Object.destroy)<br>
  6757. After destroy, this object is not usable anymore.
  6758. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  6759. !#zh
  6760. 销毁该贴图,并立即释放它对应的显存。(继承自 cc.Object.destroy)<br/>
  6761. 销毁后,该对象不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  6762. */
  6763. destroy(): boolean;
  6764. /**
  6765. !#en
  6766. Pixel format of the texture.
  6767. !#zh 获取纹理的像素格式。
  6768. */
  6769. getPixelFormat(): number;
  6770. /**
  6771. !#en
  6772. Whether or not the texture has their Alpha premultiplied.
  6773. !#zh 检查纹理在上传 GPU 时预乘选项是否开启。
  6774. */
  6775. hasPremultipliedAlpha(): boolean;
  6776. /**
  6777. !#en
  6778. Handler of texture loaded event.
  6779. Since v2.0, you don't need to invoke this function, it will be invoked automatically after texture loaded.
  6780. !#zh 贴图加载事件处理器。v2.0 之后你将不在需要手动执行这个函数,它会在贴图加载成功之后自动执行。
  6781. @param premultiplied premultiplied
  6782. */
  6783. handleLoadedTexture(premultiplied?: boolean): void;
  6784. /**
  6785. !#en
  6786. Description of cc.Texture2D.
  6787. !#zh cc.Texture2D 描述。
  6788. */
  6789. description(): string;
  6790. /**
  6791. !#en
  6792. Release texture, please use destroy instead.
  6793. !#zh 释放纹理,请使用 destroy 替代。
  6794. */
  6795. releaseTexture(): void;
  6796. /**
  6797. !#en Sets the wrap s and wrap t options. <br/>
  6798. If the texture size is NPOT (non power of 2), then in can only use gl.CLAMP_TO_EDGE in gl.TEXTURE_WRAP_{S,T}.
  6799. !#zh 设置纹理包装模式。
  6800. 若纹理贴图尺寸是 NPOT(non power of 2),则只能使用 Texture2D.WrapMode.CLAMP_TO_EDGE。
  6801. @param wrapS wrapS
  6802. @param wrapT wrapT
  6803. */
  6804. setWrapMode(wrapS: Texture2D.WrapMode, wrapT: Texture2D.WrapMode): void;
  6805. /**
  6806. !#en Sets the minFilter and magFilter options
  6807. !#zh 设置纹理贴图缩小和放大过滤器算法选项。
  6808. @param minFilter minFilter
  6809. @param magFilter magFilter
  6810. */
  6811. setFilters(minFilter: Texture2D.Filter, magFilter: Texture2D.Filter): void;
  6812. /**
  6813. !#en
  6814. Sets the flipY options
  6815. !#zh 设置贴图的纵向翻转选项。
  6816. @param flipY flipY
  6817. */
  6818. setFlipY(flipY: boolean): void;
  6819. /**
  6820. !#en
  6821. Sets the premultiply alpha options
  6822. !#zh 设置贴图的预乘选项。
  6823. @param premultiply premultiply
  6824. */
  6825. setPremultiplyAlpha(premultiply: boolean): void;
  6826. /**
  6827. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6828. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6829. @param type The type of event.
  6830. */
  6831. hasEventListener(type: string): boolean;
  6832. /**
  6833. !#en
  6834. Register an callback of a specific event type on the EventTarget.
  6835. This type of event should be triggered via `emit`.
  6836. !#zh
  6837. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6838. @param type A string representing the event type to listen for.
  6839. @param callback The callback that will be invoked when the event is dispatched.
  6840. The callback is ignored if it is a duplicate (the callbacks are unique).
  6841. @param target The target (this object) to invoke the callback, can be null
  6842. @example
  6843. ```js
  6844. eventTarget.on('fire', function () {
  6845. cc.log("fire in the hole");
  6846. }, node);
  6847. ```
  6848. */
  6849. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6850. /**
  6851. !#en
  6852. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6853. if only type is passed as parameter, all listeners registered with that type will be removed.
  6854. !#zh
  6855. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6856. @param type A string representing the event type being removed.
  6857. @param callback The callback to remove.
  6858. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6859. @example
  6860. ```js
  6861. // register fire eventListener
  6862. var callback = eventTarget.on('fire', function () {
  6863. cc.log("fire in the hole");
  6864. }, target);
  6865. // remove fire event listener
  6866. eventTarget.off('fire', callback, target);
  6867. // remove all fire event listeners
  6868. eventTarget.off('fire');
  6869. ```
  6870. */
  6871. off(type: string, callback?: Function, target?: any): void;
  6872. /**
  6873. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6874. This is not for removing all listeners in the current event target,
  6875. and this is not for removing all listeners the target parameter have registered.
  6876. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6877. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6878. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6879. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6880. @param target The target to be searched for all related listeners
  6881. */
  6882. targetOff(target: any): void;
  6883. /**
  6884. !#en
  6885. Register an callback of a specific event type on the EventTarget,
  6886. the callback will remove itself after the first time it is triggered.
  6887. !#zh
  6888. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6889. @param type A string representing the event type to listen for.
  6890. @param callback The callback that will be invoked when the event is dispatched.
  6891. The callback is ignored if it is a duplicate (the callbacks are unique).
  6892. @param target The target (this object) to invoke the callback, can be null
  6893. @example
  6894. ```js
  6895. eventTarget.once('fire', function () {
  6896. cc.log("this is the callback and will be invoked only once");
  6897. }, node);
  6898. ```
  6899. */
  6900. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6901. /**
  6902. !#en
  6903. Send an event with the event object.
  6904. !#zh
  6905. 通过事件对象派发事件
  6906. @param event event
  6907. */
  6908. dispatchEvent(event: Event): void;
  6909. /**
  6910. !#en
  6911. Destroy all callbackInfos.
  6912. !#zh
  6913. 销毁记录的事件
  6914. */
  6915. clear(): void;
  6916. }
  6917. /** !#en
  6918. EventTarget is an object to which an event is dispatched when something has occurred.
  6919. Entity are the most common event targets, but other objects can be event targets too.
  6920. Event targets are an important part of the Fireball event model.
  6921. The event target serves as the focal point for how events flow through the scene graph.
  6922. When an event such as a mouse click or a keypress occurs, Fireball dispatches an event object
  6923. into the event flow from the root of the hierarchy. The event object then makes its way through
  6924. the scene graph until it reaches the event target, at which point it begins its return trip through
  6925. the scene graph. This round-trip journey to the event target is conceptually divided into three phases:
  6926. - The capture phase comprises the journey from the root to the last node before the event target's node
  6927. - The target phase comprises only the event target node
  6928. - The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the tree
  6929. See also: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  6930. Event targets can implement the following methods:
  6931. - _getCapturingTargets
  6932. - _getBubblingTargets
  6933. !#zh
  6934. 事件目标是事件触发时,分派的事件对象,Node 是最常见的事件目标,
  6935. 但是其他对象也可以是事件目标。<br/> */
  6936. export class EventTarget extends CallbacksInvoker {
  6937. /**
  6938. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6939. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6940. @param type The type of event.
  6941. */
  6942. hasEventListener(type: string): boolean;
  6943. /**
  6944. !#en
  6945. Register an callback of a specific event type on the EventTarget.
  6946. This type of event should be triggered via `emit`.
  6947. !#zh
  6948. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6949. @param type A string representing the event type to listen for.
  6950. @param callback The callback that will be invoked when the event is dispatched.
  6951. The callback is ignored if it is a duplicate (the callbacks are unique).
  6952. @param target The target (this object) to invoke the callback, can be null
  6953. @example
  6954. ```js
  6955. eventTarget.on('fire', function () {
  6956. cc.log("fire in the hole");
  6957. }, node);
  6958. ```
  6959. */
  6960. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6961. /**
  6962. !#en
  6963. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6964. if only type is passed as parameter, all listeners registered with that type will be removed.
  6965. !#zh
  6966. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6967. @param type A string representing the event type being removed.
  6968. @param callback The callback to remove.
  6969. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6970. @example
  6971. ```js
  6972. // register fire eventListener
  6973. var callback = eventTarget.on('fire', function () {
  6974. cc.log("fire in the hole");
  6975. }, target);
  6976. // remove fire event listener
  6977. eventTarget.off('fire', callback, target);
  6978. // remove all fire event listeners
  6979. eventTarget.off('fire');
  6980. ```
  6981. */
  6982. off(type: string, callback?: Function, target?: any): void;
  6983. /**
  6984. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6985. This is not for removing all listeners in the current event target,
  6986. and this is not for removing all listeners the target parameter have registered.
  6987. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6988. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6989. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6990. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6991. @param target The target to be searched for all related listeners
  6992. */
  6993. targetOff(target: any): void;
  6994. /**
  6995. !#en
  6996. Register an callback of a specific event type on the EventTarget,
  6997. the callback will remove itself after the first time it is triggered.
  6998. !#zh
  6999. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7000. @param type A string representing the event type to listen for.
  7001. @param callback The callback that will be invoked when the event is dispatched.
  7002. The callback is ignored if it is a duplicate (the callbacks are unique).
  7003. @param target The target (this object) to invoke the callback, can be null
  7004. @example
  7005. ```js
  7006. eventTarget.once('fire', function () {
  7007. cc.log("this is the callback and will be invoked only once");
  7008. }, node);
  7009. ```
  7010. */
  7011. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7012. /**
  7013. !#en
  7014. Send an event with the event object.
  7015. !#zh
  7016. 通过事件对象派发事件
  7017. @param event event
  7018. */
  7019. dispatchEvent(event: Event): void;
  7020. /**
  7021. !#en
  7022. Destroy all callbackInfos.
  7023. !#zh
  7024. 销毁记录的事件
  7025. */
  7026. clear(): void;
  7027. }
  7028. /** !#en Base class of all kinds of events.
  7029. !#zh 包含事件相关信息的对象。 */
  7030. export class Event {
  7031. /**
  7032. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  7033. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  7034. */
  7035. constructor(type: string, bubbles: boolean);
  7036. /** !#en The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  7037. !#zh 事件类型。 */
  7038. type: string;
  7039. /** !#en Indicate whether the event bubbles up through the tree or not.
  7040. !#zh 表示该事件是否进行冒泡。 */
  7041. bubbles: boolean;
  7042. /** !#en A reference to the target to which the event was originally dispatched.
  7043. !#zh 最初事件触发的目标 */
  7044. target: any;
  7045. /** !#en A reference to the currently registered target for the event.
  7046. !#zh 当前目标 */
  7047. currentTarget: any;
  7048. /** !#en
  7049. Indicates which phase of the event flow is currently being evaluated.
  7050. Returns an integer value represented by 4 constants:
  7051. - Event.NONE = 0
  7052. - Event.CAPTURING_PHASE = 1
  7053. - Event.AT_TARGET = 2
  7054. - Event.BUBBLING_PHASE = 3
  7055. The phases are explained in the [section 3.1, Event dispatch and DOM event flow]
  7056. (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
  7057. !#zh 事件阶段 */
  7058. eventPhase: number;
  7059. /**
  7060. !#en Reset the event for being stored in the object pool.
  7061. !#zh 重置对象池中存储的事件。
  7062. */
  7063. unuse(): string;
  7064. /**
  7065. !#en Reuse the event for being used again by the object pool.
  7066. !#zh 用于对象池再次使用的事件。
  7067. */
  7068. reuse(): string;
  7069. /**
  7070. !#en Stops propagation for current event.
  7071. !#zh 停止传递当前事件。
  7072. */
  7073. stopPropagation(): void;
  7074. /**
  7075. !#en Stops propagation for current event immediately,
  7076. the event won't even be dispatched to the listeners attached in the current target.
  7077. !#zh 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
  7078. */
  7079. stopPropagationImmediate(): void;
  7080. /**
  7081. !#en Checks whether the event has been stopped.
  7082. !#zh 检查该事件是否已经停止传递.
  7083. */
  7084. isStopped(): boolean;
  7085. /**
  7086. !#en
  7087. <p>
  7088. Gets current target of the event <br/>
  7089. note: It only be available when the event listener is associated with node. <br/>
  7090. It returns 0 when the listener is associated with fixed priority.
  7091. </p>
  7092. !#zh 获取当前目标节点
  7093. */
  7094. getCurrentTarget(): Node;
  7095. /**
  7096. !#en Gets the event type.
  7097. !#zh 获取事件类型
  7098. */
  7099. getType(): string;
  7100. /** !#en Code for event without type.
  7101. !#zh 没有类型的事件 */
  7102. static NO_TYPE: string;
  7103. /** !#en The type code of Touch event.
  7104. !#zh 触摸事件类型 */
  7105. static TOUCH: string;
  7106. /** !#en The type code of Mouse event.
  7107. !#zh 鼠标事件类型 */
  7108. static MOUSE: string;
  7109. /** !#en The type code of Keyboard event.
  7110. !#zh 键盘事件类型 */
  7111. static KEYBOARD: string;
  7112. /** !#en The type code of Acceleration event.
  7113. !#zh 加速器事件类型 */
  7114. static ACCELERATION: string;
  7115. /** !#en Events not currently dispatched are in this phase
  7116. !#zh 尚未派发事件阶段 */
  7117. static NONE: number;
  7118. /** !#en
  7119. The capturing phase comprises the journey from the root to the last node before the event target's node
  7120. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7121. !#zh 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。 */
  7122. static CAPTURING_PHASE: number;
  7123. /** !#en
  7124. The target phase comprises only the event target node
  7125. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7126. !#zh 目标阶段仅包括事件目标节点。 */
  7127. static AT_TARGET: number;
  7128. /** !#en
  7129. The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy
  7130. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7131. !#zh 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。 */
  7132. static BUBBLING_PHASE: number;
  7133. }
  7134. /** !#en
  7135. The System event, it currently supports keyboard events and accelerometer events.<br>
  7136. You can get the SystemEvent instance with cc.systemEvent.<br>
  7137. !#zh
  7138. 系统事件,它目前支持按键事件和重力感应事件。<br>
  7139. 你可以通过 cc.systemEvent 获取到 SystemEvent 的实例。<br> */
  7140. export class SystemEvent extends EventTarget {
  7141. /**
  7142. !#en whether enable accelerometer event
  7143. !#zh 是否启用加速度计事件
  7144. @param isEnable isEnable
  7145. */
  7146. setAccelerometerEnabled(isEnable: boolean): void;
  7147. /**
  7148. !#en set accelerometer interval value
  7149. !#zh 设置加速度计间隔值
  7150. @param interval interval
  7151. */
  7152. setAccelerometerInterval(interval: number): void;
  7153. }
  7154. /** !#en Box Collider.
  7155. !#zh 包围盒碰撞组件 */
  7156. export class BoxCollider extends Collider implements Collider.Box {
  7157. /** !#en
  7158. Collider info in world coordinate.
  7159. !#zh
  7160. 碰撞体的世界坐标系下的信息。 */
  7161. world: ColliderInfo;
  7162. /** !#en Position offset
  7163. !#zh 位置偏移量 */
  7164. offset: Vec2;
  7165. /** !#en Box size
  7166. !#zh 包围盒大小 */
  7167. size: Size;
  7168. }
  7169. /** !#en Circle Collider.
  7170. !#zh 圆形碰撞组件 */
  7171. export class CircleCollider extends Collider implements Collider.Circle {
  7172. /** !#en
  7173. Collider info in world coordinate.
  7174. !#zh
  7175. 碰撞体的世界坐标系下的信息。 */
  7176. world: ColliderInfo;
  7177. /** !#en Position offset
  7178. !#zh 位置偏移量 */
  7179. offset: Vec2;
  7180. /** !#en Circle radius
  7181. !#zh 圆形半径 */
  7182. radius: number;
  7183. }
  7184. /** !#en Collider component base class.
  7185. !#zh 碰撞组件基类 */
  7186. export class Collider extends Component {
  7187. /** !#en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
  7188. !#zh 标签。当一个节点上有多个碰撞组件时,在发生碰撞后,可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。 */
  7189. tag: number;
  7190. }
  7191. /** !#en
  7192. Collider Info.
  7193. !#zh
  7194. 碰撞体信息。 */
  7195. export class ColliderInfo {
  7196. /** !#en
  7197. Collider aabb information of last frame
  7198. !#zh
  7199. 碰撞体上一帧的 aabb 信息 */
  7200. preAabb: Rect;
  7201. /** !#en
  7202. Collider aabb information of current frame
  7203. !#zh
  7204. 碰撞体当前帧的 aabb 信息 */
  7205. aabb: Rect;
  7206. /** !#en
  7207. Collider matrix
  7208. !#zh
  7209. 碰撞体的矩阵信息 */
  7210. matrix: Mat4;
  7211. /** !#en
  7212. Collider radius (for CircleCollider)
  7213. !#zh
  7214. 碰撞体的半径(只对 CircleCollider 有效) */
  7215. radius: number;
  7216. /** !#en
  7217. Collider position (for CircleCollider)
  7218. !#zh
  7219. 碰撞体的位置(只对 CircleCollider 有效) */
  7220. position: Vec2;
  7221. /** !#en
  7222. Collider points (for BoxCollider and PolygonCollider)
  7223. !#zh
  7224. 碰撞体的顶点信息(只对 BoxCollider 和 PolygonCollider 有效) */
  7225. points: Vec2[];
  7226. }
  7227. /** !#en
  7228. A simple collision manager class.
  7229. It will calculate whether the collider collides other colliders, if collides then call the callbacks.
  7230. !#zh
  7231. 一个简单的碰撞组件管理类,用于处理节点之间的碰撞组件是否产生了碰撞,并调用相应回调函数。 */
  7232. export class CollisionManager implements EventTarget {
  7233. /** !#en
  7234. !#zh
  7235. 是否开启碰撞管理,默认为不开启 */
  7236. enabled: boolean;
  7237. /** !#en
  7238. !#zh
  7239. 是否绘制碰撞组件的包围盒,默认为不绘制 */
  7240. enabledDrawBoundingBox: boolean;
  7241. /** !#en
  7242. !#zh
  7243. 是否绘制碰撞组件的形状,默认为不绘制 */
  7244. enabledDebugDraw: boolean;
  7245. /**
  7246. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  7247. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  7248. @param type The type of event.
  7249. */
  7250. hasEventListener(type: string): boolean;
  7251. /**
  7252. !#en
  7253. Register an callback of a specific event type on the EventTarget.
  7254. This type of event should be triggered via `emit`.
  7255. !#zh
  7256. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  7257. @param type A string representing the event type to listen for.
  7258. @param callback The callback that will be invoked when the event is dispatched.
  7259. The callback is ignored if it is a duplicate (the callbacks are unique).
  7260. @param target The target (this object) to invoke the callback, can be null
  7261. @example
  7262. ```js
  7263. eventTarget.on('fire', function () {
  7264. cc.log("fire in the hole");
  7265. }, node);
  7266. ```
  7267. */
  7268. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  7269. /**
  7270. !#en
  7271. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  7272. if only type is passed as parameter, all listeners registered with that type will be removed.
  7273. !#zh
  7274. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  7275. @param type A string representing the event type being removed.
  7276. @param callback The callback to remove.
  7277. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  7278. @example
  7279. ```js
  7280. // register fire eventListener
  7281. var callback = eventTarget.on('fire', function () {
  7282. cc.log("fire in the hole");
  7283. }, target);
  7284. // remove fire event listener
  7285. eventTarget.off('fire', callback, target);
  7286. // remove all fire event listeners
  7287. eventTarget.off('fire');
  7288. ```
  7289. */
  7290. off(type: string, callback?: Function, target?: any): void;
  7291. /**
  7292. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  7293. This is not for removing all listeners in the current event target,
  7294. and this is not for removing all listeners the target parameter have registered.
  7295. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  7296. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  7297. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  7298. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  7299. @param target The target to be searched for all related listeners
  7300. */
  7301. targetOff(target: any): void;
  7302. /**
  7303. !#en
  7304. Register an callback of a specific event type on the EventTarget,
  7305. the callback will remove itself after the first time it is triggered.
  7306. !#zh
  7307. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7308. @param type A string representing the event type to listen for.
  7309. @param callback The callback that will be invoked when the event is dispatched.
  7310. The callback is ignored if it is a duplicate (the callbacks are unique).
  7311. @param target The target (this object) to invoke the callback, can be null
  7312. @example
  7313. ```js
  7314. eventTarget.once('fire', function () {
  7315. cc.log("this is the callback and will be invoked only once");
  7316. }, node);
  7317. ```
  7318. */
  7319. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7320. /**
  7321. !#en
  7322. Send an event with the event object.
  7323. !#zh
  7324. 通过事件对象派发事件
  7325. @param event event
  7326. */
  7327. dispatchEvent(event: Event): void;
  7328. /**
  7329. !#en
  7330. Destroy all callbackInfos.
  7331. !#zh
  7332. 销毁记录的事件
  7333. */
  7334. clear(): void;
  7335. }
  7336. /** !#en Intersection helper class
  7337. !#zh 辅助类,用于测试形状与形状是否相交 */
  7338. export class Intersection {
  7339. /**
  7340. !#en Test line and line
  7341. !#zh 测试线段与线段是否相交
  7342. @param a1 The start point of the first line
  7343. @param a2 The end point of the first line
  7344. @param b1 The start point of the second line
  7345. @param b2 The end point of the second line
  7346. */
  7347. static lineLine(a1: Vec2, a2: Vec2, b1: Vec2, b2: Vec2): boolean;
  7348. /**
  7349. !#en Test line and rect
  7350. !#zh 测试线段与矩形是否相交
  7351. @param a1 The start point of the line
  7352. @param a2 The end point of the line
  7353. @param b The rect
  7354. */
  7355. static lineRect(a1: Vec2, a2: Vec2, b: Rect): boolean;
  7356. /**
  7357. !#en Test line and polygon
  7358. !#zh 测试线段与多边形是否相交
  7359. @param a1 The start point of the line
  7360. @param a2 The end point of the line
  7361. @param b The polygon, a set of points
  7362. */
  7363. static linePolygon(a1: Vec2, a2: Vec2, b: Vec2[]): boolean;
  7364. /**
  7365. !#en Test rect and rect
  7366. !#zh 测试矩形与矩形是否相交
  7367. @param a The first rect
  7368. @param b The second rect
  7369. */
  7370. static rectRect(a: Rect, b: Rect): boolean;
  7371. /**
  7372. !#en Test rect and polygon
  7373. !#zh 测试矩形与多边形是否相交
  7374. @param a The rect
  7375. @param b The polygon, a set of points
  7376. */
  7377. static rectPolygon(a: Rect, b: Vec2[]): boolean;
  7378. /**
  7379. !#en Test polygon and polygon
  7380. !#zh 测试多边形与多边形是否相交
  7381. @param a The first polygon, a set of points
  7382. @param b The second polygon, a set of points
  7383. */
  7384. static polygonPolygon(a: Vec2[], b: Vec2[]): boolean;
  7385. /**
  7386. !#en Test circle and circle
  7387. !#zh 测试圆形与圆形是否相交
  7388. @param a Object contains position and radius
  7389. @param b Object contains position and radius
  7390. */
  7391. static circleCircle(a: {position: Vec2, radius: number}, b: {position: Vec2, radius: number}): boolean;
  7392. /**
  7393. !#en Test polygon and circle
  7394. !#zh 测试矩形与圆形是否相交
  7395. @param polygon The Polygon, a set of points
  7396. @param circle Object contains position and radius
  7397. */
  7398. static polygonCircle(polygon: Vec2[], circle: {position: Vec2, radius: number}): boolean;
  7399. /**
  7400. !#en Test whether the point is in the polygon
  7401. !#zh 测试一个点是否在一个多边形中
  7402. @param point The point
  7403. @param polygon The polygon, a set of points
  7404. */
  7405. static pointInPolygon(point: Vec2, polygon: Vec2[]): boolean;
  7406. /**
  7407. !#en Calculate the distance of point to line.
  7408. !#zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
  7409. @param point The point
  7410. @param start The start point of line
  7411. @param end The end point of line
  7412. @param isSegment whether this line is a segment
  7413. */
  7414. static pointLineDistance(point: Vec2, start: Vec2, end: Vec2, isSegment: boolean): number;
  7415. }
  7416. /** !#en Polygon Collider.
  7417. !#zh 多边形碰撞组件 */
  7418. export class PolygonCollider extends Collider implements Collider.Polygon {
  7419. /** !#en
  7420. Collider info in world coordinate.
  7421. !#zh
  7422. 碰撞体的世界坐标系下的信息。 */
  7423. world: ColliderInfo;
  7424. /** !#en Position offset
  7425. !#zh 位置偏移量 */
  7426. offset: Vec2;
  7427. /** !#en Polygon points
  7428. !#zh 多边形顶点数组 */
  7429. points: Vec2[];
  7430. }
  7431. /** !#en The touch event class
  7432. !#zh 封装了触摸相关的信息。 */
  7433. export class Touch {
  7434. /**
  7435. !#en Returns the current touch location in OpenGL coordinates.、
  7436. !#zh 获取当前触点位置。
  7437. */
  7438. getLocation(): Vec2;
  7439. /**
  7440. !#en Returns X axis location value.
  7441. !#zh 获取当前触点 X 轴位置。
  7442. */
  7443. getLocationX(): number;
  7444. /**
  7445. !#en Returns Y axis location value.
  7446. !#zh 获取当前触点 Y 轴位置。
  7447. */
  7448. getLocationY(): number;
  7449. /**
  7450. !#en Returns the previous touch location in OpenGL coordinates.
  7451. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  7452. */
  7453. getPreviousLocation(): Vec2;
  7454. /**
  7455. !#en Returns the start touch location in OpenGL coordinates.
  7456. !#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  7457. */
  7458. getStartLocation(): Vec2;
  7459. /**
  7460. !#en Returns the delta distance from the previous touche to the current one in screen coordinates.
  7461. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  7462. */
  7463. getDelta(): Vec2;
  7464. /**
  7465. !#en Returns the current touch location in screen coordinates.
  7466. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  7467. */
  7468. getLocationInView(): Vec2;
  7469. /**
  7470. !#en Returns the previous touch location in screen coordinates.
  7471. !#zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  7472. */
  7473. getPreviousLocationInView(): Vec2;
  7474. /**
  7475. !#en Returns the start touch location in screen coordinates.
  7476. !#zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  7477. */
  7478. getStartLocationInView(): Vec2;
  7479. /**
  7480. !#en Returns the id of cc.Touch.
  7481. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  7482. */
  7483. getID(): number;
  7484. /**
  7485. !#en Sets information to touch.
  7486. !#zh 设置触摸相关的信息。用于监控触摸事件。
  7487. @param id id
  7488. @param x x
  7489. @param y y
  7490. */
  7491. setTouchInfo(id: number, x: number, y: number): void;
  7492. }
  7493. /** !#en The animation component is used to play back animations.
  7494. Animation provide several events to register:
  7495. - play : Emit when begin playing animation
  7496. - stop : Emit when stop playing animation
  7497. - pause : Emit when pause animation
  7498. - resume : Emit when resume animation
  7499. - lastframe : If animation repeat count is larger than 1, emit when animation play to the last frame
  7500. - finished : Emit when finish playing animation
  7501. !#zh Animation 组件用于播放动画。
  7502. Animation 提供了一系列可注册的事件:
  7503. - play : 开始播放时
  7504. - stop : 停止播放时
  7505. - pause : 暂停播放时
  7506. - resume : 恢复播放时
  7507. - lastframe : 假如动画循环次数大于 1,当动画播放到最后一帧时
  7508. - finished : 动画播放完成时 */
  7509. export class Animation extends Component implements EventTarget {
  7510. /** !#en Animation will play the default clip when start game.
  7511. !#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 */
  7512. defaultClip: AnimationClip;
  7513. /** !#en Current played clip.
  7514. !#zh 当前播放的动画剪辑。 */
  7515. currentClip: AnimationClip;
  7516. /** !#en Whether the animation should auto play the default clip when start game.
  7517. !#zh 是否在运行游戏后自动播放默认动画剪辑。 */
  7518. playOnLoad: boolean;
  7519. /**
  7520. !#en Get all the clips used in this animation.
  7521. !#zh 获取动画组件上的所有动画剪辑。
  7522. */
  7523. getClips(): AnimationClip[];
  7524. /**
  7525. !#en Plays an animation and stop other animations.
  7526. !#zh 播放指定的动画,并且停止当前正在播放动画。如果没有指定动画,则播放默认动画。
  7527. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  7528. @param startTime play an animation from startTime
  7529. @example
  7530. ```js
  7531. var animCtrl = this.node.getComponent(cc.Animation);
  7532. animCtrl.play("linear");
  7533. ```
  7534. */
  7535. play(name?: string, startTime?: number): AnimationState;
  7536. /**
  7537. !#en
  7538. Plays an additive animation, it will not stop other animations.
  7539. If there are other animations playing, then will play several animations at the same time.
  7540. !#zh 播放指定的动画(将不会停止当前播放的动画)。如果没有指定动画,则播放默认动画。
  7541. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  7542. @param startTime play an animation from startTime
  7543. @example
  7544. ```js
  7545. // linear_1 and linear_2 at the same time playing.
  7546. var animCtrl = this.node.getComponent(cc.Animation);
  7547. animCtrl.playAdditive("linear_1");
  7548. animCtrl.playAdditive("linear_2");
  7549. ```
  7550. */
  7551. playAdditive(name?: string, startTime?: number): AnimationState;
  7552. /**
  7553. !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. <br/>
  7554. Stopping an animation also Rewinds it to the Start.
  7555. !#zh 停止指定的动画。如果没有指定名字,则停止当前正在播放的动画。
  7556. @param name The animation to stop, if not supplied then stops all playing animations.
  7557. */
  7558. stop(name?: string): void;
  7559. /**
  7560. !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.
  7561. !#zh 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。
  7562. @param name The animation to pauses, if not supplied then pauses all playing animations.
  7563. */
  7564. pause(name?: string): void;
  7565. /**
  7566. !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.
  7567. !#zh 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。
  7568. @param name The animation to resumes, if not supplied then resumes all paused animations.
  7569. */
  7570. resume(name?: string): void;
  7571. /**
  7572. !#en Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time.
  7573. !#zh 设置指定动画的播放时间。如果没有指定名字,则设置当前播放动画的播放时间。
  7574. @param time The time to go to
  7575. @param name Specified animation name, if not supplied then make all animations go to the time.
  7576. */
  7577. setCurrentTime(time?: number, name?: string): void;
  7578. /**
  7579. !#en Returns the animation state named name. If no animation with the specified name, the function will return null.
  7580. !#zh 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 null。
  7581. @param name name
  7582. */
  7583. getAnimationState(name: string): AnimationState;
  7584. /**
  7585. !#en Adds a clip to the animation with name newName. If a clip with that name already exists it will be replaced with the new clip.
  7586. !#zh 添加动画剪辑,并且可以重新设置该动画剪辑的名称。
  7587. @param clip the clip to add
  7588. @param newName newName
  7589. */
  7590. addClip(clip: AnimationClip, newName?: string): AnimationState;
  7591. /**
  7592. !#en
  7593. Remove clip from the animation list. This will remove the clip and any animation states based on it.
  7594. If there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.
  7595. But if force is true, then will always remove the clip and any animation states based on it. If clip is defaultClip, defaultClip will be reset to null
  7596. !#zh
  7597. 从动画列表中移除指定的动画剪辑,<br/>
  7598. 如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话,默认是不会删除 clip 的。
  7599. 但是如果 force 参数为 true,则会强制停止该动画,然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip,defaultClip 将会被重置为 null。
  7600. @param clip clip
  7601. @param force If force is true, then will always remove the clip and any animation states based on it.
  7602. */
  7603. removeClip(clip: AnimationClip, force?: boolean): void;
  7604. /**
  7605. !#en
  7606. Samples animations at the current state.<br/>
  7607. This is useful when you explicitly want to set up some animation state, and sample it once.
  7608. !#zh 对指定或当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。
  7609. @param name name
  7610. */
  7611. sample(name: string): void;
  7612. /**
  7613. !#en
  7614. Register animation event callback.
  7615. The event arguments will provide the AnimationState which emit the event.
  7616. When play an animation, will auto register the event callback to the AnimationState, and unregister the event callback from the AnimationState when animation stopped.
  7617. !#zh
  7618. 注册动画事件回调。
  7619. 回调的事件里将会附上发送事件的 AnimationState。
  7620. 当播放一个动画时,会自动将事件注册到对应的 AnimationState 上,停止播放时会将事件从这个 AnimationState 上取消注册。
  7621. @param type A string representing the event type to listen for.
  7622. @param callback The callback that will be invoked when the event is dispatched.
  7623. The callback is ignored if it is a duplicate (the callbacks are unique).
  7624. @param state state
  7625. @param target The target (this object) to invoke the callback, can be null
  7626. @param useCapture When set to true, the capture argument prevents callback
  7627. from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
  7628. When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
  7629. Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
  7630. @example
  7631. ```js
  7632. onPlay: function (type, state) {
  7633. // callback
  7634. }
  7635. // register event to all animation
  7636. animation.on('play', this.onPlay, this);
  7637. ```
  7638. */
  7639. on(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void;
  7640. on<T>(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void;
  7641. on(type: string, callback: (type: string, state: cc.AnimationState) => void, target?: any, useCapture?: boolean): (type: string, state: cc.AnimationState) => void;
  7642. /**
  7643. !#en
  7644. Unregister animation event callback.
  7645. !#zh
  7646. 取消注册动画事件回调。
  7647. @param type A string representing the event type being removed.
  7648. @param callback The callback to remove.
  7649. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  7650. @param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.
  7651. If not specified, useCapture defaults to false. If a callback was registered twice,
  7652. one with capture and one without, each must be removed separately. Removal of a capturing callback
  7653. does not affect a non-capturing version of the same listener, and vice versa.
  7654. @example
  7655. ```js
  7656. // unregister event to all animation
  7657. animation.off('play', this.onPlay, this);
  7658. ```
  7659. */
  7660. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  7661. /**
  7662. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  7663. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  7664. @param type The type of event.
  7665. */
  7666. hasEventListener(type: string): boolean;
  7667. /**
  7668. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  7669. This is not for removing all listeners in the current event target,
  7670. and this is not for removing all listeners the target parameter have registered.
  7671. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  7672. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  7673. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  7674. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  7675. @param target The target to be searched for all related listeners
  7676. */
  7677. targetOff(target: any): void;
  7678. /**
  7679. !#en
  7680. Register an callback of a specific event type on the EventTarget,
  7681. the callback will remove itself after the first time it is triggered.
  7682. !#zh
  7683. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7684. @param type A string representing the event type to listen for.
  7685. @param callback The callback that will be invoked when the event is dispatched.
  7686. The callback is ignored if it is a duplicate (the callbacks are unique).
  7687. @param target The target (this object) to invoke the callback, can be null
  7688. @example
  7689. ```js
  7690. eventTarget.once('fire', function () {
  7691. cc.log("this is the callback and will be invoked only once");
  7692. }, node);
  7693. ```
  7694. */
  7695. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7696. /**
  7697. !#en
  7698. Send an event with the event object.
  7699. !#zh
  7700. 通过事件对象派发事件
  7701. @param event event
  7702. */
  7703. dispatchEvent(event: Event): void;
  7704. /**
  7705. !#en
  7706. Destroy all callbackInfos.
  7707. !#zh
  7708. 销毁记录的事件
  7709. */
  7710. clear(): void;
  7711. }
  7712. /** !#en Audio Source.
  7713. !#zh 音频源组件,能对音频剪辑。 */
  7714. export class AudioSource extends Component {
  7715. /** !#en
  7716. Is the audio source playing (Read Only). <br/>
  7717. Note: isPlaying is not supported for Native platforms.
  7718. !#zh
  7719. 该音频剪辑是否正播放(只读)。<br/>
  7720. 注意:Native 平台暂时不支持 isPlaying。 */
  7721. isPlaying: boolean;
  7722. /** !#en The clip of the audio source to play.
  7723. !#zh 要播放的音频剪辑。 */
  7724. clip: AudioClip;
  7725. /** !#en The volume of the audio source.
  7726. !#zh 音频源的音量(0.0 ~ 1.0)。 */
  7727. volume: number;
  7728. /** !#en Is the audio source mute?
  7729. !#zh 是否静音音频源。Mute 是设置音量为 0,取消静音是恢复原来的音量。 */
  7730. mute: boolean;
  7731. /** !#en Is the audio source looping?
  7732. !#zh 音频源是否循环播放? */
  7733. loop: boolean;
  7734. /** !#en If set to true, the audio source will automatically start playing on onEnable.
  7735. !#zh 如果设置为 true,音频源将在 onEnable 时自动播放。 */
  7736. playOnLoad: boolean;
  7737. /** !#en If set to true and AudioClip is a deferred load resource, the component will preload AudioClip in the onLoad phase.
  7738. !#zh 如果设置为 true 且 AudioClip 为延迟加载资源,组件将在 onLoad 阶段预加载 AudioClip。 */
  7739. preload: boolean;
  7740. /**
  7741. !#en Plays the clip.
  7742. !#zh 播放音频剪辑。
  7743. */
  7744. play(): void;
  7745. /**
  7746. !#en Stops the clip.
  7747. !#zh 停止当前音频剪辑。
  7748. */
  7749. stop(): void;
  7750. /**
  7751. !#en Pause the clip.
  7752. !#zh 暂停当前音频剪辑。
  7753. */
  7754. pause(): void;
  7755. /**
  7756. !#en Resume the clip.
  7757. !#zh 恢复播放。
  7758. */
  7759. resume(): void;
  7760. /**
  7761. !#en Rewind playing music.
  7762. !#zh 从头开始播放。
  7763. */
  7764. rewind(): void;
  7765. /**
  7766. !#en Get current time
  7767. !#zh 获取当前的播放时间
  7768. */
  7769. getCurrentTime(): number;
  7770. /**
  7771. !#en Set current time
  7772. !#zh 设置当前的播放时间
  7773. @param time time
  7774. */
  7775. setCurrentTime(time: number): number;
  7776. /**
  7777. !#en Get audio duration
  7778. !#zh 获取当前音频的长度
  7779. */
  7780. getDuration(): number;
  7781. }
  7782. /** !#en
  7783. This component will block all input events (mouse and touch) within the bounding box of the node, preventing the input from penetrating into the underlying node, typically for the background of the top UI.<br>
  7784. This component does not have any API interface and can be added directly to the scene to take effect.
  7785. !#zh
  7786. 该组件将拦截所属节点 bounding box 内的所有输入事件(鼠标和触摸),防止输入穿透到下层节点,一般用于上层 UI 的背景。<br>
  7787. 该组件没有任何 API 接口,直接添加到场景即可生效。 */
  7788. export class BlockInputEvents extends Component {
  7789. }
  7790. /** !#en
  7791. Button component. Can be pressed or clicked. Button has 4 Transition types:
  7792. - Button.Transition.NONE // Button will do nothing
  7793. - Button.Transition.COLOR // Button will change target's color
  7794. - Button.Transition.SPRITE // Button will change target Sprite's sprite
  7795. - Button.Transition.SCALE // Button will change target node's scale
  7796. The button can bind events (but you must be on the button's node to bind events).<br/>
  7797. The following events can be triggered on all platforms.
  7798. - cc.Node.EventType.TOUCH_START // Press
  7799. - cc.Node.EventType.TOUCH_MOVE // After pressing and moving
  7800. - cc.Node.EventType.TOUCH_END // After pressing and releasing
  7801. - cc.Node.EventType.TOUCH_CANCEL // Press to cancel
  7802. The following events are only triggered on the PC platform:
  7803. - cc.Node.EventType.MOUSE_DOWN
  7804. - cc.Node.EventType.MOUSE_MOVE
  7805. - cc.Node.EventType.MOUSE_ENTER
  7806. - cc.Node.EventType.MOUSE_LEAVE
  7807. - cc.Node.EventType.MOUSE_UP
  7808. - cc.Node.EventType.MOUSE_WHEEL
  7809. User can get the current clicked node with 'event.target' from event object which is passed as parameter in the callback function of click event.
  7810. !#zh
  7811. 按钮组件。可以被按下,或者点击。
  7812. 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
  7813. - Button.Transition.NONE // 不做任何过渡
  7814. - Button.Transition.COLOR // 进行颜色之间过渡
  7815. - Button.Transition.SPRITE // 进行精灵之间过渡
  7816. - Button.Transition.SCALE // 进行缩放过渡
  7817. 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):<br/>
  7818. 以下事件可以在全平台上都触发:
  7819. - cc.Node.EventType.TOUCH_START // 按下时事件
  7820. - cc.Node.EventType.TOUCH_MOVE // 按住移动后事件
  7821. - cc.Node.EventType.TOUCH_END // 按下后松开后事件
  7822. - cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
  7823. 以下事件只在 PC 平台上触发:
  7824. - cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件
  7825. - cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件
  7826. - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
  7827. - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
  7828. - cc.Node.EventType.MOUSE_UP // 鼠标松开事件
  7829. - cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件
  7830. 用户可以通过获取 __点击事件__ 回调函数的参数 event 的 target 属性获取当前点击对象。 */
  7831. export class Button extends Component implements GraySpriteState {
  7832. /** !#en
  7833. Whether the Button is disabled.
  7834. If true, the Button will trigger event and do transition.
  7835. !#zh
  7836. 按钮事件是否被响应,如果为 false,则按钮将被禁用。 */
  7837. interactable: boolean;
  7838. /** !#en When this flag is true, Button target sprite will turn gray when interactable is false.
  7839. !#zh 如果这个标记为 true,当 button 的 interactable 属性为 false 的时候,会使用内置 shader 让 button 的 target 节点的 sprite 组件变灰 */
  7840. enableAutoGrayEffect: boolean;
  7841. /** !#en Transition type
  7842. !#zh 按钮状态改变时过渡方式。 */
  7843. transition: Button.Transition;
  7844. /** !#en Normal state color.
  7845. !#zh 普通状态下按钮所显示的颜色。 */
  7846. normalColor: Color;
  7847. /** !#en Pressed state color
  7848. !#zh 按下状态时按钮所显示的颜色。 */
  7849. pressedColor: Color;
  7850. /** !#en Hover state color
  7851. !#zh 悬停状态下按钮所显示的颜色。 */
  7852. hoverColor: Color;
  7853. /** !#en Disabled state color
  7854. !#zh 禁用状态下按钮所显示的颜色。 */
  7855. disabledColor: Color;
  7856. /** !#en Color and Scale transition duration
  7857. !#zh 颜色过渡和缩放过渡时所需时间 */
  7858. duration: number;
  7859. /** !#en When user press the button, the button will zoom to a scale.
  7860. The final scale of the button equals (button original scale * zoomScale)
  7861. !#zh 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale */
  7862. zoomScale: number;
  7863. /** !#en Normal state sprite
  7864. !#zh 普通状态下按钮所显示的 Sprite 。 */
  7865. normalSprite: SpriteFrame;
  7866. /** !#en Pressed state sprite
  7867. !#zh 按下状态时按钮所显示的 Sprite 。 */
  7868. pressedSprite: SpriteFrame;
  7869. /** !#en Hover state sprite
  7870. !#zh 悬停状态下按钮所显示的 Sprite 。 */
  7871. hoverSprite: SpriteFrame;
  7872. /** !#en Disabled state sprite
  7873. !#zh 禁用状态下按钮所显示的 Sprite 。 */
  7874. disabledSprite: SpriteFrame;
  7875. /** !#en
  7876. Transition target.
  7877. When Button state changed:
  7878. If Transition type is Button.Transition.NONE, Button will do nothing
  7879. If Transition type is Button.Transition.COLOR, Button will change target's color
  7880. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
  7881. !#zh
  7882. 需要过渡的目标。
  7883. 当前按钮状态改变规则:
  7884. -如果 Transition type 选择 Button.Transition.NONE,按钮不做任何过渡。
  7885. -如果 Transition type 选择 Button.Transition.COLOR,按钮会对目标颜色进行颜色之间的过渡。
  7886. -如果 Transition type 选择 Button.Transition.Sprite,按钮会对目标 Sprite 进行 Sprite 之间的过渡。 */
  7887. target: Node;
  7888. /** !#en If Button is clicked, it will trigger event's handler
  7889. !#zh 按钮的点击事件列表。 */
  7890. clickEvents: Component.EventHandler[];
  7891. /** !#en The normal material.
  7892. !#zh 正常状态的材质。 */
  7893. normalMaterial: Material;
  7894. /** !#en The gray material.
  7895. !#zh 置灰状态的材质。 */
  7896. grayMaterial: Material;
  7897. }
  7898. /** !#zh 作为 UI 根节点,为所有子节点提供视窗四边的位置信息以供对齐,另外提供屏幕适配策略接口,方便从编辑器设置。<br>
  7899. 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。 */
  7900. export class Canvas extends Component {
  7901. /** !#en Current active canvas, the scene should only have one active canvas at the same time.
  7902. !#zh 当前激活的画布组件,场景同一时间只能有一个激活的画布。 */
  7903. static instance: Canvas;
  7904. /** !#en The desigin resolution for current scene.
  7905. !#zh 当前场景设计分辨率。 */
  7906. designResolution: Size;
  7907. /** !#en TODO
  7908. !#zh: 是否优先将设计分辨率高度撑满视图高度。 */
  7909. fitHeight: boolean;
  7910. /** !#en TODO
  7911. !#zh: 是否优先将设计分辨率宽度撑满视图宽度。 */
  7912. fitWidth: boolean;
  7913. }
  7914. /** !#en
  7915. Base class for everything attached to Node(Entity).<br/>
  7916. <br/>
  7917. NOTE: Not allowed to use construction parameters for Component's subclasses,
  7918. because Component is created by the engine.
  7919. !#zh
  7920. 所有附加到节点的基类。<br/>
  7921. <br/>
  7922. 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。 */
  7923. export class Component extends Object {
  7924. /** !#en The node this component is attached to. A component is always attached to a node.
  7925. !#zh 该组件被附加到的节点。组件总会附加到一个节点。 */
  7926. node: Node;
  7927. /** !#en The uuid for editor.
  7928. !#zh 组件的 uuid,用于编辑器。 */
  7929. uuid: string;
  7930. /** !#en indicates whether this component is enabled or not.
  7931. !#zh 表示该组件自身是否启用。 */
  7932. enabled: boolean;
  7933. /** !#en indicates whether this component is enabled and its node is also active in the hierarchy.
  7934. !#zh 表示该组件是否被启用并且所在的节点也处于激活状态。 */
  7935. enabledInHierarchy: boolean;
  7936. /** !#en Returns a value which used to indicate the onLoad get called or not.
  7937. !#zh 返回一个值用来判断 onLoad 是否被调用过,不等于 0 时调用过,等于 0 时未调用。 */
  7938. _isOnLoadCalled: number;
  7939. /**
  7940. !#en Update is called every frame, if the Component is enabled.<br/>
  7941. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7942. !#zh 如果该组件启用,则每帧调用 update。<br/>
  7943. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7944. @param dt the delta time in seconds it took to complete the last frame
  7945. */
  7946. protected update(dt: number): void;
  7947. /**
  7948. !#en LateUpdate is called every frame, if the Component is enabled.<br/>
  7949. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7950. !#zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  7951. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7952. @param dt the delta time in seconds it took to complete the last frame
  7953. */
  7954. protected lateUpdate(dt: number): void;
  7955. /**
  7956. !#en
  7957. When attaching to an active node or its node first activated.
  7958. onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  7959. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7960. !#zh
  7961. 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  7962. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7963. */
  7964. protected onLoad(): void;
  7965. /**
  7966. !#en
  7967. Called before all scripts' update if the Component is enabled the first time.
  7968. Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  7969. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7970. !#zh
  7971. 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  7972. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7973. */
  7974. protected start(): void;
  7975. /**
  7976. !#en Called when this component becomes enabled and its node is active.<br/>
  7977. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7978. !#zh 当该组件被启用,并且它的节点也激活时。<br/>
  7979. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7980. */
  7981. protected onEnable(): void;
  7982. /**
  7983. !#en Called when this component becomes disabled or its node becomes inactive.<br/>
  7984. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7985. !#zh 当该组件被禁用或节点变为无效时调用。<br/>
  7986. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7987. */
  7988. protected onDisable(): void;
  7989. /**
  7990. !#en Called when this component will be destroyed.<br/>
  7991. This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
  7992. !#zh 当该组件被销毁时调用<br/>
  7993. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7994. */
  7995. protected onDestroy(): void;
  7996. protected onFocusInEditor(): void;
  7997. protected onLostFocusInEditor(): void;
  7998. /**
  7999. !#en Called to initialize the component or node’s properties when adding the component the first time or when the Reset command is used. This function is only called in editor.
  8000. !#zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  8001. */
  8002. protected resetInEditor(): void;
  8003. /**
  8004. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  8005. !#zh 向节点添加一个组件类,你还可以通过传入脚本的名称来添加组件。
  8006. @param typeOrClassName the constructor or the class name of the component to add
  8007. @example
  8008. ```js
  8009. var sprite = node.addComponent(cc.Sprite);
  8010. var test = node.addComponent("Test");
  8011. ```
  8012. */
  8013. addComponent<T extends Component>(type: {new(): T}): T;
  8014. addComponent(className: string): any;
  8015. /**
  8016. !#en
  8017. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  8018. You can also get component in the node by passing in the name of the script.
  8019. !#zh
  8020. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  8021. 传入参数也可以是脚本的名称。
  8022. @param typeOrClassName typeOrClassName
  8023. @example
  8024. ```js
  8025. // get sprite component.
  8026. var sprite = node.getComponent(cc.Sprite);
  8027. // get custom test calss.
  8028. var test = node.getComponent("Test");
  8029. ```
  8030. */
  8031. getComponent<T extends Component>(type: {prototype: T}): T;
  8032. getComponent(className: string): any;
  8033. /**
  8034. !#en Returns all components of supplied Type in the node.
  8035. !#zh 返回节点上指定类型的所有组件。
  8036. @param typeOrClassName typeOrClassName
  8037. @example
  8038. ```js
  8039. var sprites = node.getComponents(cc.Sprite);
  8040. var tests = node.getComponents("Test");
  8041. ```
  8042. */
  8043. getComponents<T extends Component>(type: {prototype: T}): T[];
  8044. getComponents(className: string): any[];
  8045. /**
  8046. !#en Returns the component of supplied type in any of its children using depth first search.
  8047. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  8048. @param typeOrClassName typeOrClassName
  8049. @example
  8050. ```js
  8051. var sprite = node.getComponentInChildren(cc.Sprite);
  8052. var Test = node.getComponentInChildren("Test");
  8053. ```
  8054. */
  8055. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  8056. getComponentInChildren(className: string): any;
  8057. /**
  8058. !#en Returns the components of supplied type in self or any of its children using depth first search.
  8059. !#zh 递归查找自身或所有子节点中指定类型的组件
  8060. @param typeOrClassName typeOrClassName
  8061. @example
  8062. ```js
  8063. var sprites = node.getComponentsInChildren(cc.Sprite);
  8064. var tests = node.getComponentsInChildren("Test");
  8065. ```
  8066. */
  8067. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  8068. getComponentsInChildren(className: string): any[];
  8069. /**
  8070. !#en
  8071. If the component's bounding box is different from the node's, you can implement this method to supply
  8072. a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
  8073. !#zh
  8074. 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
  8075. 以便编辑器的场景视图可以正确地执行点选测试。
  8076. @param out_rect the Rect to receive the bounding box
  8077. */
  8078. _getLocalBounds(out_rect: Rect): void;
  8079. /**
  8080. !#en
  8081. onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  8082. an undo operation on this component.<br/>
  8083. <br/>
  8084. If the component contains the "internal state", short for "temporary member variables which not included<br/>
  8085. in its CCClass properties", then you may need to implement this function.<br/>
  8086. <br/>
  8087. The editor will call the getset accessors of your component to record/restore the component's state<br/>
  8088. for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  8089. this function to manually synchronize your component's "internal states" with its public properties.<br/>
  8090. Once you implement this function, all the getset accessors of your component will not be called when<br/>
  8091. the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  8092. will be recorded or restored by editor.<br/>
  8093. <br/>
  8094. Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  8095. to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  8096. properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  8097. will not be called during reset operation. Which means that only the properties with default value<br/>
  8098. will be reset by editor.
  8099. This function is only called in editor mode.
  8100. !#zh
  8101. onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  8102. <br/>
  8103. 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  8104. <br/>
  8105. 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。然而,在极端的情况下,它可能无法良好运作。<br/>
  8106. 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  8107. <br/>
  8108. 同样的,编辑可能无法在极端情况下正确地重置您的组件。如果你需要支持组件重置菜单,则需要在该方法中手工同步组件属性到“内部状态”。一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。这意味着仅仅指定了默认值的属性将被编辑器重置。
  8109. <br/>
  8110. 此方法仅在编辑器下会被调用。
  8111. */
  8112. onRestore(): void;
  8113. /**
  8114. !#en
  8115. Schedules a custom selector.<br/>
  8116. If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
  8117. !#zh
  8118. 调度一个自定义的回调函数。<br/>
  8119. 如果回调函数已调度,那么将不会重复调度它,只会更新时间间隔参数。
  8120. @param callback The callback function
  8121. @param interval Tick interval in seconds. 0 means tick every frame.
  8122. @param repeat The selector will be executed (repeat + 1) times, you can use cc.macro.REPEAT_FOREVER for tick infinitely.
  8123. @param delay The amount of time that the first tick will wait before execution. Unit: s
  8124. @example
  8125. ```js
  8126. var timeCallback = function (dt) {
  8127. cc.log("time: " + dt);
  8128. }
  8129. this.schedule(timeCallback, 1);
  8130. ```
  8131. */
  8132. schedule(callback: Function, interval?: number, repeat?: number, delay?: number): void;
  8133. /**
  8134. !#en Schedules a callback function that runs only once, with a delay of 0 or larger.
  8135. !#zh 调度一个只运行一次的回调函数,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
  8136. @param callback A function wrapped as a selector
  8137. @param delay The amount of time that the first tick will wait before execution. Unit: s
  8138. @example
  8139. ```js
  8140. var timeCallback = function (dt) {
  8141. cc.log("time: " + dt);
  8142. }
  8143. this.scheduleOnce(timeCallback, 2);
  8144. ```
  8145. */
  8146. scheduleOnce(callback: Function, delay?: number): void;
  8147. /**
  8148. !#en Unschedules a custom callback function.
  8149. !#zh 取消调度一个自定义的回调函数。
  8150. @param callback_fn A function wrapped as a selector
  8151. @example
  8152. ```js
  8153. this.unschedule(_callback);
  8154. ```
  8155. */
  8156. unschedule(callback_fn: Function): void;
  8157. /**
  8158. !#en
  8159. unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
  8160. Actions are not affected by this method.
  8161. !#zh 取消调度所有已调度的回调函数:定制的回调函数以及 `update` 回调函数。动作不受此方法影响。
  8162. @example
  8163. ```js
  8164. this.unscheduleAllCallbacks();
  8165. ```
  8166. */
  8167. unscheduleAllCallbacks(): void;
  8168. }
  8169. /** !#en The Label Component.
  8170. !#zh 文字标签组件 */
  8171. export class Label extends RenderComponent {
  8172. /** !#en Content string of label.
  8173. !#zh 标签显示的文本内容。 */
  8174. string: string;
  8175. /** !#en Horizontal Alignment of label.
  8176. !#zh 文本内容的水平对齐方式。 */
  8177. horizontalAlign: Label.HorizontalAlign;
  8178. /** !#en Vertical Alignment of label.
  8179. !#zh 文本内容的垂直对齐方式。 */
  8180. verticalAlign: Label.VerticalAlign;
  8181. /** !#en The actual rendering font size in shrink mode
  8182. !#zh SHRINK 模式下面文本实际渲染的字体大小 */
  8183. actualFontSize: number;
  8184. /** !#en Font size of label.
  8185. !#zh 文本字体大小。 */
  8186. fontSize: number;
  8187. /** !#en Font family of label, only take effect when useSystemFont property is true.
  8188. !#zh 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。 */
  8189. fontFamily: string;
  8190. /** !#en Line Height of label.
  8191. !#zh 文本行高。 */
  8192. lineHeight: number;
  8193. /** !#en Overflow of label.
  8194. !#zh 文字显示超出范围时的处理方式。 */
  8195. overflow: Label.Overflow;
  8196. /** !#en Whether auto wrap label when string width is large than label width.
  8197. !#zh 是否自动换行。 */
  8198. enableWrapText: boolean;
  8199. /** !#en The font of label.
  8200. !#zh 文本字体。 */
  8201. font: Font;
  8202. /** !#en Whether use system font name or not.
  8203. !#zh 是否使用系统字体。 */
  8204. useSystemFont: boolean;
  8205. /** !#en The spacing of the x axis between characters, only take Effect when using bitmap fonts.
  8206. !#zh 文字之间 x 轴的间距,仅在使用位图字体时生效。 */
  8207. spacingX: number;
  8208. /** !#en The cache mode of label. This mode only supports system fonts.
  8209. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  8210. cacheMode: Label.CacheMode;
  8211. /** !#en Whether enable bold.
  8212. !#zh 是否启用黑体。 */
  8213. enableBold: boolean;
  8214. /** !#en Whether enable italic.
  8215. !#zh 是否启用斜体。 */
  8216. enableItalic: boolean;
  8217. /** !#en Whether enable underline.
  8218. !#zh 是否启用下划线。 */
  8219. enableUnderline: boolean;
  8220. /** !#en The height of underline.
  8221. !#zh 下划线高度。 */
  8222. underlineHeight: number;
  8223. /**
  8224. !#zh 需要保证当前场景中没有使用CHAR缓存的Label才可以清除,否则已渲染的文字没有重新绘制会不显示
  8225. !#en It can be cleared that need to ensure there is not use the CHAR cache in the current scene. Otherwise, the rendered text will not be displayed without repainting.
  8226. */
  8227. static clearCharCache(): void;
  8228. }
  8229. /** !#en Outline effect used to change the display, only for system fonts or TTF fonts
  8230. !#zh 描边效果组件,用于字体描边,只能用于系统字体 */
  8231. export class LabelOutline extends Component {
  8232. /** !#en outline color
  8233. !#zh 改变描边的颜色 */
  8234. color: Color;
  8235. /** !#en Change the outline width
  8236. !#zh 改变描边的宽度 */
  8237. width: number;
  8238. }
  8239. /** !#en Shadow effect for Label component, only for system fonts or TTF fonts
  8240. !#zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体 */
  8241. export class LabelShadow extends Component {
  8242. /** !#en The shadow color
  8243. !#zh 阴影的颜色 */
  8244. color: Color;
  8245. /** !#en Offset between font and shadow
  8246. !#zh 字体与阴影的偏移 */
  8247. offset: Vec2;
  8248. /** !#en A non-negative float specifying the level of shadow blur
  8249. !#zh 阴影的模糊程度 */
  8250. blur: number;
  8251. }
  8252. /** !#en
  8253. The Layout is a container component, use it to arrange child elements easily.<br>
  8254. Note:<br>
  8255. 1.Scaling and rotation of child nodes are not considered.<br>
  8256. 2.After setting the Layout, the results need to be updated until the next frame,
  8257. unless you manually call {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。
  8258. !#zh
  8259. Layout 组件相当于一个容器,能自动对它的所有子节点进行统一排版。<br>
  8260. 注意:<br>
  8261. 1.不会考虑子节点的缩放和旋转。<br>
  8262. 2.对 Layout 设置后结果需要到下一帧才会更新,除非你设置完以后手动调用 {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。 */
  8263. export class Layout extends Component {
  8264. /** !#en The layout type.
  8265. !#zh 布局类型 */
  8266. type: Layout.Type;
  8267. /** !#en
  8268. The are three resize modes for Layout.
  8269. None, resize Container and resize children.
  8270. !#zh 缩放模式 */
  8271. resizeMode: Layout.ResizeMode;
  8272. /** !#en The cell size for grid layout.
  8273. !#zh 每个格子的大小,只有布局类型为 GRID 的时候才有效。 */
  8274. cellSize: Size;
  8275. /** !#en
  8276. The start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,
  8277. and then break line on demand. Choose vertical if you want to layout vertically at first .
  8278. !#zh 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。 */
  8279. startAxis: Layout.AxisDirection;
  8280. /** !#en The left padding of layout, it only effect the layout in one direction.
  8281. !#zh 容器内左边距,只会在一个布局方向上生效。 */
  8282. paddingLeft: number;
  8283. /** !#en The right padding of layout, it only effect the layout in one direction.
  8284. !#zh 容器内右边距,只会在一个布局方向上生效。 */
  8285. paddingRight: number;
  8286. /** !#en The top padding of layout, it only effect the layout in one direction.
  8287. !#zh 容器内上边距,只会在一个布局方向上生效。 */
  8288. paddingTop: number;
  8289. /** !#en The bottom padding of layout, it only effect the layout in one direction.
  8290. !#zh 容器内下边距,只会在一个布局方向上生效。 */
  8291. paddingBottom: number;
  8292. /** !#en The distance in x-axis between each element in layout.
  8293. !#zh 子节点之间的水平间距。 */
  8294. spacingX: number;
  8295. /** !#en The distance in y-axis between each element in layout.
  8296. !#zh 子节点之间的垂直间距。 */
  8297. spacingY: number;
  8298. /** !#en
  8299. Only take effect in Vertical layout mode.
  8300. This option changes the start element's positioning.
  8301. !#zh 垂直排列子节点的方向。 */
  8302. verticalDirection: Layout.VerticalDirection;
  8303. /** !#en
  8304. Only take effect in Horizontal layout mode.
  8305. This option changes the start element's positioning.
  8306. !#zh 水平排列子节点的方向。 */
  8307. horizontalDirection: Layout.HorizontalDirection;
  8308. /** !#en Adjust the layout if the children scaled.
  8309. !#zh 子节点缩放比例是否影响布局。 */
  8310. affectedByScale: boolean;
  8311. /**
  8312. !#en Perform the layout update
  8313. !#zh 立即执行更新布局
  8314. @example
  8315. ```js
  8316. layout.type = cc.Layout.HORIZONTAL;
  8317. layout.node.addChild(childNode);
  8318. cc.log(childNode.x); // not yet changed
  8319. layout.updateLayout();
  8320. cc.log(childNode.x); // changed
  8321. ```
  8322. */
  8323. updateLayout(): void;
  8324. }
  8325. /** !#en The Mask Component
  8326. !#zh 遮罩组件 */
  8327. export class Mask extends RenderComponent {
  8328. /** !#en The mask type.
  8329. !#zh 遮罩类型 */
  8330. type: Mask.Type;
  8331. /** !#en The mask image
  8332. !#zh 遮罩所需要的贴图 */
  8333. spriteFrame: SpriteFrame;
  8334. /** !#en
  8335. The alpha threshold.(Not supported Canvas Mode) <br/>
  8336. The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold. <br/>
  8337. Should be a float between 0 and 1. <br/>
  8338. This default to 0.1.
  8339. When it's set to 1, the stencil will discard all pixels, nothing will be shown.
  8340. !#zh
  8341. Alpha 阈值(不支持 Canvas 模式)<br/>
  8342. 只有当模板的像素的 alpha 大于等于 alphaThreshold 时,才会绘制内容。<br/>
  8343. 该数值 0 ~ 1 之间的浮点数,默认值为 0.1
  8344. 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容 */
  8345. alphaThreshold: number;
  8346. /** !#en Reverse mask (Not supported Canvas Mode)
  8347. !#zh 反向遮罩(不支持 Canvas 模式) */
  8348. inverted: boolean;
  8349. /** TODO: remove segments, not supported by graphics
  8350. !#en The segements for ellipse mask.
  8351. !#zh 椭圆遮罩的曲线细分数 */
  8352. segements: number;
  8353. }
  8354. /** !#en
  8355. cc.MotionStreak manages a Ribbon based on it's motion in absolute space. <br/>
  8356. You construct it with a fadeTime, minimum segment size, texture path, texture <br/>
  8357. length and color. The fadeTime controls how long it takes each vertex in <br/>
  8358. the streak to fade out, the minimum segment size it how many pixels the <br/>
  8359. streak will move before adding a new ribbon segment, and the texture <br/>
  8360. length is the how many pixels the texture is stretched across. The texture <br/>
  8361. is vertically aligned along the streak segment.
  8362. !#zh 运动轨迹,用于游戏对象的运动轨迹上实现拖尾渐隐效果。 */
  8363. export class MotionStreak extends Component implements BlendFunc {
  8364. /** !#en
  8365. !#zh 在编辑器模式下预览拖尾效果。 */
  8366. preview: boolean;
  8367. /** !#en The fade time to fade.
  8368. !#zh 拖尾的渐隐时间,以秒为单位。 */
  8369. fadeTime: number;
  8370. /** !#en The minimum segment size.
  8371. !#zh 拖尾之间最小距离。 */
  8372. minSeg: number;
  8373. /** !#en The stroke's width.
  8374. !#zh 拖尾的宽度。 */
  8375. stroke: number;
  8376. /** !#en The texture of the MotionStreak.
  8377. !#zh 拖尾的贴图。 */
  8378. texture: Texture2D;
  8379. /** !#en The color of the MotionStreak.
  8380. !#zh 拖尾的颜色 */
  8381. color: Color;
  8382. /** !#en The fast Mode.
  8383. !#zh 是否启用了快速模式。当启用快速模式,新的点会被更快地添加,但精度较低。 */
  8384. fastMode: boolean;
  8385. /**
  8386. !#en Remove all living segments of the ribbon.
  8387. !#zh 删除当前所有的拖尾片段。
  8388. @example
  8389. ```js
  8390. // Remove all living segments of the ribbon.
  8391. myMotionStreak.reset();
  8392. ```
  8393. */
  8394. reset(): void;
  8395. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  8396. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  8397. srcBlendFactor: macro.BlendFactor;
  8398. /** !#en specify the destination Blend Factor.
  8399. !#zh 指定目标的混合模式 */
  8400. dstBlendFactor: macro.BlendFactor;
  8401. }
  8402. /** !#en The PageView control
  8403. !#zh 页面视图组件 */
  8404. export class PageView extends ScrollView {
  8405. /** !#en Specify the size type of each page in PageView.
  8406. !#zh 页面视图中每个页面大小类型 */
  8407. sizeMode: PageView.SizeMode;
  8408. /** !#en The page view direction
  8409. !#zh 页面视图滚动类型 */
  8410. direction: PageView.Direction;
  8411. /** !#en
  8412. The scroll threshold value, when drag exceeds this value,
  8413. release the next page will automatically scroll, less than the restore
  8414. !#zh 滚动临界值,默认单位百分比,当拖拽超出该数值时,松开会自动滚动下一页,小于时则还原。 */
  8415. scrollThreshold: number;
  8416. /** !#en
  8417. Auto page turning velocity threshold. When users swipe the PageView quickly,
  8418. it will calculate a velocity based on the scroll distance and time,
  8419. if the calculated velocity is larger than the threshold, then it will trigger page turning.
  8420. !#zh
  8421. 快速滑动翻页临界值。
  8422. 当用户快速滑动时,会根据滑动开始和结束的距离与时间计算出一个速度值,
  8423. 该值与此临界值相比较,如果大于临界值,则进行自动翻页。 */
  8424. autoPageTurningThreshold: number;
  8425. /** !#en Change the PageTurning event timing of PageView.
  8426. !#zh 设置 PageView PageTurning 事件的发送时机。 */
  8427. pageTurningEventTiming: number;
  8428. /** !#en The Page View Indicator
  8429. !#zh 页面视图指示器组件 */
  8430. indicator: PageViewIndicator;
  8431. /** !#en The time required to turn over a page. unit: second
  8432. !#zh 每个页面翻页时所需时间。单位:秒 */
  8433. pageTurningSpeed: number;
  8434. /** !#en PageView events callback
  8435. !#zh 滚动视图的事件回调函数 */
  8436. pageEvents: Component.EventHandler[];
  8437. /**
  8438. !#en Returns current page index
  8439. !#zh 返回当前页面索引
  8440. */
  8441. getCurrentPageIndex(): number;
  8442. /**
  8443. !#en Set current page index
  8444. !#zh 设置当前页面索引
  8445. @param index index
  8446. */
  8447. setCurrentPageIndex(index: number): void;
  8448. /**
  8449. !#en Returns all pages of pageview
  8450. !#zh 返回视图中的所有页面
  8451. */
  8452. getPages(): Node[];
  8453. /**
  8454. !#en At the end of the current page view to insert a new view
  8455. !#zh 在当前页面视图的尾部插入一个新视图
  8456. @param page page
  8457. */
  8458. addPage(page: Node): void;
  8459. /**
  8460. !#en Inserts a page in the specified location
  8461. !#zh 将页面插入指定位置中
  8462. @param page page
  8463. @param index index
  8464. */
  8465. insertPage(page: Node, index: number): void;
  8466. /**
  8467. !#en Removes a page from PageView.
  8468. !#zh 移除指定页面
  8469. @param page page
  8470. */
  8471. removePage(page: Node): void;
  8472. /**
  8473. !#en Removes a page at index of PageView.
  8474. !#zh 移除指定下标的页面
  8475. @param index index
  8476. */
  8477. removePageAtIndex(index: number): void;
  8478. /**
  8479. !#en Removes all pages from PageView
  8480. !#zh 移除所有页面
  8481. */
  8482. removeAllPages(): void;
  8483. /**
  8484. !#en Scroll PageView to index.
  8485. !#zh 滚动到指定页面
  8486. @param idx index of page.
  8487. @param timeInSecond scrolling time
  8488. */
  8489. scrollToPage(idx: number, timeInSecond: number): void;
  8490. }
  8491. /** !#en
  8492. Visual indicator of progress in some operation.
  8493. Displays a bar to the user representing how far the operation has progressed.
  8494. !#zh
  8495. 进度条组件,可用于显示加载资源时的进度。 */
  8496. export class ProgressBar extends Component {
  8497. /** !#en The targeted Sprite which will be changed progressively.
  8498. !#zh 用来显示进度条比例的 Sprite 对象。 */
  8499. barSprite: Sprite;
  8500. /** !#en The progress mode, there are two modes supported now: horizontal and vertical.
  8501. !#zh 进度条的模式 */
  8502. mode: ProgressBar.Mode;
  8503. /** !#en The total width or height of the bar sprite.
  8504. !#zh 进度条实际的总长度 */
  8505. totalLength: number;
  8506. /** !#en The current progress of the bar sprite. The valid value is between 0-1.
  8507. !#zh 当前进度值,该数值的区间是 0-1 之间。 */
  8508. progress: number;
  8509. /** !#en Whether reverse the progress direction of the bar sprite.
  8510. !#zh 进度条是否进行反方向变化。 */
  8511. reverse: boolean;
  8512. }
  8513. /** !#en The Page View Indicator Component
  8514. !#zh 页面视图每页标记组件 */
  8515. export class PageViewIndicator extends Component {
  8516. /** !#en The spriteFrame for each element.
  8517. !#zh 每个页面标记显示的图片 */
  8518. spriteFrame: SpriteFrame;
  8519. /** !#en The location direction of PageViewIndicator.
  8520. !#zh 页面标记摆放方向 */
  8521. direction: PageViewIndicator.Direction;
  8522. /** !#en The cellSize for each element.
  8523. !#zh 每个页面标记的大小 */
  8524. cellSize: Size;
  8525. /** !#en The distance between each element.
  8526. !#zh 每个页面标记之间的边距 */
  8527. spacing: number;
  8528. /**
  8529. !#en Set Page View
  8530. !#zh 设置页面视图
  8531. @param target target
  8532. */
  8533. setPageView(target: PageView): void;
  8534. }
  8535. /** !#en
  8536. Base class for components which supports rendering features.
  8537. !#zh
  8538. 所有支持渲染的组件的基类 */
  8539. export class RenderComponent extends Component {
  8540. /** !#en The materials used by this render component.
  8541. !#zh 渲染组件使用的材质。 */
  8542. sharedMaterials: Material[];
  8543. /**
  8544. !#en Get the material by index.
  8545. !#zh 根据指定索引获取材质
  8546. @param index index
  8547. */
  8548. getMaterial(index: number): MaterialVariant;
  8549. /**
  8550. !#en Gets all the materials.
  8551. !#zh 获取所有材质。
  8552. */
  8553. getMaterials(): MaterialVariant[];
  8554. /**
  8555. !#en Set the material by index.
  8556. !#zh 根据指定索引设置材质
  8557. @param index index
  8558. @param material material
  8559. */
  8560. setMaterial(index: number, material: Material): Material;
  8561. }
  8562. /** !#en The RichText Component.
  8563. !#zh 富文本组件 */
  8564. export class RichText extends Component {
  8565. /** !#en Content string of RichText.
  8566. !#zh 富文本显示的文本内容。 */
  8567. string: string;
  8568. /** !#en Horizontal Alignment of each line in RichText.
  8569. !#zh 文本内容的水平对齐方式。 */
  8570. horizontalAlign: macro.TextAlignment;
  8571. /** !#en Font size of RichText.
  8572. !#zh 富文本字体大小。 */
  8573. fontSize: number;
  8574. /** !#en Custom System font of RichText
  8575. !#zh 富文本定制系统字体 */
  8576. fontFamily: string;
  8577. /** !#en Custom TTF font of RichText
  8578. !#zh 富文本定制字体 */
  8579. font: TTFFont;
  8580. /** !#en Whether use system font name or not.
  8581. !#zh 是否使用系统字体。 */
  8582. useSystemFont: boolean;
  8583. /** !#en The cache mode of label. This mode only supports system fonts.
  8584. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  8585. cacheMode: Label.CacheMode;
  8586. /** !#en The maximize width of the RichText
  8587. !#zh 富文本的最大宽度 */
  8588. maxWidth: number;
  8589. /** !#en Line Height of RichText.
  8590. !#zh 富文本行高。 */
  8591. lineHeight: number;
  8592. /** !#en The image atlas for the img tag. For each src value in the img tag, there should be a valid spriteFrame in the image atlas.
  8593. !#zh 对于 img 标签里面的 src 属性名称,都需要在 imageAtlas 里面找到一个有效的 spriteFrame,否则 img tag 会判定为无效。 */
  8594. imageAtlas: SpriteAtlas;
  8595. /** !#en
  8596. Once checked, the RichText will block all input events (mouse and touch) within
  8597. the bounding box of the node, preventing the input from penetrating into the underlying node.
  8598. !#zh
  8599. 选中此选项后,RichText 将阻止节点边界框中的所有输入事件(鼠标和触摸),从而防止输入事件穿透到底层节点。 */
  8600. handleTouchEvent: boolean;
  8601. }
  8602. /** !#en
  8603. This component is used to adjust the layout of current node to respect the safe area of a notched mobile device such as the iPhone X.
  8604. It is typically used for the top node of the UI interaction area. For specific usage, refer to the official [example-cases/02_ui/16_safeArea/SafeArea.fire](https://github.com/cocos-creator/example-cases).
  8605. The concept of safe area is to give you a fixed inner rectangle in which you can safely display content that will be drawn on screen.
  8606. You are strongly discouraged from providing controls outside of this area. But your screen background could embellish edges.
  8607. This component internally uses the API `cc.sys.getSafeAreaRect();` to obtain the safe area of the current iOS or Android device,
  8608. and implements the adaptation by using the Widget component and set anchor.
  8609. !#zh
  8610. 该组件会将所在节点的布局适配到 iPhone X 等异形屏手机的安全区域内,通常用于 UI 交互区域的顶层节点,具体用法可参考官方范例 [example-cases/02_ui/16_safeArea/SafeArea.fire](https://github.com/cocos-creator/example-cases)。
  8611. 该组件内部通过 API `cc.sys.getSafeAreaRect();` 获取到当前 iOS 或 Android 设备的安全区域,并通过 Widget 组件实现适配。 */
  8612. export class SafeArea extends Component {
  8613. /**
  8614. !#en Adapt to safe area
  8615. !#zh 立即适配安全区域
  8616. @example
  8617. ```js
  8618. let safeArea = this.node.addComponent(cc.SafeArea);
  8619. safeArea.updateArea();
  8620. ```
  8621. */
  8622. updateArea(): void;
  8623. }
  8624. /** !#en
  8625. The Scrollbar control allows the user to scroll an image or other view that is too large to see completely
  8626. !#zh 滚动条组件 */
  8627. export class Scrollbar extends Component {
  8628. /** !#en The "handle" part of the scrollbar.
  8629. !#zh 作为当前滚动区域位置显示的滑块 Sprite。 */
  8630. handle: Sprite;
  8631. /** !#en The direction of scrollbar.
  8632. !#zh ScrollBar 的滚动方向。 */
  8633. direction: Scrollbar.Direction;
  8634. /** !#en Whether enable auto hide or not.
  8635. !#zh 是否在没有滚动动作时自动隐藏 ScrollBar。 */
  8636. enableAutoHide: boolean;
  8637. /** !#en
  8638. The time to hide scrollbar when scroll finished.
  8639. Note: This value is only useful when enableAutoHide is true.
  8640. !#zh
  8641. 没有滚动动作后经过多久会自动隐藏。
  8642. 注意:只要当 “enableAutoHide” 为 true 时,才有效。 */
  8643. autoHideTime: number;
  8644. }
  8645. /** !#en
  8646. Layout container for a view hierarchy that can be scrolled by the user,
  8647. allowing it to be larger than the physical display.
  8648. !#zh
  8649. 滚动视图组件 */
  8650. export class ScrollView extends Component {
  8651. /** !#en This is a reference to the UI element to be scrolled.
  8652. !#zh 可滚动展示内容的节点。 */
  8653. content: Node;
  8654. /** !#en Enable horizontal scroll.
  8655. !#zh 是否开启水平滚动。 */
  8656. horizontal: boolean;
  8657. /** !#en Enable vertical scroll.
  8658. !#zh 是否开启垂直滚动。 */
  8659. vertical: boolean;
  8660. /** !#en When inertia is set, the content will continue to move when touch ended.
  8661. !#zh 是否开启滚动惯性。 */
  8662. inertia: boolean;
  8663. /** !#en
  8664. It determines how quickly the content stop moving. A value of 1 will stop the movement immediately.
  8665. A value of 0 will never stop the movement until it reaches to the boundary of scrollview.
  8666. !#zh
  8667. 开启惯性后,在用户停止触摸后滚动多快停止,0表示永不停止,1表示立刻停止。 */
  8668. brake: number;
  8669. /** !#en When elastic is set, the content will be bounce back when move out of boundary.
  8670. !#zh 是否允许滚动内容超过边界,并在停止触摸后回弹。 */
  8671. elastic: boolean;
  8672. /** !#en The elapse time of bouncing back. A value of 0 will bounce back immediately.
  8673. !#zh 回弹持续的时间,0 表示将立即反弹。 */
  8674. bounceDuration: number;
  8675. /** !#en The horizontal scrollbar reference.
  8676. !#zh 水平滚动的 ScrollBar。 */
  8677. horizontalScrollBar: Scrollbar;
  8678. /** !#en The vertical scrollbar reference.
  8679. !#zh 垂直滚动的 ScrollBar。 */
  8680. verticalScrollBar: Scrollbar;
  8681. /** !#en Scrollview events callback
  8682. !#zh 滚动视图的事件回调函数 */
  8683. scrollEvents: Component.EventHandler[];
  8684. /** !#en If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  8685. It's set to true by default.
  8686. !#zh 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。
  8687. 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。 */
  8688. cancelInnerEvents: boolean;
  8689. /**
  8690. !#en Scroll the content to the bottom boundary of ScrollView.
  8691. !#zh 视图内容将在规定时间内滚动到视图底部。
  8692. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8693. the content will jump to the bottom boundary immediately.
  8694. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8695. @example
  8696. ```js
  8697. // Scroll to the bottom of the view.
  8698. scrollView.scrollToBottom(0.1);
  8699. ```
  8700. */
  8701. scrollToBottom(timeInSecond?: number, attenuated?: boolean): void;
  8702. /**
  8703. !#en Scroll the content to the top boundary of ScrollView.
  8704. !#zh 视图内容将在规定时间内滚动到视图顶部。
  8705. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8706. the content will jump to the top boundary immediately.
  8707. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8708. @example
  8709. ```js
  8710. // Scroll to the top of the view.
  8711. scrollView.scrollToTop(0.1);
  8712. ```
  8713. */
  8714. scrollToTop(timeInSecond?: number, attenuated?: boolean): void;
  8715. /**
  8716. !#en Scroll the content to the left boundary of ScrollView.
  8717. !#zh 视图内容将在规定时间内滚动到视图左边。
  8718. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8719. the content will jump to the left boundary immediately.
  8720. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8721. @example
  8722. ```js
  8723. // Scroll to the left of the view.
  8724. scrollView.scrollToLeft(0.1);
  8725. ```
  8726. */
  8727. scrollToLeft(timeInSecond?: number, attenuated?: boolean): void;
  8728. /**
  8729. !#en Scroll the content to the right boundary of ScrollView.
  8730. !#zh 视图内容将在规定时间内滚动到视图右边。
  8731. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8732. the content will jump to the right boundary immediately.
  8733. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8734. @example
  8735. ```js
  8736. // Scroll to the right of the view.
  8737. scrollView.scrollToRight(0.1);
  8738. ```
  8739. */
  8740. scrollToRight(timeInSecond?: number, attenuated?: boolean): void;
  8741. /**
  8742. !#en Scroll the content to the top left boundary of ScrollView.
  8743. !#zh 视图内容将在规定时间内滚动到视图左上角。
  8744. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8745. the content will jump to the top left boundary immediately.
  8746. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8747. @example
  8748. ```js
  8749. // Scroll to the upper left corner of the view.
  8750. scrollView.scrollToTopLeft(0.1);
  8751. ```
  8752. */
  8753. scrollToTopLeft(timeInSecond?: number, attenuated?: boolean): void;
  8754. /**
  8755. !#en Scroll the content to the top right boundary of ScrollView.
  8756. !#zh 视图内容将在规定时间内滚动到视图右上角。
  8757. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8758. the content will jump to the top right boundary immediately.
  8759. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8760. @example
  8761. ```js
  8762. // Scroll to the top right corner of the view.
  8763. scrollView.scrollToTopRight(0.1);
  8764. ```
  8765. */
  8766. scrollToTopRight(timeInSecond?: number, attenuated?: boolean): void;
  8767. /**
  8768. !#en Scroll the content to the bottom left boundary of ScrollView.
  8769. !#zh 视图内容将在规定时间内滚动到视图左下角。
  8770. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8771. the content will jump to the bottom left boundary immediately.
  8772. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8773. @example
  8774. ```js
  8775. // Scroll to the lower left corner of the view.
  8776. scrollView.scrollToBottomLeft(0.1);
  8777. ```
  8778. */
  8779. scrollToBottomLeft(timeInSecond?: number, attenuated?: boolean): void;
  8780. /**
  8781. !#en Scroll the content to the bottom right boundary of ScrollView.
  8782. !#zh 视图内容将在规定时间内滚动到视图右下角。
  8783. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8784. the content will jump to the bottom right boundary immediately.
  8785. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8786. @example
  8787. ```js
  8788. // Scroll to the lower right corner of the view.
  8789. scrollView.scrollToBottomRight(0.1);
  8790. ```
  8791. */
  8792. scrollToBottomRight(timeInSecond?: number, attenuated?: boolean): void;
  8793. /**
  8794. !#en Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted, then it will jump to the
  8795. specific offset immediately.
  8796. !#zh 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond参数不传,则立即滚动到指定偏移位置。
  8797. @param offset A Vec2, the value of which each axis between 0 and maxScrollOffset
  8798. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8799. the content will jump to the specific offset of ScrollView immediately.
  8800. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8801. @example
  8802. ```js
  8803. // Scroll to middle position in 0.1 second in x-axis
  8804. let maxScrollOffset = this.getMaxScrollOffset();
  8805. scrollView.scrollToOffset(cc.v2(maxScrollOffset.x / 2, 0), 0.1);
  8806. ```
  8807. */
  8808. scrollToOffset(offset: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  8809. /**
  8810. !#en Get the positive offset value corresponds to the content's top left boundary.
  8811. !#zh 获取滚动视图相对于左上角原点的当前滚动偏移
  8812. */
  8813. getScrollOffset(): Vec2;
  8814. /**
  8815. !#en Get the maximize available scroll offset
  8816. !#zh 获取滚动视图最大可以滚动的偏移量
  8817. */
  8818. getMaxScrollOffset(): Vec2;
  8819. /**
  8820. !#en Scroll the content to the horizontal percent position of ScrollView.
  8821. !#zh 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。
  8822. @param percent A value between 0 and 1.
  8823. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8824. the content will jump to the horizontal percent position of ScrollView immediately.
  8825. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8826. @example
  8827. ```js
  8828. // Scroll to middle position.
  8829. scrollView.scrollToBottomRight(0.5, 0.1);
  8830. ```
  8831. */
  8832. scrollToPercentHorizontal(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  8833. /**
  8834. !#en Scroll the content to the percent position of ScrollView in any direction.
  8835. !#zh 视图内容在规定时间内进行垂直方向和水平方向的滚动,并且滚动到指定百分比位置上。
  8836. @param anchor A point which will be clamp between cc.v2(0,0) and cc.v2(1,1).
  8837. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8838. the content will jump to the percent position of ScrollView immediately.
  8839. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8840. @example
  8841. ```js
  8842. // Vertical scroll to the bottom of the view.
  8843. scrollView.scrollTo(cc.v2(0, 1), 0.1);
  8844. // Horizontal scroll to view right.
  8845. scrollView.scrollTo(cc.v2(1, 0), 0.1);
  8846. ```
  8847. */
  8848. scrollTo(anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  8849. /**
  8850. !#en Scroll the content to the vertical percent position of ScrollView.
  8851. !#zh 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。
  8852. @param percent A value between 0 and 1.
  8853. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8854. the content will jump to the vertical percent position of ScrollView immediately.
  8855. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8856. // Scroll to middle position.
  8857. scrollView.scrollToPercentVertical(0.5, 0.1);
  8858. */
  8859. scrollToPercentVertical(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  8860. /**
  8861. !#en Stop auto scroll immediately
  8862. !#zh 停止自动滚动, 调用此 API 可以让 Scrollview 立即停止滚动
  8863. */
  8864. stopAutoScroll(): void;
  8865. /**
  8866. !#en Modify the content position.
  8867. !#zh 设置当前视图内容的坐标点。
  8868. @param position The position in content's parent space.
  8869. */
  8870. setContentPosition(position: Vec2): void;
  8871. /**
  8872. !#en Query the content's position in its parent space.
  8873. !#zh 获取当前视图内容的坐标点。
  8874. */
  8875. getContentPosition(): Vec2;
  8876. /**
  8877. !#en Query whether the user is currently dragging the ScrollView to scroll it
  8878. !#zh 用户是否在拖拽当前滚动视图
  8879. */
  8880. isScrolling(): boolean;
  8881. /**
  8882. !#en Query whether the ScrollView is currently scrolling because of a bounceback or inertia slowdown.
  8883. !#zh 当前滚动视图是否在惯性滚动
  8884. */
  8885. isAutoScrolling(): boolean;
  8886. }
  8887. /** !#en The Slider Control
  8888. !#zh 滑动器组件 */
  8889. export class Slider extends Component {
  8890. /** !#en The "handle" part of the slider
  8891. !#zh 滑动器滑块按钮部件 */
  8892. handle: Button;
  8893. /** !#en The slider direction
  8894. !#zh 滑动器方向 */
  8895. direction: Slider.Direction;
  8896. /** !#en The current progress of the slider. The valid value is between 0-1
  8897. !#zh 当前进度值,该数值的区间是 0-1 之间 */
  8898. progress: number;
  8899. /** !#en The slider slide events' callback array
  8900. !#zh 滑动器组件滑动事件回调函数数组 */
  8901. slideEvents: Component.EventHandler[];
  8902. }
  8903. /** !#en Renders a sprite in the scene.
  8904. !#zh 该组件用于在场景中渲染精灵。 */
  8905. export class Sprite extends RenderComponent implements BlendFunc {
  8906. /** !#en The sprite frame of the sprite.
  8907. !#zh 精灵的精灵帧 */
  8908. spriteFrame: SpriteFrame;
  8909. /** !#en The sprite render type.
  8910. !#zh 精灵渲染类型 */
  8911. type: Sprite.Type;
  8912. /** !#en
  8913. The fill type, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8914. !#zh
  8915. 精灵填充类型,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8916. fillType: Sprite.FillType;
  8917. /** !#en
  8918. The fill Center, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8919. !#zh
  8920. 填充中心点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8921. fillCenter: Vec2;
  8922. /** !#en
  8923. The fill Start, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8924. !#zh
  8925. 填充起始点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8926. fillStart: number;
  8927. /** !#en
  8928. The fill Range, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8929. !#zh
  8930. 填充范围,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8931. fillRange: number;
  8932. /** !#en specify the frame is trimmed or not.
  8933. !#zh 是否使用裁剪模式 */
  8934. trim: boolean;
  8935. /** !#en specify the size tracing mode.
  8936. !#zh 精灵尺寸调整模式 */
  8937. sizeMode: Sprite.SizeMode;
  8938. /**
  8939. Change the state of sprite.
  8940. @param state NORMAL or GRAY State.
  8941. */
  8942. setState(state: Sprite.State): void;
  8943. /**
  8944. Gets the current state.
  8945. */
  8946. getState(): Sprite.State;
  8947. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  8948. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  8949. srcBlendFactor: macro.BlendFactor;
  8950. /** !#en specify the destination Blend Factor.
  8951. !#zh 指定目标的混合模式 */
  8952. dstBlendFactor: macro.BlendFactor;
  8953. }
  8954. /** !#en The toggle component is a CheckBox, when it used together with a ToggleGroup, it
  8955. could be treated as a RadioButton.
  8956. !#zh Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。 */
  8957. export class Toggle extends Button implements GraySpriteState {
  8958. /** !#en When this value is true, the check mark component will be enabled, otherwise
  8959. the check mark component will be disabled.
  8960. !#zh 如果这个设置为 true,则 check mark 组件会处于 enabled 状态,否则处于 disabled 状态。 */
  8961. isChecked: boolean;
  8962. /** !#en The toggle group which the toggle belongs to, when it is null, the toggle is a CheckBox.
  8963. Otherwise, the toggle is a RadioButton.
  8964. !#zh Toggle 所属的 ToggleGroup,这个属性是可选的。如果这个属性为 null,则 Toggle 是一个 CheckBox,
  8965. 否则,Toggle 是一个 RadioButton。 */
  8966. toggleGroup: ToggleGroup;
  8967. /** !#en The image used for the checkmark.
  8968. !#zh Toggle 处于选中状态时显示的图片 */
  8969. checkMark: Sprite;
  8970. /** !#en If Toggle is clicked, it will trigger event's handler
  8971. !#zh Toggle 按钮的点击事件列表。 */
  8972. checkEvents: Component.EventHandler[];
  8973. /**
  8974. !#en Make the toggle button checked.
  8975. !#zh 使 toggle 按钮处于选中状态
  8976. */
  8977. check(): void;
  8978. /**
  8979. !#en Make the toggle button unchecked.
  8980. !#zh 使 toggle 按钮处于未选中状态
  8981. */
  8982. uncheck(): void;
  8983. /** !#en The normal material.
  8984. !#zh 正常状态的材质。 */
  8985. normalMaterial: Material;
  8986. /** !#en The gray material.
  8987. !#zh 置灰状态的材质。 */
  8988. grayMaterial: Material;
  8989. }
  8990. /** !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles. <br/>
  8991. Toggles that belong to the same group could only have one of them to be switched on at a time.<br/>
  8992. Note: All the first layer child node containing the toggle component will auto be added to the container
  8993. !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。<br/>
  8994. 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。<br/>
  8995. 注意:所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中 */
  8996. export class ToggleContainer extends Component {
  8997. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  8998. If it is false, it will make sure there is always only one toggle could be switched on
  8999. and the already switched on toggle can't be switched off.
  9000. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  9001. allowSwitchOff: boolean;
  9002. /** !#en If Toggle is clicked, it will trigger event's handler
  9003. !#zh Toggle 按钮的点击事件列表。 */
  9004. checkEvents: Component.EventHandler[];
  9005. /** !#en Read only property, return the toggle items array reference managed by ToggleContainer.
  9006. !#zh 只读属性,返回 ToggleContainer 管理的 toggle 数组引用 */
  9007. toggleItems: Toggle[];
  9008. }
  9009. /** !#en ToggleGroup is not a visiable UI component but a way to modify the behavior of a set of Toggles.
  9010. Toggles that belong to the same group could only have one of them to be switched on at a time.
  9011. !#zh ToggleGroup 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。当一组 Toggle 属于同一个 ToggleGroup 的时候,
  9012. 任何时候只能有一个 Toggle 处于选中状态。 */
  9013. export class ToggleGroup extends Component {
  9014. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  9015. If it is false, it will make sure there is always only one toggle could be switched on
  9016. and the already switched on toggle can't be switched off.
  9017. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  9018. allowSwitchOff: boolean;
  9019. /** !#en Read only property, return the toggle items array reference managed by toggleGroup.
  9020. !#zh 只读属性,返回 toggleGroup 管理的 toggle 数组引用 */
  9021. toggleItems: any[];
  9022. }
  9023. /** !#en
  9024. Handling touch events in a ViewGroup takes special care,
  9025. because it's common for a ViewGroup to have children that are targets for different touch events than the ViewGroup itself.
  9026. To make sure that each view correctly receives the touch events intended for it,
  9027. ViewGroup should register capture phase event and handle the event propagation properly.
  9028. Please refer to Scrollview for more information.
  9029. !#zh
  9030. ViewGroup的事件处理比较特殊,因为 ViewGroup 里面的子节点关心的事件跟 ViewGroup 本身可能不一样。
  9031. 为了让子节点能够正确地处理事件,ViewGroup 需要注册 capture 阶段的事件,并且合理地处理 ViewGroup 之间的事件传递。
  9032. 请参考 ScrollView 的实现来获取更多信息。 */
  9033. export class ViewGroup extends Component {
  9034. }
  9035. /** !#en
  9036. Stores and manipulate the anchoring based on its parent.
  9037. Widget are used for GUI but can also be used for other things.
  9038. Widget will adjust current node's position and size automatically, but the results after adjustment can not be obtained until the next frame unless you call {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}} manually.
  9039. !#zh
  9040. Widget 组件,用于设置和适配其相对于父节点的边距,Widget 通常被用于 UI 界面,也可以用于其他地方。
  9041. Widget 会自动调整当前节点的坐标和宽高,不过目前调整后的结果要到下一帧才能在脚本里获取到,除非你先手动调用 {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}}。 */
  9042. export class Widget extends Component {
  9043. /** !#en Specifies an alignment target that can only be one of the parent nodes of the current node.
  9044. The default value is null, and when null, indicates the current parent.
  9045. !#zh 指定一个对齐目标,只能是当前节点的其中一个父节点,默认为空,为空时表示当前父节点。 */
  9046. target: Node;
  9047. /** !#en Whether to align the top.
  9048. !#zh 是否对齐上边。 */
  9049. isAlignTop: boolean;
  9050. /** !#en
  9051. Vertically aligns the midpoint, This will open the other vertical alignment options cancel.
  9052. !#zh
  9053. 是否垂直方向对齐中点,开启此项会将垂直方向其他对齐选项取消。 */
  9054. isAlignVerticalCenter: boolean;
  9055. /** !#en Whether to align the bottom.
  9056. !#zh 是否对齐下边。 */
  9057. isAlignBottom: boolean;
  9058. /** !#en Whether to align the left.
  9059. !#zh 是否对齐左边 */
  9060. isAlignLeft: boolean;
  9061. /** !#en
  9062. Horizontal aligns the midpoint. This will open the other horizontal alignment options canceled.
  9063. !#zh
  9064. 是否水平方向对齐中点,开启此选项会将水平方向其他对齐选项取消。 */
  9065. isAlignHorizontalCenter: boolean;
  9066. /** !#en Whether to align the right.
  9067. !#zh 是否对齐右边。 */
  9068. isAlignRight: boolean;
  9069. /** !#en
  9070. Whether the stretched horizontally, when enable the left and right alignment will be stretched horizontally,
  9071. the width setting is invalid (read only).
  9072. !#zh
  9073. 当前是否水平拉伸。当同时启用左右对齐时,节点将会被水平拉伸,此时节点的宽度只读。 */
  9074. isStretchWidth: boolean;
  9075. /** !#en
  9076. Whether the stretched vertically, when enable the left and right alignment will be stretched vertically,
  9077. then height setting is invalid (read only)
  9078. !#zh
  9079. 当前是否垂直拉伸。当同时启用上下对齐时,节点将会被垂直拉伸,此时节点的高度只读。 */
  9080. isStretchHeight: boolean;
  9081. /** !#en
  9082. The margins between the top of this node and the top of parent node,
  9083. the value can be negative, Only available in 'isAlignTop' open.
  9084. !#zh
  9085. 本节点顶边和父节点顶边的距离,可填写负值,只有在 isAlignTop 开启时才有作用。 */
  9086. top: number;
  9087. /** !#en
  9088. The margins between the bottom of this node and the bottom of parent node,
  9089. the value can be negative, Only available in 'isAlignBottom' open.
  9090. !#zh
  9091. 本节点底边和父节点底边的距离,可填写负值,只有在 isAlignBottom 开启时才有作用。 */
  9092. bottom: number;
  9093. /** !#en
  9094. The margins between the left of this node and the left of parent node,
  9095. the value can be negative, Only available in 'isAlignLeft' open.
  9096. !#zh
  9097. 本节点左边和父节点左边的距离,可填写负值,只有在 isAlignLeft 开启时才有作用。 */
  9098. left: number;
  9099. /** !#en
  9100. The margins between the right of this node and the right of parent node,
  9101. the value can be negative, Only available in 'isAlignRight' open.
  9102. !#zh
  9103. 本节点右边和父节点右边的距离,可填写负值,只有在 isAlignRight 开启时才有作用。 */
  9104. right: number;
  9105. /** !#en
  9106. Horizontal aligns the midpoint offset value,
  9107. the value can be negative, Only available in 'isAlignHorizontalCenter' open.
  9108. !#zh 水平居中的偏移值,可填写负值,只有在 isAlignHorizontalCenter 开启时才有作用。 */
  9109. horizontalCenter: number;
  9110. /** !#en
  9111. Vertical aligns the midpoint offset value,
  9112. the value can be negative, Only available in 'isAlignVerticalCenter' open.
  9113. !#zh 垂直居中的偏移值,可填写负值,只有在 isAlignVerticalCenter 开启时才有作用。 */
  9114. verticalCenter: number;
  9115. /** !#en If true, horizontalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  9116. !#zh 如果为 true,"horizontalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  9117. isAbsoluteHorizontalCenter: boolean;
  9118. /** !#en If true, verticalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  9119. !#zh 如果为 true,"verticalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  9120. isAbsoluteVerticalCenter: boolean;
  9121. /** !#en
  9122. If true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  9123. !#zh
  9124. 如果为 true,"top" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  9125. isAbsoluteTop: boolean;
  9126. /** !#en
  9127. If true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  9128. !#zh
  9129. 如果为 true,"bottom" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  9130. isAbsoluteBottom: boolean;
  9131. /** !#en
  9132. If true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  9133. !#zh
  9134. 如果为 true,"left" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  9135. isAbsoluteLeft: boolean;
  9136. /** !#en
  9137. If true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  9138. !#zh
  9139. 如果为 true,"right" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  9140. isAbsoluteRight: boolean;
  9141. /** !#en Specifies the alignment mode of the Widget, which determines when the widget should refresh.
  9142. !#zh 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。 */
  9143. alignMode: Widget.AlignMode;
  9144. /**
  9145. !#en
  9146. Immediately perform the widget alignment. You need to manually call this method only if
  9147. you need to get the latest results after the alignment before the end of current frame.
  9148. !#zh
  9149. 立刻执行 widget 对齐操作。这个接口一般不需要手工调用。
  9150. 只有当你需要在当前帧结束前获得 widget 对齐后的最新结果时才需要手动调用这个方法。
  9151. @example
  9152. ```js
  9153. widget.top = 10; // change top margin
  9154. cc.log(widget.node.y); // not yet changed
  9155. widget.updateAlignment();
  9156. cc.log(widget.node.y); // changed
  9157. ```
  9158. */
  9159. updateAlignment(): void;
  9160. /** !#en
  9161. When turned on, it will only be aligned once at the end of the onEnable frame,
  9162. then immediately disables the current component.
  9163. This will allow the script or animation to continue controlling the current node.
  9164. Note: It will still be aligned at the frame when onEnable is called.
  9165. !#zh
  9166. 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。
  9167. 这样便于脚本或动画继续控制当前节点。
  9168. 注意:onEnable 时所在的那一帧仍然会进行对齐。 */
  9169. isAlignOnce: boolean;
  9170. }
  9171. /** !#en SubContextView is a view component which controls open data context viewport in minigame platform.<br/>
  9172. The component's node size decide the viewport of the sub context content in main context,
  9173. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  9174. This component provides multiple important features:<br/>
  9175. 1. Sub context could use its own resolution size and policy.<br/>
  9176. 2. Sub context could be minized to smallest size it needed.<br/>
  9177. 3. Resolution of sub context content could be increased.<br/>
  9178. 4. User touch input is transformed to the correct viewport.<br/>
  9179. 5. Texture update is handled by this component. User don't need to worry.<br/>
  9180. One important thing to be noted, whenever the node's bounding box change,
  9181. !#zh SubContextView 可以用来控制小游戏平台开放数据域在主域中的视窗的位置。<br/>
  9182. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  9183. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  9184. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  9185. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  9186. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  9187. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  9188. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/> */
  9189. export class SubContextView extends Component {
  9190. /**
  9191. !#en Reset open data context size and viewport
  9192. !#zh 重置开放数据域的尺寸和视窗
  9193. */
  9194. reset(): void;
  9195. /**
  9196. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  9197. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  9198. */
  9199. updateSubContextViewport(): void;
  9200. }
  9201. /** !#en WXSubContextView is deprecated since v2.4.1, please use SubContextView instead.
  9202. !#zh 自 v2.4.1 起,WXSubContextView 已经废弃,请使用 SubContextView */
  9203. export class WXSubContextView extends Component {
  9204. }
  9205. /** !#en SwanSubContextView is deprecated since v2.4.1, please use SubContextView instead.
  9206. !#zh 自 v2.4.1 起,SwanSubContextView 已经废弃,请使用 SubContextView */
  9207. export class SwanSubContextView extends Component {
  9208. }
  9209. /** undefined */
  9210. export class Graphics extends RenderComponent {
  9211. /** !#en
  9212. Current line width.
  9213. !#zh
  9214. 当前线条宽度 */
  9215. lineWidth: number;
  9216. /** !#en
  9217. lineJoin determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together.
  9218. !#zh
  9219. lineJoin 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性。 */
  9220. lineJoin: Graphics.LineJoin;
  9221. /** !#en
  9222. lineCap determines how the end points of every line are drawn.
  9223. !#zh
  9224. lineCap 指定如何绘制每一条线段末端。 */
  9225. lineCap: Graphics.LineCap;
  9226. /** !#en
  9227. stroke color
  9228. !#zh
  9229. 线段颜色 */
  9230. strokeColor: Color;
  9231. /** !#en
  9232. fill color
  9233. !#zh
  9234. 填充颜色 */
  9235. fillColor: Color;
  9236. /** !#en
  9237. Sets the miter limit ratio
  9238. !#zh
  9239. 设置斜接面限制比例 */
  9240. miterLimit: number;
  9241. /**
  9242. !#en Move path start point to (x,y).
  9243. !#zh 移动路径起点到坐标(x, y)
  9244. @param x The x axis of the coordinate for the end point.
  9245. @param y The y axis of the coordinate for the end point.
  9246. */
  9247. moveTo(x?: number, y?: number): void;
  9248. /**
  9249. !#en Adds a straight line to the path
  9250. !#zh 绘制直线路径
  9251. @param x The x axis of the coordinate for the end point.
  9252. @param y The y axis of the coordinate for the end point.
  9253. */
  9254. lineTo(x?: number, y?: number): void;
  9255. /**
  9256. !#en Adds a cubic Bézier curve to the path
  9257. !#zh 绘制三次贝赛尔曲线路径
  9258. @param c1x The x axis of the coordinate for the first control point.
  9259. @param c1y The y axis of the coordinate for first control point.
  9260. @param c2x The x axis of the coordinate for the second control point.
  9261. @param c2y The y axis of the coordinate for the second control point.
  9262. @param x The x axis of the coordinate for the end point.
  9263. @param y The y axis of the coordinate for the end point.
  9264. */
  9265. bezierCurveTo(c1x?: number, c1y?: number, c2x?: number, c2y?: number, x?: number, y?: number): void;
  9266. /**
  9267. !#en Adds a quadratic Bézier curve to the path
  9268. !#zh 绘制二次贝赛尔曲线路径
  9269. @param cx The x axis of the coordinate for the control point.
  9270. @param cy The y axis of the coordinate for the control point.
  9271. @param x The x axis of the coordinate for the end point.
  9272. @param y The y axis of the coordinate for the end point.
  9273. */
  9274. quadraticCurveTo(cx?: number, cy?: number, x?: number, y?: number): void;
  9275. /**
  9276. !#en Adds an arc to the path which is centered at (cx, cy) position with radius r starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to false).
  9277. !#zh 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  9278. @param cx The x axis of the coordinate for the center point.
  9279. @param cy The y axis of the coordinate for the center point.
  9280. @param r The arc's radius.
  9281. @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
  9282. @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
  9283. @param counterclockwise An optional Boolean which, if true, causes the arc to be drawn counter-clockwise between the two angles. By default it is drawn clockwise.
  9284. */
  9285. arc(cx?: number, cy?: number, r?: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
  9286. /**
  9287. !#en Adds an ellipse to the path.
  9288. !#zh 绘制椭圆路径。
  9289. @param cx The x axis of the coordinate for the center point.
  9290. @param cy The y axis of the coordinate for the center point.
  9291. @param rx The ellipse's x-axis radius.
  9292. @param ry The ellipse's y-axis radius.
  9293. */
  9294. ellipse(cx?: number, cy?: number, rx?: number, ry?: number): void;
  9295. /**
  9296. !#en Adds an circle to the path.
  9297. !#zh 绘制圆形路径。
  9298. @param cx The x axis of the coordinate for the center point.
  9299. @param cy The y axis of the coordinate for the center point.
  9300. @param r The circle's radius.
  9301. */
  9302. circle(cx?: number, cy?: number, r?: number): void;
  9303. /**
  9304. !#en Adds an rectangle to the path.
  9305. !#zh 绘制矩形路径。
  9306. @param x The x axis of the coordinate for the rectangle starting point.
  9307. @param y The y axis of the coordinate for the rectangle starting point.
  9308. @param w The rectangle's width.
  9309. @param h The rectangle's height.
  9310. */
  9311. rect(x?: number, y?: number, w?: number, h?: number): void;
  9312. /**
  9313. !#en Adds an round corner rectangle to the path.
  9314. !#zh 绘制圆角矩形路径。
  9315. @param x The x axis of the coordinate for the rectangle starting point.
  9316. @param y The y axis of the coordinate for the rectangle starting point.
  9317. @param w The rectangles width.
  9318. @param h The rectangle's height.
  9319. @param r The radius of the rectangle.
  9320. */
  9321. roundRect(x?: number, y?: number, w?: number, h?: number, r?: number): void;
  9322. /**
  9323. !#en Draws a filled rectangle.
  9324. !#zh 绘制填充矩形。
  9325. @param x The x axis of the coordinate for the rectangle starting point.
  9326. @param y The y axis of the coordinate for the rectangle starting point.
  9327. @param w The rectangle's width.
  9328. @param h The rectangle's height.
  9329. */
  9330. fillRect(x?: number, y?: number, w?: number, h?: number): void;
  9331. /**
  9332. !#en Erasing any previously drawn content.
  9333. !#zh 擦除之前绘制的所有内容的方法。
  9334. @param clean Whether to clean the graphics inner cache.
  9335. */
  9336. clear(clean?: boolean): void;
  9337. /**
  9338. !#en Causes the point of the pen to move back to the start of the current path. It tries to add a straight line from the current point to the start.
  9339. !#zh 将笔点返回到当前路径起始点的。它尝试从当前点到起始点绘制一条直线。
  9340. */
  9341. close(): void;
  9342. /**
  9343. !#en Strokes the current or given path with the current stroke style.
  9344. !#zh 根据当前的画线样式,绘制当前或已经存在的路径。
  9345. */
  9346. stroke(): void;
  9347. /**
  9348. !#en Fills the current or given path with the current fill style.
  9349. !#zh 根据当前的画线样式,填充当前或已经存在的路径。
  9350. */
  9351. fill(): void;
  9352. }
  9353. /** undefined */
  9354. export class WorldManifold {
  9355. /** !#en
  9356. world contact point (point of intersection)
  9357. !#zh
  9358. 碰撞点集合 */
  9359. points: Vec2[];
  9360. /** !#en
  9361. world vector pointing from A to B
  9362. !#zh
  9363. 世界坐标系下由 A 指向 B 的向量 */
  9364. normal: Vec2;
  9365. }
  9366. /** !#en
  9367. A manifold point is a contact point belonging to a contact manifold.
  9368. It holds details related to the geometry and dynamics of the contact points.
  9369. Note: the impulses are used for internal caching and may not
  9370. provide reliable contact forces, especially for high speed collisions.
  9371. !#zh
  9372. ManifoldPoint 是接触信息中的接触点信息。它拥有关于几何和接触点的详细信息。
  9373. 注意:信息中的冲量用于系统内部缓存,提供的接触力可能不是很准确,特别是高速移动中的碰撞信息。 */
  9374. export class ManifoldPoint {
  9375. /** !#en
  9376. The local point usage depends on the manifold type:
  9377. -e_circles: the local center of circleB
  9378. -e_faceA: the local center of circleB or the clip point of polygonB
  9379. -e_faceB: the clip point of polygonA
  9380. !#zh
  9381. 本地坐标点的用途取决于 manifold 的类型
  9382. - e_circles: circleB 的本地中心点
  9383. - e_faceA: circleB 的本地中心点 或者是 polygonB 的截取点
  9384. - e_faceB: polygonB 的截取点 */
  9385. localPoint: Vec2;
  9386. /** !#en
  9387. Normal impulse.
  9388. !#zh
  9389. 法线冲量。 */
  9390. normalImpulse: number;
  9391. /** !#en
  9392. Tangent impulse.
  9393. !#zh
  9394. 切线冲量。 */
  9395. tangentImpulse: number;
  9396. }
  9397. /** undefined */
  9398. export class Manifold {
  9399. /** !#en
  9400. Manifold type : 0: e_circles, 1: e_faceA, 2: e_faceB
  9401. !#zh
  9402. Manifold 类型 : 0: e_circles, 1: e_faceA, 2: e_faceB */
  9403. type: number;
  9404. /** !#en
  9405. The local point usage depends on the manifold type:
  9406. -e_circles: the local center of circleA
  9407. -e_faceA: the center of faceA
  9408. -e_faceB: the center of faceB
  9409. !#zh
  9410. 用途取决于 manifold 类型
  9411. -e_circles: circleA 的本地中心点
  9412. -e_faceA: faceA 的本地中心点
  9413. -e_faceB: faceB 的本地中心点 */
  9414. localPoint: Vec2;
  9415. /** !#en
  9416. -e_circles: not used
  9417. -e_faceA: the normal on polygonA
  9418. -e_faceB: the normal on polygonB
  9419. !#zh
  9420. -e_circles: 没被使用到
  9421. -e_faceA: polygonA 的法向量
  9422. -e_faceB: polygonB 的法向量 */
  9423. localNormal: Vec2;
  9424. /** !#en
  9425. the points of contact.
  9426. !#zh
  9427. 接触点信息。 */
  9428. points: ManifoldPoint[];
  9429. }
  9430. /** !#en
  9431. Contact impulses for reporting.
  9432. !#zh
  9433. 用于返回给回调的接触冲量。 */
  9434. export class PhysicsImpulse {
  9435. /** !#en
  9436. Normal impulses.
  9437. !#zh
  9438. 法线方向的冲量 */
  9439. normalImpulses: any;
  9440. /** !#en
  9441. Tangent impulses
  9442. !#zh
  9443. 切线方向的冲量 */
  9444. tangentImpulses: any;
  9445. }
  9446. /** !#en
  9447. PhysicsContact will be generated during begin and end collision as a parameter of the collision callback.
  9448. Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
  9449. !#zh
  9450. 物理接触会在开始和结束碰撞之间生成,并作为参数传入到碰撞回调函数中。
  9451. 注意:传入的物理接触会被系统进行重用,所以不要在使用中缓存里面的任何信息。 */
  9452. export class PhysicsContact {
  9453. /**
  9454. !#en
  9455. Get the world manifold.
  9456. !#zh
  9457. 获取世界坐标系下的碰撞信息。
  9458. */
  9459. getWorldManifold(): WorldManifold;
  9460. /**
  9461. !#en
  9462. Get the manifold.
  9463. !#zh
  9464. 获取本地(局部)坐标系下的碰撞信息。
  9465. */
  9466. getManifold(): Manifold;
  9467. /**
  9468. !#en
  9469. Get the impulses.
  9470. Note: PhysicsImpulse can only used in onPostSolve callback.
  9471. !#zh
  9472. 获取冲量信息
  9473. 注意:这个信息只有在 onPostSolve 回调中才能获取到
  9474. */
  9475. getImpulse(): PhysicsImpulse;
  9476. /** !#en
  9477. One of the collider that collided
  9478. !#zh
  9479. 发生碰撞的碰撞体之一 */
  9480. colliderA: Collider;
  9481. /** !#en
  9482. One of the collider that collided
  9483. !#zh
  9484. 发生碰撞的碰撞体之一 */
  9485. colliderB: Collider;
  9486. /** !#en
  9487. If set disabled to true, the contact will be ignored until contact end.
  9488. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
  9489. !#zh
  9490. 如果 disabled 被设置为 true,那么直到接触结束此接触都将被忽略。
  9491. 如果只是希望在当前时间步或子步中忽略此接触,请使用 disabledOnce 。 */
  9492. disabled: boolean;
  9493. /** !#en
  9494. Disabled contact for current time step or sub-step.
  9495. !#zh
  9496. 在当前时间步或子步中忽略此接触。 */
  9497. disabledOnce: boolean;
  9498. /**
  9499. !#en
  9500. Is this contact touching?
  9501. !#zh
  9502. 返回碰撞体是否已经接触到。
  9503. */
  9504. isTouching(): boolean;
  9505. /**
  9506. !#en
  9507. Set the desired tangent speed for a conveyor belt behavior.
  9508. !#zh
  9509. 为传送带设置期望的切线速度
  9510. @param tangentSpeed tangentSpeed
  9511. */
  9512. setTangentSpeed(tangentSpeed: number): void;
  9513. /**
  9514. !#en
  9515. Get the desired tangent speed.
  9516. !#zh
  9517. 获取切线速度
  9518. */
  9519. getTangentSpeed(): number;
  9520. /**
  9521. !#en
  9522. Override the default friction mixture. You can call this in onPreSolve callback.
  9523. !#zh
  9524. 覆盖默认的摩擦力系数。你可以在 onPreSolve 回调中调用此函数。
  9525. @param friction friction
  9526. */
  9527. setFriction(friction: number): void;
  9528. /**
  9529. !#en
  9530. Get the friction.
  9531. !#zh
  9532. 获取当前摩擦力系数
  9533. */
  9534. getFriction(): number;
  9535. /**
  9536. !#en
  9537. Reset the friction mixture to the default value.
  9538. !#zh
  9539. 重置摩擦力系数到默认值
  9540. */
  9541. resetFriction(): void;
  9542. /**
  9543. !#en
  9544. Override the default restitution mixture. You can call this in onPreSolve callback.
  9545. !#zh
  9546. 覆盖默认的恢复系数。你可以在 onPreSolve 回调中调用此函数。
  9547. @param restitution restitution
  9548. */
  9549. setRestitution(restitution: number): void;
  9550. /**
  9551. !#en
  9552. Get the restitution.
  9553. !#zh
  9554. 获取当前恢复系数
  9555. */
  9556. getRestitution(): number;
  9557. /**
  9558. !#en
  9559. Reset the restitution mixture to the default value.
  9560. !#zh
  9561. 重置恢复系数到默认值
  9562. */
  9563. resetRestitution(): void;
  9564. }
  9565. /** !#en Enum for RigidBodyType.
  9566. !#zh 刚体类型 */
  9567. export enum RigidBodyType {
  9568. Static = 0,
  9569. Kinematic = 0,
  9570. Dynamic = 0,
  9571. Animated = 0,
  9572. }
  9573. /** !#en Enum for RayCastType.
  9574. !#zh 射线检测类型 */
  9575. export enum RayCastType {
  9576. Closest = 0,
  9577. Any = 0,
  9578. AllClosest = 0,
  9579. All = 0,
  9580. }
  9581. /** !#en
  9582. Physics manager uses box2d as the inner physics system, and hide most box2d implement details(creating rigidbody, synchronize rigidbody info to node).
  9583. You can visit some common box2d function through physics manager(hit testing, raycast, debug info).
  9584. Physics manager distributes the collision information to each collision callback when collision is produced.
  9585. Note: You need first enable the collision listener in the rigidbody.
  9586. !#zh
  9587. 物理系统将 box2d 作为内部物理系统,并且隐藏了大部分 box2d 实现细节(比如创建刚体,同步刚体信息到节点中等)。
  9588. 你可以通过物理系统访问一些 box2d 常用的功能,比如点击测试,射线测试,设置测试信息等。
  9589. 物理系统还管理碰撞信息的分发,她会在产生碰撞时,将碰撞信息分发到各个碰撞回调中。
  9590. 注意:你需要先在刚体中开启碰撞接听才会产生相应的碰撞回调。<br>
  9591. 支持的物理系统指定绘制信息事件,请参阅 {{#crossLink "PhysicsManager.DrawBits"}}{{/crossLink}} */
  9592. export class PhysicsManager implements EventTarget {
  9593. /** !#en
  9594. The ratio transform between physics unit and pixel unit, generally is 32.
  9595. !#zh
  9596. 物理单位与像素单位互相转换的比率,一般是 32。 */
  9597. static PTM_RATIO: number;
  9598. /** !#en
  9599. The velocity iterations for the velocity constraint solver.
  9600. !#zh
  9601. 速度更新迭代数 */
  9602. static VELOCITY_ITERATIONS: number;
  9603. /** !#en
  9604. The position Iterations for the position constraint solver.
  9605. !#zh
  9606. 位置迭代更新数 */
  9607. static POSITION_ITERATIONS: number;
  9608. /** !#en
  9609. Specify the fixed time step.
  9610. Need enabledAccumulator to make it work.
  9611. !#zh
  9612. 指定固定的物理更新间隔时间,需要开启 enabledAccumulator 才有效。 */
  9613. static FIXED_TIME_STEP: number;
  9614. /** !#en
  9615. Specify the max accumulator time.
  9616. Need enabledAccumulator to make it work.
  9617. !#zh
  9618. 每次可用于更新物理系统的最大时间,需要开启 enabledAccumulator 才有效。 */
  9619. static MAX_ACCUMULATOR: number;
  9620. /** !#en
  9621. If enabled accumulator, then will call step function with the fixed time step FIXED_TIME_STEP.
  9622. And if the update dt is bigger than the time step, then will call step function several times.
  9623. If disabled accumulator, then will call step function with a time step calculated with the frame rate.
  9624. !#zh
  9625. 如果开启此选项,那么将会以固定的间隔时间 FIXED_TIME_STEP 来更新物理引擎,如果一个 update 的间隔时间大于 FIXED_TIME_STEP,则会对物理引擎进行多次更新。
  9626. 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个间隔时间来更新物理引擎。 */
  9627. enabledAccumulator: boolean;
  9628. /**
  9629. !#en
  9630. Test which collider contains the given world point
  9631. !#zh
  9632. 获取包含给定世界坐标系点的碰撞体
  9633. @param point the world point
  9634. */
  9635. testPoint(point: Vec2): PhysicsCollider;
  9636. /**
  9637. !#en
  9638. Test which colliders intersect the given world rect
  9639. !#zh
  9640. 获取与给定世界坐标系矩形相交的碰撞体
  9641. @param rect the world rect
  9642. */
  9643. testAABB(rect: Rect): PhysicsCollider[];
  9644. /**
  9645. !#en
  9646. Raycast the world for all colliders in the path of the ray.
  9647. The raycast ignores colliders that contain the starting point.
  9648. !#zh
  9649. 检测哪些碰撞体在给定射线的路径上,射线检测将忽略包含起始点的碰撞体。
  9650. @param p1 start point of the raycast
  9651. @param p2 end point of the raycast
  9652. @param type optional, default is RayCastType.Closest
  9653. */
  9654. rayCast(p1: Vec2, p2: Vec2, type: RayCastType): PhysicsRayCastResult[];
  9655. /** !#en
  9656. Enabled the physics manager?
  9657. !#zh
  9658. 指定是否启用物理系统? */
  9659. enabled: boolean;
  9660. /** !#en
  9661. Debug draw flags.
  9662. !#zh
  9663. 设置调试绘制标志 */
  9664. debugDrawFlags: number;
  9665. /** !#en
  9666. The physics world gravity.
  9667. !#zh
  9668. 物理世界重力值 */
  9669. gravity: Vec2;
  9670. /**
  9671. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  9672. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  9673. @param type The type of event.
  9674. */
  9675. hasEventListener(type: string): boolean;
  9676. /**
  9677. !#en
  9678. Register an callback of a specific event type on the EventTarget.
  9679. This type of event should be triggered via `emit`.
  9680. !#zh
  9681. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  9682. @param type A string representing the event type to listen for.
  9683. @param callback The callback that will be invoked when the event is dispatched.
  9684. The callback is ignored if it is a duplicate (the callbacks are unique).
  9685. @param target The target (this object) to invoke the callback, can be null
  9686. @example
  9687. ```js
  9688. eventTarget.on('fire', function () {
  9689. cc.log("fire in the hole");
  9690. }, node);
  9691. ```
  9692. */
  9693. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  9694. /**
  9695. !#en
  9696. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  9697. if only type is passed as parameter, all listeners registered with that type will be removed.
  9698. !#zh
  9699. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  9700. @param type A string representing the event type being removed.
  9701. @param callback The callback to remove.
  9702. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  9703. @example
  9704. ```js
  9705. // register fire eventListener
  9706. var callback = eventTarget.on('fire', function () {
  9707. cc.log("fire in the hole");
  9708. }, target);
  9709. // remove fire event listener
  9710. eventTarget.off('fire', callback, target);
  9711. // remove all fire event listeners
  9712. eventTarget.off('fire');
  9713. ```
  9714. */
  9715. off(type: string, callback?: Function, target?: any): void;
  9716. /**
  9717. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  9718. This is not for removing all listeners in the current event target,
  9719. and this is not for removing all listeners the target parameter have registered.
  9720. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  9721. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  9722. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  9723. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  9724. @param target The target to be searched for all related listeners
  9725. */
  9726. targetOff(target: any): void;
  9727. /**
  9728. !#en
  9729. Register an callback of a specific event type on the EventTarget,
  9730. the callback will remove itself after the first time it is triggered.
  9731. !#zh
  9732. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  9733. @param type A string representing the event type to listen for.
  9734. @param callback The callback that will be invoked when the event is dispatched.
  9735. The callback is ignored if it is a duplicate (the callbacks are unique).
  9736. @param target The target (this object) to invoke the callback, can be null
  9737. @example
  9738. ```js
  9739. eventTarget.once('fire', function () {
  9740. cc.log("this is the callback and will be invoked only once");
  9741. }, node);
  9742. ```
  9743. */
  9744. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  9745. /**
  9746. !#en
  9747. Send an event with the event object.
  9748. !#zh
  9749. 通过事件对象派发事件
  9750. @param event event
  9751. */
  9752. dispatchEvent(event: Event): void;
  9753. /**
  9754. !#en
  9755. Destroy all callbackInfos.
  9756. !#zh
  9757. 销毁记录的事件
  9758. */
  9759. clear(): void;
  9760. }
  9761. /** undefined */
  9762. export class PhysicsRayCastResult {
  9763. /** !#en
  9764. The PhysicsCollider which intersects with the raycast
  9765. !#zh
  9766. 与射线相交的碰撞体 */
  9767. collider: PhysicsCollider;
  9768. /** !#en
  9769. The intersection point
  9770. !#zh
  9771. 射线与碰撞体相交的点 */
  9772. point: Vec2;
  9773. /** !#en
  9774. The normal vector at the point of intersection
  9775. !#zh
  9776. 射线与碰撞体相交的点的法向量 */
  9777. normal: Vec2;
  9778. /** !#en
  9779. The fraction of the raycast path at the point of intersection
  9780. !#zh
  9781. 射线与碰撞体相交的点占射线长度的分数 */
  9782. fraction: number;
  9783. }
  9784. /** undefined */
  9785. export class RigidBody extends Component {
  9786. /** !#en
  9787. Should enabled contact listener?
  9788. When a collision is trigger, the collision callback will only be called when enabled contact listener.
  9789. !#zh
  9790. 是否启用接触接听器。
  9791. 当 collider 产生碰撞时,只有开启了接触接听器才会调用相应的回调函数 */
  9792. enabledContactListener: boolean;
  9793. /**
  9794. !#en
  9795. Collision callback.
  9796. Called when two collider begin to touch.
  9797. !#zh
  9798. 碰撞回调。
  9799. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体开始接触时被调用。
  9800. @param contact contact information
  9801. @param selfCollider the collider belong to this rigidbody
  9802. @param otherCollider the collider belong to another rigidbody
  9803. */
  9804. onBeginContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9805. /**
  9806. !#en
  9807. Collision callback.
  9808. Called when two collider cease to touch.
  9809. !#zh
  9810. 碰撞回调。
  9811. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体停止接触时被调用。
  9812. @param contact contact information
  9813. @param selfCollider the collider belong to this rigidbody
  9814. @param otherCollider the collider belong to another rigidbody
  9815. */
  9816. onEndContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9817. /**
  9818. !#en
  9819. Collision callback.
  9820. This is called when a contact is updated.
  9821. This allows you to inspect a contact before it goes to the solver(e.g. disable contact).
  9822. Note: this is called only for awake bodies.
  9823. Note: this is called even when the number of contact points is zero.
  9824. Note: this is not called for sensors.
  9825. !#zh
  9826. 碰撞回调。
  9827. 如果你的脚本中实现了这个函数,那么它将会在接触更新时被调用。
  9828. 你可以在接触被处理前根据他包含的信息作出相应的处理,比如将这个接触禁用掉。
  9829. 注意:回调只会为醒着的刚体调用。
  9830. 注意:接触点为零的时候也有可能被调用。
  9831. 注意:感知体(sensor)的回调不会被调用。
  9832. @param contact contact information
  9833. @param selfCollider the collider belong to this rigidbody
  9834. @param otherCollider the collider belong to another rigidbody
  9835. */
  9836. onPreSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9837. /**
  9838. !#en
  9839. Collision callback.
  9840. This is called after a contact is updated.
  9841. You can get the impulses from the contact in this callback.
  9842. !#zh
  9843. 碰撞回调。
  9844. 如果你的脚本中实现了这个函数,那么它将会在接触更新完后被调用。
  9845. 你可以在这个回调中从接触信息中获取到冲量信息。
  9846. @param contact contact information
  9847. @param selfCollider the collider belong to this rigidbody
  9848. @param otherCollider the collider belong to another rigidbody
  9849. */
  9850. onPostSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  9851. /** !#en
  9852. Is this a fast moving body that should be prevented from tunneling through
  9853. other moving bodies?
  9854. Note :
  9855. - All bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
  9856. - You should use this flag sparingly since it increases processing time.
  9857. !#zh
  9858. 这个刚体是否是一个快速移动的刚体,并且需要禁止穿过其他快速移动的刚体?
  9859. 需要注意的是 :
  9860. - 所有刚体都被禁止从 运动刚体 和 静态刚体 中穿过。此选项只关注于 动态刚体。
  9861. - 应该尽量少的使用此选项,因为它会增加程序处理时间。 */
  9862. bullet: boolean;
  9863. /** !#en
  9864. Rigidbody type : Static, Kinematic, Dynamic or Animated.
  9865. !#zh
  9866. 刚体类型: Static, Kinematic, Dynamic or Animated. */
  9867. type: RigidBodyType;
  9868. /** !#en
  9869. Set this flag to false if this body should never fall asleep.
  9870. Note that this increases CPU usage.
  9871. !#zh
  9872. 如果此刚体永远都不应该进入睡眠,那么设置这个属性为 false。
  9873. 需要注意这将使 CPU 占用率提高。 */
  9874. allowSleep: boolean;
  9875. /** !#en
  9876. Scale the gravity applied to this body.
  9877. !#zh
  9878. 缩放应用在此刚体上的重力值 */
  9879. gravityScale: number;
  9880. /** !#en
  9881. Linear damping is use to reduce the linear velocity.
  9882. The damping parameter can be larger than 1, but the damping effect becomes sensitive to the
  9883. time step when the damping parameter is large.
  9884. !#zh
  9885. Linear damping 用于衰减刚体的线性速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  9886. linearDamping: number;
  9887. /** !#en
  9888. Angular damping is use to reduce the angular velocity. The damping parameter
  9889. can be larger than 1 but the damping effect becomes sensitive to the
  9890. time step when the damping parameter is large.
  9891. !#zh
  9892. Angular damping 用于衰减刚体的角速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  9893. angularDamping: number;
  9894. /** !#en
  9895. The linear velocity of the body's origin in world co-ordinates.
  9896. !#zh
  9897. 刚体在世界坐标下的线性速度 */
  9898. linearVelocity: Vec2;
  9899. /** !#en
  9900. The angular velocity of the body.
  9901. !#zh
  9902. 刚体的角速度 */
  9903. angularVelocity: number;
  9904. /** !#en
  9905. Should this body be prevented from rotating?
  9906. !#zh
  9907. 是否禁止此刚体进行旋转 */
  9908. fixedRotation: boolean;
  9909. /** !#en
  9910. Set the sleep state of the body. A sleeping body has very low CPU cost.(When the rigid body is hit, if the rigid body is in sleep state, it will be immediately awakened.)
  9911. !#zh
  9912. 设置刚体的睡眠状态。 睡眠的刚体具有非常低的 CPU 成本。(当刚体被碰撞到时,如果刚体处于睡眠状态,它会立即被唤醒) */
  9913. awake: boolean;
  9914. /** !#en
  9915. Whether to wake up this rigid body during initialization
  9916. !#zh
  9917. 是否在初始化时唤醒此刚体 */
  9918. awakeOnLoad: boolean;
  9919. /** !#en
  9920. Set the active state of the body. An inactive body is not
  9921. simulated and cannot be collided with or woken up.
  9922. If body is active, all fixtures will be added to the
  9923. broad-phase.
  9924. If body is inactive, all fixtures will be removed from
  9925. the broad-phase and all contacts will be destroyed.
  9926. Fixtures on an inactive body are implicitly inactive and will
  9927. not participate in collisions, ray-casts, or queries.
  9928. Joints connected to an inactive body are implicitly inactive.
  9929. !#zh
  9930. 设置刚体的激活状态。一个非激活状态下的刚体是不会被模拟和碰撞的,不管它是否处于睡眠状态下。
  9931. 如果刚体处于激活状态下,所有夹具会被添加到 粗测阶段(broad-phase)。
  9932. 如果刚体处于非激活状态下,所有夹具会被从 粗测阶段(broad-phase)中移除。
  9933. 在非激活状态下的夹具不会参与到碰撞,射线,或者查找中
  9934. 链接到非激活状态下刚体的关节也是非激活的。 */
  9935. active: boolean;
  9936. /**
  9937. !#en
  9938. Converts a given point in the world coordinate system to this rigid body's local coordinate system
  9939. !#zh
  9940. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  9941. @param worldPoint a point in world coordinates.
  9942. @param out optional, the receiving point
  9943. */
  9944. getLocalPoint(worldPoint: Vec2, out: Vec2): Vec2;
  9945. /**
  9946. !#en
  9947. Converts a given point in this rigid body's local coordinate system to the world coordinate system
  9948. !#zh
  9949. 将一个给定的刚体本地坐标系下的点转换为世界坐标系下的点
  9950. @param localPoint a point in local coordinates.
  9951. @param out optional, the receiving point
  9952. */
  9953. getWorldPoint(localPoint: Vec2, out: Vec2): Vec2;
  9954. /**
  9955. !#en
  9956. Converts a given vector in this rigid body's local coordinate system to the world coordinate system
  9957. !#zh
  9958. 将一个给定的刚体本地坐标系下的向量转换为世界坐标系下的向量
  9959. @param localVector a vector in world coordinates.
  9960. @param out optional, the receiving vector
  9961. */
  9962. getWorldVector(localVector: Vec2, out: Vec2): Vec2;
  9963. /**
  9964. !#en
  9965. Converts a given vector in the world coordinate system to this rigid body's local coordinate system
  9966. !#zh
  9967. 将一个给定的世界坐标系下的向量转换为刚体本地坐标系下的向量
  9968. @param worldVector a vector in world coordinates.
  9969. @param out optional, the receiving vector
  9970. */
  9971. getLocalVector(worldVector: Vec2, out: Vec2): Vec2;
  9972. /**
  9973. !#en
  9974. Get the world body origin position.
  9975. !#zh
  9976. 获取刚体世界坐标系下的原点值
  9977. @param out optional, the receiving point
  9978. */
  9979. getWorldPosition(out: Vec2): Vec2;
  9980. /**
  9981. !#en
  9982. Get the world body rotation angle.
  9983. !#zh
  9984. 获取刚体世界坐标系下的旋转值。
  9985. */
  9986. getWorldRotation(): number;
  9987. /**
  9988. !#en
  9989. Get the local position of the center of mass.
  9990. !#zh
  9991. 获取刚体本地坐标系下的质心
  9992. */
  9993. getLocalCenter(): Vec2;
  9994. /**
  9995. !#en
  9996. Get the world position of the center of mass.
  9997. !#zh
  9998. 获取刚体世界坐标系下的质心
  9999. */
  10000. getWorldCenter(): Vec2;
  10001. /**
  10002. !#en
  10003. Get the world linear velocity of a world point attached to this body.
  10004. !#zh
  10005. 获取刚体上指定点的线性速度
  10006. @param worldPoint a point in world coordinates.
  10007. @param out optional, the receiving point
  10008. */
  10009. getLinearVelocityFromWorldPoint(worldPoint: Vec2, out: Vec2): Vec2;
  10010. /**
  10011. !#en
  10012. Get total mass of the body.
  10013. !#zh
  10014. 获取刚体的质量。
  10015. */
  10016. getMass(): number;
  10017. /**
  10018. !#en
  10019. Get the rotational inertia of the body about the local origin.
  10020. !#zh
  10021. 获取刚体本地坐标系下原点的旋转惯性
  10022. */
  10023. getInertia(): number;
  10024. /**
  10025. !#en
  10026. Get all the joints connect to the rigidbody.
  10027. !#zh
  10028. 获取链接到此刚体的所有关节
  10029. */
  10030. getJointList(): Joint[];
  10031. /**
  10032. !#en
  10033. Apply a force at a world point. If the force is not
  10034. applied at the center of mass, it will generate a torque and
  10035. affect the angular velocity.
  10036. !#zh
  10037. 施加一个力到刚体上的一个点。如果力没有施加到刚体的质心上,还会产生一个扭矩并且影响到角速度。
  10038. @param force the world force vector.
  10039. @param point the world position.
  10040. @param wake also wake up the body.
  10041. */
  10042. applyForce(force: Vec2, point: Vec2, wake: boolean): void;
  10043. /**
  10044. !#en
  10045. Apply a force to the center of mass.
  10046. !#zh
  10047. 施加一个力到刚体上的质心上。
  10048. @param force the world force vector.
  10049. @param wake also wake up the body.
  10050. */
  10051. applyForceToCenter(force: Vec2, wake: boolean): void;
  10052. /**
  10053. !#en
  10054. Apply a torque. This affects the angular velocity.
  10055. !#zh
  10056. 施加一个扭矩力,将影响刚体的角速度
  10057. @param torque about the z-axis (out of the screen), usually in N-m.
  10058. @param wake also wake up the body
  10059. */
  10060. applyTorque(torque: number, wake: boolean): void;
  10061. /**
  10062. !#en
  10063. Apply a impulse at a world point, This immediately modifies the velocity.
  10064. If the impulse is not applied at the center of mass, it will generate a torque and
  10065. affect the angular velocity.
  10066. !#zh
  10067. 施加冲量到刚体上的一个点,将立即改变刚体的线性速度。
  10068. 如果冲量施加到的点不是刚体的质心,那么将产生一个扭矩并影响刚体的角速度。
  10069. @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
  10070. @param point the world position
  10071. @param wake alse wake up the body
  10072. */
  10073. applyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): void;
  10074. /**
  10075. !#en
  10076. Apply an angular impulse.
  10077. !#zh
  10078. 施加一个角速度冲量。
  10079. @param impulse the angular impulse in units of kg*m*m/s
  10080. @param wake also wake up the body
  10081. */
  10082. applyAngularImpulse(impulse: number, wake: boolean): void;
  10083. /**
  10084. !#en
  10085. Synchronize node's world position to box2d rigidbody's position.
  10086. If enableAnimated is true and rigidbody's type is Animated type,
  10087. will set linear velocity instead of directly set rigidbody's position.
  10088. !#zh
  10089. 同步节点的世界坐标到 box2d 刚体的坐标上。
  10090. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的线性速度来代替直接设置刚体的位置。
  10091. @param enableAnimated enableAnimated
  10092. */
  10093. syncPosition(enableAnimated: boolean): void;
  10094. /**
  10095. !#en
  10096. Synchronize node's world angle to box2d rigidbody's angle.
  10097. If enableAnimated is true and rigidbody's type is Animated type,
  10098. will set angular velocity instead of directly set rigidbody's angle.
  10099. !#zh
  10100. 同步节点的世界旋转角度值到 box2d 刚体的旋转值上。
  10101. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的角速度来代替直接设置刚体的角度。
  10102. @param enableAnimated enableAnimated
  10103. */
  10104. syncRotation(enableAnimated: boolean): void;
  10105. }
  10106. /** !#en Mesh Asset.
  10107. !#zh 网格资源。 */
  10108. export class Mesh extends Asset implements EventTarget {
  10109. /** !#en Get ir set the sub meshes.
  10110. !#zh 设置或者获取子网格。 */
  10111. subMeshes: InputAssembler[];
  10112. /**
  10113. !#en
  10114. Init vertex buffer according to the vertex format.
  10115. !#zh
  10116. 根据顶点格式初始化顶点内存。
  10117. @param vertexFormat vertex format
  10118. @param vertexCount how much vertex should be create in this buffer.
  10119. @param dynamic whether or not to use dynamic buffer.
  10120. @param index index
  10121. */
  10122. init(vertexFormat: gfx.VertexFormat, vertexCount: number, dynamic?: boolean, index?: boolean): void;
  10123. /**
  10124. !#en
  10125. Set the vertex values.
  10126. !#zh
  10127. 设置顶点数据
  10128. @param name the attribute name, e.g. gfx.ATTR_POSITION
  10129. @param values the vertex values
  10130. */
  10131. setVertices(name: string, values: Vec2[]|Vec3[]|Color[]|number[]|Uint8Array|Float32Array): void;
  10132. /**
  10133. !#en
  10134. Set the sub mesh indices.
  10135. !#zh
  10136. 设置子网格索引。
  10137. @param indices the sub mesh indices.
  10138. @param index sub mesh index.
  10139. @param dynamic whether or not to use dynamic buffer.
  10140. */
  10141. setIndices(indices: number[]|Uint16Array|Uint8Array, index?: number, dynamic?: boolean): void;
  10142. /**
  10143. !#en
  10144. Set the sub mesh primitive type.
  10145. !#zh
  10146. 设置子网格绘制线条的方式。
  10147. @param type type
  10148. @param index index
  10149. */
  10150. setPrimitiveType(type: number, index: number): void;
  10151. /**
  10152. !#en
  10153. Clear the buffer data.
  10154. !#zh
  10155. 清除网格创建的内存数据。
  10156. */
  10157. clear(): void;
  10158. /**
  10159. !#en Set mesh bounding box
  10160. !#zh 设置网格的包围盒
  10161. @param min min
  10162. @param max max
  10163. */
  10164. setBoundingBox(min: Vec3, max: Vec3): void;
  10165. /**
  10166. !#en Read the specified attributes of the subgrid into the target buffer.
  10167. !#zh 读取子网格的指定属性到目标缓冲区中。
  10168. @param primitiveIndex The subgrid index.
  10169. @param attributeName attribute name.
  10170. @param buffer The target buffer.
  10171. @param stride The byte interval between adjacent attributes in the target buffer.
  10172. @param offset The offset of the first attribute in the target buffer.
  10173. */
  10174. copyAttribute(primitiveIndex: number, attributeName: string, buffer: ArrayBuffer, stride: number, offset: number): boolean;
  10175. /**
  10176. !#en Read the index data of the subgrid into the target array.
  10177. !#zh 读取子网格的索引数据到目标数组中。
  10178. @param primitiveIndex The subgrid index.
  10179. @param outputArray The target array.
  10180. */
  10181. copyIndices(primitiveIndex: number, outputArray: DataView): boolean;
  10182. /**
  10183. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  10184. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  10185. @param type The type of event.
  10186. */
  10187. hasEventListener(type: string): boolean;
  10188. /**
  10189. !#en
  10190. Register an callback of a specific event type on the EventTarget.
  10191. This type of event should be triggered via `emit`.
  10192. !#zh
  10193. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  10194. @param type A string representing the event type to listen for.
  10195. @param callback The callback that will be invoked when the event is dispatched.
  10196. The callback is ignored if it is a duplicate (the callbacks are unique).
  10197. @param target The target (this object) to invoke the callback, can be null
  10198. @example
  10199. ```js
  10200. eventTarget.on('fire', function () {
  10201. cc.log("fire in the hole");
  10202. }, node);
  10203. ```
  10204. */
  10205. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  10206. /**
  10207. !#en
  10208. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  10209. if only type is passed as parameter, all listeners registered with that type will be removed.
  10210. !#zh
  10211. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  10212. @param type A string representing the event type being removed.
  10213. @param callback The callback to remove.
  10214. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  10215. @example
  10216. ```js
  10217. // register fire eventListener
  10218. var callback = eventTarget.on('fire', function () {
  10219. cc.log("fire in the hole");
  10220. }, target);
  10221. // remove fire event listener
  10222. eventTarget.off('fire', callback, target);
  10223. // remove all fire event listeners
  10224. eventTarget.off('fire');
  10225. ```
  10226. */
  10227. off(type: string, callback?: Function, target?: any): void;
  10228. /**
  10229. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  10230. This is not for removing all listeners in the current event target,
  10231. and this is not for removing all listeners the target parameter have registered.
  10232. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  10233. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  10234. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  10235. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  10236. @param target The target to be searched for all related listeners
  10237. */
  10238. targetOff(target: any): void;
  10239. /**
  10240. !#en
  10241. Register an callback of a specific event type on the EventTarget,
  10242. the callback will remove itself after the first time it is triggered.
  10243. !#zh
  10244. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  10245. @param type A string representing the event type to listen for.
  10246. @param callback The callback that will be invoked when the event is dispatched.
  10247. The callback is ignored if it is a duplicate (the callbacks are unique).
  10248. @param target The target (this object) to invoke the callback, can be null
  10249. @example
  10250. ```js
  10251. eventTarget.once('fire', function () {
  10252. cc.log("this is the callback and will be invoked only once");
  10253. }, node);
  10254. ```
  10255. */
  10256. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  10257. /**
  10258. !#en
  10259. Send an event with the event object.
  10260. !#zh
  10261. 通过事件对象派发事件
  10262. @param event event
  10263. */
  10264. dispatchEvent(event: Event): void;
  10265. }
  10266. /** !#en
  10267. Mesh Renderer Component
  10268. !#zh
  10269. 网格渲染组件 */
  10270. export class MeshRenderer extends RenderComponent {
  10271. /** !#en
  10272. The mesh which the renderer uses.
  10273. !#zh
  10274. 设置使用的网格 */
  10275. mesh: Mesh;
  10276. /** !#en
  10277. Whether the mesh should receive shadows.
  10278. !#zh
  10279. 网格是否接受光源投射的阴影 */
  10280. receiveShadows: boolean;
  10281. /** !#en
  10282. Shadow Casting Mode
  10283. !#zh
  10284. 网格投射阴影的模式 */
  10285. shadowCastingMode: MeshRenderer.ShadowCastingMode;
  10286. /** !#en
  10287. Enable auto merge mesh, only support when mesh's VertexFormat, PrimitiveType, materials are all the same
  10288. !#zh
  10289. 开启自动合并 mesh 功能,只有在网格的 顶点格式,PrimitiveType, 使用的材质 都一致的情况下才会有效 */
  10290. enableAutoBatch: boolean;
  10291. }
  10292. /** The class BufferRange denotes a range of the buffer. */
  10293. export class BufferRange {
  10294. /** The offset of the range. */
  10295. offset: number;
  10296. /** The length of the range. */
  10297. length: number;
  10298. }
  10299. /** undefined */
  10300. export class VertexFormat {
  10301. /** The data range of this bundle.
  10302. This range of data is essentially mapped to a GPU vertex buffer. */
  10303. data: BufferRange;
  10304. /** The attribute formats. */
  10305. formats: VertexFormat;
  10306. /** The vertex bundle that the primitive use. */
  10307. vertexBundleIndices: number[];
  10308. /** The data range of the primitive.
  10309. This range of data is essentially mapped to a GPU indices buffer. */
  10310. data: BufferRange;
  10311. /** The type of this primitive's indices. */
  10312. indexUnit: number;
  10313. /** The primitive's topology. */
  10314. topology: number;
  10315. }
  10316. /** !#en The renderer object which provide access to render system APIs,
  10317. detailed APIs will be available progressively.
  10318. !#zh 提供基础渲染接口的渲染器对象,渲染层的基础接口将逐步开放给用户 */
  10319. export class renderer {
  10320. /** !#en The render engine is available only after cc.game.EVENT_ENGINE_INITED event.<br/>
  10321. Normally it will be inited as the webgl render engine, but in wechat open context domain,
  10322. it will be inited as the canvas render engine. Canvas render engine is no longer available for other use case since v2.0.
  10323. !#zh 基础渲染引擎对象只在 cc.game.EVENT_ENGINE_INITED 事件触发后才可获取。<br/>
  10324. 大多数情况下,它都会是 WebGL 渲染引擎实例,但是在微信开放数据域当中,它会是 Canvas 渲染引擎实例。请注意,从 2.0 开始,我们在其他平台和环境下都废弃了 Canvas 渲染器。 */
  10325. static renderEngine: any;
  10326. /** !#en The total draw call count in last rendered frame.
  10327. !#zh 上一次渲染帧所提交的渲染批次总数。 */
  10328. static drawCalls: number;
  10329. }
  10330. /** !#en the device accelerometer reports values for each axis in units of g-force.
  10331. !#zh 设备重力传感器传递的各个轴的数据。 */
  10332. export class constructor {
  10333. /**
  10334. whether enable accelerometer event
  10335. @param isEnable isEnable
  10336. */
  10337. setAccelerometerEnabled(isEnable: boolean): void;
  10338. /**
  10339. set accelerometer interval value
  10340. @param interval interval
  10341. */
  10342. setAccelerometerInterval(interval: number): void;
  10343. }
  10344. /** undefined */
  10345. export enum VerticalTextAlignment {
  10346. TOP = 0,
  10347. CENTER = 0,
  10348. BOTTOM = 0,
  10349. }
  10350. /** The base class of most of all the objects in Fireball. */
  10351. export class Object {
  10352. /** !#en The name of the object.
  10353. !#zh 该对象的名称。 */
  10354. name: string;
  10355. /** !#en
  10356. Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
  10357. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  10358. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  10359. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  10360. but this is often caused by a particular logical requirements, which is not normally required.
  10361. !#zh
  10362. 表示该对象是否可用(被 destroy 后将不可用)。<br>
  10363. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。 */
  10364. isValid: boolean;
  10365. /**
  10366. !#en
  10367. Destroy this Object, and release all its own references to other objects.<br/>
  10368. Actual object destruction will delayed until before rendering.
  10369. From the next frame, this object is not usable anymore.
  10370. You can use `cc.isValid(obj)` to check whether the object is destroyed before accessing it.
  10371. !#zh
  10372. 销毁该对象,并释放所有它对其它对象的引用。<br/>
  10373. 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
  10374. 您可以在访问对象之前使用 `cc.isValid(obj)` 来检查对象是否已被销毁。
  10375. @example
  10376. ```js
  10377. obj.destroy();
  10378. ```
  10379. */
  10380. destroy(): boolean;
  10381. }
  10382. /** Bit mask that controls object states. */
  10383. export enum Flags {
  10384. DontSave = 0,
  10385. EditorOnly = 0,
  10386. HideInHierarchy = 0,
  10387. }
  10388. /** The fullscreen API provides an easy way for web content to be presented using the user's entire screen.
  10389. It's invalid on safari, QQbrowser and android browser */
  10390. export class screen {
  10391. /**
  10392. initialize
  10393. */
  10394. init(): void;
  10395. /**
  10396. return true if it's full now.
  10397. */
  10398. fullScreen(): boolean;
  10399. /**
  10400. change the screen to full mode.
  10401. @param element element
  10402. @param onFullScreenChange onFullScreenChange
  10403. @param onFullScreenError onFullScreenError
  10404. */
  10405. requestFullScreen(element: Element, onFullScreenChange: Function, onFullScreenError: Function): void;
  10406. /**
  10407. exit the full mode.
  10408. */
  10409. exitFullScreen(): boolean;
  10410. /**
  10411. Automatically request full screen with a touch/click event
  10412. @param element element
  10413. @param onFullScreenChange onFullScreenChange
  10414. */
  10415. autoFullScreen(element: Element, onFullScreenChange: Function): void;
  10416. }
  10417. /** System variables */
  10418. export class sys {
  10419. /** English language code */
  10420. static LANGUAGE_ENGLISH: string;
  10421. /** Chinese language code */
  10422. static LANGUAGE_CHINESE: string;
  10423. /** French language code */
  10424. static LANGUAGE_FRENCH: string;
  10425. /** Italian language code */
  10426. static LANGUAGE_ITALIAN: string;
  10427. /** German language code */
  10428. static LANGUAGE_GERMAN: string;
  10429. /** Spanish language code */
  10430. static LANGUAGE_SPANISH: string;
  10431. /** Spanish language code */
  10432. static LANGUAGE_DUTCH: string;
  10433. /** Russian language code */
  10434. static LANGUAGE_RUSSIAN: string;
  10435. /** Korean language code */
  10436. static LANGUAGE_KOREAN: string;
  10437. /** Japanese language code */
  10438. static LANGUAGE_JAPANESE: string;
  10439. /** Hungarian language code */
  10440. static LANGUAGE_HUNGARIAN: string;
  10441. /** Portuguese language code */
  10442. static LANGUAGE_PORTUGUESE: string;
  10443. /** Arabic language code */
  10444. static LANGUAGE_ARABIC: string;
  10445. /** Norwegian language code */
  10446. static LANGUAGE_NORWEGIAN: string;
  10447. /** Polish language code */
  10448. static LANGUAGE_POLISH: string;
  10449. /** Turkish language code */
  10450. static LANGUAGE_TURKISH: string;
  10451. /** Ukrainian language code */
  10452. static LANGUAGE_UKRAINIAN: string;
  10453. /** Romanian language code */
  10454. static LANGUAGE_ROMANIAN: string;
  10455. /** Bulgarian language code */
  10456. static LANGUAGE_BULGARIAN: string;
  10457. /** Unknown language code */
  10458. static LANGUAGE_UNKNOWN: string;
  10459. static OS_IOS: string;
  10460. static OS_ANDROID: string;
  10461. static OS_WINDOWS: string;
  10462. static OS_MARMALADE: string;
  10463. static OS_LINUX: string;
  10464. static OS_BADA: string;
  10465. static OS_BLACKBERRY: string;
  10466. static OS_OSX: string;
  10467. static OS_WP8: string;
  10468. static OS_WINRT: string;
  10469. static OS_UNKNOWN: string;
  10470. static UNKNOWN: number;
  10471. static WIN32: number;
  10472. static LINUX: number;
  10473. static MACOS: number;
  10474. static ANDROID: number;
  10475. static IPHONE: number;
  10476. static IPAD: number;
  10477. static BLACKBERRY: number;
  10478. static NACL: number;
  10479. static EMSCRIPTEN: number;
  10480. static TIZEN: number;
  10481. static WINRT: number;
  10482. static WP8: number;
  10483. static MOBILE_BROWSER: number;
  10484. static DESKTOP_BROWSER: number;
  10485. /** Indicates whether executes in editor's window process (Electron's renderer context) */
  10486. static EDITOR_PAGE: number;
  10487. /** Indicates whether executes in editor's main process (Electron's browser context) */
  10488. static EDITOR_CORE: number;
  10489. static WECHAT_GAME: number;
  10490. static QQ_PLAY: number;
  10491. static FB_PLAYABLE_ADS: number;
  10492. static BAIDU_GAME: number;
  10493. static VIVO_GAME: number;
  10494. static OPPO_GAME: number;
  10495. static HUAWEI_GAME: number;
  10496. static XIAOMI_GAME: number;
  10497. static JKW_GAME: number;
  10498. static ALIPAY_GAME: number;
  10499. static WECHAT_GAME_SUB: number;
  10500. static BAIDU_GAME_SUB: number;
  10501. static QTT_GAME: number;
  10502. static BYTEDANCE_GAME: number;
  10503. static BYTEDANCE_GAME_SUB: number;
  10504. static LINKSURE: number;
  10505. /** BROWSER_TYPE_WECHAT */
  10506. static BROWSER_TYPE_WECHAT: string;
  10507. static BROWSER_TYPE_ANDROID: string;
  10508. static BROWSER_TYPE_IE: string;
  10509. static BROWSER_TYPE_EDGE: string;
  10510. static BROWSER_TYPE_QQ: string;
  10511. static BROWSER_TYPE_MOBILE_QQ: string;
  10512. static BROWSER_TYPE_UC: string;
  10513. /** uc third party integration. */
  10514. static BROWSER_TYPE_UCBS: string;
  10515. static BROWSER_TYPE_360: string;
  10516. static BROWSER_TYPE_BAIDU_APP: string;
  10517. static BROWSER_TYPE_BAIDU: string;
  10518. static BROWSER_TYPE_MAXTHON: string;
  10519. static BROWSER_TYPE_OPERA: string;
  10520. static BROWSER_TYPE_OUPENG: string;
  10521. static BROWSER_TYPE_MIUI: string;
  10522. static BROWSER_TYPE_FIREFOX: string;
  10523. static BROWSER_TYPE_SAFARI: string;
  10524. static BROWSER_TYPE_CHROME: string;
  10525. static BROWSER_TYPE_LIEBAO: string;
  10526. static BROWSER_TYPE_QZONE: string;
  10527. static BROWSER_TYPE_SOUGOU: string;
  10528. static BROWSER_TYPE_HUAWEI: string;
  10529. static BROWSER_TYPE_UNKNOWN: string;
  10530. /** Is native ? This is set to be true in jsb auto. */
  10531. static isNative: boolean;
  10532. /** Is web browser ? */
  10533. static isBrowser: boolean;
  10534. /**
  10535. Is webgl extension support?
  10536. @param name name
  10537. */
  10538. static glExtension(name: any): void;
  10539. /**
  10540. Get max joint matrix size for skinned mesh renderer.
  10541. */
  10542. static getMaxJointMatrixSize(): void;
  10543. /**
  10544. !#en
  10545. Returns the safe area of the screen. If the screen is not notched, the design resolution will be returned by default.
  10546. Only supported on Android, iOS and WeChat Mini Game platform.
  10547. !#zh
  10548. 返回手机屏幕安全区域,如果不是异形屏将默认返回设计分辨率尺寸。目前只支持安卓、iOS 原生平台和微信小游戏平台。
  10549. */
  10550. static getSafeAreaRect(): Rect;
  10551. /** Indicate whether system is mobile system */
  10552. static isMobile: boolean;
  10553. /** Indicate the running platform */
  10554. static platform: number;
  10555. /** Get current language iso 639-1 code.
  10556. Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc.
  10557. The actual value totally depends on results provided by destination platform. */
  10558. static languageCode: string;
  10559. /** Indicate the current language of the running system */
  10560. static language: string;
  10561. /** Indicate the running os name */
  10562. static os: string;
  10563. /** Indicate the running os version */
  10564. static osVersion: string;
  10565. /** Indicate the running os main version */
  10566. static osMainVersion: number;
  10567. /** Indicate the running browser type */
  10568. static browserType: string|void;
  10569. /** Indicate the running browser version */
  10570. static browserVersion: string|void;
  10571. /** Indicate the real pixel resolution of the whole game window */
  10572. static windowPixelResolution: Size;
  10573. /** cc.sys.localStorage is a local storage component. */
  10574. static localStorage: any;
  10575. /** The capabilities of the current platform */
  10576. static capabilities: any;
  10577. /**
  10578. !#en
  10579. Get the network type of current device, return cc.sys.NetworkType.LAN if failure.
  10580. !#zh
  10581. 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
  10582. */
  10583. static getNetworkType(): sys.NetworkType;
  10584. /**
  10585. !#en
  10586. Get the battery level of current device, return 1.0 if failure.
  10587. !#zh
  10588. 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
  10589. */
  10590. static getBatteryLevel(): number;
  10591. /**
  10592. Forces the garbage collection, only available in JSB
  10593. */
  10594. static garbageCollect(): void;
  10595. /**
  10596. Restart the JS VM, only available in JSB
  10597. */
  10598. static restartVM(): void;
  10599. /**
  10600. Check whether an object is valid,
  10601. In web engine, it will return true if the object exist
  10602. In native engine, it will return true if the JS object and the correspond native object are both valid
  10603. @param obj obj
  10604. */
  10605. static isObjectValid(obj: any): boolean;
  10606. /**
  10607. Dump system informations
  10608. */
  10609. static dump(): void;
  10610. /**
  10611. Open a url in browser
  10612. @param url url
  10613. */
  10614. static openURL(url: string): void;
  10615. /**
  10616. Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
  10617. */
  10618. static now(): number;
  10619. }
  10620. /** cc.view is the singleton object which represents the game window.<br/>
  10621. It's main task include: <br/>
  10622. - Apply the design resolution policy<br/>
  10623. - Provide interaction with the window, like resize event on web, retina display support, etc...<br/>
  10624. - Manage the game view port which can be different with the window<br/>
  10625. - Manage the content scale and translation<br/>
  10626. <br/>
  10627. Since the cc.view is a singleton, you don't need to call any constructor or create functions,<br/>
  10628. the standard way to use it is by calling:<br/>
  10629. - cc.view.methodName(); <br/> */
  10630. export class View extends EventTarget {
  10631. /**
  10632. !#en
  10633. Sets view's target-densitydpi for android mobile browser. it can be set to: <br/>
  10634. 1. cc.macro.DENSITYDPI_DEVICE, value is "device-dpi" <br/>
  10635. 2. cc.macro.DENSITYDPI_HIGH, value is "high-dpi" (default value) <br/>
  10636. 3. cc.macro.DENSITYDPI_MEDIUM, value is "medium-dpi" (browser's default value) <br/>
  10637. 4. cc.macro.DENSITYDPI_LOW, value is "low-dpi" <br/>
  10638. 5. Custom value, e.g: "480" <br/>
  10639. !#zh 设置目标内容的每英寸像素点密度。
  10640. @param densityDPI densityDPI
  10641. */
  10642. setTargetDensityDPI(densityDPI: string): void;
  10643. /**
  10644. !#en
  10645. Returns the current target-densitydpi value of cc.view.
  10646. !#zh 获取目标内容的每英寸像素点密度。
  10647. */
  10648. getTargetDensityDPI(): string;
  10649. /**
  10650. !#en
  10651. Sets whether resize canvas automatically when browser's size changed.<br/>
  10652. Useful only on web.
  10653. !#zh 设置当发现浏览器的尺寸改变时,是否自动调整 canvas 尺寸大小。
  10654. 仅在 Web 模式下有效。
  10655. @param enabled Whether enable automatic resize with browser's resize event
  10656. */
  10657. resizeWithBrowserSize(enabled: boolean): void;
  10658. /**
  10659. !#en
  10660. Sets the callback function for cc.view's resize action,<br/>
  10661. this callback will be invoked before applying resolution policy, <br/>
  10662. so you can do any additional modifications within the callback.<br/>
  10663. Useful only on web.
  10664. !#zh 设置 cc.view 调整视窗尺寸行为的回调函数,
  10665. 这个回调函数会在应用适配模式之前被调用,
  10666. 因此你可以在这个回调函数内添加任意附加改变,
  10667. 仅在 Web 平台下有效。
  10668. @param callback The callback function
  10669. */
  10670. setResizeCallback(callback: Function|void): void;
  10671. /**
  10672. !#en
  10673. Sets the orientation of the game, it can be landscape, portrait or auto.
  10674. When set it to landscape or portrait, and screen w/h ratio doesn't fit,
  10675. cc.view will automatically rotate the game canvas using CSS.
  10676. Note that this function doesn't have any effect in native,
  10677. in native, you need to set the application orientation in native project settings
  10678. !#zh 设置游戏屏幕朝向,它能够是横版,竖版或自动。
  10679. 当设置为横版或竖版,并且屏幕的宽高比例不匹配时,
  10680. cc.view 会自动用 CSS 旋转游戏场景的 canvas,
  10681. 这个方法不会对 native 部分产生任何影响,对于 native 而言,你需要在应用设置中的设置排版。
  10682. @param orientation Possible values: cc.macro.ORIENTATION_LANDSCAPE | cc.macro.ORIENTATION_PORTRAIT | cc.macro.ORIENTATION_AUTO
  10683. */
  10684. setOrientation(orientation: number): void;
  10685. /**
  10686. !#en
  10687. Sets whether the engine modify the "viewport" meta in your web page.<br/>
  10688. It's enabled by default, we strongly suggest you not to disable it.<br/>
  10689. And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden<br/>
  10690. Only useful on web
  10691. !#zh 设置引擎是否调整 viewport meta 来配合屏幕适配。
  10692. 默认设置为启动,我们强烈建议你不要将它设置为关闭。
  10693. 即使当它启动时,你仍然能够设置你的 viewport meta,它不会被覆盖。
  10694. 仅在 Web 模式下有效
  10695. @param enabled Enable automatic modification to "viewport" meta
  10696. */
  10697. adjustViewportMeta(enabled: boolean): void;
  10698. /**
  10699. !#en
  10700. Retina support is enabled by default for Apple device but disabled for other devices,<br/>
  10701. it takes effect only when you called setDesignResolutionPolicy<br/>
  10702. Only useful on web
  10703. !#zh 对于 Apple 这种支持 Retina 显示的设备上默认进行优化而其他类型设备默认不进行优化,
  10704. 它仅会在你调用 setDesignResolutionPolicy 方法时有影响。
  10705. 仅在 Web 模式下有效。
  10706. @param enabled Enable or disable retina display
  10707. */
  10708. enableRetina(enabled: boolean): void;
  10709. /**
  10710. !#en
  10711. Check whether retina display is enabled.<br/>
  10712. Only useful on web
  10713. !#zh 检查是否对 Retina 显示设备进行优化。
  10714. 仅在 Web 模式下有效。
  10715. */
  10716. isRetinaEnabled(): boolean;
  10717. /**
  10718. !#en Whether to Enable on anti-alias
  10719. !#zh 控制抗锯齿是否开启
  10720. @param enabled Enable or not anti-alias
  10721. */
  10722. enableAntiAlias(enabled: boolean): void;
  10723. /**
  10724. !#en Returns whether the current enable on anti-alias
  10725. !#zh 返回当前是否抗锯齿
  10726. */
  10727. isAntiAliasEnabled(): boolean;
  10728. /**
  10729. !#en
  10730. If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>
  10731. You can pass true as parameter to enable it and disable it by passing false.<br/>
  10732. Only useful on web
  10733. !#zh 启动时,移动端游戏会在移动端自动尝试进入全屏模式。
  10734. 你能够传入 true 为参数去启动它,用 false 参数来关闭它。
  10735. @param enabled Enable or disable auto full screen on mobile devices
  10736. */
  10737. enableAutoFullScreen(enabled: boolean): void;
  10738. /**
  10739. !#en
  10740. Check whether auto full screen is enabled.<br/>
  10741. Only useful on web
  10742. !#zh 检查自动进入全屏模式是否启动。
  10743. 仅在 Web 模式下有效。
  10744. */
  10745. isAutoFullScreenEnabled(): boolean;
  10746. /**
  10747. !#en
  10748. Returns the canvas size of the view.<br/>
  10749. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  10750. On web, it returns the size of the canvas element.
  10751. !#zh 返回视图中 canvas 的尺寸。
  10752. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  10753. 在 Web 平台下,它返回 canvas 元素尺寸。
  10754. */
  10755. getCanvasSize(): Size;
  10756. /**
  10757. !#en
  10758. Returns the frame size of the view.<br/>
  10759. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  10760. On web, it returns the size of the canvas's outer DOM element.
  10761. !#zh 返回视图中边框尺寸。
  10762. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  10763. 在 web 平台下,它返回 canvas 元素的外层 DOM 元素尺寸。
  10764. */
  10765. getFrameSize(): Size;
  10766. /**
  10767. !#en
  10768. On native, it sets the frame size of view.<br/>
  10769. On web, it sets the size of the canvas's outer DOM element.
  10770. !#zh 在 native 平台下,设置视图框架尺寸。
  10771. 在 web 平台下,设置 canvas 外层 DOM 元素尺寸。
  10772. @param width width
  10773. @param height height
  10774. */
  10775. setFrameSize(width: number, height: number): void;
  10776. /**
  10777. !#en
  10778. Returns the visible area size of the view port.
  10779. !#zh 返回视图窗口可见区域尺寸。
  10780. */
  10781. getVisibleSize(): Size;
  10782. /**
  10783. !#en
  10784. Returns the visible area size of the view port.
  10785. !#zh 返回视图窗口可见区域像素尺寸。
  10786. */
  10787. getVisibleSizeInPixel(): Size;
  10788. /**
  10789. !#en
  10790. Returns the visible origin of the view port.
  10791. !#zh 返回视图窗口可见区域原点。
  10792. */
  10793. getVisibleOrigin(): Vec2;
  10794. /**
  10795. !#en
  10796. Returns the visible origin of the view port.
  10797. !#zh 返回视图窗口可见区域像素原点。
  10798. */
  10799. getVisibleOriginInPixel(): Vec2;
  10800. /**
  10801. !#en
  10802. Returns the current resolution policy
  10803. !#zh 返回当前分辨率方案
  10804. */
  10805. getResolutionPolicy(): ResolutionPolicy;
  10806. /**
  10807. !#en
  10808. Sets the current resolution policy
  10809. !#zh 设置当前分辨率模式
  10810. @param resolutionPolicy resolutionPolicy
  10811. */
  10812. setResolutionPolicy(resolutionPolicy: ResolutionPolicy|number): void;
  10813. /**
  10814. !#en
  10815. Sets the resolution policy with designed view size in points.<br/>
  10816. The resolution policy include: <br/>
  10817. [1] ResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched.<br/>
  10818. [2] ResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut.<br/>
  10819. [3] ResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.<br/>
  10820. [4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width<br/>
  10821. [5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height<br/>
  10822. [cc.ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by cc.ResolutionPolicy<br/>
  10823. !#zh 通过设置设计分辨率和匹配模式来进行游戏画面的屏幕适配。
  10824. @param width Design resolution width.
  10825. @param height Design resolution height.
  10826. @param resolutionPolicy The resolution policy desired
  10827. */
  10828. setDesignResolutionSize(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  10829. /**
  10830. !#en
  10831. Returns the designed size for the view.
  10832. Default resolution size is the same as 'getFrameSize'.
  10833. !#zh 返回视图的设计分辨率。
  10834. 默认下分辨率尺寸同 `getFrameSize` 方法相同
  10835. */
  10836. getDesignResolutionSize(): Size;
  10837. /**
  10838. !#en
  10839. Sets the container to desired pixel resolution and fit the game content to it.
  10840. This function is very useful for adaptation in mobile browsers.
  10841. In some HD android devices, the resolution is very high, but its browser performance may not be very good.
  10842. In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.
  10843. But this API can be helpful to set a desired pixel resolution which is in between.
  10844. This API will do the following:
  10845. 1. Set viewport's width to the desired width in pixel
  10846. 2. Set body width to the exact pixel resolution
  10847. 3. The resolution policy will be reset with designed view size in points.
  10848. !#zh 设置容器(container)需要的像素分辨率并且适配相应分辨率的游戏内容。
  10849. @param width Design resolution width.
  10850. @param height Design resolution height.
  10851. @param resolutionPolicy The resolution policy desired
  10852. */
  10853. setRealPixelResolution(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  10854. /**
  10855. !#en
  10856. Sets view port rectangle with points.
  10857. !#zh 用设计分辨率下的点尺寸来设置视窗。
  10858. @param x x
  10859. @param y y
  10860. @param w width
  10861. @param h height
  10862. */
  10863. setViewportInPoints(x: number, y: number, w: number, h: number): void;
  10864. /**
  10865. !#en
  10866. Sets Scissor rectangle with points.
  10867. !#zh 用设计分辨率下的点的尺寸来设置 scissor 剪裁区域。
  10868. @param x x
  10869. @param y y
  10870. @param w w
  10871. @param h h
  10872. */
  10873. setScissorInPoints(x: number, y: number, w: number, h: number): void;
  10874. /**
  10875. !#en
  10876. Returns whether GL_SCISSOR_TEST is enable
  10877. !#zh 检查 scissor 是否生效。
  10878. */
  10879. isScissorEnabled(): boolean;
  10880. /**
  10881. !#en
  10882. Returns the current scissor rectangle
  10883. !#zh 返回当前的 scissor 剪裁区域。
  10884. */
  10885. getScissorRect(): Rect;
  10886. /**
  10887. !#en
  10888. Returns the view port rectangle.
  10889. !#zh 返回视窗剪裁区域。
  10890. */
  10891. getViewportRect(): Rect;
  10892. /**
  10893. !#en
  10894. Returns scale factor of the horizontal direction (X axis).
  10895. !#zh 返回横轴的缩放比,这个缩放比是将画布像素分辨率放到设计分辨率的比例。
  10896. */
  10897. getScaleX(): number;
  10898. /**
  10899. !#en
  10900. Returns scale factor of the vertical direction (Y axis).
  10901. !#zh 返回纵轴的缩放比,这个缩放比是将画布像素分辨率缩放到设计分辨率的比例。
  10902. */
  10903. getScaleY(): number;
  10904. /**
  10905. !#en
  10906. Returns device pixel ratio for retina display.
  10907. !#zh 返回设备或浏览器像素比例。
  10908. */
  10909. getDevicePixelRatio(): number;
  10910. /**
  10911. !#en
  10912. Returns the real location in view for a translation based on a related position
  10913. !#zh 将屏幕坐标转换为游戏视图下的坐标。
  10914. @param tx The X axis translation
  10915. @param ty The Y axis translation
  10916. @param relatedPos The related position object including "left", "top", "width", "height" informations
  10917. */
  10918. convertToLocationInView(tx: number, ty: number, relatedPos: any): Vec2;
  10919. }
  10920. /** <p>cc.game.containerStrategy class is the root strategy class of container's scale strategy,
  10921. it controls the behavior of how to scale the cc.game.container and cc.game.canvas object</p> */
  10922. export class ContainerStrategy {
  10923. /**
  10924. !#en
  10925. Manipulation before appling the strategy
  10926. !#zh 在应用策略之前的操作
  10927. @param view The target view
  10928. */
  10929. preApply(view: View): void;
  10930. /**
  10931. !#en
  10932. Function to apply this strategy
  10933. !#zh 策略应用方法
  10934. @param view view
  10935. @param designedResolution designedResolution
  10936. */
  10937. apply(view: View, designedResolution: Size): void;
  10938. /**
  10939. !#en
  10940. Manipulation after applying the strategy
  10941. !#zh 策略调用之后的操作
  10942. @param view The target view
  10943. */
  10944. postApply(view: View): void;
  10945. }
  10946. /** <p>cc.ContentStrategy class is the root strategy class of content's scale strategy,
  10947. it controls the behavior of how to scale the scene and setup the viewport for the game</p> */
  10948. export class ContentStrategy {
  10949. /**
  10950. !#en
  10951. Manipulation before applying the strategy
  10952. !#zh 策略应用前的操作
  10953. @param view The target view
  10954. */
  10955. preApply(view: View): void;
  10956. /**
  10957. !#en Function to apply this strategy
  10958. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10959. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10960. !#zh 调用策略方法
  10961. @param view view
  10962. @param designedResolution designedResolution
  10963. */
  10964. apply(view: View, designedResolution: Size): any;
  10965. /**
  10966. !#en
  10967. Manipulation after applying the strategy
  10968. !#zh 策略调用之后的操作
  10969. @param view The target view
  10970. */
  10971. postApply(view: View): void;
  10972. }
  10973. /** undefined */
  10974. export class EqualToFrame extends ContainerStrategy {
  10975. }
  10976. /** undefined */
  10977. export class ProportionalToFrame extends ContainerStrategy {
  10978. }
  10979. /** undefined */
  10980. export class EqualToWindow extends EqualToFrame {
  10981. }
  10982. /** undefined */
  10983. export class ProportionalToWindow extends ProportionalToFrame {
  10984. }
  10985. /** undefined */
  10986. export class OriginalContainer extends ContainerStrategy {
  10987. }
  10988. /** <p>cc.ResolutionPolicy class is the root strategy class of scale strategy,
  10989. its main task is to maintain the compatibility with Cocos2d-x</p> */
  10990. export class ResolutionPolicy {
  10991. /**
  10992. @param containerStg The container strategy
  10993. @param contentStg The content strategy
  10994. */
  10995. constructor(containerStg: ContainerStrategy, contentStg: ContentStrategy);
  10996. /**
  10997. !#en Manipulation before applying the resolution policy
  10998. !#zh 策略应用前的操作
  10999. @param view The target view
  11000. */
  11001. preApply(view: View): void;
  11002. /**
  11003. !#en Function to apply this resolution policy
  11004. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  11005. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  11006. !#zh 调用策略方法
  11007. @param view The target view
  11008. @param designedResolution The user defined design resolution
  11009. */
  11010. apply(view: View, designedResolution: Size): any;
  11011. /**
  11012. !#en Manipulation after appyling the strategy
  11013. !#zh 策略应用之后的操作
  11014. @param view The target view
  11015. */
  11016. postApply(view: View): void;
  11017. /**
  11018. !#en
  11019. Setup the container's scale strategy
  11020. !#zh 设置容器的适配策略
  11021. @param containerStg containerStg
  11022. */
  11023. setContainerStrategy(containerStg: ContainerStrategy): void;
  11024. /**
  11025. !#en
  11026. Setup the content's scale strategy
  11027. !#zh 设置内容的适配策略
  11028. @param contentStg contentStg
  11029. */
  11030. setContentStrategy(contentStg: ContentStrategy): void;
  11031. /** The entire application is visible in the specified area without trying to preserve the original aspect ratio.<br/>
  11032. Distortion can occur, and the application may appear stretched or compressed. */
  11033. static EXACT_FIT: number;
  11034. /** The entire application fills the specified area, without distortion but possibly with some cropping,<br/>
  11035. while maintaining the original aspect ratio of the application. */
  11036. static NO_BORDER: number;
  11037. /** The entire application is visible in the specified area without distortion while maintaining the original<br/>
  11038. aspect ratio of the application. Borders can appear on two sides of the application. */
  11039. static SHOW_ALL: number;
  11040. /** The application takes the height of the design resolution size and modifies the width of the internal<br/>
  11041. canvas so that it fits the aspect ratio of the device<br/>
  11042. no distortion will occur however you must make sure your application works on different<br/>
  11043. aspect ratios */
  11044. static FIXED_HEIGHT: number;
  11045. /** The application takes the width of the design resolution size and modifies the height of the internal<br/>
  11046. canvas so that it fits the aspect ratio of the device<br/>
  11047. no distortion will occur however you must make sure your application works on different<br/>
  11048. aspect ratios */
  11049. static FIXED_WIDTH: number;
  11050. /** Unknow policy */
  11051. static UNKNOWN: number;
  11052. }
  11053. /** cc.visibleRect is a singleton object which defines the actual visible rect of the current view,
  11054. it should represent the same rect as cc.view.getViewportRect() */
  11055. export class visibleRect {
  11056. /**
  11057. initialize
  11058. @param visibleRect visibleRect
  11059. */
  11060. static init(visibleRect: Rect): void;
  11061. /** Top left coordinate of the screen related to the game scene. */
  11062. static topLeft: Vec2;
  11063. /** Top right coordinate of the screen related to the game scene. */
  11064. static topRight: Vec2;
  11065. /** Top center coordinate of the screen related to the game scene. */
  11066. static top: Vec2;
  11067. /** Bottom left coordinate of the screen related to the game scene. */
  11068. static bottomLeft: Vec2;
  11069. /** Bottom right coordinate of the screen related to the game scene. */
  11070. static bottomRight: Vec2;
  11071. /** Bottom center coordinate of the screen related to the game scene. */
  11072. static bottom: Vec2;
  11073. /** Center coordinate of the screen related to the game scene. */
  11074. static center: Vec2;
  11075. /** Left center coordinate of the screen related to the game scene. */
  11076. static left: Vec2;
  11077. /** Right center coordinate of the screen related to the game scene. */
  11078. static right: Vec2;
  11079. /** Width of the screen. */
  11080. static width: number;
  11081. /** Height of the screen. */
  11082. static height: number;
  11083. }
  11084. /** !#en The callbacks invoker to handle and invoke callbacks by key.
  11085. !#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。 */
  11086. export class CallbacksInvoker {
  11087. /**
  11088. !#zh
  11089. 检查指定事件是否已注册回调。
  11090. !#en
  11091. Check if the specified key has any registered callback. If a callback is also specified,
  11092. it will only return true if the callback is registered.
  11093. @param key key
  11094. @param callback callback
  11095. @param target target
  11096. */
  11097. hasEventListener(key: string, callback?: Function, target?: any): boolean;
  11098. /**
  11099. !#zh
  11100. 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
  11101. !#en
  11102. Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  11103. @param keyOrTarget The event key to be removed or the target to be removed
  11104. */
  11105. removeAll(keyOrTarget: string|any): void;
  11106. /**
  11107. !#zh
  11108. 删除之前与同类型,回调,目标注册的回调。
  11109. @param key key
  11110. @param callback callback
  11111. @param target target
  11112. */
  11113. off(key: string, callback: Function, target?: any): void;
  11114. /**
  11115. !#en
  11116. Trigger an event directly with the event name and necessary arguments.
  11117. !#zh
  11118. 通过事件名发送自定义事件
  11119. @param key event type
  11120. @param arg1 First argument
  11121. @param arg2 Second argument
  11122. @param arg3 Third argument
  11123. @param arg4 Fourth argument
  11124. @param arg5 Fifth argument
  11125. @example
  11126. ```js
  11127. eventTarget.emit('fire', event);
  11128. eventTarget.emit('fire', message, emitter);
  11129. ```
  11130. */
  11131. emit(key: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  11132. }
  11133. /** !#en Contains information collected during deserialization
  11134. !#zh 包含反序列化时的一些信息 */
  11135. export class Details {
  11136. /** the obj list whose field needs to load asset by uuid */
  11137. uuidObjList: any[];
  11138. /** the corresponding field name which referenced to the asset */
  11139. uuidPropList: (String|Number)[];
  11140. /** list of the depends assets' uuid */
  11141. uuidList: string[];
  11142. /**
  11143. @param data data
  11144. */
  11145. init(data: any): void;
  11146. reset(): void;
  11147. /**
  11148. @param obj obj
  11149. @param propName propName
  11150. @param uuid uuid
  11151. */
  11152. push(obj: any, propName: string, uuid: string): void;
  11153. /** list of the depends assets' uuid */
  11154. uuidList: string[];
  11155. /** the obj list whose field needs to load asset by uuid */
  11156. uuidObjList: any[];
  11157. /** the corresponding field name which referenced to the asset */
  11158. uuidPropList: string[];
  11159. reset(): void;
  11160. /**
  11161. @param obj obj
  11162. @param propName propName
  11163. @param uuid uuid
  11164. */
  11165. push(obj: any, propName: string, uuid: string): void;
  11166. }
  11167. /** !#en The module provides utilities for working with file and directory paths
  11168. !#zh 用于处理文件与目录的路径的模块 */
  11169. export class path {
  11170. /**
  11171. !#en Join strings to be a path.
  11172. !#zh 拼接字符串为 Path
  11173. @example
  11174. ```js
  11175. ------------------------------
  11176. cc.path.join("a", "b.png"); //-->"a/b.png"
  11177. cc.path.join("a", "b", "c.png"); //-->"a/b/c.png"
  11178. cc.path.join("a", "b"); //-->"a/b"
  11179. cc.path.join("a", "b", "/"); //-->"a/b/"
  11180. cc.path.join("a", "b/", "/"); //-->"a/b/"
  11181. ```
  11182. */
  11183. static join(): string;
  11184. /**
  11185. !#en Get the ext name of a path including '.', like '.png'.
  11186. !#zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
  11187. @param pathStr pathStr
  11188. @example
  11189. ```js
  11190. ---------------------------
  11191. cc.path.extname("a/b.png"); //-->".png"
  11192. cc.path.extname("a/b.png?a=1&b=2"); //-->".png"
  11193. cc.path.extname("a/b"); //-->null
  11194. cc.path.extname("a/b?a=1&b=2"); //-->null
  11195. ```
  11196. */
  11197. static extname(pathStr: string): any;
  11198. /**
  11199. !#en Get the main name of a file name
  11200. !#zh 获取文件名的主名称
  11201. @param fileName fileName
  11202. */
  11203. static mainFileName(fileName: string): string;
  11204. /**
  11205. !#en Get the file name of a file path.
  11206. !#zh 获取文件路径的文件名。
  11207. @param pathStr pathStr
  11208. @param extname extname
  11209. @example
  11210. ```js
  11211. ---------------------------------
  11212. cc.path.basename("a/b.png"); //-->"b.png"
  11213. cc.path.basename("a/b.png?a=1&b=2"); //-->"b.png"
  11214. cc.path.basename("a/b.png", ".png"); //-->"b"
  11215. cc.path.basename("a/b.png?a=1&b=2", ".png"); //-->"b"
  11216. cc.path.basename("a/b.png", ".txt"); //-->"b.png"
  11217. ```
  11218. */
  11219. static basename(pathStr: string, extname?: string): any;
  11220. /**
  11221. !#en Get dirname of a file path.
  11222. !#zh 获取文件路径的目录名。
  11223. @param pathStr pathStr
  11224. @example
  11225. ```js
  11226. ---------------------------------
  11227. * unix
  11228. cc.path.driname("a/b/c.png"); //-->"a/b"
  11229. cc.path.driname("a/b/c.png?a=1&b=2"); //-->"a/b"
  11230. cc.path.dirname("a/b/"); //-->"a/b"
  11231. cc.path.dirname("c.png"); //-->""
  11232. * windows
  11233. cc.path.driname("a\\b\\c.png"); //-->"a\b"
  11234. cc.path.driname("a\\b\\c.png?a=1&b=2"); //-->"a\b"
  11235. ```
  11236. */
  11237. static dirname(pathStr: string): any;
  11238. /**
  11239. !#en Change extname of a file path.
  11240. !#zh 更改文件路径的扩展名。
  11241. @param pathStr pathStr
  11242. @param extname extname
  11243. @example
  11244. ```js
  11245. ---------------------------------
  11246. cc.path.changeExtname("a/b.png", ".plist"); //-->"a/b.plist"
  11247. cc.path.changeExtname("a/b.png?a=1&b=2", ".plist"); //-->"a/b.plist?a=1&b=2"
  11248. ```
  11249. */
  11250. static changeExtname(pathStr: string, extname?: string): string;
  11251. }
  11252. /** !#en
  11253. AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.<br/>
  11254. !#zh
  11255. AffineTransform 类代表一个仿射变换矩阵。它基本上是由平移旋转,缩放转变所组成。<br/> */
  11256. export class AffineTransform {
  11257. /**
  11258. !#en Create a AffineTransform object with all contents in the matrix.
  11259. !#zh 用在矩阵中的所有内容创建一个 AffineTransform 对象。
  11260. @param a a
  11261. @param b b
  11262. @param c c
  11263. @param d d
  11264. @param tx tx
  11265. @param ty ty
  11266. */
  11267. static create(a: number, b: number, c: number, d: number, tx: number, ty: number): AffineTransform;
  11268. /**
  11269. !#en
  11270. Create a identity transformation matrix: <br/>
  11271. [ 1, 0, 0, <br/>
  11272. 0, 1, 0 ]
  11273. !#zh
  11274. 单位矩阵:<br/>
  11275. [ 1, 0, 0, <br/>
  11276. 0, 1, 0 ]
  11277. */
  11278. static identity(): AffineTransform;
  11279. /**
  11280. !#en Clone a AffineTransform object from the specified transform.
  11281. !#zh 克隆指定的 AffineTransform 对象。
  11282. @param t t
  11283. */
  11284. static clone(t: AffineTransform): AffineTransform;
  11285. /**
  11286. !#en
  11287. Concatenate a transform matrix to another
  11288. The results are reflected in the out affine transform
  11289. out = t1 * t2
  11290. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  11291. !#zh
  11292. 拼接两个矩阵,将结果保存到 out 矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  11293. out = t1 * t2
  11294. @param out Out object to store the concat result
  11295. @param t1 The first transform object.
  11296. @param t2 The transform object to concatenate.
  11297. */
  11298. static concat(out: AffineTransform, t1: AffineTransform, t2: AffineTransform): AffineTransform;
  11299. /**
  11300. !#en Get the invert transform of an AffineTransform object.
  11301. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  11302. !#zh 求逆矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  11303. @param out out
  11304. @param t t
  11305. */
  11306. static invert(out: AffineTransform, t: AffineTransform): AffineTransform;
  11307. /**
  11308. !#en Get an AffineTransform object from a given matrix 4x4.
  11309. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  11310. !#zh 从一个 4x4 Matrix 获取 AffineTransform 对象。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  11311. @param out out
  11312. @param mat mat
  11313. */
  11314. static invert(out: AffineTransform, mat: Mat4): AffineTransform;
  11315. /**
  11316. !#en Apply the affine transformation on a point.
  11317. This function is memory free, you should create the output Vec2 by yourself and manage its memory.
  11318. !#zh 对一个点应用矩阵变换。这个函数不创建任何内存,你需要先创建一个 Vec2 对象用来存储结果,并作为第一个参数传入函数。
  11319. @param out The output point to store the result
  11320. @param point Point to apply transform or x.
  11321. @param transOrY transform matrix or y.
  11322. @param t transform matrix.
  11323. */
  11324. static transformVec2(out: Vec2, point: Vec2|number, transOrY: AffineTransform|number, t?: AffineTransform): Vec2;
  11325. /**
  11326. !#en Apply the affine transformation on a size.
  11327. This function is memory free, you should create the output Size by yourself and manage its memory.
  11328. !#zh 应用仿射变换矩阵到 Size 上。这个函数不创建任何内存,你需要先创建一个 Size 对象用来存储结果,并作为第一个参数传入函数。
  11329. @param out The output point to store the result
  11330. @param size size
  11331. @param t t
  11332. */
  11333. static transformSize(out: Size, size: Size, t: AffineTransform): Size;
  11334. /**
  11335. !#en Apply the affine transformation on a rect.
  11336. This function is memory free, you should create the output Rect by yourself and manage its memory.
  11337. !#zh 应用仿射变换矩阵到 Rect 上。这个函数不创建任何内存,你需要先创建一个 Rect 对象用来存储结果,并作为第一个参数传入函数。
  11338. @param out out
  11339. @param rect rect
  11340. @param anAffineTransform anAffineTransform
  11341. */
  11342. static transformRect(out: Rect, rect: Rect, anAffineTransform: AffineTransform): Rect;
  11343. /**
  11344. !#en Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
  11345. This function is memory free, you should create the output vectors by yourself and manage their memory.
  11346. !#zh 应用仿射变换矩阵到 Rect 上, 并转换为有向包围盒。这个函数不创建任何内存,你需要先创建包围盒的四个 Vector 对象用来存储结果,并作为前四个参数传入函数。
  11347. @param out_bl out_bl
  11348. @param out_tl out_tl
  11349. @param out_tr out_tr
  11350. @param out_br out_br
  11351. @param rect rect
  11352. @param anAffineTransform anAffineTransform
  11353. */
  11354. static transformObb(out_bl: Vec2, out_tl: Vec2, out_tr: Vec2, out_br: Vec2, rect: Rect, anAffineTransform: AffineTransform): void;
  11355. }
  11356. /** A base node for CCNode, it will:
  11357. - maintain scene hierarchy and active logic
  11358. - notifications if some properties changed
  11359. - define some interfaces shares between CCNode
  11360. - define machanisms for Enity Component Systems
  11361. - define prefab and serialize functions */
  11362. export class _BaseNode extends Object implements EventTarget {
  11363. /** !#en Name of node.
  11364. !#zh 该节点名称。 */
  11365. name: string;
  11366. /** !#en The uuid for editor, will be stripped before building project.
  11367. !#zh 主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。 */
  11368. uuid: string;
  11369. /** !#en All children nodes.
  11370. !#zh 节点的所有子节点。 */
  11371. children: Node[];
  11372. /** !#en All children nodes.
  11373. !#zh 节点的子节点数量。 */
  11374. childrenCount: number;
  11375. /** !#en
  11376. The local active state of this node.<br/>
  11377. Note that a Node may be inactive because a parent is not active, even if this returns true.<br/>
  11378. Use {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.
  11379. !#zh
  11380. 当前节点的自身激活状态。<br/>
  11381. 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。<br/>
  11382. 如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}}。 */
  11383. active: boolean;
  11384. /** !#en Indicates whether this node is active in the scene.
  11385. !#zh 表示此节点是否在场景中激活。 */
  11386. activeInHierarchy: boolean;
  11387. /**
  11388. @param name name
  11389. */
  11390. constructor(name?: string);
  11391. /** !#en The parent of the node.
  11392. !#zh 该节点的父节点。 */
  11393. parent: Node;
  11394. /**
  11395. !#en Get parent of the node.
  11396. !#zh 获取该节点的父节点。
  11397. @example
  11398. ```js
  11399. var parent = this.node.getParent();
  11400. ```
  11401. */
  11402. getParent(): Node;
  11403. /**
  11404. !#en Set parent of the node.
  11405. !#zh 设置该节点的父节点。
  11406. @param value value
  11407. @example
  11408. ```js
  11409. node.setParent(newNode);
  11410. ```
  11411. */
  11412. setParent(value: Node): void;
  11413. /**
  11414. !#en
  11415. Properties configuration function <br/>
  11416. All properties in attrs will be set to the node, <br/>
  11417. when the setter of the node is available, <br/>
  11418. the property will be set via setter function.<br/>
  11419. !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
  11420. @param attrs Properties to be set to node
  11421. @example
  11422. ```js
  11423. var attrs = { key: 0, num: 100 };
  11424. node.attr(attrs);
  11425. ```
  11426. */
  11427. attr(attrs: any): void;
  11428. /**
  11429. !#en Returns a child from the container given its uuid.
  11430. !#zh 通过 uuid 获取节点的子节点。
  11431. @param uuid The uuid to find the child node.
  11432. @example
  11433. ```js
  11434. var child = node.getChildByUuid(uuid);
  11435. ```
  11436. */
  11437. getChildByUuid(uuid: string): Node;
  11438. /**
  11439. !#en Returns a child from the container given its name.
  11440. !#zh 通过名称获取节点的子节点。
  11441. @param name A name to find the child node.
  11442. @example
  11443. ```js
  11444. var child = node.getChildByName("Test Node");
  11445. ```
  11446. */
  11447. getChildByName(name: string): Node;
  11448. /**
  11449. !#en
  11450. Inserts a child to the node at a specified index.
  11451. !#zh
  11452. 插入子节点到指定位置
  11453. @param child the child node to be inserted
  11454. @param siblingIndex the sibling index to place the child in
  11455. @example
  11456. ```js
  11457. node.insertChild(child, 2);
  11458. ```
  11459. */
  11460. insertChild(child: Node, siblingIndex: number): void;
  11461. /**
  11462. !#en Get the sibling index.
  11463. !#zh 获取同级索引。
  11464. @example
  11465. ```js
  11466. var index = node.getSiblingIndex();
  11467. ```
  11468. */
  11469. getSiblingIndex(): number;
  11470. /**
  11471. !#en Set the sibling index of this node.
  11472. !#zh 设置节点同级索引。
  11473. @param index index
  11474. @example
  11475. ```js
  11476. node.setSiblingIndex(1);
  11477. ```
  11478. */
  11479. setSiblingIndex(index: number): void;
  11480. /**
  11481. !#en Walk though the sub children tree of the current node.
  11482. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children.
  11483. This function call is not recursive, it's based on stack.
  11484. Please don't walk any other node inside the walk process.
  11485. !#zh 遍历该节点的子树里的所有节点并按规则执行回调函数。
  11486. 对子树中的所有节点,包含当前节点,会执行两次回调,prefunc 会在访问它的子节点之前调用,postfunc 会在访问所有子节点之后调用。
  11487. 这个函数的实现不是基于递归的,而是基于栈展开递归的方式。
  11488. 请不要在 walk 过程中对任何其他的节点嵌套执行 walk。
  11489. @param prefunc The callback to process node when reach the node for the first time
  11490. @param postfunc The callback to process node when re-visit the node after walked all children in its sub tree
  11491. @example
  11492. ```js
  11493. node.walk(function (target) {
  11494. console.log('Walked through node ' + target.name + ' for the first time');
  11495. }, function (target) {
  11496. console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
  11497. });
  11498. ```
  11499. */
  11500. walk(prefunc: (target: _BaseNode) => void, postfunc: (target: _BaseNode) => void): void;
  11501. /**
  11502. !#en
  11503. Remove itself from its parent node. If cleanup is `true`, then also remove all events and actions. <br/>
  11504. If the cleanup parameter is not passed, it will force a cleanup, so it is recommended that you always pass in the `false` parameter when calling this API.<br/>
  11505. If the node orphan, then nothing happens.
  11506. !#zh
  11507. 从父节点中删除该节点。如果不传入 cleanup 参数或者传入 `true`,那么这个节点上所有绑定的事件、action 都会被删除。<br/>
  11508. 因此建议调用这个 API 时总是传入 `false` 参数。<br/>
  11509. 如果这个节点是一个孤节点,那么什么都不会发生。
  11510. @param cleanup true if all actions and callbacks on this node should be removed, false otherwise.
  11511. @example
  11512. ```js
  11513. node.removeFromParent();
  11514. node.removeFromParent(false);
  11515. ```
  11516. */
  11517. removeFromParent(cleanup?: boolean): void;
  11518. /**
  11519. !#en
  11520. Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
  11521. If the cleanup parameter is not passed, it will force a cleanup. <br/>
  11522. "remove" logic MUST only be on this method <br/>
  11523. If a class wants to extend the 'removeChild' behavior it only needs <br/>
  11524. to override this method.
  11525. !#zh
  11526. 移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  11527. 如果 cleanup 参数不传入,默认为 true 表示清理。<br/>
  11528. @param child The child node which will be removed.
  11529. @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
  11530. @example
  11531. ```js
  11532. node.removeChild(newNode);
  11533. node.removeChild(newNode, false);
  11534. ```
  11535. */
  11536. removeChild(child: Node, cleanup?: boolean): void;
  11537. /**
  11538. !#en
  11539. Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
  11540. If the cleanup parameter is not passed, it will force a cleanup.
  11541. !#zh
  11542. 移除节点所有的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  11543. 如果 cleanup 参数不传入,默认为 true 表示清理。
  11544. @param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
  11545. @example
  11546. ```js
  11547. node.removeAllChildren();
  11548. node.removeAllChildren(false);
  11549. ```
  11550. */
  11551. removeAllChildren(cleanup?: boolean): void;
  11552. /**
  11553. !#en Is this node a child of the given node?
  11554. !#zh 是否是指定节点的子节点?
  11555. @param parent parent
  11556. @example
  11557. ```js
  11558. node.isChildOf(newNode);
  11559. ```
  11560. */
  11561. isChildOf(parent: Node): boolean;
  11562. /**
  11563. !#en
  11564. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  11565. You can also get component in the node by passing in the name of the script.
  11566. !#zh
  11567. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  11568. 传入参数也可以是脚本的名称。
  11569. @param typeOrClassName typeOrClassName
  11570. @example
  11571. ```js
  11572. // get sprite component
  11573. var sprite = node.getComponent(cc.Sprite);
  11574. // get custom test class
  11575. var test = node.getComponent("Test");
  11576. ```
  11577. */
  11578. getComponent<T extends Component>(type: {prototype: T}): T;
  11579. getComponent(className: string): any;
  11580. /**
  11581. !#en Returns all components of supplied type in the node.
  11582. !#zh 返回节点上指定类型的所有组件。
  11583. @param typeOrClassName typeOrClassName
  11584. @example
  11585. ```js
  11586. var sprites = node.getComponents(cc.Sprite);
  11587. var tests = node.getComponents("Test");
  11588. ```
  11589. */
  11590. getComponents<T extends Component>(type: {prototype: T}): T[];
  11591. getComponents(className: string): any[];
  11592. /**
  11593. !#en Returns the component of supplied type in any of its children using depth first search.
  11594. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  11595. @param typeOrClassName typeOrClassName
  11596. @example
  11597. ```js
  11598. var sprite = node.getComponentInChildren(cc.Sprite);
  11599. var Test = node.getComponentInChildren("Test");
  11600. ```
  11601. */
  11602. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  11603. getComponentInChildren(className: string): any;
  11604. /**
  11605. !#en Returns all components of supplied type in self or any of its children.
  11606. !#zh 递归查找自身或所有子节点中指定类型的组件
  11607. @param typeOrClassName typeOrClassName
  11608. @example
  11609. ```js
  11610. var sprites = node.getComponentsInChildren(cc.Sprite);
  11611. var tests = node.getComponentsInChildren("Test");
  11612. ```
  11613. */
  11614. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  11615. getComponentsInChildren(className: string): any[];
  11616. /**
  11617. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  11618. !#zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  11619. @param typeOrClassName The constructor or the class name of the component to add
  11620. @example
  11621. ```js
  11622. var sprite = node.addComponent(cc.Sprite);
  11623. var test = node.addComponent("Test");
  11624. ```
  11625. */
  11626. addComponent<T extends Component>(type: {new(): T}): T;
  11627. addComponent(className: string): any;
  11628. /**
  11629. !#en
  11630. Removes a component identified by the given name or removes the component object given.
  11631. You can also use component.destroy() if you already have the reference.
  11632. !#zh
  11633. 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  11634. 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  11635. @param component The need remove component.
  11636. @example
  11637. ```js
  11638. node.removeComponent(cc.Sprite);
  11639. var Test = require("Test");
  11640. node.removeComponent(Test);
  11641. ```
  11642. */
  11643. removeComponent(component: string|Function|Component): void;
  11644. /**
  11645. !#en
  11646. Destroy all children from the node, and release all their own references to other objects.<br/>
  11647. Actual destruct operation will delayed until before rendering.
  11648. !#zh
  11649. 销毁所有子节点,并释放所有它们对其它对象的引用。<br/>
  11650. 实际销毁操作会延迟到当前帧渲染前执行。
  11651. @example
  11652. ```js
  11653. node.destroyAllChildren();
  11654. ```
  11655. */
  11656. destroyAllChildren(): void;
  11657. /**
  11658. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  11659. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  11660. @param type The type of event.
  11661. */
  11662. hasEventListener(type: string): boolean;
  11663. /**
  11664. !#en
  11665. Register an callback of a specific event type on the EventTarget.
  11666. This type of event should be triggered via `emit`.
  11667. !#zh
  11668. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  11669. @param type A string representing the event type to listen for.
  11670. @param callback The callback that will be invoked when the event is dispatched.
  11671. The callback is ignored if it is a duplicate (the callbacks are unique).
  11672. @param target The target (this object) to invoke the callback, can be null
  11673. @example
  11674. ```js
  11675. eventTarget.on('fire', function () {
  11676. cc.log("fire in the hole");
  11677. }, node);
  11678. ```
  11679. */
  11680. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  11681. /**
  11682. !#en
  11683. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  11684. if only type is passed as parameter, all listeners registered with that type will be removed.
  11685. !#zh
  11686. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  11687. @param type A string representing the event type being removed.
  11688. @param callback The callback to remove.
  11689. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  11690. @example
  11691. ```js
  11692. // register fire eventListener
  11693. var callback = eventTarget.on('fire', function () {
  11694. cc.log("fire in the hole");
  11695. }, target);
  11696. // remove fire event listener
  11697. eventTarget.off('fire', callback, target);
  11698. // remove all fire event listeners
  11699. eventTarget.off('fire');
  11700. ```
  11701. */
  11702. off(type: string, callback?: Function, target?: any): void;
  11703. /**
  11704. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  11705. This is not for removing all listeners in the current event target,
  11706. and this is not for removing all listeners the target parameter have registered.
  11707. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  11708. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  11709. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  11710. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  11711. @param target The target to be searched for all related listeners
  11712. */
  11713. targetOff(target: any): void;
  11714. /**
  11715. !#en
  11716. Register an callback of a specific event type on the EventTarget,
  11717. the callback will remove itself after the first time it is triggered.
  11718. !#zh
  11719. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  11720. @param type A string representing the event type to listen for.
  11721. @param callback The callback that will be invoked when the event is dispatched.
  11722. The callback is ignored if it is a duplicate (the callbacks are unique).
  11723. @param target The target (this object) to invoke the callback, can be null
  11724. @example
  11725. ```js
  11726. eventTarget.once('fire', function () {
  11727. cc.log("this is the callback and will be invoked only once");
  11728. }, node);
  11729. ```
  11730. */
  11731. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  11732. /**
  11733. !#en
  11734. Send an event with the event object.
  11735. !#zh
  11736. 通过事件对象派发事件
  11737. @param event event
  11738. */
  11739. dispatchEvent(event: Event): void;
  11740. /**
  11741. !#en
  11742. Destroy all callbackInfos.
  11743. !#zh
  11744. 销毁记录的事件
  11745. */
  11746. clear(): void;
  11747. }
  11748. /** !#en
  11749. Helper class for setting material blend function.
  11750. !#zh
  11751. 设置材质混合模式的辅助类。 */
  11752. export class BlendFunc {
  11753. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  11754. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  11755. srcBlendFactor: macro.BlendFactor;
  11756. /** !#en specify the destination Blend Factor.
  11757. !#zh 指定目标的混合模式 */
  11758. dstBlendFactor: macro.BlendFactor;
  11759. }
  11760. /** An internal helper class for switching render component's material between normal sprite material and gray sprite material. */
  11761. export class GraySpriteState {
  11762. /** !#en The normal material.
  11763. !#zh 正常状态的材质。 */
  11764. normalMaterial: Material;
  11765. /** !#en The gray material.
  11766. !#zh 置灰状态的材质。 */
  11767. grayMaterial: Material;
  11768. }
  11769. /** misc utilities */
  11770. export class misc {
  11771. /**
  11772. !#en Clamp a value between from and to.
  11773. !#zh
  11774. 限定浮点数的最大最小值。<br/>
  11775. 数值大于 max_inclusive 则返回 max_inclusive。<br/>
  11776. 数值小于 min_inclusive 则返回 min_inclusive。<br/>
  11777. 否则返回自身。
  11778. @param value value
  11779. @param min_inclusive min_inclusive
  11780. @param max_inclusive max_inclusive
  11781. @example
  11782. ```js
  11783. var v1 = cc.misc.clampf(20, 0, 20); // 20;
  11784. var v2 = cc.misc.clampf(-1, 0, 20); // 0;
  11785. var v3 = cc.misc.clampf(10, 0, 20); // 10;
  11786. ```
  11787. */
  11788. static clampf(value: number, min_inclusive: number, max_inclusive: number): number;
  11789. /**
  11790. !#en Clamp a value between 0 and 1.
  11791. !#zh 限定浮点数的取值范围为 0 ~ 1 之间。
  11792. @param value value
  11793. @example
  11794. ```js
  11795. var v1 = cc.misc.clamp01(20); // 1;
  11796. var v2 = cc.misc.clamp01(-1); // 0;
  11797. var v3 = cc.misc.clamp01(0.5); // 0.5;
  11798. ```
  11799. */
  11800. static clamp01(value: number): number;
  11801. /**
  11802. Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end
  11803. @param a number A
  11804. @param b number B
  11805. @param r ratio between 0 and 1
  11806. @example
  11807. ```js
  11808. ----
  11809. lerp
  11810. cc.misc.lerp(2,10,0.5)//returns 6
  11811. cc.misc.lerp(2,10,0.2)//returns 3.6
  11812. ```
  11813. */
  11814. static lerp(a: number, b: number, r: number): number;
  11815. /**
  11816. converts degrees to radians
  11817. @param angle angle
  11818. */
  11819. static degreesToRadians(angle: number): number;
  11820. /**
  11821. converts radians to degrees
  11822. @param angle angle
  11823. */
  11824. static radiansToDegrees(angle: number): number;
  11825. }
  11826. /** !#en
  11827. Representation of RGBA colors.
  11828. Each color component is a floating point value with a range from 0 to 255.
  11829. You can also use the convenience method {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} to create a new Color.
  11830. !#zh
  11831. cc.Color 用于表示颜色。
  11832. 它包含 RGBA 四个以浮点数保存的颜色分量,每个的值都在 0 到 255 之间。
  11833. 您也可以通过使用 {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} 的便捷方法来创建一个新的 Color。 */
  11834. export class Color extends ValueType {
  11835. /** !#en Solid white, RGBA is [255, 255, 255, 255].
  11836. !#zh 纯白色,RGBA 是 [255, 255, 255, 255]。 */
  11837. static WHITE: Color;
  11838. /** !#en Solid black, RGBA is [0, 0, 0, 255].
  11839. !#zh 纯黑色,RGBA 是 [0, 0, 0, 255]。 */
  11840. static BLACK: Color;
  11841. /** !#en Transparent, RGBA is [0, 0, 0, 0].
  11842. !#zh 透明,RGBA 是 [0, 0, 0, 0]。 */
  11843. static TRANSPARENT: Color;
  11844. /** !#en Grey, RGBA is [127.5, 127.5, 127.5].
  11845. !#zh 灰色,RGBA 是 [127.5, 127.5, 127.5]。 */
  11846. static GRAY: Color;
  11847. /** !#en Solid red, RGBA is [255, 0, 0].
  11848. !#zh 纯红色,RGBA 是 [255, 0, 0]。 */
  11849. static RED: Color;
  11850. /** !#en Solid green, RGBA is [0, 255, 0].
  11851. !#zh 纯绿色,RGBA 是 [0, 255, 0]。 */
  11852. static GREEN: Color;
  11853. /** !#en Solid blue, RGBA is [0, 0, 255].
  11854. !#zh 纯蓝色,RGBA 是 [0, 0, 255]。 */
  11855. static BLUE: Color;
  11856. /** !#en Yellow, RGBA is [255, 235, 4].
  11857. !#zh 黄色,RGBA 是 [255, 235, 4]。 */
  11858. static YELLOW: Color;
  11859. /** !#en Orange, RGBA is [255, 127, 0].
  11860. !#zh 橙色,RGBA 是 [255, 127, 0]。 */
  11861. static ORANGE: Color;
  11862. /** !#en Cyan, RGBA is [0, 255, 255].
  11863. !#zh 青色,RGBA 是 [0, 255, 255]。 */
  11864. static CYAN: Color;
  11865. /** !#en Magenta, RGBA is [255, 0, 255].
  11866. !#zh 洋红色(品红色),RGBA 是 [255, 0, 255]。 */
  11867. static MAGENTA: Color;
  11868. /**
  11869. Copy content of a color into another.
  11870. */
  11871. static copy (out: Color, a: Color): Color;
  11872. /**
  11873. Clone a new color.
  11874. */
  11875. static clone (a: Color): Color;
  11876. /**
  11877. Set the components of a color to the given values.
  11878. */
  11879. static set (out: Color, r?: number, g?: number, b?: number, a?: number): Color;
  11880. /**
  11881. Converts the hexadecimal formal color into rgb formal.
  11882. */
  11883. static fromHex (out: Color, hex: number): Color;
  11884. /**
  11885. Converts the hexadecimal formal color into rgb formal.
  11886. */
  11887. static fromHEX (out: Color, hex: string): Color;
  11888. /**
  11889. Add components of two colors, respectively.
  11890. */
  11891. static add (out: Color, a: Color, b: Color): Color;
  11892. /**
  11893. Subtract components of color b from components of color a, respectively.
  11894. */
  11895. static subtract (out: Color, a: Color, b: Color): Color;
  11896. /**
  11897. Multiply components of two colors, respectively.
  11898. */
  11899. static multiply (out: Color, a: Color, b: Color): Color;
  11900. /**
  11901. Divide components of color a by components of color b, respectively.
  11902. */
  11903. static divide (out: Color, a: Color, b: Color): Color;
  11904. /**
  11905. Scales a color by a number.
  11906. */
  11907. static scale (out: Color, a: Color, b: number): Color;
  11908. /**
  11909. Performs a linear interpolation between two colors.
  11910. */
  11911. static lerp (out: Color, a: Color, b: Color, t: number): Color;
  11912. /**
  11913. !#zh 颜色转数组
  11914. !#en Turn an array of colors
  11915. @param ofs 数组起始偏移量
  11916. */
  11917. static toArray <Out extends IWritableArrayLike<number>> (out: Out, a: IColorLike, ofs?: number): Out;
  11918. /**
  11919. !#zh 数组转颜色
  11920. !#en An array of colors turn
  11921. @param ofs 数组起始偏移量
  11922. */
  11923. static fromArray <Out extends IColorLike> (arr: IWritableArrayLike<number>, out: Out, ofs?: number): Out;
  11924. /**
  11925. !#zh 颜色 RGB 预乘 Alpha 通道
  11926. !#en RGB premultiply alpha channel
  11927. @param out 返回颜色
  11928. @param color 预乘处理的目标颜色
  11929. */
  11930. static premultiplyAlpha <Out extends IColorLike> (out: Out, a: IColorLike);
  11931. /**
  11932. @param r red component of the color, default value is 0.
  11933. @param g green component of the color, defualt value is 0.
  11934. @param b blue component of the color, default value is 0.
  11935. @param a alpha component of the color, default value is 255.
  11936. */
  11937. constructor(r?: number, g?: number, b?: number, a?: number);
  11938. /**
  11939. !#en Clone a new color from the current color.
  11940. !#zh 克隆当前颜色。
  11941. @example
  11942. ```js
  11943. var color = new cc.Color();
  11944. var newColor = color.clone();// Color {r: 0, g: 0, b: 0, a: 255}
  11945. ```
  11946. */
  11947. clone(): Color;
  11948. /**
  11949. !#en TODO
  11950. !#zh 判断两个颜色是否相等。
  11951. @param other other
  11952. @example
  11953. ```js
  11954. var color1 = cc.Color.WHITE;
  11955. var color2 = new cc.Color(255, 255, 255);
  11956. cc.log(color1.equals(color2)); // true;
  11957. color2 = cc.Color.RED;
  11958. cc.log(color2.equals(color1)); // false;
  11959. ```
  11960. */
  11961. equals(other: Color): boolean;
  11962. /**
  11963. !#en TODO
  11964. !#zh 线性插值
  11965. @param to to
  11966. @param ratio the interpolation coefficient.
  11967. @param out optional, the receiving vector.
  11968. @example
  11969. ```js
  11970. // Converts a white color to a black one trough time.
  11971. update: function (dt) {
  11972. var color = this.node.color;
  11973. if (color.equals(cc.Color.BLACK)) {
  11974. return;
  11975. }
  11976. this.ratio += dt * 0.1;
  11977. this.node.color = cc.Color.WHITE.lerp(cc.Color.BLACK, ratio);
  11978. }
  11979. ```
  11980. */
  11981. lerp(to: Color, ratio: number, out?: Color): Color;
  11982. /**
  11983. !#en TODO
  11984. !#zh 转换为方便阅读的字符串。
  11985. @example
  11986. ```js
  11987. var color = cc.Color.WHITE;
  11988. color.toString(); // "rgba(255, 255, 255, 255)"
  11989. ```
  11990. */
  11991. toString(): string;
  11992. /** !#en Get or set red channel value
  11993. !#zh 获取或者设置红色通道 */
  11994. r: number;
  11995. /** !#en Get or set green channel value
  11996. !#zh 获取或者设置绿色通道 */
  11997. g: number;
  11998. /** !#en Get or set blue channel value
  11999. !#zh 获取或者设置蓝色通道 */
  12000. b: number;
  12001. /** !#en Get or set alpha channel value
  12002. !#zh 获取或者设置透明通道 */
  12003. a: number;
  12004. /**
  12005. !#en Gets red channel value
  12006. !#zh 获取当前颜色的红色值。
  12007. */
  12008. getR(): number;
  12009. /**
  12010. !#en Sets red value and return the current color object
  12011. !#zh 设置当前的红色值,并返回当前对象。
  12012. @param red the new Red component.
  12013. @example
  12014. ```js
  12015. var color = new cc.Color();
  12016. color.setR(255); // Color {r: 255, g: 0, b: 0, a: 255}
  12017. ```
  12018. */
  12019. setR(red: number): Color;
  12020. /**
  12021. !#en Gets green channel value
  12022. !#zh 获取当前颜色的绿色值。
  12023. */
  12024. getG(): number;
  12025. /**
  12026. !#en Sets green value and return the current color object
  12027. !#zh 设置当前的绿色值,并返回当前对象。
  12028. @param green the new Green component.
  12029. @example
  12030. ```js
  12031. var color = new cc.Color();
  12032. color.setG(255); // Color {r: 0, g: 255, b: 0, a: 255}
  12033. ```
  12034. */
  12035. setG(green: number): Color;
  12036. /**
  12037. !#en Gets blue channel value
  12038. !#zh 获取当前颜色的蓝色值。
  12039. */
  12040. getB(): number;
  12041. /**
  12042. !#en Sets blue value and return the current color object
  12043. !#zh 设置当前的蓝色值,并返回当前对象。
  12044. @param blue the new Blue component.
  12045. @example
  12046. ```js
  12047. var color = new cc.Color();
  12048. color.setB(255); // Color {r: 0, g: 0, b: 255, a: 255}
  12049. ```
  12050. */
  12051. setB(blue: number): Color;
  12052. /**
  12053. !#en Gets alpha channel value
  12054. !#zh 获取当前颜色的透明度值。
  12055. */
  12056. getA(): number;
  12057. /**
  12058. !#en Sets alpha value and return the current color object
  12059. !#zh 设置当前的透明度,并返回当前对象。
  12060. @param alpha the new Alpha component.
  12061. @example
  12062. ```js
  12063. var color = new cc.Color();
  12064. color.setA(0); // Color {r: 0, g: 0, b: 0, a: 0}
  12065. ```
  12066. */
  12067. setA(alpha: number): Color;
  12068. /**
  12069. !#en Convert color to css format.
  12070. !#zh 转换为 CSS 格式。
  12071. @param opt "rgba", "rgb", "#rgb" or "#rrggbb".
  12072. @example
  12073. ```js
  12074. var color = cc.Color.BLACK;
  12075. color.toCSS(); // "rgba(0,0,0,1.00)";
  12076. color.toCSS("rgba"); // "rgba(0,0,0,1.00)";
  12077. color.toCSS("rgb"); // "rgba(0,0,0)";
  12078. color.toCSS("#rgb"); // "#000";
  12079. color.toCSS("#rrggbb"); // "#000000";
  12080. ```
  12081. */
  12082. toCSS(opt?: string): string;
  12083. /**
  12084. !#en Read hex string and store color data into the current color object, the hex string must be formated as rgba or rgb.
  12085. !#zh 读取 16 进制颜色。
  12086. @param hexString hexString
  12087. @example
  12088. ```js
  12089. var color = cc.Color.BLACK;
  12090. color.fromHEX("#FFFF33"); // Color {r: 255, g: 255, b: 51, a: 255};
  12091. ```
  12092. */
  12093. fromHEX(hexString: string): Color;
  12094. /**
  12095. !#en convert Color to HEX color string.
  12096. !#zh 转换为 16 进制。
  12097. @param fmt "#rgb", "#rrggbb" or "#rrggbbaa".
  12098. @example
  12099. ```js
  12100. var color = cc.Color.BLACK;
  12101. color.toHEX("#rgb"); // "000";
  12102. color.toHEX("#rrggbb"); // "000000";
  12103. ```
  12104. */
  12105. toHEX(fmt?: string): string;
  12106. /**
  12107. !#en Convert to 24bit rgb value.
  12108. !#zh 转换为 24bit 的 RGB 值。
  12109. @example
  12110. ```js
  12111. var color = cc.Color.YELLOW;
  12112. color.toRGBValue(); // 16771844;
  12113. ```
  12114. */
  12115. toRGBValue(): number;
  12116. /**
  12117. !#en Read HSV model color and convert to RGB color
  12118. !#zh 读取 HSV(色彩模型)格式。
  12119. @param h h
  12120. @param s s
  12121. @param v v
  12122. @example
  12123. ```js
  12124. var color = cc.Color.YELLOW;
  12125. color.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};
  12126. ```
  12127. */
  12128. fromHSV(h: number, s: number, v: number): Color;
  12129. /**
  12130. !#en Transform to HSV model color
  12131. !#zh 转换为 HSV(色彩模型)格式。
  12132. @example
  12133. ```js
  12134. var color = cc.Color.YELLOW;
  12135. color.toHSV(); // Object {h: 0.1533864541832669, s: 0.9843137254901961, v: 1};
  12136. ```
  12137. */
  12138. toHSV(): any;
  12139. /**
  12140. !#en Set the color
  12141. !#zh 设置颜色
  12142. @param color color
  12143. */
  12144. set (color: Color): Color;
  12145. /**
  12146. !#en Multiplies the current color by the specified color
  12147. !#zh 将当前颜色乘以与指定颜色
  12148. @param other other
  12149. */
  12150. multiply(other: Color): Color;
  12151. }
  12152. /** Mathematical 3x3 matrix.
  12153. NOTE: we use column-major matrix for all matrix calculation.
  12154. This may lead to some confusion when referencing OpenGL documentation,
  12155. however, which represents out all matricies in column-major format.
  12156. This means that while in code a matrix may be typed out as:
  12157. [1, 0, 0, 0,
  12158. 0, 1, 0, 0,
  12159. 0, 0, 1, 0,
  12160. x, y, z, 0]
  12161. The same matrix in the [OpenGL documentation](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml)
  12162. is written as:
  12163. 1 0 0 x
  12164. 0 1 0 y
  12165. 0 0 1 z
  12166. 0 0 0 0
  12167. Please rest assured, however, that they are the same thing!
  12168. This is not unique to glMatrix, either, as OpenGL developers have long been confused by the
  12169. apparent lack of consistency between the memory layout and the documentation. */
  12170. export class Mat3 extends ValueType {
  12171. /** Identity of Mat3 */
  12172. static IDENTITY: Mat3;
  12173. /**
  12174. !#zh 矩阵转数组
  12175. !#en Matrix transpose array
  12176. @param ofs 数组内的起始偏移量
  12177. */
  12178. static toArray <Out extends IWritableArrayLike<number>> (out: Out, mat: IMat3Like, ofs?: number): Out;
  12179. /**
  12180. !#zh 数组转矩阵
  12181. !#en Transfer matrix array
  12182. @param ofs 数组起始偏移量
  12183. */
  12184. static fromArray <Out extends IMat3Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  12185. /** !#en Matrix Data
  12186. !#zh 矩阵数据 */
  12187. m: Float64Array|Float32Array;
  12188. constructor (m00?: number | Float32Array, m01?: number, m02?: number, m03?: number, m04?: number, m05?: number, m06?: number, m07?: number, m08?: number);
  12189. }
  12190. /** !#en Representation of 4*4 matrix.
  12191. !#zh 表示 4*4 矩阵 */
  12192. export class Mat4 extends ValueType {
  12193. /**
  12194. !#en Multiply the current matrix with another one
  12195. !#zh 将当前矩阵与指定矩阵相乘
  12196. @param other the second operand
  12197. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12198. */
  12199. mul(other: Mat4, out?: Mat4): Mat4;
  12200. /**
  12201. !#en Multiply each element of the matrix by a scalar.
  12202. !#zh 将矩阵的每一个元素都乘以指定的缩放值。
  12203. @param number amount to scale the matrix's elements by
  12204. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12205. */
  12206. mulScalar(number: number, out?: Mat4): Mat4;
  12207. /**
  12208. !#en Subtracts the current matrix with another one
  12209. !#zh 将当前矩阵与指定的矩阵相减
  12210. @param other the second operand
  12211. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12212. */
  12213. sub(other: Mat4, out?: Mat4): Mat4;
  12214. /** Identity of Mat4 */
  12215. static IDENTITY: Mat4;
  12216. /**
  12217. !#zh 获得指定矩阵的拷贝
  12218. !#en Copy of the specified matrix to obtain
  12219. */
  12220. static clone<Out extends IMat4Like> (a: Out): Mat4;
  12221. /**
  12222. !#zh 复制目标矩阵
  12223. !#en Copy the target matrix
  12224. */
  12225. static copy<Out extends IMat4Like> (out: Out, a: Out): Out;
  12226. /**
  12227. !#zh 将目标赋值为单位矩阵
  12228. !#en The target of an assignment is the identity matrix
  12229. */
  12230. static identity<Out extends IMat4Like> (out: Out): Out;
  12231. /**
  12232. !#zh 转置矩阵
  12233. !#en Transposed matrix
  12234. */
  12235. static transpose<Out extends IMat4Like> (out: Out, a: Out): Out;
  12236. /**
  12237. !#zh 矩阵求逆
  12238. !#en Matrix inversion
  12239. */
  12240. static invert<Out extends IMat4Like> (out: Out, a: Out): Out;
  12241. /**
  12242. !#zh 矩阵行列式
  12243. !#en Matrix determinant
  12244. */
  12245. static determinant<Out extends IMat4Like> (a: Out): number;
  12246. /**
  12247. !#zh 矩阵乘法
  12248. !#en Matrix Multiplication
  12249. */
  12250. static multiply<Out extends IMat4Like> (out: Out, a: Out, b: Out): Out;
  12251. /**
  12252. !#zh 在给定矩阵变换基础上加入变换
  12253. !#en Was added in a given transformation matrix transformation on the basis of
  12254. */
  12255. static transform<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike): Out;
  12256. /**
  12257. !#zh 在给定矩阵变换基础上加入新位移变换
  12258. !#en Add new displacement transducer in a matrix transformation on the basis of a given
  12259. */
  12260. static translate<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike): Out;
  12261. /**
  12262. !#zh 在给定矩阵变换基础上加入新缩放变换
  12263. !#en Add new scaling transformation in a given matrix transformation on the basis of
  12264. */
  12265. static scale<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike): Out;
  12266. /**
  12267. !#zh 在给定矩阵变换基础上加入新旋转变换
  12268. !#en Add a new rotational transform matrix transformation on the basis of a given
  12269. @param rad 旋转角度
  12270. @param axis 旋转轴
  12271. */
  12272. static rotate<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, rad: number, axis: VecLike): Out;
  12273. /**
  12274. !#zh 在给定矩阵变换基础上加入绕 X 轴的旋转变换
  12275. !#en Add rotational transformation around the X axis at a given matrix transformation on the basis of
  12276. @param rad 旋转角度
  12277. */
  12278. static rotateX<Out extends IMat4Like> (out: Out, a: Out, rad: number): Out;
  12279. /**
  12280. !#zh 在给定矩阵变换基础上加入绕 Y 轴的旋转变换
  12281. !#en Add about the Y axis rotation transformation in a given matrix transformation on the basis of
  12282. @param rad 旋转角度
  12283. */
  12284. static rotateY<Out extends IMat4Like> (out: Out, a: Out, rad: number): Out;
  12285. /**
  12286. !#zh 在给定矩阵变换基础上加入绕 Z 轴的旋转变换
  12287. !#en Added about the Z axis at a given rotational transformation matrix transformation on the basis of
  12288. @param rad 旋转角度
  12289. */
  12290. static rotateZ<Out extends IMat4Like> (out: Out, a: Out, rad: number): Out;
  12291. /**
  12292. !#zh 计算位移矩阵
  12293. !#en Displacement matrix calculation
  12294. */
  12295. static fromTranslation<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, v: VecLike): Out;
  12296. /**
  12297. !#zh 计算缩放矩阵
  12298. !#en Scaling matrix calculation
  12299. */
  12300. static fromScaling<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, v: VecLike): Out;
  12301. /**
  12302. !#zh 计算旋转矩阵
  12303. !#en Calculates the rotation matrix
  12304. */
  12305. static fromRotation<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, rad: number, axis: VecLike): Out;
  12306. /**
  12307. !#zh 计算绕 X 轴的旋转矩阵
  12308. !#en Calculating rotation matrix about the X axis
  12309. */
  12310. static fromXRotation<Out extends IMat4Like> (out: Out, rad: number): Out;
  12311. /**
  12312. !#zh 计算绕 Y 轴的旋转矩阵
  12313. !#en Calculating rotation matrix about the Y axis
  12314. */
  12315. static fromYRotation<Out extends IMat4Like> (out: Out, rad: number): Out;
  12316. /**
  12317. !#zh 计算绕 Z 轴的旋转矩阵
  12318. !#en Calculating rotation matrix about the Z axis
  12319. */
  12320. static fromZRotation<Out extends IMat4Like> (out: Out, rad: number): Out;
  12321. /**
  12322. !#zh 根据旋转和位移信息计算矩阵
  12323. !#en The rotation and displacement information calculating matrix
  12324. */
  12325. static fromRT<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike): Out;
  12326. /**
  12327. !#zh 提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  12328. !#en Extracting displacement information of the matrix, the matrix transform to the default sequential application S-> R-> T is
  12329. */
  12330. static getTranslation<Out extends IMat4Like, VecLike extends IVec3Like> (out: VecLike, mat: Out): VecLike;
  12331. /**
  12332. !#zh 提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  12333. !#en Scaling information extraction matrix, the matrix transform to the default sequential application S-> R-> T is
  12334. */
  12335. static getScaling<Out extends IMat4Like, VecLike extends IVec3Like> (out: VecLike, mat: Out): VecLike;
  12336. /**
  12337. !#zh 提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息,如考虑缩放应使用 `toRTS` 函数。
  12338. !#en Rotation information extraction matrix, the matrix containing no default input scaling information, such as the use of `toRTS` should consider the scaling function.
  12339. */
  12340. static getRotation<Out extends IMat4Like> (out: Quat, mat: Out): Quat;
  12341. /**
  12342. !#zh 提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  12343. !#en Extracting rotational displacement, zoom information, the default matrix transformation in order S-> R-> T applications
  12344. */
  12345. static toRTS<Out extends IMat4Like, VecLike extends IVec3Like> (mat: Out, q: Quat, v: VecLike, s: VecLike): void;
  12346. /**
  12347. !#zh 根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用
  12348. !#en The rotary displacement, the scaling matrix calculation information, the order S-> R-> T applications
  12349. */
  12350. static fromRTS<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike, s: VecLike): Out;
  12351. /**
  12352. !#zh 根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 S->R->T 的顺序应用
  12353. !#en According to the specified rotation, displacement, and scale conversion matrix calculation information center, order S-> R-> T applications
  12354. @param q 旋转值
  12355. @param v 位移值
  12356. @param s 缩放值
  12357. @param o 指定变换中心
  12358. */
  12359. static fromRTSOrigin<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike, s: VecLike, o: VecLike): Out;
  12360. /**
  12361. !#zh 根据指定的旋转信息计算矩阵
  12362. !#en The rotation matrix calculation information specified
  12363. */
  12364. static fromQuat<Out extends IMat4Like> (out: Out, q: Quat): Out;
  12365. /**
  12366. !#zh 根据指定的视锥体信息计算矩阵
  12367. !#en The matrix calculation information specified frustum
  12368. @param left 左平面距离
  12369. @param right 右平面距离
  12370. @param bottom 下平面距离
  12371. @param top 上平面距离
  12372. @param near 近平面距离
  12373. @param far 远平面距离
  12374. */
  12375. static frustum<Out extends IMat4Like> (out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number): Out;
  12376. /**
  12377. !#zh 计算透视投影矩阵
  12378. !#en Perspective projection matrix calculation
  12379. @param fovy 纵向视角高度
  12380. @param aspect 长宽比
  12381. @param near 近平面距离
  12382. @param far 远平面距离
  12383. */
  12384. static perspective<Out extends IMat4Like> (out: Out, fovy: number, aspect: number, near: number, far: number): Out;
  12385. /**
  12386. !#zh 计算正交投影矩阵
  12387. !#en Computing orthogonal projection matrix
  12388. @param left 左平面距离
  12389. @param right 右平面距离
  12390. @param bottom 下平面距离
  12391. @param top 上平面距离
  12392. @param near 近平面距离
  12393. @param far 远平面距离
  12394. */
  12395. static ortho<Out extends IMat4Like> (out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number): Out;
  12396. /**
  12397. !#zh 根据视点计算矩阵,注意 `eye - center` 不能为零向量或与 `up` 向量平行
  12398. !#en `Up` parallel vector or vector center` not be zero - the matrix calculation according to the viewpoint, note` eye
  12399. @param eye 当前位置
  12400. @param center 目标视点
  12401. @param up 视口上方向
  12402. */
  12403. static lookAt<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, eye: VecLike, center: VecLike, up: VecLike): Out;
  12404. /**
  12405. !#zh 计算逆转置矩阵
  12406. !#en Reversal matrix calculation
  12407. */
  12408. static inverseTranspose<Out extends IMat4Like> (out: Out, a: Out): Out;
  12409. /**
  12410. !#zh 逐元素矩阵加法
  12411. !#en Element by element matrix addition
  12412. */
  12413. static add<Out extends IMat4Like> (out: Out, a: Out, b: Out): Out;
  12414. /**
  12415. !#zh 逐元素矩阵减法
  12416. !#en Matrix element by element subtraction
  12417. */
  12418. static subtract<Out extends IMat4Like> (out: Out, a: Out, b: Out): Out;
  12419. /**
  12420. !#zh 矩阵标量乘法
  12421. !#en Matrix scalar multiplication
  12422. */
  12423. static multiplyScalar<Out extends IMat4Like> (out: Out, a: Out, b: number): Out;
  12424. /**
  12425. !#zh 逐元素矩阵标量乘加: A + B * scale
  12426. !#en Elements of the matrix by the scalar multiplication and addition: A + B * scale
  12427. */
  12428. static multiplyScalarAndAdd<Out extends IMat4Like> (out: Out, a: Out, b: Out, scale: number): Out;
  12429. /**
  12430. !#zh 矩阵等价判断
  12431. !#en Analyzing the equivalent matrix
  12432. */
  12433. static strictEquals<Out extends IMat4Like> (a: Out, b: Out): boolean;
  12434. /**
  12435. !#zh 排除浮点数误差的矩阵近似等价判断
  12436. !#en Negative floating point error is approximately equivalent to determining a matrix
  12437. */
  12438. static equals<Out extends IMat4Like> (a: Out, b: Out, epsilon?: number): boolean;
  12439. /**
  12440. !#zh 矩阵转数组
  12441. !#en Matrix transpose array
  12442. @param ofs 数组内的起始偏移量
  12443. */
  12444. static toArray <Out extends IWritableArrayLike<number>> (out: Out, mat: IMat4Like, ofs?: number): Out;
  12445. /**
  12446. !#zh 数组转矩阵
  12447. !#en Transfer matrix array
  12448. @param ofs 数组起始偏移量
  12449. */
  12450. static fromArray <Out extends IMat4Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  12451. /** !#en Matrix Data
  12452. !#zh 矩阵数据 */
  12453. m: Float64Array|Float32Array;
  12454. /**
  12455. !#en
  12456. Constructor
  12457. see {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  12458. !#zh
  12459. 构造函数,可查看 {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  12460. */
  12461. constructor ( m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number, m30?: number, m31?: number, m32?: number, m33?: number);
  12462. /**
  12463. !#en clone a Mat4 object
  12464. !#zh 克隆一个 Mat4 对象
  12465. */
  12466. clone(): Mat4;
  12467. /**
  12468. !#en Sets the matrix with another one's value
  12469. !#zh 用另一个矩阵设置这个矩阵的值。
  12470. @param srcObj srcObj
  12471. */
  12472. set(srcObj: Mat4): Mat4;
  12473. /**
  12474. !#en Check whether two matrix equal
  12475. !#zh 当前的矩阵是否与指定的矩阵相等。
  12476. @param other other
  12477. */
  12478. equals(other: Mat4): boolean;
  12479. /**
  12480. !#en Check whether two matrix equal with default degree of variance.
  12481. !#zh
  12482. 近似判断两个矩阵是否相等。<br/>
  12483. 判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
  12484. @param other other
  12485. */
  12486. fuzzyEquals(other: Mat4): boolean;
  12487. /**
  12488. !#en Transform to string with matrix informations
  12489. !#zh 转换为方便阅读的字符串。
  12490. */
  12491. toString(): string;
  12492. /**
  12493. Set the matrix to the identity matrix
  12494. */
  12495. identity(): Mat4;
  12496. /**
  12497. Transpose the values of a mat4
  12498. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12499. */
  12500. transpose(out?: Mat4): Mat4;
  12501. /**
  12502. Inverts a mat4
  12503. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12504. */
  12505. invert(out?: Mat4): Mat4;
  12506. /**
  12507. Calculates the adjugate of a mat4
  12508. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12509. */
  12510. adjoint(out?: Mat4): Mat4;
  12511. /**
  12512. Calculates the determinant of a mat4
  12513. */
  12514. determinant(): number;
  12515. /**
  12516. Adds two Mat4
  12517. @param other the second operand
  12518. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
  12519. */
  12520. add(other: Mat4, out?: Mat4): Mat4;
  12521. /**
  12522. Subtracts the current matrix with another one
  12523. @param other the second operand
  12524. */
  12525. subtract(other: Mat4): Mat4;
  12526. /**
  12527. Subtracts the current matrix with another one
  12528. @param other the second operand
  12529. */
  12530. multiply(other: Mat4): Mat4;
  12531. /**
  12532. Multiply each element of the matrix by a scalar.
  12533. @param number amount to scale the matrix's elements by
  12534. */
  12535. multiplyScalar(number: number): Mat4;
  12536. /**
  12537. Translate a mat4 by the given vector
  12538. @param v vector to translate by
  12539. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12540. */
  12541. translate(v: Vec3, out?: Mat4): Mat4;
  12542. /**
  12543. Scales the mat4 by the dimensions in the given vec3
  12544. @param v vector to scale by
  12545. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12546. */
  12547. scale(v: Vec3, out?: Mat4): Mat4;
  12548. /**
  12549. Rotates a mat4 by the given angle around the given axis
  12550. @param rad the angle to rotate the matrix by
  12551. @param axis the axis to rotate around
  12552. @param out the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
  12553. */
  12554. rotate(rad: number, axis: Vec3, out?: Mat4): Mat4;
  12555. /**
  12556. Returns the translation vector component of a transformation matrix.
  12557. @param out Vector to receive translation component, if not provided, a new vec3 will be created
  12558. */
  12559. getTranslation(out: Vec3): Vec3;
  12560. /**
  12561. Returns the scale factor component of a transformation matrix
  12562. @param out Vector to receive scale component, if not provided, a new vec3 will be created
  12563. */
  12564. getScale(out: Vec3): Vec3;
  12565. /**
  12566. Returns the rotation factor component of a transformation matrix
  12567. @param out Vector to receive rotation component, if not provided, a new quaternion object will be created
  12568. */
  12569. getRotation(out: Quat): Quat;
  12570. /**
  12571. Restore the matrix values from a quaternion rotation, vector translation and vector scale
  12572. @param q Rotation quaternion
  12573. @param v Translation vector
  12574. @param s Scaling vector
  12575. */
  12576. fromRTS(q: Quat, v: Vec3, s: Vec3): Mat4;
  12577. /**
  12578. Restore the matrix values from a quaternion rotation
  12579. @param q Rotation quaternion
  12580. */
  12581. fromQuat(q: Quat): Mat4;
  12582. }
  12583. /** !#en Representation of 2D vectors and points.
  12584. !#zh 表示 2D 向量和坐标 */
  12585. export class Quat extends ValueType {
  12586. /**
  12587. !#en
  12588. Constructor
  12589. see {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  12590. !#zh
  12591. 构造函数,可查看 {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  12592. @param x x
  12593. @param y y
  12594. @param z z
  12595. @param w w
  12596. */
  12597. constructor(x?: number, y?: number, z?: number, w?: number);
  12598. /**
  12599. !#en Calculate the multiply result between this quaternion and another one
  12600. !#zh 计算四元数乘积的结果
  12601. @param other other
  12602. @param out out
  12603. */
  12604. mul(other: Quat, out?: Quat): Quat;
  12605. /**
  12606. !#zh 获得指定四元数的拷贝
  12607. !#en Obtaining copy specified quaternion
  12608. */
  12609. static clone<Out extends IQuatLike> (a: Out): Quat;
  12610. /**
  12611. !#zh 复制目标四元数
  12612. !#en Copy quaternion target
  12613. */
  12614. static copy<Out extends IQuatLike, QuatLike extends IQuatLike> (out: Out, a: QuatLike): Out;
  12615. /**
  12616. !#zh 设置四元数值
  12617. !#en Provided Quaternion Value
  12618. */
  12619. static set<Out extends IQuatLike> (out: Out, x: number, y: number, z: number, w: number): Out;
  12620. /**
  12621. !#zh 将目标赋值为单位四元数
  12622. !#en The target of an assignment as a unit quaternion
  12623. */
  12624. static identity<Out extends IQuatLike> (out: Out): Out;
  12625. /**
  12626. !#zh 设置四元数为两向量间的最短路径旋转,默认两向量都已归一化
  12627. !#en Set quaternion rotation is the shortest path between two vectors, the default two vectors are normalized
  12628. */
  12629. static rotationTo<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, a: VecLike, b: VecLike): Out;
  12630. /**
  12631. !#zh 获取四元数的旋转轴和旋转弧度
  12632. !#en Get the rotary shaft and the arc of rotation quaternion
  12633. @param outAxis 旋转轴输出
  12634. @param q 源四元数
  12635. */
  12636. static getAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like> (outAxis: VecLike, q: Out): number;
  12637. /**
  12638. !#zh 四元数乘法
  12639. !#en Quaternion multiplication
  12640. */
  12641. static multiply<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike> (out: Out, a: QuatLike_1, b: QuatLike_2): Out;
  12642. /**
  12643. !#zh 四元数标量乘法
  12644. !#en Quaternion scalar multiplication
  12645. */
  12646. static multiplyScalar<Out extends IQuatLike> (out: Out, a: Out, b: number): Out;
  12647. /**
  12648. !#zh 四元数乘加:A + B * scale
  12649. !#en Quaternion multiplication and addition: A + B * scale
  12650. */
  12651. static scaleAndAdd<Out extends IQuatLike> (out: Out, a: Out, b: Out, scale: number): Out;
  12652. /**
  12653. !#zh 绕 X 轴旋转指定四元数
  12654. !#en About the X axis specified quaternion
  12655. @param rad 旋转弧度
  12656. */
  12657. static rotateX<Out extends IQuatLike> (out: Out, a: Out, rad: number): Out;
  12658. /**
  12659. !#zh 绕 Y 轴旋转指定四元数
  12660. !#en Rotation about the Y axis designated quaternion
  12661. @param rad 旋转弧度
  12662. */
  12663. static rotateY<Out extends IQuatLike> (out: Out, a: Out, rad: number): Out;
  12664. /**
  12665. !#zh 绕 Z 轴旋转指定四元数
  12666. !#en Around the Z axis specified quaternion
  12667. @param rad 旋转弧度
  12668. */
  12669. static rotateZ<Out extends IQuatLike> (out: Out, a: Out, rad: number): Out;
  12670. /**
  12671. !#zh 绕世界空间下指定轴旋转四元数
  12672. !#en Space around the world at a given axis of rotation quaternion
  12673. @param axis 旋转轴,默认已归一化
  12674. @param rad 旋转弧度
  12675. */
  12676. static rotateAround<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number): Out;
  12677. /**
  12678. !#zh 绕本地空间下指定轴旋转四元数
  12679. !#en Local space around the specified axis rotation quaternion
  12680. @param axis 旋转轴
  12681. @param rad 旋转弧度
  12682. */
  12683. static rotateAroundLocal<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number): Out;
  12684. /**
  12685. !#zh 根据 xyz 分量计算 w 分量,默认已归一化
  12686. !#en The component w xyz components calculated, normalized by default
  12687. */
  12688. static calculateW<Out extends IQuatLike> (out: Out, a: Out): Out;
  12689. /**
  12690. !#zh 四元数点积(数量积)
  12691. !#en Quaternion dot product (scalar product)
  12692. */
  12693. static dot<Out extends IQuatLike> (a: Out, b: Out): number;
  12694. /**
  12695. !#zh 逐元素线性插值: A + t * (B - A)
  12696. !#en Element by element linear interpolation: A + t * (B - A)
  12697. */
  12698. static lerp<Out extends IQuatLike> (out: Out, a: Out, b: Out, t: number): Out;
  12699. /**
  12700. !#zh 四元数球面插值
  12701. !#en Spherical quaternion interpolation
  12702. */
  12703. static slerp<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike>(out: Out, a: QuatLike_1, b: QuatLike_2, t: number): Out;
  12704. /**
  12705. !#zh 带两个控制点的四元数球面插值
  12706. !#en Quaternion with two spherical interpolation control points
  12707. */
  12708. static sqlerp<Out extends IQuatLike> (out: Out, a: Out, b: Out, c: Out, d: Out, t: number): Out;
  12709. /**
  12710. !#zh 四元数求逆
  12711. !#en Quaternion inverse
  12712. */
  12713. static invert<Out extends IQuatLike, QuatLike extends IQuatLike> (out: Out, a: QuatLike): Out;
  12714. /**
  12715. !#zh 求共轭四元数,对单位四元数与求逆等价,但更高效
  12716. !#en Conjugating a quaternion, and the unit quaternion equivalent to inversion, but more efficient
  12717. */
  12718. static conjugate<Out extends IQuatLike> (out: Out, a: Out): Out;
  12719. /**
  12720. !#zh 求四元数长度
  12721. !#en Seek length quaternion
  12722. */
  12723. static len<Out extends IQuatLike> (a: Out): number;
  12724. /**
  12725. !#zh 求四元数长度平方
  12726. !#en Seeking quaternion square of the length
  12727. */
  12728. static lengthSqr<Out extends IQuatLike> (a: Out): number;
  12729. /**
  12730. !#zh 归一化四元数
  12731. !#en Normalized quaternions
  12732. */
  12733. static normalize<Out extends IQuatLike> (out: Out, a: Out): Out;
  12734. /**
  12735. !#zh 根据本地坐标轴朝向计算四元数,默认三向量都已归一化且相互垂直
  12736. !#en Calculated according to the local orientation quaternion coordinate axis, the default three vectors are normalized and mutually perpendicular
  12737. */
  12738. static fromAxes<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, xAxis: VecLike, yAxis: VecLike, zAxis: VecLike): Out;
  12739. /**
  12740. !#zh 根据视口的前方向和上方向计算四元数
  12741. !#en The forward direction and the direction of the viewport computing quaternion
  12742. @param view 视口面向的前方向,必须归一化
  12743. @param up 视口的上方向,必须归一化,默认为 (0, 1, 0)
  12744. */
  12745. static fromViewUp<Out extends IQuatLike> (out: Out, view: Vec3, up?: Vec3): Out;
  12746. /**
  12747. !#zh 根据旋转轴和旋转弧度计算四元数
  12748. !#en The quaternion calculated and the arc of rotation of the rotary shaft
  12749. */
  12750. static fromAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, axis: VecLike, rad: number): Out;
  12751. /**
  12752. !#zh 根据三维矩阵信息计算四元数,默认输入矩阵不含有缩放信息
  12753. !#en Calculating the three-dimensional quaternion matrix information, default zoom information input matrix does not contain
  12754. */
  12755. static fromMat3<Out extends IQuatLike> (out: Out, mat: Mat3): Out;
  12756. /**
  12757. !#zh 根据欧拉角信息计算四元数,旋转顺序为 YZX
  12758. !#en The quaternion calculated Euler angle information, rotation order YZX
  12759. */
  12760. static fromEuler<Out extends IQuatLike> (out: Out, x: number, y: number, z: number): Out;
  12761. /**
  12762. !#zh 返回定义此四元数的坐标系 X 轴向量
  12763. !#en This returns the result of the quaternion coordinate system X-axis vector
  12764. */
  12765. static toAxisX<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out): VecLike;
  12766. /**
  12767. !#zh 返回定义此四元数的坐标系 Y 轴向量
  12768. !#en This returns the result of the quaternion coordinate system Y axis vector
  12769. */
  12770. static toAxisY<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out): VecLike;
  12771. /**
  12772. !#zh 返回定义此四元数的坐标系 Z 轴向量
  12773. !#en This returns the result of the quaternion coordinate system the Z-axis vector
  12774. */
  12775. static toAxisZ<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out): VecLike;
  12776. /**
  12777. !#zh 根据四元数计算欧拉角,返回角度 x, y 在 [-180, 180] 区间内, z 默认在 [-90, 90] 区间内,旋转顺序为 YZX
  12778. !#en The quaternion calculated Euler angles, return angle x, y in the [-180, 180] interval, z default the range [-90, 90] interval, the rotation order YZX
  12779. @param outerZ z 取值范围区间改为 [-180, -90] U [90, 180]
  12780. */
  12781. static toEuler<Out extends IVec3Like> (out: Out, q: IQuatLike, outerZ?: boolean): Out;
  12782. /**
  12783. !#zh 四元数等价判断
  12784. !#en Analyzing quaternion equivalent
  12785. */
  12786. static strictEquals<Out extends IQuatLike> (a: Out, b: Out): boolean;
  12787. /**
  12788. !#zh 排除浮点数误差的四元数近似等价判断
  12789. !#en Negative floating point error quaternion approximately equivalent Analyzing
  12790. */
  12791. static equals<Out extends IQuatLike> (a: Out, b: Out, epsilon?: number): boolean;
  12792. /**
  12793. !#zh 四元数转数组
  12794. !#en Quaternion rotation array
  12795. @param ofs 数组内的起始偏移量
  12796. */
  12797. static toArray <Out extends IWritableArrayLike<number>> (out: Out, q: IQuatLike, ofs?: number): Out;
  12798. /**
  12799. !#zh 数组转四元数
  12800. !#en Array to a quaternion
  12801. @param ofs 数组起始偏移量
  12802. */
  12803. static fromArray <Out extends IQuatLike> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  12804. x: number;
  12805. y: number;
  12806. z: number;
  12807. w: number;
  12808. /**
  12809. !#en clone a Quat object and return the new object
  12810. !#zh 克隆一个四元数并返回
  12811. */
  12812. clone(): Quat;
  12813. /**
  12814. !#en Set values with another quaternion
  12815. !#zh 用另一个四元数的值设置到当前对象上。
  12816. @param newValue !#en new value to set. !#zh 要设置的新值
  12817. */
  12818. set(newValue: Quat): Quat;
  12819. /**
  12820. !#en Check whether current quaternion equals another
  12821. !#zh 当前的四元数是否与指定的四元数相等。
  12822. @param other other
  12823. */
  12824. equals(other: Quat): boolean;
  12825. /**
  12826. !#en Convert quaternion to euler
  12827. !#zh 转换四元数到欧拉角
  12828. @param out out
  12829. */
  12830. toEuler(out: Vec3): Vec3;
  12831. /**
  12832. !#en Convert euler to quaternion
  12833. !#zh 转换欧拉角到四元数
  12834. @param euler euler
  12835. */
  12836. fromEuler(euler: Vec3): Quat;
  12837. /**
  12838. !#en Calculate the interpolation result between this quaternion and another one with given ratio
  12839. !#zh 计算四元数的插值结果
  12840. @param to to
  12841. @param ratio ratio
  12842. @param out out
  12843. */
  12844. lerp(to: Quat, ratio: number, out?: Quat): Quat;
  12845. /**
  12846. !#en Calculate the multiply result between this quaternion and another one
  12847. !#zh 计算四元数乘积的结果
  12848. @param other other
  12849. */
  12850. multiply(other: Quat): Quat;
  12851. /**
  12852. !#en Rotates a quaternion by the given angle (in radians) about a world space axis.
  12853. !#zh 围绕世界空间轴按给定弧度旋转四元数
  12854. @param rot Quaternion to rotate
  12855. @param axis The axis around which to rotate in world space
  12856. @param rad Angle (in radians) to rotate
  12857. @param out Quaternion to store result
  12858. */
  12859. rotateAround(rot: Quat, axis: Vec3, rad: number, out?: Quat): Quat;
  12860. }
  12861. /** !#en A 2D rectangle defined by x, y position and width, height.
  12862. !#zh 通过位置和宽高定义的 2D 矩形。 */
  12863. export class Rect extends ValueType {
  12864. /**
  12865. !#en
  12866. Constructor of Rect class.
  12867. see {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} for convenience method.
  12868. !#zh
  12869. Rect类的构造函数。可以通过 {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} 简便方法进行创建。
  12870. @param x x
  12871. @param y y
  12872. @param w w
  12873. @param h h
  12874. */
  12875. constructor(x?: number, y?: number, w?: number, h?: number);
  12876. /**
  12877. !#en Creates a rectangle from two coordinate values.
  12878. !#zh 根据指定 2 个坐标创建出一个矩形区域。
  12879. @param v1 v1
  12880. @param v2 v2
  12881. @example
  12882. ```js
  12883. cc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};
  12884. ```
  12885. */
  12886. static fromMinMax(v1: Vec2, v2: Vec2): Rect;
  12887. x: number;
  12888. y: number;
  12889. width: number;
  12890. height: number;
  12891. /**
  12892. !#en TODO
  12893. !#zh 克隆一个新的 Rect。
  12894. @example
  12895. ```js
  12896. var a = new cc.Rect(0, 0, 10, 10);
  12897. a.clone();// Rect {x: 0, y: 0, width: 10, height: 10}
  12898. ```
  12899. */
  12900. clone(): Rect;
  12901. /**
  12902. !#en TODO
  12903. !#zh 是否等于指定的矩形。
  12904. @param other other
  12905. @example
  12906. ```js
  12907. var a = new cc.Rect(0, 0, 10, 10);
  12908. var b = new cc.Rect(0, 0, 10, 10);
  12909. a.equals(b);// true;
  12910. ```
  12911. */
  12912. equals(other: Rect): boolean;
  12913. /**
  12914. !#en TODO
  12915. !#zh 线性插值
  12916. @param to to
  12917. @param ratio the interpolation coefficient.
  12918. @param out optional, the receiving vector.
  12919. @example
  12920. ```js
  12921. var a = new cc.Rect(0, 0, 10, 10);
  12922. var b = new cc.Rect(50, 50, 100, 100);
  12923. update (dt) {
  12924. // method 1;
  12925. var c = a.lerp(b, dt * 0.1);
  12926. // method 2;
  12927. a.lerp(b, dt * 0.1, c);
  12928. }
  12929. ```
  12930. */
  12931. lerp(to: Rect, ratio: number, out?: Rect): Rect;
  12932. /**
  12933. !#en Check whether the current rectangle intersects with the given one
  12934. !#zh 当前矩形与指定矩形是否相交。
  12935. @param rect rect
  12936. @example
  12937. ```js
  12938. var a = new cc.Rect(0, 0, 10, 10);
  12939. var b = new cc.Rect(0, 0, 20, 20);
  12940. a.intersects(b);// true
  12941. ```
  12942. */
  12943. intersects(rect: Rect): boolean;
  12944. /**
  12945. !#en Returns the overlapping portion of 2 rectangles.
  12946. !#zh 返回 2 个矩形重叠的部分。
  12947. @param out Stores the result
  12948. @param rectB rectB
  12949. @example
  12950. ```js
  12951. var a = new cc.Rect(0, 10, 20, 20);
  12952. var b = new cc.Rect(0, 10, 10, 10);
  12953. var intersection = new cc.Rect();
  12954. a.intersection(intersection, b); // intersection {x: 0, y: 10, width: 10, height: 10};
  12955. ```
  12956. */
  12957. intersection(out: Rect, rectB: Rect): Rect;
  12958. /**
  12959. !#en Check whether the current rect contains the given point
  12960. !#zh 当前矩形是否包含指定坐标点。
  12961. Returns true if the point inside this rectangle.
  12962. @param point point
  12963. @example
  12964. ```js
  12965. var a = new cc.Rect(0, 0, 10, 10);
  12966. var b = new cc.Vec2(0, 5);
  12967. a.contains(b);// true
  12968. ```
  12969. */
  12970. contains(point: Vec2): boolean;
  12971. /**
  12972. !#en Returns true if the other rect totally inside this rectangle.
  12973. !#zh 当前矩形是否包含指定矩形。
  12974. @param rect rect
  12975. @example
  12976. ```js
  12977. var a = new cc.Rect(0, 0, 20, 20);
  12978. var b = new cc.Rect(0, 0, 10, 10);
  12979. a.containsRect(b);// true
  12980. ```
  12981. */
  12982. containsRect(rect: Rect): boolean;
  12983. /**
  12984. !#en Returns the smallest rectangle that contains the current rect and the given rect.
  12985. !#zh 返回一个包含当前矩形和指定矩形的最小矩形。
  12986. @param out Stores the result
  12987. @param rectB rectB
  12988. @example
  12989. ```js
  12990. var a = new cc.Rect(0, 10, 20, 20);
  12991. var b = new cc.Rect(0, 10, 10, 10);
  12992. var union = new cc.Rect();
  12993. a.union(union, b); // union {x: 0, y: 10, width: 20, height: 20};
  12994. ```
  12995. */
  12996. union(out: Rect, rectB: Rect): Rect;
  12997. /**
  12998. !#en Apply matrix4 to the rect.
  12999. !#zh 使用 mat4 对矩形进行矩阵转换。
  13000. @param out The output rect
  13001. @param mat The matrix4
  13002. */
  13003. transformMat4(out: Rect, mat: Mat4): void;
  13004. /**
  13005. !#en Output rect informations to string
  13006. !#zh 转换为方便阅读的字符串
  13007. @example
  13008. ```js
  13009. var a = new cc.Rect(0, 0, 10, 10);
  13010. a.toString();// "(0.00, 0.00, 10.00, 10.00)";
  13011. ```
  13012. */
  13013. toString(): string;
  13014. /** !#en The minimum x value, equals to rect.x
  13015. !#zh 矩形 x 轴上的最小值,等价于 rect.x。 */
  13016. xMin: number;
  13017. /** !#en The minimum y value, equals to rect.y
  13018. !#zh 矩形 y 轴上的最小值。 */
  13019. yMin: number;
  13020. /** !#en The maximum x value.
  13021. !#zh 矩形 x 轴上的最大值。 */
  13022. xMax: number;
  13023. /** !#en The maximum y value.
  13024. !#zh 矩形 y 轴上的最大值。 */
  13025. yMax: number;
  13026. /** !#en The position of the center of the rectangle.
  13027. !#zh 矩形的中心点。 */
  13028. center: Vec2;
  13029. /** !#en The X and Y position of the rectangle.
  13030. !#zh 矩形的 x 和 y 坐标。 */
  13031. origin: Vec2;
  13032. /** !#en Width and height of the rectangle.
  13033. !#zh 矩形的大小。 */
  13034. size: Size;
  13035. }
  13036. /** !#en
  13037. cc.Size is the class for size object,<br/>
  13038. please do not use its constructor to create sizes,<br/>
  13039. use {{#crossLink "cc/size:method"}}{{/crossLink}} alias function instead.<br/>
  13040. It will be deprecated soon, please use cc.Vec2 instead.
  13041. !#zh
  13042. cc.Size 是 size 对象的类。<br/>
  13043. 请不要使用它的构造函数创建的 size,<br/>
  13044. 使用 {{#crossLink "cc/size:method"}}{{/crossLink}} 别名函数。<br/>
  13045. 它不久将被取消,请使用cc.Vec2代替。 */
  13046. export class Size {
  13047. /**
  13048. @param width width
  13049. @param height height
  13050. */
  13051. constructor(width: number|Size, height?: number);
  13052. /** !#en return a Size object with width = 0 and height = 0.
  13053. !#zh 返回一个宽度为 0 和高度为 0 的 Size 对象。 */
  13054. static ZERO: Size;
  13055. width: number;
  13056. height: number;
  13057. /**
  13058. !#en TODO
  13059. !#zh 克隆 size 对象。
  13060. @example
  13061. ```js
  13062. var a = new cc.size(10, 10);
  13063. a.clone();// return Size {width: 0, height: 0};
  13064. ```
  13065. */
  13066. clone(): Size;
  13067. /**
  13068. !#en TODO
  13069. !#zh 当前 Size 对象是否等于指定 Size 对象。
  13070. @param other other
  13071. @example
  13072. ```js
  13073. var a = new cc.size(10, 10);
  13074. a.equals(new cc.size(10, 10));// return true;
  13075. ```
  13076. */
  13077. equals(other: Size): boolean;
  13078. /**
  13079. !#en TODO
  13080. !#zh 线性插值。
  13081. @param to to
  13082. @param ratio the interpolation coefficient.
  13083. @param out optional, the receiving vector.
  13084. @example
  13085. ```js
  13086. var a = new cc.size(10, 10);
  13087. var b = new cc.rect(50, 50, 100, 100);
  13088. update (dt) {
  13089. // method 1;
  13090. var c = a.lerp(b, dt * 0.1);
  13091. // method 2;
  13092. a.lerp(b, dt * 0.1, c);
  13093. }
  13094. ```
  13095. */
  13096. lerp(to: Rect, ratio: number, out?: Size): Size;
  13097. /**
  13098. !#en TODO
  13099. !#zh 转换为方便阅读的字符串。
  13100. @example
  13101. ```js
  13102. var a = new cc.size(10, 10);
  13103. a.toString();// return "(10.00, 10.00)";
  13104. ```
  13105. */
  13106. toString(): string;
  13107. }
  13108. /** !#en The base class of all value types.
  13109. !#zh 所有值类型的基类。 */
  13110. export class ValueType {
  13111. /**
  13112. !#en This method returns an exact copy of current value.
  13113. !#zh 克隆当前值,该方法返回一个新对象,新对象的值和原对象相等。
  13114. */
  13115. clone(): ValueType;
  13116. /**
  13117. !#en Compares this object with the other one.
  13118. !#zh 当前对象是否等于指定对象。
  13119. @param other other
  13120. */
  13121. equals(other: ValueType): boolean;
  13122. /**
  13123. !#en
  13124. Linearly interpolates between this value to to value by ratio which is in the range [0, 1].
  13125. When ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.
  13126. !#zh
  13127. 线性插值。<br/>
  13128. 当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
  13129. @param to the to value
  13130. @param ratio the interpolation coefficient
  13131. */
  13132. lerp(to: ValueType, ratio: number): ValueType;
  13133. /**
  13134. !#en
  13135. Copys all the properties from another given object to this value.
  13136. !#zh
  13137. 从其它对象把所有属性复制到当前对象。
  13138. @param source the source to copy
  13139. */
  13140. set(source: ValueType): void;
  13141. /**
  13142. !#en Convert to a readable string.
  13143. !#zh 转换为方便阅读的字符串。
  13144. */
  13145. toString(): string;
  13146. }
  13147. /** !#en Representation of 2D vectors and points.
  13148. !#zh 表示 2D 向量和坐标 */
  13149. export class Vec2 extends ValueType {
  13150. /**
  13151. !#en Returns the length of this vector.
  13152. !#zh 返回该向量的长度。
  13153. @example
  13154. ```js
  13155. var v = cc.v2(10, 10);
  13156. v.mag(); // return 14.142135623730951;
  13157. ```
  13158. */
  13159. mag(): number;
  13160. /**
  13161. !#en Returns the squared length of this vector.
  13162. !#zh 返回该向量的长度平方。
  13163. @example
  13164. ```js
  13165. var v = cc.v2(10, 10);
  13166. v.magSqr(); // return 200;
  13167. ```
  13168. */
  13169. magSqr(): number;
  13170. /**
  13171. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  13172. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  13173. @param vector vector
  13174. @example
  13175. ```js
  13176. var v = cc.v2(10, 10);
  13177. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  13178. ```
  13179. */
  13180. subSelf(vector: Vec2): Vec2;
  13181. /**
  13182. !#en Subtracts one vector from this, and returns the new result.
  13183. !#zh 向量减法,并返回新结果。
  13184. @param vector vector
  13185. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13186. @example
  13187. ```js
  13188. var v = cc.v2(10, 10);
  13189. v.sub(cc.v2(5, 5)); // return Vec2 {x: 5, y: 5};
  13190. var v1 = new Vec2;
  13191. v.sub(cc.v2(5, 5), v1); // return Vec2 {x: 5, y: 5};
  13192. ```
  13193. */
  13194. sub(vector: Vec2, out?: Vec2): Vec2;
  13195. /**
  13196. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  13197. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  13198. @param num num
  13199. @example
  13200. ```js
  13201. var v = cc.v2(10, 10);
  13202. v.mulSelf(5);// return Vec2 {x: 50, y: 50};
  13203. ```
  13204. */
  13205. mulSelf(num: number): Vec2;
  13206. /**
  13207. !#en Multiplies by a number, and returns the new result.
  13208. !#zh 缩放向量,并返回新结果。
  13209. @param num num
  13210. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13211. @example
  13212. ```js
  13213. var v = cc.v2(10, 10);
  13214. v.mul(5); // return Vec2 {x: 50, y: 50};
  13215. var v1 = new Vec2;
  13216. v.mul(5, v1); // return Vec2 {x: 50, y: 50};
  13217. ```
  13218. */
  13219. mul(num: number, out?: Vec2): Vec2;
  13220. /**
  13221. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  13222. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  13223. @param num num
  13224. @example
  13225. ```js
  13226. var v = cc.v2(10, 10);
  13227. v.divSelf(5); // return Vec2 {x: 2, y: 2};
  13228. ```
  13229. */
  13230. divSelf(num: number): Vec2;
  13231. /**
  13232. !#en Divides by a number, and returns the new result.
  13233. !#zh 向量除法,并返回新的结果。
  13234. @param num num
  13235. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13236. @example
  13237. ```js
  13238. var v = cc.v2(10, 10);
  13239. v.div(5); // return Vec2 {x: 2, y: 2};
  13240. var v1 = new Vec2;
  13241. v.div(5, v1); // return Vec2 {x: 2, y: 2};
  13242. ```
  13243. */
  13244. div(num: number, out?: Vec2): Vec2;
  13245. /**
  13246. !#en Multiplies two vectors.
  13247. !#zh 分量相乘。
  13248. @param vector vector
  13249. @example
  13250. ```js
  13251. var v = cc.v2(10, 10);
  13252. v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  13253. ```
  13254. */
  13255. scaleSelf(vector: Vec2): Vec2;
  13256. /**
  13257. !#en Multiplies two vectors, and returns the new result.
  13258. !#zh 分量相乘,并返回新的结果。
  13259. @param vector vector
  13260. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13261. @example
  13262. ```js
  13263. var v = cc.v2(10, 10);
  13264. v.scale(cc.v2(5, 5)); // return Vec2 {x: 50, y: 50};
  13265. var v1 = new Vec2;
  13266. v.scale(cc.v2(5, 5), v1); // return Vec2 {x: 50, y: 50};
  13267. ```
  13268. */
  13269. scale(vector: Vec2, out?: Vec2): Vec2;
  13270. /**
  13271. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  13272. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  13273. @example
  13274. ```js
  13275. var v = cc.v2(10, 10);
  13276. v.negSelf(); // return Vec2 {x: -10, y: -10};
  13277. ```
  13278. */
  13279. negSelf(): Vec2;
  13280. /**
  13281. !#en Negates the components, and returns the new result.
  13282. !#zh 返回取反后的新向量。
  13283. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13284. @example
  13285. ```js
  13286. var v = cc.v2(10, 10);
  13287. var v1 = new Vec2;
  13288. v.neg(v1); // return Vec2 {x: -10, y: -10};
  13289. ```
  13290. */
  13291. neg(out?: Vec2): Vec2;
  13292. /** !#en return a Vec2 object with x = 1 and y = 1.
  13293. !#zh 新 Vec2 对象。 */
  13294. static ONE: Vec2;
  13295. /** !#en return a Vec2 object with x = 0 and y = 0.
  13296. !#zh 返回 x = 0 和 y = 0 的 Vec2 对象。 */
  13297. static ZERO: Vec2;
  13298. /** !#en return a readonly Vec2 object with x = 0 and y = 0.
  13299. !#zh 返回一个 x = 0 和 y = 0 的 Vec2 只读对象。 */
  13300. static ZERO_R: Vec2;
  13301. /** !#en return a Vec2 object with x = 0 and y = 1.
  13302. !#zh 返回 x = 0 和 y = 1 的 Vec2 对象。 */
  13303. static UP: Vec2;
  13304. /** !#en return a readonly Vec2 object with x = 0 and y = 1.
  13305. !#zh 返回 x = 0 和 y = 1 的 Vec2 只读对象。 */
  13306. static UP_R: Vec2;
  13307. /** !#en return a readonly Vec2 object with x = 1 and y = 0.
  13308. !#zh 返回 x = 1 和 y = 0 的 Vec2 只读对象。 */
  13309. static RIGHT: Vec2;
  13310. /** !#en return a Vec2 object with x = 1 and y = 0.
  13311. !#zh 返回 x = 1 和 y = 0 的 Vec2 对象。 */
  13312. static RIGHT_R: Vec2;
  13313. /**
  13314. !#zh 获得指定向量的拷贝
  13315. */
  13316. static clone <Out extends IVec2Like> (a: Out): Vec2;
  13317. /**
  13318. !#zh 复制指定向量的值
  13319. */
  13320. static copy <Out extends IVec2Like> (out: Out, a: Out): Out;
  13321. /**
  13322. !#zh 设置向量值
  13323. */
  13324. static set <Out extends IVec2Like> (out: Out, x: number, y: number): Out;
  13325. /**
  13326. !#zh 逐元素向量加法
  13327. */
  13328. static add <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  13329. /**
  13330. !#zh 逐元素向量减法
  13331. */
  13332. static subtract <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  13333. /**
  13334. !#zh 逐元素向量乘法
  13335. */
  13336. static multiply <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  13337. /**
  13338. !#zh 逐元素向量除法
  13339. */
  13340. static divide <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  13341. /**
  13342. !#zh 逐元素向量向上取整
  13343. */
  13344. static ceil <Out extends IVec2Like> (out: Out, a: Out): Out;
  13345. /**
  13346. !#zh 逐元素向量向下取整
  13347. */
  13348. static floor <Out extends IVec2Like> (out: Out, a: Out): Out;
  13349. /**
  13350. !#zh 逐元素向量最小值
  13351. */
  13352. static min <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  13353. /**
  13354. !#zh 逐元素向量最大值
  13355. */
  13356. static max <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  13357. /**
  13358. !#zh 逐元素向量四舍五入取整
  13359. */
  13360. static round <Out extends IVec2Like> (out: Out, a: Out): Out;
  13361. /**
  13362. !#zh 向量标量乘法
  13363. */
  13364. static multiplyScalar <Out extends IVec2Like> (out: Out, a: Out, b: number): Out;
  13365. /**
  13366. !#zh 逐元素向量乘加: A + B * scale
  13367. */
  13368. static scaleAndAdd <Out extends IVec2Like> (out: Out, a: Out, b: Out, scale: number): Out;
  13369. /**
  13370. !#zh 求两向量的欧氏距离
  13371. */
  13372. static distance <Out extends IVec2Like> (a: Out, b: Out): number;
  13373. /**
  13374. !#zh 求两向量的欧氏距离平方
  13375. */
  13376. static squaredDistance <Out extends IVec2Like> (a: Out, b: Out): number;
  13377. /**
  13378. !#zh 求向量长度
  13379. */
  13380. static len <Out extends IVec2Like> (a: Out): number;
  13381. /**
  13382. !#zh 求向量长度平方
  13383. */
  13384. static lengthSqr <Out extends IVec2Like> (a: Out): number;
  13385. /**
  13386. !#zh 逐元素向量取负
  13387. */
  13388. static negate <Out extends IVec2Like> (out: Out, a: Out): Out;
  13389. /**
  13390. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13391. */
  13392. static inverse <Out extends IVec2Like> (out: Out, a: Out): Out;
  13393. /**
  13394. !#zh 逐元素向量取倒数,接近 0 时返回 0
  13395. */
  13396. static inverseSafe <Out extends IVec2Like> (out: Out, a: Out): Out;
  13397. /**
  13398. !#zh 归一化向量
  13399. */
  13400. static normalize <Out extends IVec2Like, Vec2Like extends IVec2Like> (out: Out, a: Vec2Like): Out;
  13401. /**
  13402. !#zh 向量点积(数量积)
  13403. */
  13404. static dot <Out extends IVec2Like> (a: Out, b: Out): number;
  13405. /**
  13406. !#zh 向量叉积(向量积),注意二维向量的叉积为与 Z 轴平行的三维向量
  13407. */
  13408. static cross <Out extends IVec2Like> (out: Vec2, a: Out, b: Out): Vec2;
  13409. /**
  13410. !#zh 逐元素向量线性插值: A + t * (B - A)
  13411. */
  13412. static lerp <Out extends IVec2Like> (out: Out, a: Out, b: Out, t: number): Out;
  13413. /**
  13414. !#zh 生成一个在单位圆上均匀分布的随机向量
  13415. */
  13416. static random <Out extends IVec2Like> (out: Out, scale?: number): Out;
  13417. /**
  13418. !#zh 向量与三维矩阵乘法,默认向量第三位为 1。
  13419. */
  13420. static transformMat3 <Out extends IVec2Like, MatLike extends IMat3Like> (out: Out, a: Out, mat: IMat3Like): Out;
  13421. /**
  13422. !#zh 向量与四维矩阵乘法,默认向量第三位为 0,第四位为 1。
  13423. */
  13424. static transformMat4 <Out extends IVec2Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike): Out;
  13425. /**
  13426. !#zh 向量等价判断
  13427. */
  13428. static strictEquals <Out extends IVec2Like> (a: Out, b: Out): boolean;
  13429. /**
  13430. !#zh 排除浮点数误差的向量近似等价判断
  13431. */
  13432. static equals <Out extends IVec2Like> (a: Out, b: Out, epsilon?: number): boolean;
  13433. /**
  13434. !#zh 排除浮点数误差的向量近似等价判断
  13435. */
  13436. static angle <Out extends IVec2Like> (a: Out, b: Out): number;
  13437. /**
  13438. !#zh 向量转数组
  13439. */
  13440. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec2Like, ofs?: number): Out;
  13441. /**
  13442. !#zh 数组转向量
  13443. */
  13444. static fromArray <Out extends IVec2Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  13445. x: number;
  13446. y: number;
  13447. /**
  13448. !#en
  13449. Constructor
  13450. see {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} or {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  13451. !#zh
  13452. 构造函数,可查看 {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} 或者 {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  13453. @param x x
  13454. @param y y
  13455. */
  13456. constructor(x?: number, y?: number);
  13457. /**
  13458. !#en clone a Vec2 object
  13459. !#zh 克隆一个 Vec2 对象
  13460. */
  13461. clone(): Vec2;
  13462. /**
  13463. !#en Sets vector with another's value
  13464. !#zh 设置向量值。
  13465. @param newValue !#en new value to set. !#zh 要设置的新值
  13466. */
  13467. set(newValue: Vec2): Vec2;
  13468. /**
  13469. !#en Check whether two vector equal
  13470. !#zh 当前的向量是否与指定的向量相等。
  13471. @param other other
  13472. */
  13473. equals(other: Vec2): boolean;
  13474. /**
  13475. !#en Check whether two vector equal with some degree of variance.
  13476. !#zh
  13477. 近似判断两个点是否相等。<br/>
  13478. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  13479. @param other other
  13480. @param variance variance
  13481. */
  13482. fuzzyEquals(other: Vec2, variance: number): boolean;
  13483. /**
  13484. !#en Transform to string with vector informations
  13485. !#zh 转换为方便阅读的字符串。
  13486. */
  13487. toString(): string;
  13488. /**
  13489. !#en Calculate linear interpolation result between this vector and another one with given ratio
  13490. !#zh 线性插值。
  13491. @param to to
  13492. @param ratio the interpolation coefficient
  13493. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13494. */
  13495. lerp(to: Vec2, ratio: number, out?: Vec2): Vec2;
  13496. /**
  13497. !#en Clamp the vector between from float and to float.
  13498. !#zh
  13499. 返回指定限制区域后的向量。<br/>
  13500. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  13501. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  13502. 否则返回自身。
  13503. @param min_inclusive min_inclusive
  13504. @param max_inclusive max_inclusive
  13505. @example
  13506. ```js
  13507. var min_inclusive = cc.v2(0, 0);
  13508. var max_inclusive = cc.v2(20, 20);
  13509. var v1 = cc.v2(20, 20).clampf(min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};
  13510. var v2 = cc.v2(0, 0).clampf(min_inclusive, max_inclusive); // Vec2 {x: 0, y: 0};
  13511. var v3 = cc.v2(10, 10).clampf(min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};
  13512. ```
  13513. */
  13514. clampf(min_inclusive: Vec2, max_inclusive: Vec2): Vec2;
  13515. /**
  13516. !#en Adds this vector.
  13517. !#zh 向量加法。
  13518. @param vector vector
  13519. @param out out
  13520. @example
  13521. ```js
  13522. var v = cc.v2(10, 10);
  13523. v.add(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
  13524. ```
  13525. */
  13526. add(vector: Vec2, out?: Vec2): Vec2;
  13527. /**
  13528. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  13529. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  13530. @param vector vector
  13531. */
  13532. addSelf(vector: Vec2): Vec2;
  13533. /**
  13534. !#en Subtracts one vector from this.
  13535. !#zh 向量减法。
  13536. @param vector vector
  13537. @example
  13538. ```js
  13539. var v = cc.v2(10, 10);
  13540. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  13541. ```
  13542. */
  13543. subtract(vector: Vec2): Vec2;
  13544. /**
  13545. !#en Multiplies this by a number.
  13546. !#zh 缩放当前向量。
  13547. @param num num
  13548. @example
  13549. ```js
  13550. var v = cc.v2(10, 10);
  13551. v.multiply(5);// return Vec2 {x: 50, y: 50};
  13552. ```
  13553. */
  13554. multiplyScalar(num: number): Vec2;
  13555. /**
  13556. !#en Multiplies two vectors.
  13557. !#zh 分量相乘。
  13558. @param vector vector
  13559. @example
  13560. ```js
  13561. var v = cc.v2(10, 10);
  13562. v.multiply(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  13563. ```
  13564. */
  13565. multiply(vector: Vec2): Vec2;
  13566. /**
  13567. !#en Divides by a number.
  13568. !#zh 向量除法。
  13569. @param num num
  13570. @example
  13571. ```js
  13572. var v = cc.v2(10, 10);
  13573. v.divide(5); // return Vec2 {x: 2, y: 2};
  13574. ```
  13575. */
  13576. divide(num: number): Vec2;
  13577. /**
  13578. !#en Negates the components.
  13579. !#zh 向量取反。
  13580. @example
  13581. ```js
  13582. var v = cc.v2(10, 10);
  13583. v.negate(); // return Vec2 {x: -10, y: -10};
  13584. ```
  13585. */
  13586. negate(): Vec2;
  13587. /**
  13588. !#en Dot product
  13589. !#zh 当前向量与指定向量进行点乘。
  13590. @param vector vector
  13591. @example
  13592. ```js
  13593. var v = cc.v2(10, 10);
  13594. v.dot(cc.v2(5, 5)); // return 100;
  13595. ```
  13596. */
  13597. dot(vector?: Vec2): number;
  13598. /**
  13599. !#en Cross product
  13600. !#zh 当前向量与指定向量进行叉乘。
  13601. @param vector vector
  13602. @example
  13603. ```js
  13604. var v = cc.v2(10, 10);
  13605. v.cross(cc.v2(5, 5)); // return 0;
  13606. ```
  13607. */
  13608. cross(vector?: Vec2): number;
  13609. /**
  13610. !#en Returns the length of this vector.
  13611. !#zh 返回该向量的长度。
  13612. @example
  13613. ```js
  13614. var v = cc.v2(10, 10);
  13615. v.len(); // return 14.142135623730951;
  13616. ```
  13617. */
  13618. len(): number;
  13619. /**
  13620. !#en Returns the squared length of this vector.
  13621. !#zh 返回该向量的长度平方。
  13622. @example
  13623. ```js
  13624. var v = cc.v2(10, 10);
  13625. v.lengthSqr(); // return 200;
  13626. ```
  13627. */
  13628. lengthSqr(): number;
  13629. /**
  13630. !#en Make the length of this vector to 1.
  13631. !#zh 向量归一化,让这个向量的长度为 1。
  13632. @example
  13633. ```js
  13634. var v = cc.v2(10, 10);
  13635. v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
  13636. ```
  13637. */
  13638. normalizeSelf(): Vec2;
  13639. /**
  13640. !#en
  13641. Returns this vector with a magnitude of 1.<br/>
  13642. <br/>
  13643. Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
  13644. !#zh
  13645. 返回归一化后的向量。<br/>
  13646. <br/>
  13647. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  13648. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13649. */
  13650. normalize(out?: Vec2): Vec2;
  13651. /**
  13652. !#en Get angle in radian between this and vector.
  13653. !#zh 夹角的弧度。
  13654. @param vector vector
  13655. */
  13656. angle(vector: Vec2): number;
  13657. /**
  13658. !#en Get angle in radian between this and vector with direction.
  13659. !#zh 带方向的夹角的弧度。
  13660. @param vector vector
  13661. */
  13662. signAngle(vector: Vec2): number;
  13663. /**
  13664. !#en rotate
  13665. !#zh 返回旋转给定弧度后的新向量。
  13666. @param radians radians
  13667. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13668. */
  13669. rotate(radians: number, out?: Vec2): Vec2;
  13670. /**
  13671. !#en rotate self
  13672. !#zh 按指定弧度旋转向量。
  13673. @param radians radians
  13674. */
  13675. rotateSelf(radians: number): Vec2;
  13676. /**
  13677. !#en Calculates the projection of the current vector over the given vector.
  13678. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  13679. @param vector vector
  13680. @example
  13681. ```js
  13682. var v1 = cc.v2(20, 20);
  13683. var v2 = cc.v2(5, 5);
  13684. v1.project(v2); // Vec2 {x: 20, y: 20};
  13685. ```
  13686. */
  13687. project(vector: Vec2): Vec2;
  13688. /**
  13689. Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
  13690. @param m matrix to transform with
  13691. @param out the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  13692. */
  13693. transformMat4(m: Mat4, out?: Vec2): Vec2;
  13694. /**
  13695. Returns the maximum value in x, y.
  13696. */
  13697. maxAxis(): number;
  13698. }
  13699. /** !#en Representation of 3D vectors and points.
  13700. !#zh 表示 3D 向量和坐标 */
  13701. export class Vec3 extends ValueType {
  13702. /**
  13703. !#en Returns the length of this vector.
  13704. !#zh 返回该向量的长度。
  13705. @example
  13706. ```js
  13707. var v = cc.v3(10, 10, 10);
  13708. v.mag(); // return 17.320508075688775;
  13709. ```
  13710. */
  13711. mag(): number;
  13712. /**
  13713. !#en Returns the squared length of this vector.
  13714. !#zh 返回该向量的长度平方。
  13715. */
  13716. magSqr(): number;
  13717. /**
  13718. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  13719. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  13720. @param vector vector
  13721. */
  13722. subSelf(vector: Vec3): Vec3;
  13723. /**
  13724. !#en Subtracts one vector from this, and returns the new result.
  13725. !#zh 向量减法,并返回新结果。
  13726. @param vector vector
  13727. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13728. */
  13729. sub(vector: Vec3, out?: Vec3): Vec3;
  13730. /**
  13731. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  13732. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  13733. @param num num
  13734. */
  13735. mulSelf(num: number): Vec3;
  13736. /**
  13737. !#en Multiplies by a number, and returns the new result.
  13738. !#zh 缩放向量,并返回新结果。
  13739. @param num num
  13740. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13741. */
  13742. mul(num: number, out?: Vec3): Vec3;
  13743. /**
  13744. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  13745. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  13746. @param num num
  13747. */
  13748. divSelf(num: number): Vec3;
  13749. /**
  13750. !#en Divides by a number, and returns the new result.
  13751. !#zh 向量除法,并返回新的结果。
  13752. @param num num
  13753. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13754. */
  13755. div(num: number, out?: Vec3): Vec3;
  13756. /**
  13757. !#en Multiplies two vectors.
  13758. !#zh 分量相乘。
  13759. @param vector vector
  13760. */
  13761. scaleSelf(vector: Vec3): Vec3;
  13762. /**
  13763. !#en Multiplies two vectors, and returns the new result.
  13764. !#zh 分量相乘,并返回新的结果。
  13765. @param vector vector
  13766. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13767. */
  13768. scale(vector: Vec3, out?: Vec3): Vec3;
  13769. /**
  13770. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  13771. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  13772. */
  13773. negSelf(): Vec3;
  13774. /**
  13775. !#en Negates the components, and returns the new result.
  13776. !#zh 返回取反后的新向量。
  13777. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  13778. */
  13779. neg(out?: Vec3): Vec3;
  13780. /** !#en return a Vec3 object with x = 1, y = 1, z = 1.
  13781. !#zh 新 Vec3 对象。 */
  13782. static ONE: Vec3;
  13783. /** !#en return a Vec3 object with x = 0, y = 0, z = 0.
  13784. !#zh 返回 x = 0,y = 0,z = 0 的 Vec3 对象。 */
  13785. static ZERO: Vec3;
  13786. /** !#en return a Vec3 object with x = 0, y = 1, z = 0.
  13787. !#zh 返回 x = 0, y = 1, z = 0 的 Vec3 对象。 */
  13788. static UP: Vec3;
  13789. /** !#en return a Vec3 object with x = 1, y = 0, z = 0.
  13790. !#zh 返回 x = 1,y = 0,z = 0 的 Vec3 对象。 */
  13791. static RIGHT: Vec3;
  13792. /** !#en return a Vec3 object with x = 0, y = 0, z = 1.
  13793. !#zh 返回 x = 0,y = 0,z = 1 的 Vec3 对象。 */
  13794. static FORWARD: Vec3;
  13795. /**
  13796. !#zh 将目标赋值为零向量
  13797. !#en The target of an assignment zero vector
  13798. */
  13799. static zero<Out extends IVec3Like> (out: Out): Out;
  13800. /**
  13801. !#zh 获得指定向量的拷贝
  13802. !#en Obtaining copy vectors designated
  13803. */
  13804. static clone<Out extends IVec3Like> (a: Out): Vec3;
  13805. /**
  13806. !#zh 复制目标向量
  13807. !#en Copy the target vector
  13808. */
  13809. static copy<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like): Out;
  13810. /**
  13811. !#zh 设置向量值
  13812. !#en Set to value
  13813. */
  13814. static set<Out extends IVec3Like> (out: Out, x: number, y: number, z: number): Out;
  13815. /**
  13816. !#zh 逐元素向量加法
  13817. !#en Element-wise vector addition
  13818. */
  13819. static add<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13820. /**
  13821. !#zh 逐元素向量减法
  13822. !#en Element-wise vector subtraction
  13823. */
  13824. static subtract<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13825. /**
  13826. !#zh 逐元素向量乘法 (分量积)
  13827. !#en Element-wise vector multiplication (product component)
  13828. */
  13829. static multiply<Out extends IVec3Like, Vec3Like_1 extends IVec3Like, Vec3Like_2 extends IVec3Like> (out: Out, a: Vec3Like_1, b: Vec3Like_2): Out;
  13830. /**
  13831. !#zh 逐元素向量除法
  13832. !#en Element-wise vector division
  13833. */
  13834. static divide<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13835. /**
  13836. !#zh 逐元素向量向上取整
  13837. !#en Rounding up by elements of the vector
  13838. */
  13839. static ceil<Out extends IVec3Like> (out: Out, a: Out): Out;
  13840. /**
  13841. !#zh 逐元素向量向下取整
  13842. !#en Element vector by rounding down
  13843. */
  13844. static floor<Out extends IVec3Like> (out: Out, a: Out): Out;
  13845. /**
  13846. !#zh 逐元素向量最小值
  13847. !#en The minimum by-element vector
  13848. */
  13849. static min<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13850. /**
  13851. !#zh 逐元素向量最大值
  13852. !#en The maximum value of the element-wise vector
  13853. */
  13854. static max<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13855. /**
  13856. !#zh 逐元素向量四舍五入取整
  13857. !#en Element-wise vector of rounding to whole
  13858. */
  13859. static round<Out extends IVec3Like> (out: Out, a: Out): Out;
  13860. /**
  13861. !#zh 向量标量乘法
  13862. !#en Vector scalar multiplication
  13863. */
  13864. static multiplyScalar<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like, b: number): Out;
  13865. /**
  13866. !#zh 逐元素向量乘加: A + B * scale
  13867. !#en Element-wise vector multiply add: A + B * scale
  13868. */
  13869. static scaleAndAdd<Out extends IVec3Like> (out: Out, a: Out, b: Out, scale: number): Out;
  13870. /**
  13871. !#zh 求两向量的欧氏距离
  13872. !#en Seeking two vectors Euclidean distance
  13873. */
  13874. static distance<Out extends IVec3Like> (a: Out, b: Out): number;
  13875. /**
  13876. !#zh 求两向量的欧氏距离平方
  13877. !#en Euclidean distance squared seeking two vectors
  13878. */
  13879. static squaredDistance<Out extends IVec3Like> (a: Out, b: Out): number;
  13880. /**
  13881. !#zh 求向量长度
  13882. !#en Seeking vector length
  13883. */
  13884. static len<Out extends IVec3Like> (a: Out): number;
  13885. /**
  13886. !#zh 求向量长度平方
  13887. !#en Seeking squared vector length
  13888. */
  13889. static lengthSqr<Out extends IVec3Like> (a: Out): number;
  13890. /**
  13891. !#zh 逐元素向量取负
  13892. !#en By taking the negative elements of the vector
  13893. */
  13894. static negate<Out extends IVec3Like> (out: Out, a: Out): Out;
  13895. /**
  13896. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13897. !#en Element vector by taking the inverse, return near 0 Infinity
  13898. */
  13899. static inverse<Out extends IVec3Like> (out: Out, a: Out): Out;
  13900. /**
  13901. !#zh 逐元素向量取倒数,接近 0 时返回 0
  13902. !#en Element vector by taking the inverse, return near 0 0
  13903. */
  13904. static inverseSafe<Out extends IVec3Like> (out: Out, a: Out): Out;
  13905. /**
  13906. !#zh 归一化向量
  13907. !#en Normalized vector
  13908. */
  13909. static normalize<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like): Out;
  13910. /**
  13911. !#zh 向量点积(数量积)
  13912. !#en Vector dot product (scalar product)
  13913. */
  13914. static dot<Out extends IVec3Like> (a: Out, b: Out): number;
  13915. /**
  13916. !#zh 向量叉积(向量积)
  13917. !#en Vector cross product (vector product)
  13918. */
  13919. static cross<Out extends IVec3Like, Vec3Like_1 extends IVec3Like, Vec3Like_2 extends IVec3Like> (out: Out, a: Vec3Like_1, b: Vec3Like_2): Out;
  13920. /**
  13921. !#zh 逐元素向量线性插值: A + t * (B - A)
  13922. !#en Vector element by element linear interpolation: A + t * (B - A)
  13923. */
  13924. static lerp<Out extends IVec3Like> (out: Out, a: Out, b: Out, t: number): Out;
  13925. /**
  13926. !#zh 生成一个在单位球体上均匀分布的随机向量
  13927. !#en Generates a uniformly distributed random vectors on the unit sphere
  13928. @param scale 生成的向量长度
  13929. */
  13930. static random<Out extends IVec3Like> (out: Out, scale?: number): Out;
  13931. /**
  13932. !#zh 向量与四维矩阵乘法,默认向量第四位为 1。
  13933. !#en Four-dimensional vector and matrix multiplication, the default vectors fourth one.
  13934. */
  13935. static transformMat4<Out extends IVec3Like, Vec3Like extends IVec3Like, MatLike extends IMat4Like> (out: Out, a: Vec3Like, mat: MatLike): Out;
  13936. /**
  13937. !#zh 向量与四维矩阵乘法,默认向量第四位为 0。
  13938. !#en Four-dimensional vector and matrix multiplication, vector fourth default is 0.
  13939. */
  13940. static transformMat4Normal<Out extends IVec3Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike): Out;
  13941. /**
  13942. !#zh 向量与三维矩阵乘法
  13943. !#en Dimensional vector matrix multiplication
  13944. */
  13945. static transformMat3<Out extends IVec3Like, MatLike extends IMat3Like> (out: Out, a: Out, mat: MatLike): Out;
  13946. /**
  13947. !#zh 向量仿射变换
  13948. !#en Affine transformation vector
  13949. */
  13950. static transformAffine<Out extends IVec3Like, VecLike extends IVec3Like, MatLike extends IMat4Like>(out: Out, v: VecLike, mat: MatLike): Out;
  13951. /**
  13952. !#zh 向量四元数乘法
  13953. !#en Vector quaternion multiplication
  13954. */
  13955. static transformQuat<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike> (out: Out, a: VecLike, q: QuatLike): Out;
  13956. /**
  13957. !#zh 以缩放 -> 旋转 -> 平移顺序变换向量
  13958. !#en To scale -> rotation -> transformation vector sequence translation
  13959. */
  13960. static transformRTS<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike>(out: Out, a: VecLike, r: QuatLike, t: VecLike, s: VecLike): Out;
  13961. /**
  13962. !#zh 以平移 -> 旋转 -> 缩放顺序逆变换向量
  13963. !#en Translational -> rotation -> Zoom inverse transformation vector sequence
  13964. */
  13965. static transformInverseRTS<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike>(out: Out, a: VecLike, r: QuatLike, t: VecLike, s: VecLike): Out;
  13966. /**
  13967. !#zh 绕 X 轴旋转向量指定弧度
  13968. !#en Rotation vector specified angle about the X axis
  13969. @param v 待旋转向量
  13970. @param o 旋转中心
  13971. @param a 旋转弧度
  13972. */
  13973. static rotateX<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number): Out;
  13974. /**
  13975. !#zh 绕 Y 轴旋转向量指定弧度
  13976. !#en Rotation vector specified angle around the Y axis
  13977. @param v 待旋转向量
  13978. @param o 旋转中心
  13979. @param a 旋转弧度
  13980. */
  13981. static rotateY<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number): Out;
  13982. /**
  13983. !#zh 绕 Z 轴旋转向量指定弧度
  13984. !#en Around the Z axis specified angle vector
  13985. @param v 待旋转向量
  13986. @param o 旋转中心
  13987. @param a 旋转弧度
  13988. */
  13989. static rotateZ<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number): Out;
  13990. /**
  13991. !#zh 向量等价判断
  13992. !#en Equivalent vectors Analyzing
  13993. */
  13994. static strictEquals<Out extends IVec3Like> (a: Out, b: Out): boolean;
  13995. /**
  13996. !#zh 排除浮点数误差的向量近似等价判断
  13997. !#en Negative error vector floating point approximately equivalent Analyzing
  13998. */
  13999. static equals<Out extends IVec3Like> (a: Out, b: Out, epsilon?: number): boolean;
  14000. /**
  14001. !#zh 求两向量夹角弧度
  14002. !#en Radian angle between two vectors seek
  14003. */
  14004. static angle<Out extends IVec3Like> (a: Out, b: Out): number;
  14005. /**
  14006. !#zh 计算向量在指定平面上的投影
  14007. !#en Calculating a projection vector in the specified plane
  14008. @param a 待投影向量
  14009. @param n 指定平面的法线
  14010. */
  14011. static projectOnPlane<Out extends IVec3Like> (out: Out, a: Out, n: Out): Out;
  14012. /**
  14013. !#zh 计算向量在指定向量上的投影
  14014. !#en Projection vector calculated in the vector designated
  14015. @param a 待投影向量
  14016. @param n 目标向量
  14017. */
  14018. static project<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  14019. /**
  14020. !#zh 向量转数组
  14021. !#en Vector transfer array
  14022. @param ofs 数组起始偏移量
  14023. */
  14024. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec3Like, ofs?: number): Out;
  14025. /**
  14026. !#zh 数组转向量
  14027. !#en Array steering amount
  14028. @param ofs 数组起始偏移量
  14029. */
  14030. static fromArray <Out extends IVec3Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  14031. x: number;
  14032. y: number;
  14033. z: number;
  14034. /**
  14035. !#en
  14036. Constructor
  14037. see {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  14038. !#zh
  14039. 构造函数,可查看 {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  14040. @param x x
  14041. @param y y
  14042. @param z z
  14043. */
  14044. constructor(x?: Vec3|number, y?: number, z?: number);
  14045. /**
  14046. !#en clone a Vec3 value
  14047. !#zh 克隆一个 Vec3 值
  14048. */
  14049. clone(): Vec3;
  14050. /**
  14051. !#en Set the current vector value with the given vector.
  14052. !#zh 用另一个向量设置当前的向量对象值。
  14053. @param newValue !#en new value to set. !#zh 要设置的新值
  14054. */
  14055. set(newValue: Vec3): Vec3;
  14056. /**
  14057. !#en Check whether the vector equals another one
  14058. !#zh 当前的向量是否与指定的向量相等。
  14059. @param other other
  14060. */
  14061. equals(other: Vec3): boolean;
  14062. /**
  14063. !#en Check whether two vector equal with some degree of variance.
  14064. !#zh
  14065. 近似判断两个点是否相等。<br/>
  14066. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  14067. @param other other
  14068. @param variance variance
  14069. */
  14070. fuzzyEquals(other: Vec3, variance: number): boolean;
  14071. /**
  14072. !#en Transform to string with vector informations
  14073. !#zh 转换为方便阅读的字符串。
  14074. */
  14075. toString(): string;
  14076. /**
  14077. !#en Calculate linear interpolation result between this vector and another one with given ratio
  14078. !#zh 线性插值。
  14079. @param to to
  14080. @param ratio the interpolation coefficient
  14081. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  14082. */
  14083. lerp(to: Vec3, ratio: number, out?: Vec3): Vec3;
  14084. /**
  14085. !#en Clamp the vector between from float and to float.
  14086. !#zh
  14087. 返回指定限制区域后的向量。<br/>
  14088. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  14089. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  14090. 否则返回自身。
  14091. @param min_inclusive min_inclusive
  14092. @param max_inclusive max_inclusive
  14093. */
  14094. clampf(min_inclusive: Vec3, max_inclusive: Vec3): Vec3;
  14095. /**
  14096. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  14097. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  14098. @param vector vector
  14099. */
  14100. addSelf(vector: Vec3): Vec3;
  14101. /**
  14102. !#en Adds two vectors, and returns the new result.
  14103. !#zh 向量加法,并返回新结果。
  14104. @param vector vector
  14105. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  14106. */
  14107. add(vector: Vec3, out?: Vec3): Vec3;
  14108. /**
  14109. !#en Subtracts one vector from this.
  14110. !#zh 向量减法。
  14111. @param vector vector
  14112. */
  14113. subtract(vector: Vec3): Vec3;
  14114. /**
  14115. !#en Multiplies this by a number.
  14116. !#zh 缩放当前向量。
  14117. @param num num
  14118. */
  14119. multiplyScalar(num: number): Vec3;
  14120. /**
  14121. !#en Multiplies two vectors.
  14122. !#zh 分量相乘。
  14123. @param vector vector
  14124. */
  14125. multiply(vector: Vec3): Vec3;
  14126. /**
  14127. !#en Divides by a number.
  14128. !#zh 向量除法。
  14129. @param num num
  14130. */
  14131. divide(num: number): Vec3;
  14132. /**
  14133. !#en Negates the components.
  14134. !#zh 向量取反。
  14135. */
  14136. negate(): Vec3;
  14137. /**
  14138. !#en Dot product
  14139. !#zh 当前向量与指定向量进行点乘。
  14140. @param vector vector
  14141. */
  14142. dot(vector?: Vec3): number;
  14143. /**
  14144. !#en Cross product
  14145. !#zh 当前向量与指定向量进行叉乘。
  14146. @param vector vector
  14147. @param out out
  14148. */
  14149. cross(vector: Vec3, out?: Vec3): Vec3;
  14150. /**
  14151. !#en Returns the length of this vector.
  14152. !#zh 返回该向量的长度。
  14153. @example
  14154. ```js
  14155. var v = cc.v3(10, 10, 10);
  14156. v.len(); // return 17.320508075688775;
  14157. ```
  14158. */
  14159. len(): number;
  14160. /**
  14161. !#en Returns the squared length of this vector.
  14162. !#zh 返回该向量的长度平方。
  14163. */
  14164. lengthSqr(): number;
  14165. /**
  14166. !#en Make the length of this vector to 1.
  14167. !#zh 向量归一化,让这个向量的长度为 1。
  14168. */
  14169. normalizeSelf(): Vec3;
  14170. /**
  14171. !#en
  14172. Returns this vector with a magnitude of 1.<br/>
  14173. <br/>
  14174. Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
  14175. !#zh
  14176. 返回归一化后的向量。<br/>
  14177. <br/>
  14178. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  14179. @param out optional, the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  14180. */
  14181. normalize(out?: Vec3): Vec3;
  14182. /**
  14183. Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
  14184. @param m matrix to transform with
  14185. @param out the receiving vector, you can pass the same vec3 to save result to itself, if not provided, a new vec3 will be created
  14186. */
  14187. transformMat4(m: Mat4, out?: Vec3): Vec3;
  14188. /**
  14189. Returns the maximum value in x, y, and z
  14190. */
  14191. maxAxis(): number;
  14192. /**
  14193. !#en Get angle in radian between this and vector.
  14194. !#zh 夹角的弧度。
  14195. @param vector vector
  14196. */
  14197. angle(vector: Vec3): number;
  14198. /**
  14199. !#en Calculates the projection of the current vector over the given vector.
  14200. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  14201. @param vector vector
  14202. @example
  14203. ```js
  14204. var v1 = cc.v3(20, 20, 20);
  14205. var v2 = cc.v3(5, 5, 5);
  14206. v1.project(v2); // Vec3 {x: 20, y: 20, z: 20};
  14207. ```
  14208. */
  14209. project(vector: Vec3): Vec3;
  14210. /**
  14211. !#en Get angle in radian between this and vector with direction. <br/>
  14212. In order to compatible with the vec2 API.
  14213. !#zh 带方向的夹角的弧度。该方法仅用做兼容 2D 计算。
  14214. @param vector vector
  14215. */
  14216. signAngle(vector: Vec3|Vec2): number;
  14217. /**
  14218. !#en rotate. In order to compatible with the vec2 API.
  14219. !#zh 返回旋转给定弧度后的新向量。该方法仅用做兼容 2D 计算。
  14220. @param radians radians
  14221. @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
  14222. */
  14223. rotate(radians: number, out?: Vec3): Vec2;
  14224. /**
  14225. !#en rotate self. In order to compatible with the vec2 API.
  14226. !#zh 按指定弧度旋转向量。该方法仅用做兼容 2D 计算。
  14227. @param radians radians
  14228. */
  14229. rotateSelf(radians: number): Vec3;
  14230. }
  14231. /** !#en Representation of 3D vectors and points.
  14232. !#zh 表示 3D 向量和坐标 */
  14233. export class Vec4 extends ValueType {
  14234. /**
  14235. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  14236. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  14237. @param vector vector
  14238. */
  14239. subSelf(vector: Vec4): Vec4;
  14240. /**
  14241. !#en Subtracts one vector from this, and returns the new result.
  14242. !#zh 向量减法,并返回新结果。
  14243. @param vector vector
  14244. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14245. */
  14246. sub(vector: Vec4, out?: Vec4): Vec4;
  14247. /**
  14248. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  14249. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  14250. @param num num
  14251. */
  14252. mulSelf(num: number): Vec4;
  14253. /**
  14254. !#en Multiplies by a number, and returns the new result.
  14255. !#zh 缩放向量,并返回新结果。
  14256. @param num num
  14257. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14258. */
  14259. mul(num: number, out?: Vec4): Vec4;
  14260. /**
  14261. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  14262. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  14263. @param num num
  14264. */
  14265. divSelf(num: number): Vec4;
  14266. /**
  14267. !#en Divides by a number, and returns the new result.
  14268. !#zh 向量除法,并返回新的结果。
  14269. @param num num
  14270. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14271. */
  14272. div(num: number, out?: Vec4): Vec4;
  14273. /**
  14274. !#en Multiplies two vectors.
  14275. !#zh 分量相乘。
  14276. @param vector vector
  14277. */
  14278. scaleSelf(vector: Vec4): Vec4;
  14279. /**
  14280. !#en Multiplies two vectors, and returns the new result.
  14281. !#zh 分量相乘,并返回新的结果。
  14282. @param vector vector
  14283. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14284. */
  14285. scale(vector: Vec4, out?: Vec4): Vec4;
  14286. /**
  14287. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  14288. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  14289. */
  14290. negSelf(): Vec4;
  14291. /**
  14292. !#en Negates the components, and returns the new result.
  14293. !#zh 返回取反后的新向量。
  14294. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14295. */
  14296. neg(out?: Vec4): Vec4;
  14297. /**
  14298. !#zh 获得指定向量的拷贝
  14299. !#en Obtaining copy vectors designated
  14300. */
  14301. static clone <Out extends IVec4Like> (a: Out): Vec4;
  14302. /**
  14303. !#zh 复制目标向量
  14304. !#en Copy the target vector
  14305. */
  14306. static copy <Out extends IVec4Like> (out: Out, a: Out): Out;
  14307. /**
  14308. !#zh 设置向量值
  14309. !#en Set to value
  14310. */
  14311. static set <Out extends IVec4Like> (out: Out, x: number, y: number, z: number, w: number): Out;
  14312. /**
  14313. !#zh 逐元素向量加法
  14314. !#en Element-wise vector addition
  14315. */
  14316. static add <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  14317. /**
  14318. !#zh 逐元素向量减法
  14319. !#en Element-wise vector subtraction
  14320. */
  14321. static subtract <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  14322. /**
  14323. !#zh 逐元素向量乘法
  14324. !#en Element-wise vector multiplication
  14325. */
  14326. static multiply <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  14327. /**
  14328. !#zh 逐元素向量除法
  14329. !#en Element-wise vector division
  14330. */
  14331. static divide <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  14332. /**
  14333. !#zh 逐元素向量向上取整
  14334. !#en Rounding up by elements of the vector
  14335. */
  14336. static ceil <Out extends IVec4Like> (out: Out, a: Out): Out;
  14337. /**
  14338. !#zh 逐元素向量向下取整
  14339. !#en Element vector by rounding down
  14340. */
  14341. static floor <Out extends IVec4Like> (out: Out, a: Out): Out;
  14342. /**
  14343. !#zh 逐元素向量最小值
  14344. !#en The minimum by-element vector
  14345. */
  14346. static min <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  14347. /**
  14348. !#zh 逐元素向量最大值
  14349. !#en The maximum value of the element-wise vector
  14350. */
  14351. static max <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  14352. /**
  14353. !#zh 逐元素向量四舍五入取整
  14354. !#en Element-wise vector of rounding to whole
  14355. */
  14356. static round <Out extends IVec4Like> (out: Out, a: Out): Out;
  14357. /**
  14358. !#zh 向量标量乘法
  14359. !#en Vector scalar multiplication
  14360. */
  14361. static multiplyScalar <Out extends IVec4Like> (out: Out, a: Out, b: number): Out;
  14362. /**
  14363. !#zh 逐元素向量乘加: A + B * scale
  14364. !#en Element-wise vector multiply add: A + B * scale
  14365. */
  14366. static scaleAndAdd <Out extends IVec4Like> (out: Out, a: Out, b: Out, scale: number): Out;
  14367. /**
  14368. !#zh 求两向量的欧氏距离
  14369. !#en Seeking two vectors Euclidean distance
  14370. */
  14371. static distance <Out extends IVec4Like> (a: Out, b: Out): number;
  14372. /**
  14373. !#zh 求两向量的欧氏距离平方
  14374. !#en Euclidean distance squared seeking two vectors
  14375. */
  14376. static squaredDistance <Out extends IVec4Like> (a: Out, b: Out): number;
  14377. /**
  14378. !#zh 求向量长度
  14379. !#en Seeking vector length
  14380. */
  14381. static len <Out extends IVec4Like> (a: Out): number;
  14382. /**
  14383. !#zh 求向量长度平方
  14384. !#en Seeking squared vector length
  14385. */
  14386. static lengthSqr <Out extends IVec4Like> (a: Out): number;
  14387. /**
  14388. !#zh 逐元素向量取负
  14389. !#en By taking the negative elements of the vector
  14390. */
  14391. static negate <Out extends IVec4Like> (out: Out, a: Out): Out;
  14392. /**
  14393. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  14394. !#en Element vector by taking the inverse, return near 0 Infinity
  14395. */
  14396. static inverse <Out extends IVec4Like> (out: Out, a: Out): Out;
  14397. /**
  14398. !#zh 逐元素向量取倒数,接近 0 时返回 0
  14399. !#en Element vector by taking the inverse, return near 0 0
  14400. */
  14401. static inverseSafe <Out extends IVec4Like> (out: Out, a: Out): Out;
  14402. /**
  14403. !#zh 归一化向量
  14404. !#en Normalized vector
  14405. */
  14406. static normalize <Out extends IVec4Like> (out: Out, a: Out): Out;
  14407. /**
  14408. !#zh 向量点积(数量积)
  14409. !#en Vector dot product (scalar product)
  14410. */
  14411. static dot <Out extends IVec4Like> (a: Out, b: Out): number;
  14412. /**
  14413. !#zh 逐元素向量线性插值: A + t * (B - A)
  14414. !#en Vector element by element linear interpolation: A + t * (B - A)
  14415. */
  14416. static lerp <Out extends IVec4Like> (out: Out, a: Out, b: Out, t: number): Out;
  14417. /**
  14418. !#zh 生成一个在单位球体上均匀分布的随机向量
  14419. !#en Generates a uniformly distributed random vectors on the unit sphere
  14420. @param scale 生成的向量长度
  14421. */
  14422. static random <Out extends IVec4Like> (out: Out, scale?: number): Out;
  14423. /**
  14424. !#zh 向量矩阵乘法
  14425. !#en Vector matrix multiplication
  14426. */
  14427. static transformMat4 <Out extends IVec4Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike): Out;
  14428. /**
  14429. !#zh 向量仿射变换
  14430. !#en Affine transformation vector
  14431. */
  14432. static transformAffine<Out extends IVec4Like, VecLike extends IVec4Like, MatLike extends IMat4Like>(out: Out, v: VecLike, mat: MatLike): Out;
  14433. /**
  14434. !#zh 向量四元数乘法
  14435. !#en Vector quaternion multiplication
  14436. */
  14437. static transformQuat <Out extends IVec4Like, QuatLike extends IQuatLike> (out: Out, a: Out, q: QuatLike): Out;
  14438. /**
  14439. !#zh 向量等价判断
  14440. !#en Equivalent vectors Analyzing
  14441. */
  14442. static strictEquals <Out extends IVec4Like> (a: Out, b: Out): boolean;
  14443. /**
  14444. !#zh 排除浮点数误差的向量近似等价判断
  14445. !#en Negative error vector floating point approximately equivalent Analyzing
  14446. */
  14447. static equals <Out extends IVec4Like> (a: Out, b: Out, epsilon?: number): boolean;
  14448. /**
  14449. !#zh 向量转数组
  14450. !#en Vector transfer array
  14451. @param ofs 数组起始偏移量
  14452. */
  14453. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec4Like, ofs?: number): Out;
  14454. /**
  14455. !#zh 数组转向量
  14456. !#en Array steering amount
  14457. @param ofs 数组起始偏移量
  14458. */
  14459. static fromArray <Out extends IVec4Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  14460. x: number;
  14461. y: number;
  14462. z: number;
  14463. w: number;
  14464. /**
  14465. !#en
  14466. Constructor
  14467. see {{#crossLink "cc/vec4:method"}}cc.v4{{/crossLink}}
  14468. !#zh
  14469. 构造函数,可查看 {{#crossLink "cc/vec4:method"}}cc.v4{{/crossLink}}
  14470. @param x x
  14471. @param y y
  14472. @param z z
  14473. @param w w
  14474. */
  14475. constructor(x?: number, y?: number, z?: number, w?: number);
  14476. /**
  14477. !#en clone a Vec4 value
  14478. !#zh 克隆一个 Vec4 值
  14479. */
  14480. clone(): Vec4;
  14481. /**
  14482. !#en Set the current vector value with the given vector.
  14483. !#zh 用另一个向量设置当前的向量对象值。
  14484. @param newValue !#en new value to set. !#zh 要设置的新值
  14485. */
  14486. set(newValue: Vec4): Vec4;
  14487. /**
  14488. !#en Check whether the vector equals another one
  14489. !#zh 当前的向量是否与指定的向量相等。
  14490. @param other other
  14491. @param epsilon epsilon
  14492. */
  14493. equals(other: Vec4, epsilon?: number): boolean;
  14494. /**
  14495. !#en Check whether the vector equals another one
  14496. !#zh 判断当前向量是否在误差范围内与指定分量的向量相等。
  14497. @param x 相比较的向量的 x 分量。
  14498. @param y 相比较的向量的 y 分量。
  14499. @param z 相比较的向量的 z 分量。
  14500. @param w 相比较的向量的 w 分量。
  14501. @param epsilon 允许的误差,应为非负数。
  14502. */
  14503. equals4f(x: number, y: number, z: number, w: number, epsilon?: number): boolean;
  14504. /**
  14505. !#en Check whether strict equals other Vec4
  14506. !#zh 判断当前向量是否与指定向量相等。两向量的各分量都分别相等时返回 `true`;否则返回 `false`。
  14507. @param other 相比较的向量。
  14508. */
  14509. strictEquals(other: Vec4): boolean;
  14510. /**
  14511. !#en Check whether strict equals other Vec4
  14512. !#zh 判断当前向量是否与指定分量的向量相等。两向量的各分量都分别相等时返回 `true`;否则返回 `false`。
  14513. @param x 指定向量的 x 分量。
  14514. @param y 指定向量的 y 分量。
  14515. @param z 指定向量的 z 分量。
  14516. @param w 指定向量的 w 分量。
  14517. */
  14518. strictEquals4f(x: number, y: number, z: number, w: number): boolean;
  14519. /**
  14520. !#en Calculate linear interpolation result between this vector and another one with given ratio
  14521. !#zh 根据指定的插值比率,从当前向量到目标向量之间做插值。
  14522. @param to 目标向量。
  14523. @param ratio 插值比率,范围为 [0,1]。
  14524. */
  14525. lerp(to: Vec4, ratio: number): Vec4;
  14526. /**
  14527. !#en Transform to string with vector informations
  14528. !#zh 返回当前向量的字符串表示。
  14529. */
  14530. toString(): string;
  14531. /**
  14532. !#en Clamp the vector between minInclusive and maxInclusive.
  14533. !#zh 设置当前向量的值,使其各个分量都处于指定的范围内。
  14534. @param minInclusive 每个分量都代表了对应分量允许的最小值。
  14535. @param maxInclusive 每个分量都代表了对应分量允许的最大值。
  14536. */
  14537. clampf(minInclusive: Vec4, maxInclusive: Vec4): Vec4;
  14538. /**
  14539. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  14540. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  14541. @param vector vector
  14542. */
  14543. addSelf(vector: Vec4): Vec4;
  14544. /**
  14545. !#en Adds two vectors, and returns the new result.
  14546. !#zh 向量加法,并返回新结果。
  14547. @param vector vector
  14548. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14549. */
  14550. add(vector: Vec4, out?: Vec4): Vec4;
  14551. /**
  14552. !#en Subtracts one vector from this, and returns the new result.
  14553. !#zh 向量减法,并返回新结果。
  14554. @param vector vector
  14555. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14556. */
  14557. subtract(vector: Vec4, out?: Vec4): Vec4;
  14558. /**
  14559. !#en Multiplies this by a number.
  14560. !#zh 缩放当前向量。
  14561. @param num num
  14562. */
  14563. multiplyScalar(num: number): Vec4;
  14564. /**
  14565. !#en Multiplies two vectors.
  14566. !#zh 分量相乘。
  14567. @param vector vector
  14568. */
  14569. multiply(vector: Vec4): Vec4;
  14570. /**
  14571. !#en Divides by a number.
  14572. !#zh 向量除法。
  14573. @param num num
  14574. */
  14575. divide(num: number): Vec4;
  14576. /**
  14577. !#en Negates the components.
  14578. !#zh 向量取反
  14579. */
  14580. negate(): Vec4;
  14581. /**
  14582. !#en Dot product
  14583. !#zh 当前向量与指定向量进行点乘。
  14584. @param vector vector
  14585. */
  14586. dot(vector?: Vec4): number;
  14587. /**
  14588. !#en Cross product
  14589. !#zh 当前向量与指定向量进行叉乘。
  14590. @param vector vector
  14591. @param out out
  14592. */
  14593. cross(vector: Vec4, out?: Vec4): Vec4;
  14594. /**
  14595. !#en Returns the length of this vector.
  14596. !#zh 返回该向量的长度。
  14597. @example
  14598. ```js
  14599. var v = cc.v4(10, 10);
  14600. v.len(); // return 14.142135623730951;
  14601. ```
  14602. */
  14603. len(): number;
  14604. /**
  14605. !#en Returns the squared length of this vector.
  14606. !#zh 返回该向量的长度平方。
  14607. */
  14608. lengthSqr(): number;
  14609. /**
  14610. !#en Make the length of this vector to 1.
  14611. !#zh 向量归一化,让这个向量的长度为 1。
  14612. */
  14613. normalizeSelf(): Vec4;
  14614. /**
  14615. !#en
  14616. Returns this vector with a magnitude of 1.<br/>
  14617. <br/>
  14618. Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
  14619. !#zh
  14620. 返回归一化后的向量。<br/>
  14621. <br/>
  14622. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  14623. @param out optional, the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14624. */
  14625. normalize(out?: Vec4): Vec4;
  14626. /**
  14627. Transforms the vec4 with a mat4. 4th vector component is implicitly '1'
  14628. @param m matrix to transform with
  14629. @param out the receiving vector, you can pass the same vec4 to save result to itself, if not provided, a new vec4 will be created
  14630. */
  14631. transformMat4(m: Mat4, out?: Vec4): Vec4;
  14632. /**
  14633. Returns the maximum value in x, y, z, w.
  14634. */
  14635. maxAxis(): number;
  14636. }
  14637. /** !#en The burst of 3d particle.
  14638. !#zh 3D 粒子发射时的爆发个数 */
  14639. export class Burst {
  14640. /** !#en Time between the start of the particle system and the trigger of this Brust
  14641. !#zh 粒子系统开始运行到触发此次 Brust 的时间 */
  14642. time: number;
  14643. /** !#en Minimum number of emitted particles
  14644. !#zh 发射粒子的最小数量 */
  14645. minCount: number;
  14646. /** !#en Maximum number of emitted particles
  14647. !#zh 发射粒子的最大数量 */
  14648. maxCount: number;
  14649. /** !#en The number of times Burst was triggered.
  14650. !#zh Burst 的触发次数 */
  14651. repeatCount: number;
  14652. /** !#en Interval of each trigger
  14653. !#zh 每次触发的间隔时间 */
  14654. repeatInterval: number;
  14655. /** !#en Number of particles emitted
  14656. !#zh 发射的粒子的数量 */
  14657. count: CurveRange;
  14658. }
  14659. /** !#en The animation curve of 3d particle.
  14660. !#zh 3D 粒子动画曲线 */
  14661. export class AnimationCurve {
  14662. /** !#en Array of key value.
  14663. !#zh 关键值列表。 */
  14664. keyFrames: Keyframe[];
  14665. /** !#en Pre-wrap mode.
  14666. !#zh 前置循环模式。 */
  14667. preWrapMode: WrapMode;
  14668. /** !#en Post-wrap mode.
  14669. !#zh 后置循环模式。 */
  14670. postWrapMode: WrapMode;
  14671. }
  14672. /** !#en The ParticleSystem3D Component.
  14673. !#zh 3D 粒子组件 */
  14674. export class ParticleSystem3D extends RenderComponent {
  14675. /** !#en The run time of particle.
  14676. !#zh 粒子系统运行时间 */
  14677. duration: number;
  14678. /** !#en The maximum number of particles that a particle system can generate.
  14679. !#zh 粒子系统能生成的最大粒子数量 */
  14680. capacity: number;
  14681. /** !#en Whether the particle system loops.
  14682. !#zh 粒子系统是否循环播放 */
  14683. loop: boolean;
  14684. /** !#en Whether the particles start playing automatically after loaded.
  14685. !#zh 粒子系统加载后是否自动开始播放 */
  14686. playOnAwake: boolean;
  14687. /** !#en When selected, the particle system will start playing after one round has been played (only effective when loop is enabled).
  14688. !#zh 选中之后,粒子系统会以已播放完一轮之后的状态开始播放(仅当循环播放启用时有效) */
  14689. prewarm: boolean;
  14690. /** !#en The coordinate system in which the particle system is located.<br>
  14691. World coordinates (does not change when the position of other objects changes)<br>
  14692. Local coordinates (moving as the position of the parent node changes)<br>
  14693. Custom coordinates (moving with the position of a custom node)
  14694. !#zh 选择粒子系统所在的坐标系<br>
  14695. 世界坐标(不随其他物体位置改变而变换)<br>
  14696. 局部坐标(跟随父节点位置改变而移动)<br>
  14697. 自定坐标(跟随自定义节点的位置改变而移动) */
  14698. simulationSpace: ParticleSystem3DAssembler.Space;
  14699. /** !#en Controlling the update speed of the entire particle system.
  14700. !#zh 控制整个粒子系统的更新速度。 */
  14701. simulationSpeed: number;
  14702. /** !#en Delay particle emission time after particle system starts running.
  14703. !#zh 粒子系统开始运行后,延迟粒子发射的时间。 */
  14704. startDelay: CurveRange;
  14705. /** !#en Particle life cycle。
  14706. !#zh 粒子生命周期。 */
  14707. startLifetime: CurveRange;
  14708. /** !#en Particle initial color
  14709. !#zh 粒子初始颜色 */
  14710. startColor: GradientRange;
  14711. /** !#en Particle scale space
  14712. !#zh 缩放空间 */
  14713. scaleSpace: ParticleSystem3DAssembler.Space;
  14714. /** !#en Initial particle size
  14715. !#zh 粒子初始大小 */
  14716. startSize: CurveRange;
  14717. /** !#en Initial particle speed
  14718. !#zh 粒子初始速度 */
  14719. startSpeed: CurveRange;
  14720. /** !#en Particle initial rotation angle
  14721. !#zh 粒子初始旋转角度 */
  14722. startRotation: CurveRange;
  14723. /** !#en Gravity coefficient of particles affected by gravity
  14724. !#zh 粒子受重力影响的重力系数 */
  14725. gravityModifier: CurveRange;
  14726. /** !#en Particles emitted per second
  14727. !#zh 每秒发射的粒子数 */
  14728. rateOverTime: CurveRange;
  14729. /** !#en Number of particles emitted per unit distance moved
  14730. !#zh 每移动单位距离发射的粒子数 */
  14731. rateOverDistance: CurveRange;
  14732. /** !#en The number of Brusts that emit a specified number of particles at a specified time
  14733. !#zh 设定在指定时间发射指定数量的粒子的 Brust 的数量 */
  14734. bursts: Burst[];
  14735. /** !#en Particle emitter module
  14736. !#zh 粒子发射器模块 */
  14737. shapeModule: ShapeModule;
  14738. /** !#en Color control module
  14739. !#zh 颜色控制模块 */
  14740. colorOverLifetimeModule: ColorOverLifetimeModule;
  14741. /** !#en Particle size module
  14742. !#zh 粒子大小模块 */
  14743. sizeOvertimeModule: SizeOvertimeModule;
  14744. /** !#en Particle speed module
  14745. !#zh 粒子速度模块 */
  14746. velocityOvertimeModule: VelocityOvertimeModule;
  14747. /** !#en Particle acceleration module
  14748. !#zh 粒子加速度模块 */
  14749. forceOvertimeModule: ForceOvertimeModule;
  14750. /** !#en Particle limit speed module (only CPU particles are supported)
  14751. !#zh 粒子限制速度模块(只支持 CPU 粒子) */
  14752. limitVelocityOvertimeModule: LimitVelocityOvertimeModule;
  14753. /** !#en Particle rotation module
  14754. !#zh 粒子旋转模块 */
  14755. rotationOvertimeModule: RotationOvertimeModule;
  14756. /** !#en Texture Animation Module
  14757. !#zh 贴图动画模块 */
  14758. textureAnimationModule: TextureAnimationModule;
  14759. /** !#en Particle Trajectory Module
  14760. !#zh 粒子轨迹模块 */
  14761. trailModule: TrailModule;
  14762. /** !#en Particle generation mode
  14763. !#zh 设定粒子生成模式 */
  14764. renderMode: ParticleSystem3DAssembler.RenderMode;
  14765. /** !#en When the particle generation mode is StrecthedBillboard, in the direction of movement of the particles is stretched by velocity magnitude
  14766. !#zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按速度大小进行拉伸 */
  14767. velocityScale: number;
  14768. /** !#en When the particle generation method is StrecthedBillboard, the particles are stretched according to the particle size in the direction of motion
  14769. !#zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按粒子大小进行拉伸 */
  14770. lengthScale: number;
  14771. /** !#en Particle model
  14772. !#zh 粒子模型 */
  14773. mesh: Mesh;
  14774. /** !#en Particle material
  14775. !#zh 粒子材质 */
  14776. particleMaterial: Material;
  14777. /** !#en Particle trail material
  14778. !#zh 粒子轨迹材质 */
  14779. trailMaterial: Material;
  14780. /**
  14781. !#en Playing particle effects
  14782. !#zh 播放粒子效果
  14783. */
  14784. play(): void;
  14785. /**
  14786. !#en Pause particle effect
  14787. !#zh 暂停播放粒子效果
  14788. */
  14789. pause(): void;
  14790. /**
  14791. !#en Stop particle effect
  14792. !#zh 停止播放粒子效果
  14793. */
  14794. stop(): void;
  14795. /**
  14796. !#en Remove all particle effect
  14797. !#zh 将所有粒子从粒子系统中清除
  14798. */
  14799. clear(): void;
  14800. }
  14801. /** !#en
  14802. Helper class for ES5 Map.
  14803. !#zh
  14804. ES5 Map 辅助类。 */
  14805. export class MapUtils {
  14806. }
  14807. /** !#en Effect Asset.
  14808. !#zh Effect 资源类型。 */
  14809. export class EffectAsset extends Asset {
  14810. }
  14811. /** !#en Material Asset.
  14812. !#zh 材质资源类。 */
  14813. export class Material extends Asset {
  14814. /**
  14815. !#en Get built-in materials
  14816. !#zh 获取内置材质
  14817. @param name name
  14818. */
  14819. static getBuiltinMaterial(name: string): Material;
  14820. /**
  14821. !#en Creates a Material with builtin Effect.
  14822. !#zh 使用内建 Effect 创建一个材质。
  14823. @param effectName effectName
  14824. @param techniqueIndex techniqueIndex
  14825. */
  14826. static createWithBuiltin(effectName: string, techniqueIndex?: number): Material;
  14827. /**
  14828. !#en Creates a Material.
  14829. !#zh 创建一个材质。
  14830. @param effectAsset effectAsset
  14831. @param techniqueIndex techniqueIndex
  14832. */
  14833. static create(effectAsset: EffectAsset, techniqueIndex?: number): Material;
  14834. /**
  14835. !#en Sets the Material property
  14836. !#zh 设置材质的属性
  14837. @param name name
  14838. @param val val
  14839. @param passIdx passIdx
  14840. @param directly directly
  14841. */
  14842. setProperty(name: string, val: any, passIdx?: number, directly?: boolean): void;
  14843. /**
  14844. !#en Gets the Material property.
  14845. !#zh 获取材质的属性。
  14846. @param name name
  14847. @param passIdx passIdx
  14848. */
  14849. getProperty(name: string, passIdx: number): any;
  14850. /**
  14851. !#en Sets the Material define.
  14852. !#zh 设置材质的宏定义。
  14853. @param name name
  14854. @param val val
  14855. @param passIdx passIdx
  14856. @param force force
  14857. */
  14858. define(name: string, val: boolean|number, passIdx?: number, force?: boolean): void;
  14859. /**
  14860. !#en Gets the Material define.
  14861. !#zh 获取材质的宏定义。
  14862. @param name name
  14863. @param passIdx passIdx
  14864. */
  14865. getDefine(name: string, passIdx?: number): boolean;
  14866. /**
  14867. !#en Sets the Material cull mode.
  14868. !#zh 设置材质的裁减模式。
  14869. @param cullMode cullMode
  14870. @param passIdx passIdx
  14871. */
  14872. setCullMode(cullMode: number, passIdx: number): void;
  14873. /**
  14874. !#en Sets the Material depth states.
  14875. !#zh 设置材质的深度渲染状态。
  14876. @param depthTest depthTest
  14877. @param depthWrite depthWrite
  14878. @param depthFunc depthFunc
  14879. @param passIdx passIdx
  14880. */
  14881. setDepth(depthTest: boolean, depthWrite: boolean, depthFunc: number, passIdx: number): void;
  14882. /**
  14883. !#en Sets the Material blend states.
  14884. !#zh 设置材质的混合渲染状态。
  14885. @param enabled enabled
  14886. @param blendEq blendEq
  14887. @param blendSrc blendSrc
  14888. @param blendDst blendDst
  14889. @param blendAlphaEq blendAlphaEq
  14890. @param blendSrcAlpha blendSrcAlpha
  14891. @param blendDstAlpha blendDstAlpha
  14892. @param blendColor blendColor
  14893. @param passIdx passIdx
  14894. */
  14895. setBlend(enabled: boolean, blendEq: number, blendSrc: number, blendDst: number, blendAlphaEq: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: number, passIdx: number): void;
  14896. /**
  14897. !#en Sets whether enable the stencil test.
  14898. !#zh 设置是否开启模板测试。
  14899. @param stencilTest stencilTest
  14900. @param passIdx passIdx
  14901. */
  14902. setStencilEnabled(stencilTest: number, passIdx: number): void;
  14903. /**
  14904. !#en Sets the Material stencil render states.
  14905. !#zh 设置材质的模板测试渲染参数。
  14906. @param stencilTest stencilTest
  14907. @param stencilFunc stencilFunc
  14908. @param stencilRef stencilRef
  14909. @param stencilMask stencilMask
  14910. @param stencilFailOp stencilFailOp
  14911. @param stencilZFailOp stencilZFailOp
  14912. @param stencilZPassOp stencilZPassOp
  14913. @param stencilWriteMask stencilWriteMask
  14914. @param passIdx passIdx
  14915. */
  14916. setStencil(stencilTest: number, stencilFunc: number, stencilRef: number, stencilMask: number, stencilFailOp: number, stencilZFailOp: number, stencilZPassOp: number, stencilWriteMask: number, passIdx: number): void;
  14917. }
  14918. /** !#en
  14919. Material Variant is an extension of the Material Asset.
  14920. Changes to Material Variant do not affect other Material Variant or Material Asset,
  14921. and changes to Material Asset are synchronized to the Material Variant.
  14922. However, when a Material Variant had already modifies a state, the Material Asset state is not synchronized to the Material Variant.
  14923. !#zh
  14924. 材质变体是材质资源的一个延伸。
  14925. 材质变体的修改不会影响到其他的材质变体或者材质资源,而材质资源的修改会同步体现到材质变体上,
  14926. 但是当材质变体对一个状态修改后,材质资源再对这个状态修改是不会同步到材质变体上的。 */
  14927. export class MaterialVariant extends Material {
  14928. /**
  14929. @param materialName materialName
  14930. @param owner owner
  14931. */
  14932. static createWithBuiltin (materialName: string, owner: cc.RenderComponent): MaterialVariant | null;
  14933. /**
  14934. @param material material
  14935. @param owner owner
  14936. */
  14937. static create (material: Material, owner: cc.RenderComponent): MaterialVariant | null;
  14938. }
  14939. /** !#en cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.
  14940. !#zh EditBox 组件,用于获取用户的输入文本。 */
  14941. export class EditBox extends Component {
  14942. /** !#en Input string of EditBox.
  14943. !#zh 输入框的初始输入内容,如果为空则会显示占位符的文本。 */
  14944. string: string;
  14945. /** !#en The Label component attached to the node for EditBox's input text label
  14946. !#zh 输入框输入文本节点上挂载的 Label 组件对象 */
  14947. textLabel: Label;
  14948. /** !#en The Label component attached to the node for EditBox's placeholder text label
  14949. !#zh 输入框占位符节点上挂载的 Label 组件对象 */
  14950. placeholderLabel: Label;
  14951. /** !#en The Sprite component attached to the node for EditBox's background
  14952. !#zh 输入框背景节点上挂载的 Sprite 组件对象 */
  14953. background: Sprite;
  14954. /** !#en The background image of EditBox. This property will be removed in the future, use editBox.background instead please.
  14955. !#zh 输入框的背景图片。 该属性会在将来的版本中移除,请用 editBox.background */
  14956. backgroundImage: SpriteFrame;
  14957. /** !#en
  14958. The return key type of EditBox.
  14959. Note: it is meaningless for web platforms and desktop platforms.
  14960. !#zh
  14961. 指定移动设备上面回车按钮的样式。
  14962. 注意:这个选项对 web 平台与 desktop 平台无效。 */
  14963. returnType: EditBox.KeyboardReturnType;
  14964. /** !#en Set the input flags that are to be applied to the EditBox.
  14965. !#zh 指定输入标志位,可以指定输入方式为密码或者单词首字母大写。 */
  14966. inputFlag: EditBox.InputFlag;
  14967. /** !#en
  14968. Set the input mode of the edit box.
  14969. If you pass ANY, it will create a multiline EditBox.
  14970. !#zh
  14971. 指定输入模式: ANY表示多行输入,其它都是单行输入,移动平台上还可以指定键盘样式。 */
  14972. inputMode: EditBox.InputMode;
  14973. /** !#en Font size of the input text. This property will be removed in the future, use editBox.textLabel.fontSize instead please.
  14974. !#zh 输入框文本的字体大小。 该属性会在将来的版本中移除,请使用 editBox.textLabel.fontSize。 */
  14975. fontSize: number;
  14976. /** !#en Change the lineHeight of displayed text. This property will be removed in the future, use editBox.textLabel.lineHeight instead.
  14977. !#zh 输入框文本的行高。该属性会在将来的版本中移除,请使用 editBox.textLabel.lineHeight */
  14978. lineHeight: number;
  14979. /** !#en Font color of the input text. This property will be removed in the future, use editBox.textLabel.node.color instead.
  14980. !#zh 输入框文本的颜色。该属性会在将来的版本中移除,请使用 editBox.textLabel.node.color */
  14981. fontColor: Color;
  14982. /** !#en The display text of placeholder.
  14983. !#zh 输入框占位符的文本内容。 */
  14984. placeholder: string;
  14985. /** !#en The font size of placeholder. This property will be removed in the future, use editBox.placeholderLabel.fontSize instead.
  14986. !#zh 输入框占位符的字体大小。该属性会在将来的版本中移除,请使用 editBox.placeholderLabel.fontSize */
  14987. placeholderFontSize: number;
  14988. /** !#en The font color of placeholder. This property will be removed in the future, use editBox.placeholderLabel.node.color instead.
  14989. !#zh 输入框占位符的字体颜色。该属性会在将来的版本中移除,请使用 editBox.placeholderLabel.node.color */
  14990. placeholderFontColor: Color;
  14991. /** !#en The maximize input length of EditBox.
  14992. - If pass a value less than 0, it won't limit the input number of characters.
  14993. - If pass 0, it doesn't allow input any characters.
  14994. !#zh 输入框最大允许输入的字符个数。
  14995. - 如果值为小于 0 的值,则不会限制输入字符个数。
  14996. - 如果值为 0,则不允许用户进行任何输入。 */
  14997. maxLength: number;
  14998. /** !#en The input is always visible and be on top of the game view (only useful on Web), this property will be removed on v2.1
  14999. !zh 输入框总是可见,并且永远在游戏视图的上面(这个属性只有在 Web 上面修改有意义),该属性会在 v2.1 中移除
  15000. Note: only available on Web at the moment. */
  15001. stayOnTop: boolean;
  15002. /** !#en Set the tabIndex of the DOM input element (only useful on Web).
  15003. !#zh 修改 DOM 输入元素的 tabIndex(这个属性只有在 Web 上面修改有意义)。 */
  15004. tabIndex: number;
  15005. /** !#en The event handler to be called when EditBox began to edit text.
  15006. !#zh 开始编辑文本输入框触发的事件回调。 */
  15007. editingDidBegan: Component.EventHandler[];
  15008. /** !#en The event handler to be called when EditBox text changes.
  15009. !#zh 编辑文本输入框时触发的事件回调。 */
  15010. textChanged: Component.EventHandler[];
  15011. /** !#en The event handler to be called when EditBox edit ends.
  15012. !#zh 结束编辑文本输入框时触发的事件回调。 */
  15013. editingDidEnded: Component.EventHandler[];
  15014. /** !#en The event handler to be called when return key is pressed. Windows is not supported.
  15015. !#zh 当用户按下回车按键时的事件回调,目前不支持 windows 平台 */
  15016. editingReturn: Component.EventHandler[];
  15017. /**
  15018. !#en Let the EditBox get focus, this method will be removed on v2.1
  15019. !#zh 让当前 EditBox 获得焦点, 这个方法会在 v2.1 中移除
  15020. */
  15021. setFocus(): void;
  15022. /**
  15023. !#en Let the EditBox get focus
  15024. !#zh 让当前 EditBox 获得焦点
  15025. */
  15026. focus(): void;
  15027. /**
  15028. !#en Let the EditBox lose focus
  15029. !#zh 让当前 EditBox 失去焦点
  15030. */
  15031. blur(): void;
  15032. /**
  15033. !#en Determine whether EditBox is getting focus or not.
  15034. !#zh 判断 EditBox 是否获得了焦点
  15035. */
  15036. isFocused(): void;
  15037. /**
  15038. !#en if you don't need the EditBox and it isn't in any running Scene, you should
  15039. call the destroy method on this component or the associated node explicitly.
  15040. Otherwise, the created DOM element won't be removed from web page.
  15041. !#zh
  15042. 如果你不再使用 EditBox,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  15043. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  15044. @example
  15045. ```js
  15046. editbox.node.parent = null; // or editbox.node.removeFromParent(false);
  15047. // when you don't need editbox anymore
  15048. editbox.node.destroy();
  15049. ```
  15050. */
  15051. destroy(): boolean;
  15052. }
  15053. /** !#en .
  15054. !#zh 。 */
  15055. export class SkeletonAnimation extends Animation {
  15056. }
  15057. /** !#en SkeletonAnimationClip Asset.
  15058. !#zh 骨骼动画剪辑。 */
  15059. export class SkeletonAnimationClip extends AnimationClip {
  15060. }
  15061. /** !#en
  15062. Skinned Mesh Renderer
  15063. !#zh
  15064. 蒙皮渲染组件 */
  15065. export class SkinnedMeshRenderer extends MeshRenderer {
  15066. /** !#en
  15067. Skeleton Asset
  15068. !#zh
  15069. 骨骼资源 */
  15070. skeleton: sp.Skeleton;
  15071. /** !#en
  15072. Root Bone
  15073. !#zh
  15074. 骨骼根节点 */
  15075. rootBone: Node;
  15076. }
  15077. /** !#en
  15078. A distance joint constrains two points on two bodies
  15079. to remain at a fixed distance from each other. You can view
  15080. this as a massless, rigid rod.
  15081. !#zh
  15082. 距离关节通过一个固定的长度来约束关节链接的两个刚体。你可以将它想象成一个无质量,坚固的木棍。 */
  15083. export class DistanceJoint extends Joint {
  15084. /** !#en
  15085. The distance separating the two ends of the joint.
  15086. !#zh
  15087. 关节两端的距离 */
  15088. distance: number;
  15089. /** !#en
  15090. The spring frequency.
  15091. !#zh
  15092. 弹性系数。 */
  15093. frequency: number;
  15094. /** !#en
  15095. The damping ratio.
  15096. !#zh
  15097. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15098. dampingRatio: number;
  15099. }
  15100. /** !#en
  15101. Base class for joints to connect rigidbody.
  15102. !#zh
  15103. 关节类的基类 */
  15104. export class Joint extends Component {
  15105. /** !#en
  15106. The anchor of the rigidbody.
  15107. !#zh
  15108. 刚体的锚点。 */
  15109. anchor: Vec2;
  15110. /** !#en
  15111. The anchor of the connected rigidbody.
  15112. !#zh
  15113. 关节另一端刚体的锚点。 */
  15114. connectedAnchor: Vec2;
  15115. /** !#en
  15116. The rigidbody to which the other end of the joint is attached.
  15117. !#zh
  15118. 关节另一端链接的刚体 */
  15119. connectedBody: RigidBody;
  15120. /** !#en
  15121. Should the two rigid bodies connected with this joint collide with each other?
  15122. !#zh
  15123. 链接到关节上的两个刚体是否应该相互碰撞? */
  15124. collideConnected: boolean;
  15125. /**
  15126. !#en
  15127. Apply current changes to joint, this will regenerate inner box2d joint.
  15128. !#zh
  15129. 应用当前关节中的修改,调用此函数会重新生成内部 box2d 的关节。
  15130. */
  15131. apply(): void;
  15132. /**
  15133. !#en
  15134. Get the anchor point on rigidbody in world coordinates.
  15135. !#zh
  15136. 获取刚体世界坐标系下的锚点。
  15137. */
  15138. getWorldAnchor(): Vec2;
  15139. /**
  15140. !#en
  15141. Get the anchor point on connected rigidbody in world coordinates.
  15142. !#zh
  15143. 获取链接刚体世界坐标系下的锚点。
  15144. */
  15145. getWorldConnectedAnchor(): Vec2;
  15146. /**
  15147. !#en
  15148. Gets the reaction force of the joint.
  15149. !#zh
  15150. 获取关节的反作用力。
  15151. @param timeStep The time to calculate the reaction force for.
  15152. */
  15153. getReactionForce(timeStep: number): Vec2;
  15154. /**
  15155. !#en
  15156. Gets the reaction torque of the joint.
  15157. !#zh
  15158. 获取关节的反扭矩。
  15159. @param timeStep The time to calculate the reaction torque for.
  15160. */
  15161. getReactionTorque(timeStep: number): number;
  15162. }
  15163. /** !#en
  15164. A motor joint is used to control the relative motion
  15165. between two bodies. A typical usage is to control the movement
  15166. of a dynamic body with respect to the ground.
  15167. !#zh
  15168. 马达关节被用来控制两个刚体间的相对运动。
  15169. 一个典型的例子是用来控制一个动态刚体相对于地面的运动。 */
  15170. export class MotorJoint extends Joint {
  15171. /** !#en
  15172. The anchor of the rigidbody.
  15173. !#zh
  15174. 刚体的锚点。 */
  15175. anchor: Vec2;
  15176. /** !#en
  15177. The anchor of the connected rigidbody.
  15178. !#zh
  15179. 关节另一端刚体的锚点。 */
  15180. connectedAnchor: Vec2;
  15181. /** !#en
  15182. The linear offset from connected rigidbody to rigidbody.
  15183. !#zh
  15184. 关节另一端的刚体相对于起始端刚体的位置偏移量 */
  15185. linearOffset: Vec2;
  15186. /** !#en
  15187. The angular offset from connected rigidbody to rigidbody.
  15188. !#zh
  15189. 关节另一端的刚体相对于起始端刚体的角度偏移量 */
  15190. angularOffset: number;
  15191. /** !#en
  15192. The maximum force can be applied to rigidbody.
  15193. !#zh
  15194. 可以应用于刚体的最大的力值 */
  15195. maxForce: number;
  15196. /** !#en
  15197. The maximum torque can be applied to rigidbody.
  15198. !#zh
  15199. 可以应用于刚体的最大扭矩值 */
  15200. maxTorque: number;
  15201. /** !#en
  15202. The position correction factor in the range [0,1].
  15203. !#zh
  15204. 位置矫正系数,范围为 [0, 1] */
  15205. correctionFactor: number;
  15206. }
  15207. /** !#en
  15208. A mouse joint is used to make a point on a body track a
  15209. specified world point. This a soft constraint with a maximum
  15210. force. This allows the constraint to stretch and without
  15211. applying huge forces.
  15212. Mouse Joint will auto register the touch event with the mouse region node,
  15213. and move the choosed rigidbody in touch move event.
  15214. Note : generally mouse joint only used in test bed.
  15215. !#zh
  15216. 鼠标关节用于使刚体上的一个点追踪一个指定的世界坐标系下的位置。
  15217. 鼠标关节可以指定一个最大的里来施加一个柔和的约束。
  15218. 鼠标关节会自动使用 mouse region 节点来注册鼠标事件,并且在触摸移动事件中移动选中的刚体。
  15219. 注意:一般鼠标关节只在测试环境中使用。 */
  15220. export class MouseJoint extends Joint {
  15221. /** !#en
  15222. The anchor of the rigidbody.
  15223. !#zh
  15224. 刚体的锚点。 */
  15225. anchor: Vec2;
  15226. /** !#en
  15227. The anchor of the connected rigidbody.
  15228. !#zh
  15229. 关节另一端刚体的锚点。 */
  15230. connectedAnchor: Vec2;
  15231. /** !#en
  15232. The node used to register touch evnet.
  15233. If this is null, it will be the joint's node.
  15234. !#zh
  15235. 用于注册触摸事件的节点。
  15236. 如果没有设置这个值,那么将会使用关节的节点来注册事件。 */
  15237. mouseRegion: Node;
  15238. /** !#en
  15239. The target point.
  15240. The mouse joint will move choosed rigidbody to target point.
  15241. !#zh
  15242. 目标点,鼠标关节将会移动选中的刚体到指定的目标点 */
  15243. target: Vec2;
  15244. /** !#en
  15245. The spring frequency.
  15246. !#zh
  15247. 弹簧系数。 */
  15248. frequency: number;
  15249. /** !#en
  15250. The damping ratio.
  15251. !#zh
  15252. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15253. 0: number;
  15254. /** !#en
  15255. The maximum force
  15256. !#zh
  15257. 最大阻力值 */
  15258. maxForce: number;
  15259. }
  15260. /** !#en
  15261. A prismatic joint. This joint provides one degree of freedom: translation
  15262. along an axis fixed in rigidbody. Relative rotation is prevented. You can
  15263. use a joint limit to restrict the range of motion and a joint motor to
  15264. drive the motion or to model joint friction.
  15265. !#zh
  15266. 移动关节指定了只能在一个方向上移动刚体。
  15267. 你可以开启关节限制来设置刚体运行移动的间距,也可以开启马达来使用关节马达驱动刚体的运行。 */
  15268. export class PrismaticJoint extends Joint {
  15269. /** !#en
  15270. The local joint axis relative to rigidbody.
  15271. !#zh
  15272. 指定刚体可以移动的方向。 */
  15273. localAxisA: Vec2;
  15274. /** !#en
  15275. The reference angle.
  15276. !#zh
  15277. 相对角度 */
  15278. referenceAngle: number;
  15279. /** !#en
  15280. Enable joint distance limit?
  15281. !#zh
  15282. 是否开启关节的距离限制? */
  15283. enableLimit: boolean;
  15284. /** !#en
  15285. Enable joint motor?
  15286. !#zh
  15287. 是否开启关节马达? */
  15288. enableMotor: boolean;
  15289. /** !#en
  15290. The lower joint limit.
  15291. !#zh
  15292. 刚体能够移动的最小值 */
  15293. lowerLimit: number;
  15294. /** !#en
  15295. The upper joint limit.
  15296. !#zh
  15297. 刚体能够移动的最大值 */
  15298. upperLimit: number;
  15299. /** !#en
  15300. The maxium force can be applied to rigidbody to rearch the target motor speed.
  15301. !#zh
  15302. 可以施加到刚体的最大力。 */
  15303. maxMotorForce: number;
  15304. /** !#en
  15305. The expected motor speed.
  15306. !#zh
  15307. 期望的马达速度。 */
  15308. motorSpeed: number;
  15309. }
  15310. /** !#en
  15311. A revolute joint constrains two bodies to share a common point while they
  15312. are free to rotate about the point. The relative rotation about the shared
  15313. point is the joint angle. You can limit the relative rotation with
  15314. a joint limit that specifies a lower and upper angle. You can use a motor
  15315. to drive the relative rotation about the shared point. A maximum motor torque
  15316. is provided so that infinite forces are not generated.
  15317. !#zh
  15318. 旋转关节可以约束两个刚体围绕一个点来进行旋转。
  15319. 你可以通过开启关节限制来限制旋转的最大角度和最小角度。
  15320. 你可以通过开启马达来施加一个扭矩力来驱动这两个刚体在这一点上的相对速度。 */
  15321. export class RevoluteJoint extends Joint {
  15322. /** !#en
  15323. The reference angle.
  15324. An angle between bodies considered to be zero for the joint angle.
  15325. !#zh
  15326. 相对角度。
  15327. 两个物体之间角度为零时可以看作相等于关节角度 */
  15328. referenceAngle: number;
  15329. /** !#en
  15330. The lower angle.
  15331. !#zh
  15332. 角度的最低限制。 */
  15333. lowerAngle: number;
  15334. /** !#en
  15335. The upper angle.
  15336. !#zh
  15337. 角度的最高限制。 */
  15338. upperAngle: number;
  15339. /** !#en
  15340. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  15341. !#zh
  15342. 可以施加到刚体的最大扭矩。 */
  15343. maxMotorTorque: number;
  15344. /** !#en
  15345. The expected motor speed.
  15346. !#zh
  15347. 期望的马达速度。 */
  15348. motorSpeed: number;
  15349. /** !#en
  15350. Enable joint limit?
  15351. !#zh
  15352. 是否开启关节的限制? */
  15353. enableLimit: boolean;
  15354. /** !#en
  15355. Enable joint motor?
  15356. !#zh
  15357. 是否开启关节马达? */
  15358. enableMotor: boolean;
  15359. /**
  15360. !#en
  15361. Get the joint angle.
  15362. !#zh
  15363. 获取关节角度。
  15364. */
  15365. getJointAngle(): number;
  15366. }
  15367. /** !#en
  15368. A rope joint enforces a maximum distance between two points
  15369. on two bodies. It has no other effect.
  15370. Warning: if you attempt to change the maximum length during
  15371. the simulation you will get some non-physical behavior.
  15372. !#zh
  15373. 绳子关节只指定两个刚体间的最大距离,没有其他的效果。
  15374. 注意:如果你试图动态修改关节的长度,这有可能会得到一些意外的效果。 */
  15375. export class RopeJoint extends Joint {
  15376. /** !#en
  15377. The max length.
  15378. !#zh
  15379. 最大长度。 */
  15380. maxLength: number;
  15381. }
  15382. /** !#en
  15383. A weld joint essentially glues two bodies together. A weld joint may
  15384. distort somewhat because the island constraint solver is approximate.
  15385. !#zh
  15386. 熔接关节相当于将两个刚体粘在了一起。
  15387. 熔接关节可能会使某些东西失真,因为约束求解器算出的都是近似值。 */
  15388. export class WeldJoint extends Joint {
  15389. /** !#en
  15390. The reference angle.
  15391. !#zh
  15392. 相对角度。 */
  15393. referenceAngle: number;
  15394. /** !#en
  15395. The frequency.
  15396. !#zh
  15397. 弹性系数。 */
  15398. frequency: number;
  15399. /** !#en
  15400. The damping ratio.
  15401. !#zh
  15402. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15403. 0: number;
  15404. }
  15405. /** !#en
  15406. A wheel joint. This joint provides two degrees of freedom: translation
  15407. along an axis fixed in bodyA and rotation in the plane. You can use a joint motor to drive
  15408. the rotation or to model rotational friction.
  15409. This joint is designed for vehicle suspensions.
  15410. !#zh
  15411. 轮子关节提供两个维度的自由度:旋转和沿着指定方向上位置的移动。
  15412. 你可以通过开启关节马达来使用马达驱动刚体的旋转。
  15413. 轮组关节是专门为机动车类型设计的。 */
  15414. export class WheelJoint extends Joint {
  15415. /** !#en
  15416. The local joint axis relative to rigidbody.
  15417. !#zh
  15418. 指定刚体可以移动的方向。 */
  15419. localAxisA: Vec2;
  15420. /** !#en
  15421. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  15422. !#zh
  15423. 可以施加到刚体的最大扭矩。 */
  15424. maxMotorTorque: number;
  15425. /** !#en
  15426. The expected motor speed.
  15427. !#zh
  15428. 期望的马达速度。 */
  15429. motorSpeed: number;
  15430. /** !#en
  15431. Enable joint motor?
  15432. !#zh
  15433. 是否开启关节马达? */
  15434. enableMotor: boolean;
  15435. /** !#en
  15436. The spring frequency.
  15437. !#zh
  15438. 弹性系数。 */
  15439. frequency: number;
  15440. /** !#en
  15441. The damping ratio.
  15442. !#zh
  15443. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15444. dampingRatio: number;
  15445. }
  15446. /** undefined */
  15447. export class PhysicsBoxCollider extends PhysicsCollider implements Collider.Box {
  15448. /** !#en Position offset
  15449. !#zh 位置偏移量 */
  15450. offset: Vec2;
  15451. /** !#en Box size
  15452. !#zh 包围盒大小 */
  15453. size: Size;
  15454. }
  15455. /** undefined */
  15456. export class PhysicsChainCollider extends PolygonCollider {
  15457. /** !#en Whether the chain is loop
  15458. !#zh 链条是否首尾相连 */
  15459. loop: boolean;
  15460. /** !#en Chain points
  15461. !#zh 链条顶点数组 */
  15462. points: Vec2[];
  15463. }
  15464. /** undefined */
  15465. export class PhysicsCircleCollider extends PhysicsCollider implements Collider.Circle {
  15466. /** !#en Position offset
  15467. !#zh 位置偏移量 */
  15468. offset: Vec2;
  15469. /** !#en Circle radius
  15470. !#zh 圆形半径 */
  15471. radius: number;
  15472. }
  15473. /** undefined */
  15474. export class PhysicsCollider extends Collider {
  15475. /** !#en
  15476. The density.
  15477. !#zh
  15478. 密度 */
  15479. density: number;
  15480. /** !#en
  15481. A sensor collider collects contact information but never generates a collision response
  15482. !#zh
  15483. 一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。 */
  15484. sensor: boolean;
  15485. /** !#en
  15486. The friction coefficient, usually in the range [0,1].
  15487. !#zh
  15488. 摩擦系数,取值一般在 [0, 1] 之间 */
  15489. friction: number;
  15490. /** !#en
  15491. The restitution (elasticity) usually in the range [0,1].
  15492. !#zh
  15493. 弹性系数,取值一般在 [0, 1]之间 */
  15494. restitution: number;
  15495. /** !#en
  15496. Physics collider will find the rigidbody component on the node and set to this property.
  15497. !#zh
  15498. 碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。 */
  15499. body: RigidBody;
  15500. /**
  15501. !#en
  15502. Apply current changes to collider, this will regenerate inner box2d fixtures.
  15503. !#zh
  15504. 应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
  15505. */
  15506. apply(): void;
  15507. /**
  15508. !#en
  15509. Get the world aabb of the collider
  15510. !#zh
  15511. 获取碰撞体的世界坐标系下的包围盒
  15512. */
  15513. getAABB(): void;
  15514. }
  15515. /** undefined */
  15516. export class PhysicsPolygonCollider extends PhysicsCollider implements Collider.Polygon {
  15517. /** !#en Position offset
  15518. !#zh 位置偏移量 */
  15519. offset: Vec2;
  15520. /** !#en Polygon points
  15521. !#zh 多边形顶点数组 */
  15522. points: Vec2[];
  15523. }
  15524. /** !#en The shape module of 3d particle.
  15525. !#zh 3D 粒子的发射形状模块 */
  15526. export class ShapeModule {
  15527. /** !#en The enable of shapeModule.
  15528. !#zh 是否启用 */
  15529. enable: boolean;
  15530. /** !#en Particle emitter type.
  15531. !#zh 粒子发射器类型。 */
  15532. shapeType: shapeModule.ShapeType;
  15533. /** !#en The emission site of the particle.
  15534. !#zh 粒子从发射器哪个部位发射。 */
  15535. emitFrom: shapeModule.EmitLocation;
  15536. /** !#en Particle emitter radius.
  15537. !#zh 粒子发射器半径。 */
  15538. radius: number;
  15539. /** !#en Particle emitter emission position (not valid for Box type emitters):<bg>
  15540. - 0 means emitted from the surface;
  15541. - 1 means launch from the center;
  15542. - 0 ~ 1 indicates emission from the center to the surface.
  15543. !#zh 粒子发射器发射位置(对 Box 类型的发射器无效):<bg>
  15544. - 0 表示从表面发射;
  15545. - 1 表示从中心发射;
  15546. - 0 ~ 1 之间表示在中心到表面之间发射。 */
  15547. radiusThickness: number;
  15548. /** !#en The angle between the axis of the cone and the generatrix<bg>
  15549. Determines the opening and closing of the cone launcher
  15550. !#zh 圆锥的轴与母线的夹角<bg>。
  15551. 决定圆锥发射器的开合程度。 */
  15552. angle: number;
  15553. /** !#en Particle emitters emit in a fan-shaped range.
  15554. !#zh 粒子发射器在一个扇形范围内发射。 */
  15555. arc: number;
  15556. /** !#en How particles are emitted in the sector range.
  15557. !#zh 粒子在扇形范围内的发射方式。 */
  15558. arcMode: shapeModule.ArcMode;
  15559. /** !#en Controls the discrete intervals around the arcs where particles might be generated.
  15560. !#zh 控制可能产生粒子的弧周围的离散间隔。 */
  15561. arcSpread: number;
  15562. /** !#en The speed at which particles are emitted around the circumference.
  15563. !#zh 粒子沿圆周发射的速度。 */
  15564. arcSpeed: CurveRange;
  15565. /** !#en Axis length from top of cone to bottom of cone <bg>.
  15566. Determines the height of the cone emitter.
  15567. !#zh 圆锥顶部截面距离底部的轴长<bg>。
  15568. 决定圆锥发射器的高度。 */
  15569. length: number;
  15570. /** !#en Particle emitter emission location (for box-type particle emitters).
  15571. !#zh 粒子发射器发射位置(针对 Box 类型的粒子发射器。 */
  15572. boxThickness: Vec3;
  15573. /** !#en Particle Emitter Position
  15574. !#zh 粒子发射器位置。 */
  15575. position: Vec3;
  15576. /** !#en Particle emitter rotation angle.
  15577. !#zh 粒子发射器旋转角度。 */
  15578. rotation: Vec3;
  15579. /** !#en Particle emitter scaling
  15580. !#zh 粒子发射器缩放比例。 */
  15581. scale: Vec3;
  15582. /** !#en The direction of particle movement is determined based on the initial direction of the particles.
  15583. !#zh 根据粒子的初始方向决定粒子的移动方向。 */
  15584. alignToDirection: boolean;
  15585. /** !#en Set particle generation direction randomly.
  15586. !#zh 粒子生成方向随机设定。 */
  15587. randomDirectionAmount: number;
  15588. /** !#en Interpolation between the current emission direction and the direction from the current position to the center of the node.
  15589. !#zh 表示当前发射方向与当前位置到结点中心连线方向的插值。 */
  15590. sphericalDirectionAmount: number;
  15591. }
  15592. /** !#en The color over time module of 3d particle.
  15593. !#zh 3D 粒子颜色变化模块 */
  15594. export class ColorOvertimeModule {
  15595. /** !#en The enable of ColorOvertimeModule.
  15596. !#zh 是否启用 */
  15597. enable: boolean;
  15598. }
  15599. /** !#en The curve range of target value.
  15600. !#zh 目标值的曲线范围 */
  15601. export class CurveRange {
  15602. /** !#en Curve type.
  15603. !#zh 曲线类型。 */
  15604. mode: debug.DebugMode;
  15605. /** !#en The curve to use when mode is Curve.
  15606. !#zh 当 mode 为 Curve 时,使用的曲线。 */
  15607. curve: AnimationCurve;
  15608. /** !#en The lower limit of the curve to use when mode is TwoCurves
  15609. !#zh 当 mode 为 TwoCurves 时,使用的曲线下限。 */
  15610. curveMin: AnimationCurve;
  15611. /** !#en The upper limit of the curve to use when mode is TwoCurves
  15612. !#zh 当 mode 为 TwoCurves 时,使用的曲线上限。 */
  15613. curveMax: AnimationCurve;
  15614. /** !#en When mode is Constant, the value of the curve.
  15615. !#zh 当 mode 为 Constant 时,曲线的值。 */
  15616. constant: number;
  15617. /** !#en The lower limit of the curve to use when mode is TwoConstants
  15618. !#zh 当 mode 为 TwoConstants 时,曲线的下限。 */
  15619. constantMin: number;
  15620. /** !#en The upper limit of the curve to use when mode is TwoConstants
  15621. !#zh 当 mode 为 TwoConstants 时,曲线的上限。 */
  15622. constantMax: number;
  15623. /** !#en Coefficients applied to curve interpolation.
  15624. !#zh 应用于曲线插值的系数。 */
  15625. multiplier: number;
  15626. }
  15627. /** !#en The force over time module of 3d particle.
  15628. !#zh 3D 粒子的加速度模块 */
  15629. export class ForceOvertimeModule {
  15630. /** !#en The enable of ColorOvertimeModule.
  15631. !#zh 是否启用 */
  15632. enable: boolean;
  15633. /** !#en Coordinate system used in acceleration calculation.
  15634. !#zh 加速度计算时采用的坐标系。 */
  15635. space: ParticleSystem3DAssembler.Space;
  15636. /** !#en X-axis acceleration component.
  15637. !#zh X 轴方向上的加速度分量。 */
  15638. x: CurveRange;
  15639. /** !#en Y-axis acceleration component.
  15640. !#zh Y 轴方向上的加速度分量。 */
  15641. y: CurveRange;
  15642. /** !#en Z-axis acceleration component.
  15643. !#zh Z 轴方向上的加速度分量。 */
  15644. z: CurveRange;
  15645. }
  15646. /** !#en The gradient range of color.
  15647. !#zh 颜色值的渐变范围 */
  15648. export class GradientRange {
  15649. /** !#en Gradient type.
  15650. !#zh 渐变色类型。 */
  15651. mode: debug.DebugMode;
  15652. /** !#en The color when mode is Color.
  15653. !#zh 当 mode 为 Color 时的颜色。 */
  15654. color: Color;
  15655. /** !#en Lower color limit when mode is TwoColors.
  15656. !#zh 当 mode 为 TwoColors 时的颜色下限。 */
  15657. colorMin: Color;
  15658. /** !#en Upper color limit when mode is TwoColors.
  15659. !#zh 当 mode 为 TwoColors 时的颜色上限。 */
  15660. colorMax: Color;
  15661. /** !#en Color gradient when mode is Gradient
  15662. !#zh 当 mode 为 Gradient 时的颜色渐变。 */
  15663. gradient: Gradient;
  15664. /** !#en Lower color gradient limit when mode is TwoGradients.
  15665. !#zh 当 mode 为 TwoGradients 时的颜色渐变下限。 */
  15666. gradientMin: Gradient;
  15667. /** !#en Upper color gradient limit when mode is TwoGradients.
  15668. !#zh 当 mode 为 TwoGradients 时的颜色渐变上限。 */
  15669. gradientMax: Gradient;
  15670. }
  15671. /** !#en The color key of gradient.
  15672. !#zh color 关键帧 */
  15673. export class ColorKey {
  15674. /** !#en Color value.
  15675. !#zh 颜色值。 */
  15676. color: Color;
  15677. /** !#en Time value.
  15678. !#zh 时间值。 */
  15679. time: number;
  15680. }
  15681. /** !#en The alpha key of gradient.
  15682. !#zh alpha 关键帧 */
  15683. export class AlphaKey {
  15684. /** !#en Alpha value.
  15685. !#zh 透明度。 */
  15686. alpha: number;
  15687. /** !#en Time.
  15688. !#zh 时间帧。 */
  15689. time: number;
  15690. }
  15691. /** !#en The gradient data of color.
  15692. !#zh 颜色渐变数据 */
  15693. export class Gradient {
  15694. /** !#en Array of color key.
  15695. !#zh 颜色关键帧列表。 */
  15696. colorKeys: ColorKey[];
  15697. /** !#en Array of alpha key.
  15698. !#zh 透明度关键帧列表。 */
  15699. alphaKeys: AlphaKey[];
  15700. /** !#en Blend mode.
  15701. !#zh 混合模式。 */
  15702. mode: debug.DebugMode;
  15703. }
  15704. /** !#en The limit velocity module of 3d particle.
  15705. !#zh 3D 粒子的限速模块 */
  15706. export class LimitVelocityOvertimeModule {
  15707. /** !#en The enable of LimitVelocityOvertimeModule.
  15708. !#zh 是否启用 */
  15709. enable: boolean;
  15710. /** !#en The coordinate system used when calculating the lower speed limit.
  15711. !#zh 计算速度下限时采用的坐标系。 */
  15712. space: ParticleSystem3DAssembler.Space;
  15713. /** !#en Whether to limit the three axes separately.
  15714. !#zh 是否三个轴分开限制。 */
  15715. separateAxes: boolean;
  15716. /** !#en Lower speed limit
  15717. !#zh 速度下限。 */
  15718. limit: CurveRange;
  15719. /** !#en Lower speed limit in X direction.
  15720. !#zh X 轴方向上的速度下限。 */
  15721. limitX: CurveRange;
  15722. /** !#en Lower speed limit in Y direction.
  15723. !#zh Y 轴方向上的速度下限。 */
  15724. limitY: CurveRange;
  15725. /** !#en Lower speed limit in Z direction.
  15726. !#zh Z 轴方向上的速度下限。 */
  15727. limitZ: CurveRange;
  15728. /** !#en Interpolation of current speed and lower speed limit.
  15729. !#zh 当前速度与速度下限的插值。 */
  15730. dampen: number;
  15731. }
  15732. /** !#en The optimized curve.
  15733. !#zh 优化曲线 */
  15734. export class OptimizedCurve {
  15735. }
  15736. /** !#en The rotation module of 3d particle.
  15737. !#zh 3D 粒子的旋转模块 */
  15738. export class RotationOvertimeModule {
  15739. /** !#en The enable of RotationOvertimeModule.
  15740. !#zh 是否启用 */
  15741. enable: boolean;
  15742. /** !#en Whether to set the rotation of three axes separately (not currently supported)
  15743. !#zh 是否三个轴分开设定旋转(暂不支持)。 */
  15744. separateAxes: boolean;
  15745. /** !#en Set rotation around X axis.
  15746. !#zh 绕 X 轴设定旋转。 */
  15747. x: CurveRange;
  15748. /** !#en Set rotation around Y axis.
  15749. !#zh 绕 Y 轴设定旋转。 */
  15750. y: CurveRange;
  15751. /** !#en Set rotation around Z axis.
  15752. !#zh 绕 Z 轴设定旋转。 */
  15753. z: CurveRange;
  15754. }
  15755. /** !#en The size module of 3d particle.
  15756. !#zh 3D 粒子的大小模块 */
  15757. export class SizeOvertimeModule {
  15758. /** !#en The enable of SizeOvertimeModule.
  15759. !#zh 是否启用 */
  15760. enable: boolean;
  15761. /** !#en Decide whether to control particle size independently on each axis.
  15762. !#zh 决定是否在每个轴上独立控制粒子大小。 */
  15763. separateAxes: boolean;
  15764. /** !#en Define a curve to determine the size change of particles during their life cycle.
  15765. !#zh 定义一条曲线来决定粒子在其生命周期中的大小变化。 */
  15766. size: CurveRange;
  15767. /** !#en Defines a curve to determine the size change of particles in the X-axis direction during their life cycle.
  15768. !#zh 定义一条曲线来决定粒子在其生命周期中 X 轴方向上的大小变化。 */
  15769. x: CurveRange;
  15770. /** !#en Defines a curve to determine the size change of particles in the Y-axis direction during their life cycle.
  15771. !#zh 定义一条曲线来决定粒子在其生命周期中 Y 轴方向上的大小变化。 */
  15772. y: CurveRange;
  15773. /** !#en Defines a curve to determine the size change of particles in the Z-axis direction during their life cycle.
  15774. !#zh 定义一条曲线来决定粒子在其生命周期中 Z 轴方向上的大小变化。 */
  15775. z: CurveRange;
  15776. }
  15777. /** !#en The texture animation module of 3d particle.
  15778. !#zh 3D 粒子的贴图动画模块 */
  15779. export class TextureAnimationModule {
  15780. /** !#en The enable of TextureAnimationModule.
  15781. !#zh 是否启用 */
  15782. enable: boolean;
  15783. /** !#en Set the type of particle map animation (only supports Grid mode for the time being)
  15784. !#zh 设定粒子贴图动画的类型(暂只支持 Grid 模式。 */
  15785. mode: debug.DebugMode;
  15786. /** !#en Animation frames in X direction.
  15787. !#zh X 方向动画帧数。 */
  15788. numTilesX: number;
  15789. /** !#en Animation frames in Y direction.
  15790. !#zh Y 方向动画帧数。 */
  15791. numTilesY: number;
  15792. /** !#en The way of the animation plays.
  15793. !#zh 动画播放方式。 */
  15794. animation: Animation;
  15795. /** !#en Randomly select a line from the animated map to generate the animation. <br>
  15796. This option only takes effect when the animation playback mode is SingleRow.
  15797. !#zh 随机从动画贴图中选择一行以生成动画。<br>
  15798. 此选项仅在动画播放方式为 SingleRow 时生效。 */
  15799. randomRow: boolean;
  15800. /** !#en Select specific lines from the animation map to generate the animation. <br>
  15801. This option is only available when the animation playback mode is SingleRow and randomRow is disabled.
  15802. !#zh 从动画贴图中选择特定行以生成动画。<br>
  15803. 此选项仅在动画播放方式为 SingleRow 时且禁用 randomRow 时可用。 */
  15804. rowIndex: number;
  15805. /** !#en Frame and time curve of animation playback in one cycle.
  15806. !#zh 一个周期内动画播放的帧与时间变化曲线。 */
  15807. frameOverTime: CurveRange;
  15808. /** !#en Play from which frames, the time is the life cycle of the entire particle system.
  15809. !#zh 从第几帧开始播放,时间为整个粒子系统的生命周期。 */
  15810. startFrame: CurveRange;
  15811. /** !#en Number of playback loops in a life cycle.
  15812. !#zh 一个生命周期内播放循环的次数。 */
  15813. cycleCount: number;
  15814. }
  15815. /** !#en The velocity module of 3d particle.
  15816. !#zh 3D 粒子的速度模块 */
  15817. export class VelocityOvertimeModule {
  15818. /** !#en The enable of VelocityOvertimeModule.
  15819. !#zh 是否启用 */
  15820. enable: boolean;
  15821. /** !#en Coordinate system used in speed calculation.
  15822. !#zh 速度计算时采用的坐标系。 */
  15823. space: ParticleSystem3DAssembler.Space;
  15824. /** !#en Velocity component in X axis direction
  15825. !#zh X 轴方向上的速度分量。 */
  15826. x: CurveRange;
  15827. /** !#en Velocity component in Y axis direction
  15828. !#zh Y 轴方向上的速度分量。 */
  15829. y: CurveRange;
  15830. /** !#en Velocity component in Z axis direction
  15831. !#zh Z 轴方向上的速度分量。 */
  15832. z: CurveRange;
  15833. /** !#en Speed correction factor (only supports CPU particles).
  15834. !#zh 速度修正系数(只支持 CPU 粒子)。 */
  15835. speedModifier: CurveRange;
  15836. }
  15837. /** !#en The trail module of 3d particle.
  15838. !#zh 3D 粒子拖尾模块 */
  15839. export class TrailModule {
  15840. /** !#en The enable of trailModule.
  15841. !#zh 是否启用 */
  15842. enable: boolean;
  15843. /** !#en Sets how particles generate trajectories.
  15844. !#zh 设定粒子生成轨迹的方式。 */
  15845. mode: trailModule.TrailMode;
  15846. /** !#en Life cycle of trajectory.
  15847. !#zh 轨迹存在的生命周期。 */
  15848. lifeTime: CurveRange;
  15849. /** !#en Minimum spacing between each track particle
  15850. !#zh 每个轨迹粒子之间的最小间距。 */
  15851. minParticleDistance: number;
  15852. /** !#en The coordinate system of trajectories.
  15853. !#zh 轨迹设定时的坐标系。 */
  15854. space: ParticleSystem3DAssembler.Space;
  15855. /** !#en Whether the particle itself exists.
  15856. !#zh 粒子本身是否存在。 */
  15857. existWithParticles: boolean;
  15858. /** !#en Set the texture fill method
  15859. !#zh 设定纹理填充方式。 */
  15860. textureMode: trailModule.TextureMode;
  15861. /** !#en Whether to use particle width
  15862. !#zh 是否使用粒子的宽度。 */
  15863. widthFromParticle: boolean;
  15864. /** !#en Curves that control track length
  15865. !#zh 控制轨迹长度的曲线。 */
  15866. widthRatio: CurveRange;
  15867. /** !#en Whether to use particle color
  15868. !#zh 是否使用粒子的颜色。 */
  15869. colorFromParticle: boolean;
  15870. /** !#en The color of trajectories.
  15871. !#zh 轨迹的颜色。 */
  15872. colorOverTrail: GradientRange;
  15873. /** !#en Trajectories color over time.
  15874. !#zh 轨迹随时间变化的颜色。 */
  15875. colorOvertime: GradientRange;
  15876. }
  15877. /** Rigid body interface */
  15878. export class IRigidBody {
  15879. rigidBody: RigidBody3D;
  15880. mass: number;
  15881. linearDamping: number;
  15882. angularDamping: number;
  15883. isKinematic: boolean;
  15884. useGravity: boolean;
  15885. fixedRotation: boolean;
  15886. linearFactor: IVec3Like;
  15887. angularFactor: IVec3Like;
  15888. allowSleep: boolean;
  15889. isAwake: boolean;
  15890. isSleepy: boolean;
  15891. isSleeping: boolean;
  15892. wakeUp(): void;
  15893. sleep(): void;
  15894. /**
  15895. @param out out
  15896. */
  15897. getLinearVelocity(out: IVec3Like): void;
  15898. /**
  15899. @param out out
  15900. */
  15901. setLinearVelocity(out: IVec3Like): void;
  15902. /**
  15903. @param out out
  15904. */
  15905. getAngularVelocity(out: IVec3Like): void;
  15906. /**
  15907. @param out out
  15908. */
  15909. setAngularVelocity(out: IVec3Like): void;
  15910. /**
  15911. @param force force
  15912. @param relativePoint relativePoint
  15913. */
  15914. applyForce(force: IVec3Like, relativePoint: IVec3Like): void;
  15915. /**
  15916. @param force force
  15917. @param relativePoint relativePoint
  15918. */
  15919. applyLocalForce(force: IVec3Like, relativePoint: IVec3Like): void;
  15920. /**
  15921. @param force force
  15922. @param relativePoint relativePoint
  15923. */
  15924. applyImpulse(force: IVec3Like, relativePoint: IVec3Like): void;
  15925. /**
  15926. @param force force
  15927. @param relativePoint relativePoint
  15928. */
  15929. applyLocalImpulse(force: IVec3Like, relativePoint: IVec3Like): void;
  15930. /**
  15931. @param torque torque
  15932. */
  15933. applyTorque(torque: IVec3Like): void;
  15934. /**
  15935. @param torque torque
  15936. */
  15937. applyLocalTorque(torque: IVec3Like): void;
  15938. }
  15939. /** Class has x y z properties */
  15940. export class IVec3Like {
  15941. x: number;
  15942. y: number;
  15943. z: number;
  15944. }
  15945. /** Class has x y z w properties */
  15946. export class IQuatLike {
  15947. x: number;
  15948. y: number;
  15949. z: number;
  15950. w: number;
  15951. }
  15952. /** !#en Base shape interface. */
  15953. export class IBaseShape {
  15954. collider: Collider3D;
  15955. attachedRigidBody: RigidBody3D|void;
  15956. material: any;
  15957. isTrigger: boolean;
  15958. center: IVec3Like;
  15959. }
  15960. /** !#en box shape interface */
  15961. export class IBoxShape {
  15962. size: IVec3Like;
  15963. }
  15964. /** !#en Sphere shape interface */
  15965. export class ISphereShape {
  15966. radius: number;
  15967. }
  15968. /** Ray cast options */
  15969. export class IRaycastOptions {
  15970. groupIndex: number;
  15971. queryTrigger: boolean;
  15972. maxDistance: number;
  15973. }
  15974. /** Collision detect */
  15975. export class ICollisionDetect {
  15976. /**
  15977. Ray cast, and return information of the closest hit.
  15978. @param worldRay worldRay
  15979. @param options options
  15980. @param out out
  15981. */
  15982. raycastClosest(worldRay: geomUtils.Ray, options: IRaycastOptions, out: PhysicsRayResult): boolean;
  15983. /**
  15984. Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.
  15985. @param worldRay worldRay
  15986. @param options options
  15987. @param pool pool
  15988. @param resultes resultes
  15989. */
  15990. raycast(worldRay: geomUtils.Ray, options: IRaycastOptions, pool: RecyclePool, resultes: PhysicsRayResult[]): boolean;
  15991. }
  15992. /** Physics world interface */
  15993. export class IPhysicsWorld {
  15994. }
  15995. /** !#en The rigid body type
  15996. !#zh 刚体类型 */
  15997. export enum ERigidBodyType {
  15998. DYNAMIC = 0,
  15999. STATIC = 0,
  16000. KINEMATIC = 0,
  16001. }
  16002. /** !#en
  16003. Trigger event
  16004. !#zh
  16005. 触发事件。 */
  16006. export class ITriggerEvent {
  16007. /** !#en
  16008. The type of event fired
  16009. !#zh
  16010. 触发的事件类型 */
  16011. type: string;
  16012. /** !#en
  16013. Triggers its own collider in the event
  16014. !#zh
  16015. 触发事件中的自己的碰撞器 */
  16016. selfCollider: Collider3D;
  16017. /** !#en
  16018. Triggers another collider in the event
  16019. !#zh
  16020. 触发事件中的另一个碰撞器 */
  16021. otherCollider: Collider3D;
  16022. }
  16023. /** !#en
  16024. Collision information for collision events.
  16025. !#zh
  16026. 碰撞事件的碰撞信息。 */
  16027. export class IContactEquation {
  16028. /** !#en
  16029. The collision point A in the collision information.
  16030. !#zh
  16031. 碰撞信息中的碰撞点 A。 */
  16032. contactA: Vec3;
  16033. /** !#en
  16034. Collision point B in collision information.
  16035. !#zh
  16036. 碰撞信息中的碰撞点 B。 */
  16037. contactB: Vec3;
  16038. /** !#en
  16039. Normals in collision information.
  16040. !#zh
  16041. 碰撞信息中的法线。 */
  16042. normal: Vec3;
  16043. }
  16044. /** !#en
  16045. Collision events.
  16046. !#zh
  16047. 碰撞事件。 */
  16048. export class ICollisionEvent {
  16049. /** !#en
  16050. Event type of collision.
  16051. !#zh
  16052. 碰撞的事件类型。 */
  16053. type: string;
  16054. /** !#en
  16055. Collider of its own in collision.
  16056. !#zh
  16057. 碰撞中的自己的碰撞器。 */
  16058. selfCollider: Collider3D;
  16059. /** !#en
  16060. Another collider in the collision.
  16061. !#zh
  16062. 碰撞中的另一个碰撞器。 */
  16063. otherCollider: Collider3D;
  16064. /** !#en
  16065. Information about all the points of impact in the collision.
  16066. !#zh
  16067. 碰撞中的所有碰撞点的信息。 */
  16068. contacts: IContactEquation[];
  16069. }
  16070. /** !#en
  16071. Physical systems manager.
  16072. !#zh
  16073. 物理系统管理器。 */
  16074. export class Physics3DManager {
  16075. /** !#en
  16076. Whether to enable the physics system, default is false.
  16077. !#zh
  16078. 是否启用物理系统,默认不启用。 */
  16079. enabled: boolean;
  16080. /** !#en
  16081. Whether to allow the physics system to automatically hibernate, default is true.
  16082. !#zh
  16083. 物理系统是否允许自动休眠,默认为 true。 */
  16084. allowSleep: boolean;
  16085. /** !#en
  16086. The maximum number of sub-steps a full step is permitted to be broken into, default is 2.
  16087. !#zh
  16088. 物理每帧模拟的最大子步数,默认为 2。 */
  16089. maxSubStep: number;
  16090. /** !#en
  16091. Time spent in each simulation of physics, default is 1/60s.
  16092. !#zh
  16093. 物理每步模拟消耗的固定时间,默认为 1/60 秒。 */
  16094. deltaTime: number;
  16095. /** !#en
  16096. Whether to use a fixed time step.
  16097. !#zh
  16098. 是否使用固定的时间步长。 */
  16099. useFixedTime: boolean;
  16100. /** !#en
  16101. Gravity value of the physics simulation, default is (0, -10, 0).
  16102. !#zh
  16103. 物理世界的重力数值,默认为 (0, -10, 0)。 */
  16104. gravity: Vec3;
  16105. /** !#en
  16106. Gets the global default physical material. Note that builtin is null.
  16107. !#zh
  16108. 获取全局的默认物理材质,注意:builtin 时为 null。 */
  16109. defaultMaterial: PhysicsMaterial|void;
  16110. /**
  16111. !#en
  16112. A physical system simulation is performed once and will now be performed automatically once per frame.
  16113. !#zh
  16114. 执行一次物理系统的模拟,目前将在每帧自动执行一次。
  16115. @param deltaTime The time difference from the last execution is currently elapsed per frame
  16116. */
  16117. update(deltaTime: number): void;
  16118. /**
  16119. !#en Detect all collision boxes and return all detected results, or null if none is detected. Note that the return value is taken from the object pool, so do not save the result reference or modify the result.
  16120. !#zh 检测所有的碰撞盒,并返回所有被检测到的结果,若没有检测到,则返回空值。注意返回值是从对象池中取的,所以请不要保存结果引用或者修改结果。
  16121. @param worldRay A ray in world space
  16122. @param groupIndexOrName Collision group index or group name
  16123. @param maxDistance Maximum detection distance
  16124. @param queryTrigger Detect trigger or not
  16125. */
  16126. raycast(worldRay: geomUtils.Ray, groupIndexOrName: number|string, maxDistance: number, queryTrigger: boolean): PhysicsRayResult[];
  16127. /**
  16128. !#en Detect all collision boxes and return the detection result with the shortest ray distance. If not, return null value. Note that the return value is taken from the object pool, so do not save the result reference or modify the result.
  16129. !#zh 检测所有的碰撞盒,并返回射线距离最短的检测结果,若没有,则返回空值。注意返回值是从对象池中取的,所以请不要保存结果引用或者修改结果。
  16130. @param worldRay A ray in world space
  16131. @param groupIndexOrName Collision group index or group name
  16132. @param maxDistance Maximum detection distance
  16133. @param queryTrigger Detect trigger or not
  16134. */
  16135. raycastClosest(worldRay: geomUtils.Ray, groupIndexOrName: number|string, maxDistance: number, queryTrigger: boolean): PhysicsRayResult;
  16136. }
  16137. /** !#en
  16138. Used to store physical ray detection results
  16139. !#zh
  16140. 用于保存物理射线检测结果 */
  16141. export class PhysicsRayResult {
  16142. /** !#en
  16143. Hit the point
  16144. !#zh
  16145. 击中点 */
  16146. hitPoint: Vec3;
  16147. /** !#en
  16148. Distance
  16149. !#zh
  16150. 距离 */
  16151. distance: number;
  16152. /** !#en
  16153. Hit the collision box
  16154. !#zh
  16155. 击中的碰撞盒 */
  16156. collider: Collider3D;
  16157. /**
  16158. !#en
  16159. Set up ray. This method is used internally by the engine. Do not call it from an external script
  16160. !#zh
  16161. 设置射线,此方法由引擎内部使用,请勿在外部脚本调用
  16162. @param hitPoint hitPoint
  16163. @param distance distance
  16164. @param collider collider
  16165. */
  16166. _assign(hitPoint: Vec3, distance: number, collider: Collider3D): void;
  16167. /**
  16168. !#en
  16169. Clone
  16170. !#zh
  16171. 克隆
  16172. */
  16173. clone(): void;
  16174. }
  16175. /** !#en Manage Dynamic Atlas Manager. Dynamic Atlas Manager is used for merging textures at runtime, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details.
  16176. !#zh 管理动态图集。动态图集用于在运行时对贴图进行合并,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 */
  16177. export class DynamicAtlasManager {
  16178. /** !#en Enable or disable the dynamic atlas, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details.
  16179. !#zh 开启或者关闭动态图集,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 */
  16180. enabled: boolean;
  16181. /** !#en The maximum number of atlas that can be created.
  16182. !#zh 可以创建的最大图集数量。 */
  16183. maxAtlasCount: number;
  16184. /** !#en Is enable textureBleeding.
  16185. !#zh 是否开启 textureBleeding */
  16186. textureBleeding: boolean;
  16187. /** !#en The size of the atlas that was created
  16188. !#zh 创建的图集的宽高 */
  16189. textureSize: number;
  16190. /** !#en The maximum size of the picture that can be added to the atlas.
  16191. !#zh 可以添加进图集的图片的最大尺寸。 */
  16192. maxFrameSize: number;
  16193. /** !#en The minimum size of the picture that can be added to the atlas.
  16194. !#zh 可以添加进图集的图片的最小尺寸。 */
  16195. minFrameSize: number;
  16196. /**
  16197. !#en Append a sprite frame into the dynamic atlas.
  16198. !#zh 添加碎图进入动态图集。
  16199. @param spriteFrame spriteFrame
  16200. */
  16201. insertSpriteFrame(spriteFrame: SpriteFrame): void;
  16202. /**
  16203. !#en Resets all dynamic atlas, and the existing ones will be destroyed.
  16204. !#zh 重置所有动态图集,已有的动态图集会被销毁。
  16205. */
  16206. reset(): void;
  16207. /**
  16208. !#en Displays all the dynamic atlas in the current scene, which you can use to view the current atlas state.
  16209. !#zh 在当前场景中显示所有动态图集,可以用来查看当前的合图状态。
  16210. @param show show
  16211. */
  16212. showDebug(show: boolean): Node;
  16213. }
  16214. /** !#en
  16215. RigidBody is the basic object that make up the physical world, and it can make a node physically affected and react.
  16216. !#zh
  16217. 刚体是组成物理世界的基本对象,可以让一个节点受到物理影响并产生反应。该组件在使用 Builtin 物理引擎时无效。 */
  16218. export class RigidBody3D extends Component {
  16219. /** !#en
  16220. Whether sleep is allowed.
  16221. !#zh
  16222. 是否允许休眠。 */
  16223. allowSleep: boolean;
  16224. /** !#en
  16225. The mass of the rigidbody.
  16226. !#zh
  16227. 刚体的质量。 */
  16228. mass: number;
  16229. /** !#en
  16230. Used to reduce the linear rate of rigidbody. The larger the value, the slower the rigidbody moves.
  16231. !#zh
  16232. 线性阻尼,用于减小刚体的线性速率,值越大物体移动越慢。 */
  16233. linearDamping: number;
  16234. /** !#en
  16235. Used to reduce the rotation rate of rigidbody. The larger the value, the slower the rigidbody rotates.
  16236. !#zh
  16237. 角阻尼,用于减小刚体的旋转速率,值越大刚体旋转越慢。 */
  16238. angularDamping: number;
  16239. /** !#en
  16240. If enabled, the developer controls the displacement and rotation of the rigidbody, not the physics engine.
  16241. !#zh
  16242. 是否由开发者来控制刚体的位移和旋转,而不是受物理引擎的影响。 */
  16243. isKinematic: boolean;
  16244. /** !#en
  16245. If enabled, the rigidbody is affected by gravity.
  16246. !#zh
  16247. 如果开启,刚体会受到重力影响。 */
  16248. useGravity: boolean;
  16249. /** !#en
  16250. If enabled, the rigidbody will be fixed without rotation during a collision.
  16251. !#zh
  16252. 如果开启,发生碰撞时会固定刚体不产生旋转。 */
  16253. fixedRotation: boolean;
  16254. /** !#en
  16255. It can affect the linear velocity change of the rigidbody in each axis. The larger the value, the faster the rigidbody moves.
  16256. !#zh
  16257. 线性因子,可影响刚体在每个轴向的线性速度变化,值越大刚体移动越快。 */
  16258. linearFactor: Vec3;
  16259. /** !#en
  16260. It can affect the rotation speed change of the rigidbody in each axis. The larger the value, the faster the rigidbody rotates.
  16261. !#zh
  16262. 旋转因子,可影响刚体在每个轴向的旋转速度变化,值越大刚体旋转越快。 */
  16263. angularFactor: Vec3;
  16264. /** !#en
  16265. The rigidbody is awake.
  16266. !#zh
  16267. 刚体是否为唤醒的状态。 */
  16268. isAwake: boolean;
  16269. /** !#en
  16270. The rigidbody can enter hibernation.
  16271. !#zh
  16272. 刚体是否为可进入休眠的状态。 */
  16273. isSleepy: boolean;
  16274. /** !#en
  16275. The rigidbody is sleeping.
  16276. !#zh
  16277. 刚体是否为正在休眠的状态。 */
  16278. isSleeping: boolean;
  16279. /** !#en
  16280. Get the rigidbody object inside the physics engine.
  16281. !#zh
  16282. 获得物理引擎内部刚体对象。 */
  16283. rigidBody: IRigidBody;
  16284. /**
  16285. !#en
  16286. A force is applied to a rigid body at a point in world space.
  16287. !#zh
  16288. 在世界空间中的某点上对刚体施加一个作用力。
  16289. @param force force
  16290. @param relativePoint The point of action, relative to the center of the rigid body.
  16291. */
  16292. applyForce(force: Vec3, relativePoint: Vec3): void;
  16293. /**
  16294. !#en
  16295. Apply a force on the rigid body at a point in local space.
  16296. !#zh
  16297. 在本地空间中的某点上对刚体施加一个作用力。
  16298. @param force force
  16299. @param localPoint Point of application
  16300. */
  16301. applyLocalForce(force: Vec3, localPoint: Vec3): void;
  16302. /**
  16303. !#en
  16304. Apply an impulse to a rigid body at a point in world space.
  16305. !#zh
  16306. 在世界空间的某点上对刚体施加一个冲量。
  16307. @param impulse impulse
  16308. @param relativePoint The point of action, relative to the center of the rigid body.
  16309. */
  16310. applyImpulse(impulse: Vec3, relativePoint: Vec3): void;
  16311. /**
  16312. !#en
  16313. Apply an impulse to the rigid body at a point in local space.
  16314. !#zh
  16315. 在本地空间的某点上对刚体施加一个冲量。
  16316. @param impulse impulse
  16317. @param localPoint Point of application
  16318. */
  16319. applyLocalImpulse(impulse: Vec3, localPoint: Vec3): void;
  16320. /**
  16321. !#en
  16322. Apply a torque to the rigid body.
  16323. !#zh
  16324. 对刚体施加扭转力。
  16325. @param torque torque
  16326. */
  16327. applyTorque(torque: Vec3): void;
  16328. /**
  16329. !#en
  16330. Apply a local torque to the rigid body.
  16331. !#zh
  16332. 对刚体施加本地扭转力。
  16333. @param torque torque
  16334. */
  16335. applyLocalTorque(torque: Vec3): void;
  16336. /**
  16337. !#en
  16338. Awaken the rigid body.
  16339. !#zh
  16340. 唤醒刚体。
  16341. */
  16342. wakeUp(): void;
  16343. /**
  16344. !#en
  16345. Dormant rigid body.
  16346. !#zh
  16347. 休眠刚体。
  16348. */
  16349. sleep(): void;
  16350. /**
  16351. !#en
  16352. Get linear velocity.
  16353. !#zh
  16354. 获取线性速度。
  16355. @param out out
  16356. */
  16357. getLinearVelocity(out: Vec3): void;
  16358. /**
  16359. !#en
  16360. Set linear speed.
  16361. !#zh
  16362. 设置线性速度。
  16363. @param value value
  16364. */
  16365. setLinearVelocity(value: Vec3): void;
  16366. /**
  16367. !#en
  16368. Gets the rotation speed.
  16369. !#zh
  16370. 获取旋转速度。
  16371. @param out out
  16372. */
  16373. getAngularVelocity(out: Vec3): void;
  16374. /**
  16375. !#en
  16376. Set rotation speed.
  16377. !#zh
  16378. 设置旋转速度。
  16379. @param value value
  16380. */
  16381. setAngularVelocity(value: Vec3): void;
  16382. }
  16383. /** !#en
  16384. Each frame applies a constant force to a rigid body, depending on the RigidBody3D
  16385. !#zh
  16386. 在每帧对一个刚体施加持续的力,依赖 RigidBody3D 组件 */
  16387. export class ConstantForce extends Component {
  16388. /** !#en
  16389. Set the force used in the world coordinate system, use `this.force = otherVec3`.
  16390. !#zh
  16391. 设置世界坐标系中使用的力,设置时请用 `this.force = otherVec3` 的方式。 */
  16392. force: Vec3;
  16393. /** !#en
  16394. Set the force used in the local coordinate system, using `this.localforce = otherVec3`.
  16395. !#zh
  16396. 获取和设置本地坐标系中使用的力,设置时请用 `this.localForce = otherVec3` 的方式。 */
  16397. localForce: Vec3;
  16398. /** !#en
  16399. Torque applied to the world orientation
  16400. !#zh
  16401. 对世界朝向施加的扭矩 */
  16402. torque: Vec3;
  16403. /** !#en
  16404. Torque applied to local orientation, using `this.localtorque = otherVec3`.
  16405. !#zh
  16406. 对本地朝向施加的扭矩,设置时请用 `this.localTorque = otherVec3` 的方式。 */
  16407. localTorque: Vec3;
  16408. }
  16409. /** !#en
  16410. Physics material.
  16411. !#zh
  16412. 物理材质。 */
  16413. export class PhysicsMaterial extends Asset {
  16414. /** !#en
  16415. Friction for this material.
  16416. !#zh
  16417. 物理材质的摩擦力。 */
  16418. friction: number;
  16419. /** !#en
  16420. Restitution for this material.
  16421. !#zh
  16422. 物理材质的弹力。 */
  16423. restitution: number;
  16424. }
  16425. /** !#en
  16426. Physics box collider
  16427. !#zh
  16428. 物理盒子碰撞器 */
  16429. export class BoxCollider3D extends Collider3D {
  16430. /** !#en
  16431. Get or set the size of the box, in local space.
  16432. !#zh
  16433. 获取或设置盒的大小。 */
  16434. size: Vec3;
  16435. boxShape: IBoxShape;
  16436. }
  16437. /** !#en
  16438. The base class of the collider.
  16439. !#zh
  16440. 碰撞器的基类。 */
  16441. export class Collider3D extends Component implements EventTarget {
  16442. sharedMaterial: PhysicsMaterial;
  16443. /** !#en
  16444. get or set the collider is trigger, this will be always trigger if using builtin.
  16445. !#zh
  16446. 获取或设置碰撞器是否为触发器。 */
  16447. isTrigger: boolean;
  16448. /** !#en
  16449. get or set the center of the collider, in local space.
  16450. !#zh
  16451. 获取或设置碰撞器的中心点。 */
  16452. center: Vec3;
  16453. /** !#en
  16454. get the collider attached rigidbody, this may be null.
  16455. !#zh
  16456. 获取碰撞器所绑定的刚体组件,可能为 null。 */
  16457. attachedRigidbody: RigidBody3D|void;
  16458. /** !#en
  16459. get collider shape.
  16460. !#zh
  16461. 获取碰撞器形状。 */
  16462. shape: IBaseShape;
  16463. /**
  16464. !#en
  16465. Register an callback of a specific event type on the EventTarget.
  16466. This type of event should be triggered via `emit`.
  16467. !#zh
  16468. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  16469. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16470. @param callback The callback that will be invoked when the event is dispatched.
  16471. The callback is ignored if it is a duplicate (the callbacks are unique).
  16472. @param target The target (this object) to invoke the callback, can be null.
  16473. @example
  16474. ```js
  16475. eventTarget.on('fire', function (event) {
  16476. // event is ITriggerEvent or ICollisionEvent
  16477. }, node);
  16478. ```
  16479. */
  16480. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  16481. /**
  16482. !#en
  16483. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  16484. if only type is passed as parameter, all listeners registered with that type will be removed.
  16485. !#zh
  16486. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  16487. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16488. @param callback The callback to remove.
  16489. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed.
  16490. @example
  16491. ```js
  16492. // register fire eventListener
  16493. var callback = eventTarget.on('fire', function () {
  16494. cc.log("fire in the hole");
  16495. }, target);
  16496. // remove fire event listener
  16497. eventTarget.off('fire', callback, target);
  16498. // remove all fire event listeners
  16499. eventTarget.off('fire');
  16500. ```
  16501. */
  16502. off(type: string, callback?: Function, target?: any): void;
  16503. /**
  16504. !#en
  16505. Register an callback of a specific event type on the EventTarget,
  16506. the callback will remove itself after the first time it is triggered.
  16507. !#zh
  16508. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  16509. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16510. @param callback The callback that will be invoked when the event is dispatched.
  16511. The callback is ignored if it is a duplicate (the callbacks are unique).
  16512. @param target The target (this object) to invoke the callback, can be null.
  16513. @example
  16514. ```js
  16515. eventTarget.once('fire', function (event) {
  16516. // event is ITriggerEvent or ICollisionEvent
  16517. }, node);
  16518. ```
  16519. */
  16520. once(type: string, callback: (event: ITriggerEvent|ICollisionEvent) => void, target?: any): void;
  16521. /**
  16522. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  16523. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  16524. @param type The type of event.
  16525. */
  16526. hasEventListener(type: string): boolean;
  16527. /**
  16528. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  16529. This is not for removing all listeners in the current event target,
  16530. and this is not for removing all listeners the target parameter have registered.
  16531. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  16532. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  16533. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  16534. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  16535. @param target The target to be searched for all related listeners
  16536. */
  16537. targetOff(target: any): void;
  16538. /**
  16539. !#en
  16540. Send an event with the event object.
  16541. !#zh
  16542. 通过事件对象派发事件
  16543. @param event event
  16544. */
  16545. dispatchEvent(event: Event): void;
  16546. /**
  16547. !#en
  16548. Destroy all callbackInfos.
  16549. !#zh
  16550. 销毁记录的事件
  16551. */
  16552. clear(): void;
  16553. }
  16554. /** !#en
  16555. Physics sphere collider
  16556. !#zh
  16557. 物理球碰撞器 */
  16558. export class SphereCollider3D extends Collider3D {
  16559. /** !#en
  16560. Get or set the radius of the sphere.
  16561. !#zh
  16562. 获取或设置球的半径。 */
  16563. radius: number;
  16564. sphereShape: ISphereShape;
  16565. }
  16566. /****************************************************
  16567. * audioEngine
  16568. *****************************************************/
  16569. export namespace audioEngine {
  16570. /** !#en Audio state.
  16571. !#zh 声音播放状态 */
  16572. export enum AudioState {
  16573. ERROR = 0,
  16574. INITIALZING = 0,
  16575. PLAYING = 0,
  16576. PAUSED = 0,
  16577. STOPPED = 0,
  16578. }
  16579. }
  16580. /****************************************************
  16581. * debug
  16582. *****************************************************/
  16583. export namespace debug {
  16584. /** !#en Enum for debug modes.
  16585. !#zh 调试模式 */
  16586. export enum DebugMode {
  16587. NONE = 0,
  16588. INFO = 0,
  16589. WARN = 0,
  16590. ERROR = 0,
  16591. INFO_FOR_WEB_PAGE = 0,
  16592. WARN_FOR_WEB_PAGE = 0,
  16593. ERROR_FOR_WEB_PAGE = 0,
  16594. }
  16595. }
  16596. /****************************************************
  16597. * Node
  16598. *****************************************************/
  16599. export namespace Node {
  16600. /** !#en Node's local dirty properties flag
  16601. !#zh Node 的本地属性 dirty 状态位 */
  16602. export enum _LocalDirtyFlag {
  16603. POSITION = 0,
  16604. SCALE = 0,
  16605. ROTATION = 0,
  16606. SKEW = 0,
  16607. TRS = 0,
  16608. RS = 0,
  16609. TRS = 0,
  16610. PHYSICS_POSITION = 0,
  16611. PHYSICS_SCALE = 0,
  16612. PHYSICS_ROTATION = 0,
  16613. PHYSICS_TRS = 0,
  16614. PHYSICS_RS = 0,
  16615. ALL_POSITION = 0,
  16616. ALL_SCALE = 0,
  16617. ALL_ROTATION = 0,
  16618. ALL_TRS = 0,
  16619. ALL = 0,
  16620. }
  16621. }
  16622. /****************************************************
  16623. * Node
  16624. *****************************************************/
  16625. export namespace Node {
  16626. /** !#en The event type supported by Node
  16627. !#zh Node 支持的事件类型 */
  16628. export class EventType {
  16629. /** !#en The event type for touch start event, you can use its value directly: 'touchstart'
  16630. !#zh 当手指触摸到屏幕时。 */
  16631. static TOUCH_START: string;
  16632. /** !#en The event type for touch move event, you can use its value directly: 'touchmove'
  16633. !#zh 当手指在屏幕上移动时。 */
  16634. static TOUCH_MOVE: string;
  16635. /** !#en The event type for touch end event, you can use its value directly: 'touchend'
  16636. !#zh 当手指在目标节点区域内离开屏幕时。 */
  16637. static TOUCH_END: string;
  16638. /** !#en The event type for touch end event, you can use its value directly: 'touchcancel'
  16639. !#zh 当手指在目标节点区域外离开屏幕时。 */
  16640. static TOUCH_CANCEL: string;
  16641. /** !#en The event type for mouse down events, you can use its value directly: 'mousedown'
  16642. !#zh 当鼠标按下时触发一次。 */
  16643. static MOUSE_DOWN: string;
  16644. /** !#en The event type for mouse move events, you can use its value directly: 'mousemove'
  16645. !#zh 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。 */
  16646. static MOUSE_MOVE: string;
  16647. /** !#en The event type for mouse enter target events, you can use its value directly: 'mouseenter'
  16648. !#zh 当鼠标移入目标节点区域时,不论是否按下。 */
  16649. static MOUSE_ENTER: string;
  16650. /** !#en The event type for mouse leave target events, you can use its value directly: 'mouseleave'
  16651. !#zh 当鼠标移出目标节点区域时,不论是否按下。 */
  16652. static MOUSE_LEAVE: string;
  16653. /** !#en The event type for mouse up events, you can use its value directly: 'mouseup'
  16654. !#zh 当鼠标从按下状态松开时触发一次。 */
  16655. static MOUSE_UP: string;
  16656. /** !#en The event type for mouse wheel events, you can use its value directly: 'mousewheel'
  16657. !#zh 当鼠标滚轮滚动时。 */
  16658. static MOUSE_WHEEL: string;
  16659. /** !#en The event type for position change events.
  16660. Performance note, this event will be triggered every time corresponding properties being changed,
  16661. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16662. !#zh 当节点位置改变时触发的事件。
  16663. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16664. static POSITION_CHANGED: string;
  16665. /** !#en The event type for rotation change events.
  16666. Performance note, this event will be triggered every time corresponding properties being changed,
  16667. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16668. !#zh 当节点旋转改变时触发的事件。
  16669. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16670. static ROTATION_CHANGED: string;
  16671. /** !#en The event type for scale change events.
  16672. Performance note, this event will be triggered every time corresponding properties being changed,
  16673. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16674. !#zh 当节点缩放改变时触发的事件。
  16675. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16676. static SCALE_CHANGED: string;
  16677. /** !#en The event type for size change events.
  16678. Performance note, this event will be triggered every time corresponding properties being changed,
  16679. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16680. !#zh 当节点尺寸改变时触发的事件。
  16681. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16682. static SIZE_CHANGED: string;
  16683. /** !#en The event type for anchor point change events.
  16684. Performance note, this event will be triggered every time corresponding properties being changed,
  16685. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16686. !#zh 当节点锚点改变时触发的事件。
  16687. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16688. static ANCHOR_CHANGED: string;
  16689. /** !#en The event type for color change events.
  16690. Performance note, this event will be triggered every time corresponding properties being changed,
  16691. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16692. !#zh 当节点颜色改变时触发的事件。
  16693. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16694. static COLOR_CHANGED: string;
  16695. /** !#en The event type for new child added events.
  16696. !#zh 当新的子节点被添加时触发的事件。 */
  16697. static CHILD_ADDED: string;
  16698. /** !#en The event type for child removed events.
  16699. !#zh 当子节点被移除时触发的事件。 */
  16700. static CHILD_REMOVED: string;
  16701. /** !#en The event type for children reorder events.
  16702. !#zh 当子节点顺序改变时触发的事件。 */
  16703. static CHILD_REORDER: string;
  16704. /** !#en The event type for node group changed events.
  16705. !#zh 当节点归属群组发生变化时触发的事件。 */
  16706. static GROUP_CHANGED: string;
  16707. /** !#en The event type for node's sibling order changed.
  16708. !#zh 当节点在兄弟节点中的顺序发生变化时触发的事件。 */
  16709. static SIBLING_ORDER_CHANGED: string;
  16710. }
  16711. }
  16712. /****************************************************
  16713. * ParticleSystem
  16714. *****************************************************/
  16715. export namespace ParticleSystem {
  16716. /** !#en Enum for emitter modes
  16717. !#zh 发射模式 */
  16718. export enum EmitterMode {
  16719. GRAVITY = 0,
  16720. RADIUS = 0,
  16721. }
  16722. }
  16723. /****************************************************
  16724. * ParticleSystem
  16725. *****************************************************/
  16726. export namespace ParticleSystem {
  16727. /** !#en Enum for particles movement type.
  16728. !#zh 粒子位置类型 */
  16729. export enum PositionType {
  16730. FREE = 0,
  16731. RELATIVE = 0,
  16732. GROUPED = 0,
  16733. }
  16734. }
  16735. /****************************************************
  16736. * VideoPlayer
  16737. *****************************************************/
  16738. export namespace VideoPlayer {
  16739. /** !#en Video event type
  16740. !#zh 视频事件类型 */
  16741. export enum EventType {
  16742. PLAYING = 0,
  16743. PAUSED = 0,
  16744. STOPPED = 0,
  16745. COMPLETED = 0,
  16746. META_LOADED = 0,
  16747. CLICKED = 0,
  16748. READY_TO_PLAY = 0,
  16749. }
  16750. }
  16751. /****************************************************
  16752. * VideoPlayer
  16753. *****************************************************/
  16754. export namespace VideoPlayer {
  16755. /** !#en Enum for video resouce type type.
  16756. !#zh 视频来源 */
  16757. export enum ResourceType {
  16758. REMOTE = 0,
  16759. LOCAL = 0,
  16760. }
  16761. }
  16762. /****************************************************
  16763. * TiledMap
  16764. *****************************************************/
  16765. export namespace TiledMap {
  16766. /** !#en The orientation of tiled map.
  16767. !#zh Tiled Map 地图方向。 */
  16768. export enum Orientation {
  16769. ORTHO = 0,
  16770. HEX = 0,
  16771. ISO = 0,
  16772. }
  16773. }
  16774. /****************************************************
  16775. * TiledMap
  16776. *****************************************************/
  16777. export namespace TiledMap {
  16778. /** The property type of tiled map. */
  16779. export enum Property {
  16780. NONE = 0,
  16781. MAP = 0,
  16782. LAYER = 0,
  16783. OBJECTGROUP = 0,
  16784. OBJECT = 0,
  16785. TILE = 0,
  16786. }
  16787. }
  16788. /****************************************************
  16789. * TiledMap
  16790. *****************************************************/
  16791. export namespace TiledMap {
  16792. /** The tile flags of tiled map. */
  16793. export enum TileFlag {
  16794. HORIZONTAL = 0,
  16795. VERTICAL = 0,
  16796. DIAGONAL = 0,
  16797. FLIPPED_ALL = 0,
  16798. FLIPPED_MASK = 0,
  16799. }
  16800. }
  16801. /****************************************************
  16802. * TiledMap
  16803. *****************************************************/
  16804. export namespace TiledMap {
  16805. /** !#en The stagger axis of Hex tiled map.
  16806. !#zh 六边形地图的 stagger axis 值 */
  16807. export enum StaggerAxis {
  16808. STAGGERAXIS_X = 0,
  16809. STAGGERAXIS_Y = 0,
  16810. }
  16811. }
  16812. /****************************************************
  16813. * TiledMap
  16814. *****************************************************/
  16815. export namespace TiledMap {
  16816. /** !#en The render order of tiled map.
  16817. !#zh 地图的渲染顺序 */
  16818. export enum RenderOrder {
  16819. STAGGERINDEX_ODD = 0,
  16820. STAGGERINDEX_EVEN = 0,
  16821. RightDown = 0,
  16822. RightUp = 0,
  16823. LeftDown = 0,
  16824. LeftUp = 0,
  16825. }
  16826. }
  16827. /****************************************************
  16828. * TiledMap
  16829. *****************************************************/
  16830. export namespace TiledMap {
  16831. /** !#en TiledMap Object Type
  16832. !#zh 地图物体类型 */
  16833. export enum TMXObjectType {
  16834. RECT = 0,
  16835. ELLIPSE = 0,
  16836. POLYGON = 0,
  16837. POLYLINE = 0,
  16838. IMAGE = 0,
  16839. TEXT = 0,
  16840. }
  16841. }
  16842. /****************************************************
  16843. * WebView
  16844. *****************************************************/
  16845. export namespace WebView {
  16846. /** !#en WebView event type
  16847. !#zh 网页视图事件类型 */
  16848. export enum EventType {
  16849. LOADED = 0,
  16850. LOADING = 0,
  16851. ERROR = 0,
  16852. }
  16853. }
  16854. /****************************************************
  16855. * Camera
  16856. *****************************************************/
  16857. export namespace Camera {
  16858. /** !#en Values for Camera.clearFlags, determining what to clear when rendering a Camera.
  16859. !#zh 摄像机清除标记位,决定摄像机渲染时会清除哪些状态 */
  16860. export enum ClearFlags {
  16861. COLOR = 0,
  16862. DEPTH = 0,
  16863. STENCIL = 0,
  16864. }
  16865. }
  16866. /****************************************************
  16867. * Light
  16868. *****************************************************/
  16869. export namespace Light {
  16870. /** !#en The light source type
  16871. !#zh 光源类型 */
  16872. export enum Type {
  16873. DIRECTIONAL = 0,
  16874. POINT = 0,
  16875. SPOT = 0,
  16876. AMBIENT = 0,
  16877. }
  16878. }
  16879. /****************************************************
  16880. * Light
  16881. *****************************************************/
  16882. export namespace Light {
  16883. /** !#en The shadow type
  16884. !#zh 阴影类型 */
  16885. export enum ShadowType {
  16886. NONE = 0,
  16887. HARD = 0,
  16888. SOFT_PCF3X3 = 0,
  16889. SOFT_PCF5X5 = 0,
  16890. }
  16891. }
  16892. /****************************************************
  16893. * Prefab
  16894. *****************************************************/
  16895. export namespace Prefab {
  16896. /** !#zh
  16897. Prefab 创建实例所用的优化策略,配合 {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}} 使用。
  16898. !#en
  16899. An enumeration used with the {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}}
  16900. to specify how to optimize the instantiate operation. */
  16901. export enum OptimizationPolicy {
  16902. AUTO = 0,
  16903. SINGLE_INSTANCE = 0,
  16904. MULTI_INSTANCE = 0,
  16905. }
  16906. }
  16907. /****************************************************
  16908. * RenderTexture
  16909. *****************************************************/
  16910. export namespace RenderTexture {
  16911. /** !#en The depth buffer and stencil buffer format for RenderTexture.
  16912. !#zh RenderTexture 的深度缓冲以及模板缓冲格式。 */
  16913. export enum DepthStencilFormat {
  16914. RB_FMT_D24S8 = 0,
  16915. RB_FMT_S8 = 0,
  16916. RB_FMT_D16 = 0,
  16917. }
  16918. }
  16919. /****************************************************
  16920. * Texture2D
  16921. *****************************************************/
  16922. export namespace Texture2D {
  16923. /** The texture pixel format, default value is RGBA8888,
  16924. you should note that textures loaded by normal image files (png, jpg) can only support RGBA8888 format,
  16925. other formats are supported by compressed file types or raw data. */
  16926. export enum PixelFormat {
  16927. RGB565 = 0,
  16928. RGB5A1 = 0,
  16929. RGBA4444 = 0,
  16930. RGB888 = 0,
  16931. RGBA8888 = 0,
  16932. RGBA32F = 0,
  16933. A8 = 0,
  16934. I8 = 0,
  16935. AI88 = 0,
  16936. RGB_PVRTC_2BPPV1 = 0,
  16937. RGBA_PVRTC_2BPPV1 = 0,
  16938. RGB_A_PVRTC_2BPPV1 = 0,
  16939. RGB_PVRTC_4BPPV1 = 0,
  16940. RGBA_PVRTC_4BPPV1 = 0,
  16941. RGB_A_PVRTC_4BPPV1 = 0,
  16942. RGB_ETC1 = 0,
  16943. RGBA_ETC1 = 0,
  16944. RGB_ETC2 = 0,
  16945. RGBA_ETC2 = 0,
  16946. }
  16947. }
  16948. /****************************************************
  16949. * Texture2D
  16950. *****************************************************/
  16951. export namespace Texture2D {
  16952. /** The texture wrap mode */
  16953. export enum WrapMode {
  16954. REPEAT = 0,
  16955. CLAMP_TO_EDGE = 0,
  16956. MIRRORED_REPEAT = 0,
  16957. }
  16958. }
  16959. /****************************************************
  16960. * Texture2D
  16961. *****************************************************/
  16962. export namespace Texture2D {
  16963. /** The texture filter mode */
  16964. export enum Filter {
  16965. LINEAR = 0,
  16966. NEAREST = 0,
  16967. }
  16968. }
  16969. /****************************************************
  16970. * Event
  16971. *****************************************************/
  16972. export namespace Event {
  16973. /** !#en The Custom event
  16974. !#zh 自定义事件 */
  16975. export class EventCustom extends Event {
  16976. /**
  16977. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  16978. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  16979. */
  16980. constructor(type: string, bubbles: boolean);
  16981. /** !#en A reference to the detailed data of the event
  16982. !#zh 事件的详细数据 */
  16983. detail: any;
  16984. /**
  16985. !#en Sets user data
  16986. !#zh 设置用户数据
  16987. @param data data
  16988. */
  16989. setUserData(data: any): void;
  16990. /**
  16991. !#en Gets user data
  16992. !#zh 获取用户数据
  16993. */
  16994. getUserData(): any;
  16995. /**
  16996. !#en Gets event name
  16997. !#zh 获取事件名称
  16998. */
  16999. getEventName(): string;
  17000. }
  17001. }
  17002. /****************************************************
  17003. * SystemEvent
  17004. *****************************************************/
  17005. export namespace SystemEvent {
  17006. /** !#en The event type supported by SystemEvent
  17007. !#zh SystemEvent 支持的事件类型 */
  17008. export class EventType {
  17009. /** !#en The event type for press the key down event, you can use its value directly: 'keydown'
  17010. !#zh 当按下按键时触发的事件 */
  17011. static KEY_DOWN: string;
  17012. /** !#en The event type for press the key up event, you can use its value directly: 'keyup'
  17013. !#zh 当松开按键时触发的事件 */
  17014. static KEY_UP: string;
  17015. /** !#en The event type for press the devicemotion event, you can use its value directly: 'devicemotion'
  17016. !#zh 重力感应 */
  17017. static DEVICEMOTION: string;
  17018. }
  17019. }
  17020. /****************************************************
  17021. * Collider
  17022. *****************************************************/
  17023. export namespace Collider {
  17024. /** !#en Defines a Box Collider .
  17025. !#zh 用来定义包围盒碰撞体 */
  17026. export class Box {
  17027. /** !#en Position offset
  17028. !#zh 位置偏移量 */
  17029. offset: Vec2;
  17030. /** !#en Box size
  17031. !#zh 包围盒大小 */
  17032. size: Size;
  17033. }
  17034. }
  17035. /****************************************************
  17036. * Collider
  17037. *****************************************************/
  17038. export namespace Collider {
  17039. /** !#en Defines a Circle Collider .
  17040. !#zh 用来定义圆形碰撞体 */
  17041. export class Circle {
  17042. /** !#en Position offset
  17043. !#zh 位置偏移量 */
  17044. offset: Vec2;
  17045. /** !#en Circle radius
  17046. !#zh 圆形半径 */
  17047. radius: number;
  17048. }
  17049. }
  17050. /****************************************************
  17051. * Collider
  17052. *****************************************************/
  17053. export namespace Collider {
  17054. /** !#en Defines a Polygon Collider .
  17055. !#zh 用来定义多边形碰撞体 */
  17056. export class Polygon {
  17057. /** !#en Position offset
  17058. !#zh 位置偏移量 */
  17059. offset: Vec2;
  17060. /** !#en Polygon points
  17061. !#zh 多边形顶点数组 */
  17062. points: Vec2[];
  17063. }
  17064. }
  17065. /****************************************************
  17066. * Event
  17067. *****************************************************/
  17068. export namespace Event {
  17069. /** !#en The mouse event
  17070. !#zh 鼠标事件类型 */
  17071. export class EventMouse extends Event {
  17072. /**
  17073. !#en Sets scroll data.
  17074. !#zh 设置鼠标的滚动数据。
  17075. @param scrollX scrollX
  17076. @param scrollY scrollY
  17077. */
  17078. setScrollData(scrollX: number, scrollY: number): void;
  17079. /**
  17080. !#en Returns the x axis scroll value.
  17081. !#zh 获取鼠标滚动的X轴距离,只有滚动时才有效。
  17082. */
  17083. getScrollX(): number;
  17084. /**
  17085. !#en Returns the y axis scroll value.
  17086. !#zh 获取滚轮滚动的 Y 轴距离,只有滚动时才有效。
  17087. */
  17088. getScrollY(): number;
  17089. /**
  17090. !#en Sets cursor location.
  17091. !#zh 设置当前鼠标位置。
  17092. @param x x
  17093. @param y y
  17094. */
  17095. setLocation(x: number, y: number): void;
  17096. /**
  17097. !#en Returns cursor location.
  17098. !#zh 获取鼠标位置对象,对象包含 x 和 y 属性。
  17099. */
  17100. getLocation(): Vec2;
  17101. /**
  17102. !#en Returns the current cursor location in screen coordinates.
  17103. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  17104. */
  17105. getLocationInView(): Vec2;
  17106. /**
  17107. !#en Returns the previous touch location.
  17108. !#zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  17109. */
  17110. getPreviousLocation(): Vec2;
  17111. /**
  17112. !#en Returns the delta distance from the previous location to current location.
  17113. !#zh 获取鼠标距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  17114. */
  17115. getDelta(): Vec2;
  17116. /**
  17117. !#en Returns the X axis delta distance from the previous location to current location.
  17118. !#zh 获取鼠标距离上一次事件移动的 X 轴距离。
  17119. */
  17120. getDeltaX(): number;
  17121. /**
  17122. !#en Returns the Y axis delta distance from the previous location to current location.
  17123. !#zh 获取鼠标距离上一次事件移动的 Y 轴距离。
  17124. */
  17125. getDeltaY(): number;
  17126. /**
  17127. !#en Sets mouse button.
  17128. !#zh 设置鼠标按键。
  17129. @param button button
  17130. */
  17131. setButton(button: number): void;
  17132. /**
  17133. !#en Returns mouse button.
  17134. !#zh 获取鼠标按键。
  17135. */
  17136. getButton(): number;
  17137. /**
  17138. !#en Returns location X axis data.
  17139. !#zh 获取鼠标当前位置 X 轴。
  17140. */
  17141. getLocationX(): number;
  17142. /**
  17143. !#en Returns location Y axis data.
  17144. !#zh 获取鼠标当前位置 Y 轴。
  17145. */
  17146. getLocationY(): number;
  17147. /** !#en The none event code of mouse event.
  17148. !#zh 无。 */
  17149. static NONE: number;
  17150. /** !#en The event type code of mouse down event.
  17151. !#zh 鼠标按下事件。 */
  17152. static DOWN: number;
  17153. /** !#en The event type code of mouse up event.
  17154. !#zh 鼠标按下后释放事件。 */
  17155. static UP: number;
  17156. /** !#en The event type code of mouse move event.
  17157. !#zh 鼠标移动事件。 */
  17158. static MOVE: number;
  17159. /** !#en The event type code of mouse scroll event.
  17160. !#zh 鼠标滚轮事件。 */
  17161. static SCROLL: number;
  17162. /** !#en The tag of Mouse left button.
  17163. !#zh 鼠标左键的标签。 */
  17164. static BUTTON_LEFT: number;
  17165. /** !#en The tag of Mouse right button (The right button number is 2 on browser).
  17166. !#zh 鼠标右键的标签。 */
  17167. static BUTTON_RIGHT: number;
  17168. /** !#en The tag of Mouse middle button (The right button number is 1 on browser).
  17169. !#zh 鼠标中键的标签。 */
  17170. static BUTTON_MIDDLE: number;
  17171. /** !#en The tag of Mouse button 4.
  17172. !#zh 鼠标按键 4 的标签。 */
  17173. static BUTTON_4: number;
  17174. /** !#en The tag of Mouse button 5.
  17175. !#zh 鼠标按键 5 的标签。 */
  17176. static BUTTON_5: number;
  17177. /** !#en The tag of Mouse button 6.
  17178. !#zh 鼠标按键 6 的标签。 */
  17179. static BUTTON_6: number;
  17180. /** !#en The tag of Mouse button 7.
  17181. !#zh 鼠标按键 7 的标签。 */
  17182. static BUTTON_7: number;
  17183. /** !#en The tag of Mouse button 8.
  17184. !#zh 鼠标按键 8 的标签。 */
  17185. static BUTTON_8: number;
  17186. }
  17187. }
  17188. /****************************************************
  17189. * Event
  17190. *****************************************************/
  17191. export namespace Event {
  17192. /** !#en The touch event
  17193. !#zh 触摸事件 */
  17194. export class EventTouch extends Event {
  17195. /**
  17196. @param touchArr The array of the touches
  17197. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  17198. */
  17199. constructor(touchArr: any[], bubbles: boolean);
  17200. /** !#en The current touch object
  17201. !#zh 当前触点对象 */
  17202. touch: Touch;
  17203. /**
  17204. !#en Returns event code.
  17205. !#zh 获取事件类型。
  17206. */
  17207. getEventCode(): number;
  17208. /**
  17209. !#en Returns touches of event.
  17210. !#zh 获取触摸点的列表。
  17211. */
  17212. getTouches(): any[];
  17213. /**
  17214. !#en Sets touch location.
  17215. !#zh 设置当前触点位置
  17216. @param x x
  17217. @param y y
  17218. */
  17219. setLocation(x: number, y: number): void;
  17220. /**
  17221. !#en Returns touch location.
  17222. !#zh 获取触点位置。
  17223. */
  17224. getLocation(): Vec2;
  17225. /**
  17226. !#en Returns the current touch location in screen coordinates.
  17227. !#zh 获取当前触点在游戏窗口中的位置。
  17228. */
  17229. getLocationInView(): Vec2;
  17230. /**
  17231. !#en Returns the previous touch location.
  17232. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  17233. */
  17234. getPreviousLocation(): Vec2;
  17235. /**
  17236. !#en Returns the start touch location.
  17237. !#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  17238. */
  17239. getStartLocation(): Vec2;
  17240. /**
  17241. !#en Returns the id of cc.Touch.
  17242. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  17243. */
  17244. getID(): number;
  17245. /**
  17246. !#en Returns the delta distance from the previous location to current location.
  17247. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  17248. */
  17249. getDelta(): Vec2;
  17250. /**
  17251. !#en Returns the X axis delta distance from the previous location to current location.
  17252. !#zh 获取触点距离上一次事件移动的 x 轴距离。
  17253. */
  17254. getDeltaX(): number;
  17255. /**
  17256. !#en Returns the Y axis delta distance from the previous location to current location.
  17257. !#zh 获取触点距离上一次事件移动的 y 轴距离。
  17258. */
  17259. getDeltaY(): number;
  17260. /**
  17261. !#en Returns location X axis data.
  17262. !#zh 获取当前触点 X 轴位置。
  17263. */
  17264. getLocationX(): number;
  17265. /**
  17266. !#en Returns location Y axis data.
  17267. !#zh 获取当前触点 Y 轴位置。
  17268. */
  17269. getLocationY(): number;
  17270. }
  17271. }
  17272. /****************************************************
  17273. * Event
  17274. *****************************************************/
  17275. export namespace Event {
  17276. /** !#en The acceleration event
  17277. !#zh 加速度事件 */
  17278. export class EventAcceleration extends Event {
  17279. }
  17280. }
  17281. /****************************************************
  17282. * Event
  17283. *****************************************************/
  17284. export namespace Event {
  17285. /** !#en The keyboard event
  17286. !#zh 键盘事件 */
  17287. export class EventKeyboard extends Event {
  17288. /** !#en
  17289. The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
  17290. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.
  17291. If the key can't be identified, this value is 0.
  17292. !#zh
  17293. keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。
  17294. 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。
  17295. 如果无法识别该键,则该值为 0。 */
  17296. keyCode: number;
  17297. }
  17298. }
  17299. /****************************************************
  17300. * Animation
  17301. *****************************************************/
  17302. export namespace Animation {
  17303. /** !#en The event type supported by Animation
  17304. !#zh Animation 支持的事件类型 */
  17305. export class EventType {
  17306. /** !#en Emit when begin playing animation
  17307. !#zh 开始播放时触发 */
  17308. static PLAY: string;
  17309. /** !#en Emit when stop playing animation
  17310. !#zh 停止播放时触发 */
  17311. static STOP: string;
  17312. /** !#en Emit when pause animation
  17313. !#zh 暂停播放时触发 */
  17314. static PAUSE: string;
  17315. /** !#en Emit when resume animation
  17316. !#zh 恢复播放时触发 */
  17317. static RESUME: string;
  17318. /** !#en If animation repeat count is larger than 1, emit when animation play to the last frame
  17319. !#zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发 */
  17320. static LASTFRAME: string;
  17321. /** !#en Emit when finish playing animation
  17322. !#zh 动画播放完成时触发 */
  17323. static FINISHED: string;
  17324. }
  17325. }
  17326. /****************************************************
  17327. * Button
  17328. *****************************************************/
  17329. export namespace Button {
  17330. /** !#en Enum for transition type.
  17331. !#zh 过渡类型 */
  17332. export enum Transition {
  17333. NONE = 0,
  17334. COLOR = 0,
  17335. SPRITE = 0,
  17336. SCALE = 0,
  17337. }
  17338. }
  17339. /****************************************************
  17340. * Component
  17341. *****************************************************/
  17342. export namespace Component {
  17343. /** !#en
  17344. Component will register a event to target component's handler.
  17345. And it will trigger the handler when a certain event occurs.
  17346. !@zh
  17347. “EventHandler” 类用来设置场景中的事件回调,
  17348. 该类允许用户设置回调目标节点,目标组件名,组件方法名,
  17349. 并可通过 emit 方法调用目标函数。 */
  17350. export class EventHandler {
  17351. /** !#en the node that contains target callback, such as the node example script belongs to
  17352. !#zh 事件响应函数所在节点 ,比如例子中脚本归属的节点本身 */
  17353. target: Node;
  17354. /** !#en name of the component(script) that contains target callback, such as the name 'MainMenu' of script in example
  17355. !#zh 事件响应函数所在组件名(脚本名), 比如例子中的脚本名 'MainMenu' */
  17356. component: string;
  17357. /** !#en Event handler, such as function's name 'onClick' in example
  17358. !#zh 响应事件函数名,比如例子中的 'onClick' */
  17359. handler: string;
  17360. /** !#en Custom Event Data, such as 'eventType' in example
  17361. !#zh 自定义事件数据,比如例子中的 eventType */
  17362. customEventData: string;
  17363. /**
  17364. @param events events
  17365. @param params params
  17366. */
  17367. static emitEvents(events: EventHandler[], ...params: any[]): void;
  17368. /**
  17369. !#en Emit event with params
  17370. !#zh 触发目标组件上的指定 handler 函数,该参数是回调函数的参数值(可不填)。
  17371. @param params params
  17372. @example
  17373. ```js
  17374. // Call Function
  17375. var eventHandler = new cc.Component.EventHandler();
  17376. eventHandler.target = newTarget;
  17377. eventHandler.component = "MainMenu";
  17378. eventHandler.handler = "OnClick"
  17379. eventHandler.emit(["param1", "param2", ....]);
  17380. ```
  17381. */
  17382. emit(params: any[]): void;
  17383. }
  17384. }
  17385. /****************************************************
  17386. * Label
  17387. *****************************************************/
  17388. export namespace Label {
  17389. /** !#en Enum for text alignment.
  17390. !#zh 文本横向对齐类型 */
  17391. export enum HorizontalAlign {
  17392. LEFT = 0,
  17393. CENTER = 0,
  17394. RIGHT = 0,
  17395. }
  17396. }
  17397. /****************************************************
  17398. * Label
  17399. *****************************************************/
  17400. export namespace Label {
  17401. /** !#en Enum for vertical text alignment.
  17402. !#zh 文本垂直对齐类型 */
  17403. export enum VerticalAlign {
  17404. TOP = 0,
  17405. CENTER = 0,
  17406. BOTTOM = 0,
  17407. }
  17408. }
  17409. /****************************************************
  17410. * Label
  17411. *****************************************************/
  17412. export namespace Label {
  17413. /** !#en Enum for Overflow.
  17414. !#zh Overflow 类型 */
  17415. export enum Overflow {
  17416. NONE = 0,
  17417. CLAMP = 0,
  17418. SHRINK = 0,
  17419. RESIZE_HEIGHT = 0,
  17420. }
  17421. }
  17422. /****************************************************
  17423. * Label
  17424. *****************************************************/
  17425. export namespace Label {
  17426. /** !#en Enum for font type.
  17427. !#zh Type 类型 */
  17428. export enum Type {
  17429. TTF = 0,
  17430. BMFont = 0,
  17431. SystemFont = 0,
  17432. }
  17433. }
  17434. /****************************************************
  17435. * Label
  17436. *****************************************************/
  17437. export namespace Label {
  17438. /** !#en Enum for cache mode.
  17439. !#zh CacheMode 类型 */
  17440. export enum CacheMode {
  17441. NONE = 0,
  17442. BITMAP = 0,
  17443. CHAR = 0,
  17444. }
  17445. }
  17446. /****************************************************
  17447. * Layout
  17448. *****************************************************/
  17449. export namespace Layout {
  17450. /** !#en Enum for Layout type
  17451. !#zh 布局类型 */
  17452. export enum Type {
  17453. NONE = 0,
  17454. HORIZONTAL = 0,
  17455. VERTICAL = 0,
  17456. GRID = 0,
  17457. }
  17458. }
  17459. /****************************************************
  17460. * Layout
  17461. *****************************************************/
  17462. export namespace Layout {
  17463. /** !#en Enum for Layout Resize Mode
  17464. !#zh 缩放模式 */
  17465. export enum ResizeMode {
  17466. NONE = 0,
  17467. CONTAINER = 0,
  17468. CHILDREN = 0,
  17469. }
  17470. }
  17471. /****************************************************
  17472. * Layout
  17473. *****************************************************/
  17474. export namespace Layout {
  17475. /** !#en Enum for Grid Layout start axis direction.
  17476. The items in grid layout will be arranged in each axis at first.;
  17477. !#zh 布局轴向,只用于 GRID 布局。 */
  17478. export enum AxisDirection {
  17479. HORIZONTAL = 0,
  17480. VERTICAL = 0,
  17481. }
  17482. }
  17483. /****************************************************
  17484. * Layout
  17485. *****************************************************/
  17486. export namespace Layout {
  17487. /** !#en Enum for vertical layout direction.
  17488. Used in Grid Layout together with AxisDirection is VERTICAL
  17489. !#zh 垂直方向布局方式 */
  17490. export enum VerticalDirection {
  17491. BOTTOM_TO_TOP = 0,
  17492. TOP_TO_BOTTOM = 0,
  17493. }
  17494. }
  17495. /****************************************************
  17496. * Layout
  17497. *****************************************************/
  17498. export namespace Layout {
  17499. /** !#en Enum for horizontal layout direction.
  17500. Used in Grid Layout together with AxisDirection is HORIZONTAL
  17501. !#zh 水平方向布局方式 */
  17502. export enum HorizontalDirection {
  17503. LEFT_TO_RIGHT = 0,
  17504. RIGHT_TO_LEFT = 0,
  17505. }
  17506. }
  17507. /****************************************************
  17508. * Mask
  17509. *****************************************************/
  17510. export namespace Mask {
  17511. /** !#en the type for mask.
  17512. !#zh 遮罩组件类型 */
  17513. export enum Type {
  17514. RECT = 0,
  17515. ELLIPSE = 0,
  17516. IMAGE_STENCIL = 0,
  17517. }
  17518. }
  17519. /****************************************************
  17520. * PageView
  17521. *****************************************************/
  17522. export namespace PageView {
  17523. /** !#en The Page View Size Mode
  17524. !#zh 页面视图每个页面统一的大小类型 */
  17525. export enum SizeMode {
  17526. Unified = 0,
  17527. Free = 0,
  17528. }
  17529. }
  17530. /****************************************************
  17531. * PageView
  17532. *****************************************************/
  17533. export namespace PageView {
  17534. /** !#en The Page View Direction
  17535. !#zh 页面视图滚动类型 */
  17536. export enum Direction {
  17537. Horizontal = 0,
  17538. Vertical = 0,
  17539. }
  17540. }
  17541. /****************************************************
  17542. * PageView
  17543. *****************************************************/
  17544. export namespace PageView {
  17545. /** !#en Enum for ScrollView event type.
  17546. !#zh 滚动视图事件类型 */
  17547. export enum EventType {
  17548. PAGE_TURNING = 0,
  17549. }
  17550. }
  17551. /****************************************************
  17552. * ProgressBar
  17553. *****************************************************/
  17554. export namespace ProgressBar {
  17555. /** !#en Enum for ProgressBar mode
  17556. !#zh 进度条模式 */
  17557. export enum Mode {
  17558. HORIZONTAL = 0,
  17559. VERTICAL = 0,
  17560. FILLED = 0,
  17561. }
  17562. }
  17563. /****************************************************
  17564. * PageViewIndicator
  17565. *****************************************************/
  17566. export namespace PageViewIndicator {
  17567. /** !#en Enum for PageView Indicator direction
  17568. !#zh 页面视图指示器的摆放方向 */
  17569. export enum Direction {
  17570. HORIZONTAL = 0,
  17571. VERTICAL = 0,
  17572. }
  17573. }
  17574. /****************************************************
  17575. * Scrollbar
  17576. *****************************************************/
  17577. export namespace Scrollbar {
  17578. /** Enum for Scrollbar direction */
  17579. export enum Direction {
  17580. HORIZONTAL = 0,
  17581. VERTICAL = 0,
  17582. }
  17583. }
  17584. /****************************************************
  17585. * ScrollView
  17586. *****************************************************/
  17587. export namespace ScrollView {
  17588. /** !#en Enum for ScrollView event type.
  17589. !#zh 滚动视图事件类型 */
  17590. export enum EventType {
  17591. SCROLL_TO_TOP = 0,
  17592. SCROLL_TO_BOTTOM = 0,
  17593. SCROLL_TO_LEFT = 0,
  17594. SCROLL_TO_RIGHT = 0,
  17595. SCROLLING = 0,
  17596. BOUNCE_TOP = 0,
  17597. BOUNCE_BOTTOM = 0,
  17598. BOUNCE_LEFT = 0,
  17599. BOUNCE_RIGHT = 0,
  17600. SCROLL_ENDED = 0,
  17601. TOUCH_UP = 0,
  17602. AUTOSCROLL_ENDED_WITH_THRESHOLD = 0,
  17603. SCROLL_BEGAN = 0,
  17604. }
  17605. }
  17606. /****************************************************
  17607. * Slider
  17608. *****************************************************/
  17609. export namespace Slider {
  17610. /** !#en The Slider Direction
  17611. !#zh 滑动器方向 */
  17612. export enum Direction {
  17613. Horizontal = 0,
  17614. Vertical = 0,
  17615. }
  17616. }
  17617. /****************************************************
  17618. * Sprite
  17619. *****************************************************/
  17620. export namespace Sprite {
  17621. /** !#en Enum for sprite type.
  17622. !#zh Sprite 类型 */
  17623. export enum Type {
  17624. SIMPLE = 0,
  17625. SLICED = 0,
  17626. TILED = 0,
  17627. FILLED = 0,
  17628. MESH = 0,
  17629. }
  17630. }
  17631. /****************************************************
  17632. * Sprite
  17633. *****************************************************/
  17634. export namespace Sprite {
  17635. /** !#en Enum for fill type.
  17636. !#zh 填充类型 */
  17637. export enum FillType {
  17638. HORIZONTAL = 0,
  17639. VERTICAL = 0,
  17640. RADIAL = 0,
  17641. }
  17642. }
  17643. /****************************************************
  17644. * Sprite
  17645. *****************************************************/
  17646. export namespace Sprite {
  17647. /** !#en Sprite Size can track trimmed size, raw size or none.
  17648. !#zh 精灵尺寸调整模式 */
  17649. export enum SizeMode {
  17650. CUSTOM = 0,
  17651. TRIMMED = 0,
  17652. RAW = 0,
  17653. }
  17654. }
  17655. /****************************************************
  17656. * Sprite
  17657. *****************************************************/
  17658. export namespace Sprite {
  17659. /** !#en Sprite state can choice the normal or grayscale.
  17660. !#zh 精灵颜色通道模式。 */
  17661. export enum State {
  17662. NORMAL = 0,
  17663. GRAY = 0,
  17664. }
  17665. }
  17666. /****************************************************
  17667. * Widget
  17668. *****************************************************/
  17669. export namespace Widget {
  17670. /** !#en Enum for Widget's alignment mode, indicating when the widget should refresh.
  17671. !#zh Widget 的对齐模式,表示 Widget 应该何时刷新。 */
  17672. export enum AlignMode {
  17673. ONCE = 0,
  17674. ON_WINDOW_RESIZE = 0,
  17675. ALWAYS = 0,
  17676. }
  17677. }
  17678. /****************************************************
  17679. * geomUtils
  17680. *****************************************************/
  17681. export namespace geomUtils {
  17682. /** Aabb */
  17683. export class Aabb {
  17684. /**
  17685. create a new aabb
  17686. @param px X coordinates for aabb's original point
  17687. @param py Y coordinates for aabb's original point
  17688. @param pz Z coordinates for aabb's original point
  17689. @param w the half of aabb width
  17690. @param h the half of aabb height
  17691. @param l the half of aabb length
  17692. */
  17693. create(px: number, py: number, pz: number, w: number, h: number, l: number): Aabb;
  17694. /**
  17695. clone a new aabb
  17696. @param a the source aabb
  17697. */
  17698. clone(a: Aabb): Aabb;
  17699. /**
  17700. copy the values from one aabb to another
  17701. @param out the receiving aabb
  17702. @param a the source aabb
  17703. */
  17704. copy(out: Aabb, a: Aabb): Aabb;
  17705. /**
  17706. create a new aabb from two corner points
  17707. @param out the receiving aabb
  17708. @param minPos lower corner position of the aabb
  17709. @param maxPos upper corner position of the aabb
  17710. */
  17711. fromPoints(out: Aabb, minPos: Vec3, maxPos: Vec3): Aabb;
  17712. /**
  17713. Set the components of a aabb to the given values
  17714. @param out the receiving aabb
  17715. @param px X coordinates for aabb's original point
  17716. @param py Y coordinates for aabb's original point
  17717. @param pz Z coordinates for aabb's original point
  17718. @param w the half of aabb width
  17719. @param h the half of aabb height
  17720. @param l the half of aabb length
  17721. */
  17722. set(out: Aabb, px: number, py: number, pz: number, w: number, h: number, l: number): Aabb;
  17723. center: Vec3;
  17724. halfExtents: Vec3;
  17725. _type: number;
  17726. /**
  17727. Get the bounding points of this shape
  17728. @param minPos minPos
  17729. @param maxPos maxPos
  17730. */
  17731. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  17732. /**
  17733. Transform this shape
  17734. @param m the transform matrix
  17735. @param pos the position part of the transform
  17736. @param rot the rotation part of the transform
  17737. @param scale the scale part of the transform
  17738. @param out the target shape
  17739. */
  17740. transform(m: Mat4, pos: Vec3, rot: Quat, scale: Vec3, out?: Aabb): void;
  17741. }
  17742. }
  17743. /****************************************************
  17744. * geomUtils
  17745. *****************************************************/
  17746. export namespace geomUtils {
  17747. /** !#en Shape type. */
  17748. export enum enums {
  17749. SHAPE_RAY = 0,
  17750. SHAPE_LINE = 0,
  17751. SHAPE_SPHERE = 0,
  17752. SHAPE_AABB = 0,
  17753. SHAPE_OBB = 0,
  17754. SHAPE_PLANE = 0,
  17755. SHAPE_TRIANGLE = 0,
  17756. SHAPE_FRUSTUM = 0,
  17757. SHAPE_FRUSTUM_ACCURATE = 0,
  17758. }
  17759. }
  17760. /****************************************************
  17761. * geomUtils
  17762. *****************************************************/
  17763. export namespace geomUtils {
  17764. /** !#en frustum
  17765. !#zh 平截头体 */
  17766. export class Frustum {
  17767. /** Set whether to use accurate intersection testing function on this frustum */
  17768. accurate: boolean;
  17769. /**
  17770. create a new frustum
  17771. */
  17772. static create(): Frustum;
  17773. /**
  17774. Clone a frustum
  17775. @param f f
  17776. */
  17777. static clone(f: Frustum): Frustum;
  17778. /**
  17779. Copy the values from one frustum to another
  17780. @param out out
  17781. @param f f
  17782. */
  17783. copy(out: Frustum, f: Frustum): Frustum;
  17784. planes: geomUtils.Plane[];
  17785. planes: Vec3[];
  17786. /**
  17787. !#en Update the frustum information according to the given transform matrix.
  17788. Note that the resulting planes are not normalized under normal mode.
  17789. @param m the view-projection matrix
  17790. @param inv the inverse view-projection matrix
  17791. */
  17792. update(m: Mat4, inv: Mat4): void;
  17793. /**
  17794. !#en transform by matrix
  17795. @param mat mat
  17796. */
  17797. transform(mat: Mat4): void;
  17798. }
  17799. }
  17800. /****************************************************
  17801. * geomUtils
  17802. *****************************************************/
  17803. export namespace geomUtils {
  17804. /** undefined */
  17805. export class intersect {
  17806. /**
  17807. !#en
  17808. Check whether ray intersect with nodes
  17809. !#zh
  17810. 检测射线是否与物体有交集
  17811. @param root If root is null, then traversal nodes from scene node
  17812. @param worldRay worldRay
  17813. @param handler handler
  17814. @param filter filter
  17815. */
  17816. static ray_cast(root: Node, worldRay: geomUtils.Ray, handler: Function, filter: Function): any[];
  17817. /**
  17818. !#en ray-plane intersect<br/>
  17819. !#zh 射线与平面的相交性检测。
  17820. @param ray ray
  17821. @param plane plane
  17822. */
  17823. static ray_plane(ray: geomUtils.Ray, plane: geomUtils.Plane): number;
  17824. /**
  17825. !#en line-plane intersect<br/>
  17826. !#zh 线段与平面的相交性检测。
  17827. @param line line
  17828. @param plane plane
  17829. */
  17830. static line_plane(line: geomUtils.Line, plane: geomUtils.Plane): number;
  17831. /**
  17832. !#en ray-triangle intersect<br/>
  17833. !#zh 射线与三角形的相交性检测。
  17834. @param ray ray
  17835. @param triangle triangle
  17836. @param doubleSided doubleSided
  17837. */
  17838. static ray_triangle(ray: geomUtils.Ray, triangle: geomUtils.Triangle, doubleSided: boolean): number;
  17839. /**
  17840. !#en line-triangle intersect<br/>
  17841. !#zh 线段与三角形的相交性检测。
  17842. @param line line
  17843. @param triangle triangle
  17844. @param outPt optional, The intersection point
  17845. */
  17846. static line_triangle(line: geomUtils.Line, triangle: geomUtils.Triangle, outPt: Vec3): number;
  17847. /**
  17848. !#en line-quad intersect<br/>
  17849. !#zh 线段与四边形的相交性检测。
  17850. @param p A point on a line segment
  17851. @param q Another point on the line segment
  17852. @param a Quadrilateral point a
  17853. @param b Quadrilateral point b
  17854. @param c Quadrilateral point c
  17855. @param d Quadrilateral point d
  17856. @param outPt optional, The intersection point
  17857. */
  17858. static line_quad(p: Vec3, q: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, outPt: Vec3): number;
  17859. /**
  17860. !#en ray-sphere intersect<br/>
  17861. !#zh 射线和球的相交性检测。
  17862. @param ray ray
  17863. @param sphere sphere
  17864. */
  17865. static ray_sphere(ray: geomUtils.Ray, sphere: geomUtils.Sphere): number;
  17866. /**
  17867. !#en ray-aabb intersect<br/>
  17868. !#zh 射线和轴对齐包围盒的相交性检测。
  17869. @param ray ray
  17870. @param aabb Align the axis around the box
  17871. */
  17872. static ray_aabb(ray: geomUtils.Ray, aabb: Aabb): number;
  17873. /**
  17874. !#en ray-obb intersect<br/>
  17875. !#zh 射线和方向包围盒的相交性检测。
  17876. @param ray ray
  17877. @param obb Direction box
  17878. */
  17879. static ray_obb(ray: geomUtils.Ray, obb: geomUtils.Obb): number;
  17880. /**
  17881. !#en aabb-aabb intersect<br/>
  17882. !#zh 轴对齐包围盒和轴对齐包围盒的相交性检测。
  17883. @param aabb1 Axis alignment surrounds box 1
  17884. @param aabb2 Axis alignment surrounds box 2
  17885. */
  17886. static aabb_aabb(aabb1: Aabb, aabb2: Aabb): number;
  17887. /**
  17888. !#en aabb-obb intersect<br/>
  17889. !#zh 轴对齐包围盒和方向包围盒的相交性检测。
  17890. @param aabb Align the axis around the box
  17891. @param obb Direction box
  17892. */
  17893. static aabb_obb(aabb: Aabb, obb: geomUtils.Obb): number;
  17894. /**
  17895. !#en aabb-plane intersect<br/>
  17896. !#zh 轴对齐包围盒和平面的相交性检测。
  17897. @param aabb Align the axis around the box
  17898. @param plane plane
  17899. */
  17900. static aabb_plane(aabb: Aabb, plane: geomUtils.Plane): number;
  17901. /**
  17902. !#en aabb-frustum intersect, faster but has false positive corner cases<br/>
  17903. !#zh 轴对齐包围盒和锥台相交性检测,速度快,但有错误情况。
  17904. @param aabb Align the axis around the box
  17905. @param frustum frustum
  17906. */
  17907. static aabb_frustum(aabb: Aabb, frustum: Frustum): number;
  17908. /**
  17909. !#en aabb-frustum intersect, handles most of the false positives correctly<br/>
  17910. !#zh 轴对齐包围盒和锥台相交性检测,正确处理大多数错误情况。
  17911. @param aabb Align the axis around the box
  17912. @param frustum frustum
  17913. */
  17914. static aabb_frustum_accurate(aabb: Aabb, frustum: Frustum): number;
  17915. /**
  17916. !#en obb-point intersect<br/>
  17917. !#zh 方向包围盒和点的相交性检测。
  17918. @param obb Direction box
  17919. @param point point
  17920. */
  17921. static obb_point(obb: geomUtils.Obb, point: geomUtils.Vec3): boolean;
  17922. /**
  17923. !#en obb-plane intersect<br/>
  17924. !#zh 方向包围盒和平面的相交性检测。
  17925. @param obb Direction box
  17926. @param plane plane
  17927. */
  17928. static obb_plane(obb: geomUtils.Obb, plane: geomUtils.Plane): number;
  17929. /**
  17930. !#en obb-frustum intersect, faster but has false positive corner cases<br/>
  17931. !#zh 方向包围盒和锥台相交性检测,速度快,但有错误情况。
  17932. @param obb Direction box
  17933. @param frustum frustum
  17934. */
  17935. static obb_frustum(obb: geomUtils.Obb, frustum: Frustum): number;
  17936. /**
  17937. !#en obb-frustum intersect, handles most of the false positives correctly<br/>
  17938. !#zh 方向包围盒和锥台相交性检测,正确处理大多数错误情况。
  17939. @param obb Direction box
  17940. @param frustum frustum
  17941. */
  17942. static obb_frustum_accurate(obb: geomUtils.Obb, frustum: Frustum): number;
  17943. /**
  17944. !#en obb-obb intersect<br/>
  17945. !#zh 方向包围盒和方向包围盒的相交性检测。
  17946. @param obb1 Direction box1
  17947. @param obb2 Direction box2
  17948. */
  17949. static obb_obb(obb1: geomUtils.Obb, obb2: geomUtils.Obb): number;
  17950. /**
  17951. !#en phere-plane intersect, not necessarily faster than obb-plane<br/>
  17952. due to the length calculation of the plane normal to factor out<br/>
  17953. the unnomalized plane distance<br/>
  17954. !#zh 球与平面的相交性检测。
  17955. @param sphere sphere
  17956. @param plane plane
  17957. */
  17958. static sphere_plane(sphere: geomUtils.Sphere, plane: geomUtils.Plane): number;
  17959. /**
  17960. !#en sphere-frustum intersect, faster but has false positive corner cases<br/>
  17961. !#zh 球和锥台的相交性检测,速度快,但有错误情况。
  17962. @param sphere sphere
  17963. @param frustum frustum
  17964. */
  17965. static sphere_frustum(sphere: geomUtils.Sphere, frustum: Frustum): number;
  17966. /**
  17967. !#en sphere-frustum intersect, handles the false positives correctly<br/>
  17968. !#zh 球和锥台的相交性检测,正确处理大多数错误情况。
  17969. @param sphere sphere
  17970. @param frustum frustum
  17971. */
  17972. static sphere_frustum_accurate(sphere: geomUtils.Sphere, frustum: Frustum): number;
  17973. /**
  17974. !#en sphere-sphere intersect<br/>
  17975. !#zh 球和球的相交性检测。
  17976. @param sphere0 sphere0
  17977. @param sphere1 sphere1
  17978. */
  17979. static sphere_sphere(sphere0: geomUtils.Sphere, sphere1: geomUtils.Sphere): boolean;
  17980. /**
  17981. !#en sphere-aabb intersect<br/>
  17982. !#zh 球和轴对齐包围盒的相交性检测。
  17983. @param sphere sphere
  17984. @param aabb aabb
  17985. */
  17986. static sphere_aabb(sphere: geomUtils.Sphere, aabb: Aabb): boolean;
  17987. /**
  17988. !#en sphere-obb intersect<br/>
  17989. !#zh 球和方向包围盒的相交性检测。
  17990. @param sphere sphere
  17991. @param obb obb
  17992. */
  17993. static sphere_obb(sphere: geomUtils.Sphere, obb: geomUtils.Obb): boolean;
  17994. /**
  17995. !#en
  17996. The intersection detection of g1 and g2 can fill in the shape in the basic geometry.
  17997. !#zh
  17998. g1 和 g2 的相交性检测,可填入基础几何中的形状。
  17999. @param g1 Geometry 1
  18000. @param g2 Geometry 2
  18001. @param outPt optional, Intersection point. (note: only partial shape detection with this return value)
  18002. */
  18003. static resolve(g1: any, g2: any, outPt: any): void;
  18004. }
  18005. }
  18006. /****************************************************
  18007. * geomUtils
  18008. *****************************************************/
  18009. export namespace geomUtils {
  18010. /** !#en
  18011. line
  18012. !#zh
  18013. 直线 */
  18014. export class Line {
  18015. /**
  18016. !#en
  18017. create a new line
  18018. !#zh
  18019. 创建一个新的 line。
  18020. @param sx The x part of the starting point.
  18021. @param sy The y part of the starting point.
  18022. @param sz The z part of the starting point.
  18023. @param ex The x part of the end point.
  18024. @param ey The y part of the end point.
  18025. @param ez The z part of the end point.
  18026. */
  18027. create(sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  18028. /**
  18029. !#en
  18030. Creates a new line initialized with values from an existing line
  18031. !#zh
  18032. 克隆一个新的 line。
  18033. @param a The source of cloning.
  18034. */
  18035. clone(a: Line): Line;
  18036. /**
  18037. !#en
  18038. Copy the values from one line to another
  18039. !#zh
  18040. 复制一个线的值到另一个。
  18041. @param out The object that accepts the action.
  18042. @param a The source of the copy.
  18043. */
  18044. copy(out: Line, a: Line): Line;
  18045. /**
  18046. !#en
  18047. create a line from two points
  18048. !#zh
  18049. 用两个点创建一个线。
  18050. @param out The object that accepts the action.
  18051. @param start The starting point.
  18052. @param end At the end.
  18053. */
  18054. fromPoints(out: Line, start: Vec3, end: Vec3): Line;
  18055. /**
  18056. !#en
  18057. Set the components of a Vec3 to the given values
  18058. !#zh
  18059. 将给定线的属性设置为给定值。
  18060. @param out The object that accepts the action.
  18061. @param sx The x part of the starting point.
  18062. @param sy The y part of the starting point.
  18063. @param sz The z part of the starting point.
  18064. @param ex The x part of the end point.
  18065. @param ey The y part of the end point.
  18066. @param ez The z part of the end point.
  18067. */
  18068. set(out: Line, sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  18069. /**
  18070. !#en
  18071. Calculate the length of the line.
  18072. !#zh
  18073. 计算线的长度。
  18074. @param a The line to calculate.
  18075. */
  18076. len(a: Line): number;
  18077. /** !#en
  18078. Start points.
  18079. !#zh
  18080. 起点。 */
  18081. s: Vec3;
  18082. /** !#en
  18083. End points.
  18084. !#zh
  18085. 终点。 */
  18086. e: Vec3;
  18087. /**
  18088. !#en
  18089. Calculate the length of the line.
  18090. !#zh
  18091. 计算线的长度。
  18092. */
  18093. length(): number;
  18094. }
  18095. }
  18096. /****************************************************
  18097. * geomUtils
  18098. *****************************************************/
  18099. export namespace geomUtils {
  18100. /** !#en obb
  18101. !#zh
  18102. 基础几何 方向包围盒。 */
  18103. export class Obb {
  18104. /** !#zh
  18105. 获取形状的类型。 */
  18106. type: number;
  18107. /**
  18108. !#en
  18109. create a new obb
  18110. !#zh
  18111. 创建一个新的 obb 实例。
  18112. @param cx X coordinates of the shape relative to the origin.
  18113. @param cy Y coordinates of the shape relative to the origin.
  18114. @param cz Z coordinates of the shape relative to the origin.
  18115. @param hw Obb is half the width.
  18116. @param hh Obb is half the height.
  18117. @param hl Obb is half the Length.
  18118. @param ox_1 Direction matrix parameter.
  18119. @param ox_2 Direction matrix parameter.
  18120. @param ox_3 Direction matrix parameter.
  18121. @param oy_1 Direction matrix parameter.
  18122. @param oy_2 Direction matrix parameter.
  18123. @param oy_3 Direction matrix parameter.
  18124. @param oz_1 Direction matrix parameter.
  18125. @param oz_2 Direction matrix parameter.
  18126. @param oz_3 Direction matrix parameter.
  18127. */
  18128. create(cx: number, cy: number, cz: number, hw: number, hh: number, hl: number, ox_1: number, ox_2: number, ox_3: number, oy_1: number, oy_2: number, oy_3: number, oz_1: number, oz_2: number, oz_3: number): Obb;
  18129. /**
  18130. !#en
  18131. clone a new obb
  18132. !#zh
  18133. 克隆一个 obb。
  18134. @param a The target of cloning.
  18135. */
  18136. clone(a: Obb): Obb;
  18137. /**
  18138. !#en
  18139. copy the values from one obb to another
  18140. !#zh
  18141. 将从一个 obb 的值复制到另一个 obb。
  18142. @param out Obb that accepts the operation.
  18143. @param a Obb being copied.
  18144. */
  18145. copy(out: Obb, a: Obb): Obb;
  18146. /**
  18147. !#en
  18148. create a new obb from two corner points
  18149. !#zh
  18150. 用两个点创建一个新的 obb。
  18151. @param out Obb that accepts the operation.
  18152. @param minPos The smallest point of obb.
  18153. @param maxPos Obb's maximum point.
  18154. */
  18155. fromPoints(out: Obb, minPos: Vec3, maxPos: Vec3): Obb;
  18156. /**
  18157. !#en
  18158. Set the components of a obb to the given values
  18159. !#zh
  18160. 将给定 obb 的属性设置为给定的值。
  18161. @param cx X coordinates of the shape relative to the origin.
  18162. @param cy Y coordinates of the shape relative to the origin.
  18163. @param cz Z coordinates of the shape relative to the origin.
  18164. @param hw Obb is half the width.
  18165. @param hh Obb is half the height.
  18166. @param hl Obb is half the Length.
  18167. @param ox_1 Direction matrix parameter.
  18168. @param ox_2 Direction matrix parameter.
  18169. @param ox_3 Direction matrix parameter.
  18170. @param oy_1 Direction matrix parameter.
  18171. @param oy_2 Direction matrix parameter.
  18172. @param oy_3 Direction matrix parameter.
  18173. @param oz_1 Direction matrix parameter.
  18174. @param oz_2 Direction matrix parameter.
  18175. @param oz_3 Direction matrix parameter.
  18176. */
  18177. set(cx: number, cy: number, cz: number, hw: number, hh: number, hl: number, ox_1: number, ox_2: number, ox_3: number, oy_1: number, oy_2: number, oy_3: number, oz_1: number, oz_2: number, oz_3: number): Obb;
  18178. /** !#en
  18179. The center of the local coordinate.
  18180. !#zh
  18181. 本地坐标的中心点。 */
  18182. center: Vec3;
  18183. /** !#en
  18184. Half the length, width, and height.
  18185. !#zh
  18186. 长宽高的一半。 */
  18187. halfExtents: Vec3;
  18188. /** !#en
  18189. Direction matrix.
  18190. !#zh
  18191. 方向矩阵。 */
  18192. orientation: Mat3;
  18193. /**
  18194. !#en
  18195. Get the bounding points of this shape
  18196. !#zh
  18197. 获取 obb 的最小点和最大点。
  18198. @param minPos minPos
  18199. @param maxPos maxPos
  18200. */
  18201. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  18202. /**
  18203. !#en Transform this shape
  18204. !#zh
  18205. 将 out 根据这个 obb 的数据进行变换。
  18206. @param m The transformation matrix.
  18207. @param pos The position part of the transformation.
  18208. @param rot The rotating part of the transformation.
  18209. @param scale The scaling part of the transformation.
  18210. @param out Target of transformation.
  18211. */
  18212. transform(m: Mat4, pos: Vec3, rot: Quat, scale: Vec3, out: Obb): void;
  18213. /**
  18214. !#en
  18215. Transform out based on this obb data.
  18216. !#zh
  18217. 将 out 根据这个 obb 的数据进行变换。
  18218. @param m The transformation matrix.
  18219. @param rot The rotating part of the transformation.
  18220. @param out Target of transformation.
  18221. */
  18222. translateAndRotate(m: Mat4, rot: Quat, out: Obb): void;
  18223. /**
  18224. !#en
  18225. Scale out based on this obb data.
  18226. !#zh
  18227. 将 out 根据这个 obb 的数据进行缩放。
  18228. @param scale Scale value.
  18229. @param out Scaled target.
  18230. */
  18231. setScale(scale: Vec3, out: Obb): void;
  18232. }
  18233. }
  18234. /****************************************************
  18235. * geomUtils
  18236. *****************************************************/
  18237. export namespace geomUtils {
  18238. /** !#en
  18239. plane。
  18240. !#zh
  18241. 平面。 */
  18242. export class Plane {
  18243. /**
  18244. !#en
  18245. create a new plane
  18246. !#zh
  18247. 创建一个新的 plane。
  18248. @param nx The x part of the normal component.
  18249. @param ny The y part of the normal component.
  18250. @param nz The z part of the normal component.
  18251. @param d Distance from the origin.
  18252. */
  18253. create(nx: number, ny: number, nz: number, d: number): Plane;
  18254. /**
  18255. !#en
  18256. clone a new plane
  18257. !#zh
  18258. 克隆一个新的 plane。
  18259. @param p The source of cloning.
  18260. */
  18261. clone(p: Plane): Plane;
  18262. /**
  18263. !#en
  18264. copy the values from one plane to another
  18265. !#zh
  18266. 复制一个平面的值到另一个。
  18267. @param out The object that accepts the action.
  18268. @param p The source of the copy.
  18269. */
  18270. copy(out: Plane, p: Plane): Plane;
  18271. /**
  18272. !#en
  18273. create a plane from three points
  18274. !#zh
  18275. 用三个点创建一个平面。
  18276. @param out The object that accepts the action.
  18277. @param a Point a。
  18278. @param b Point b。
  18279. @param c Point c。
  18280. */
  18281. fromPoints(out: Plane, a: Vec3, b: Vec3, c: Vec3): Plane;
  18282. /**
  18283. !#en
  18284. Set the components of a plane to the given values
  18285. !#zh
  18286. 将给定平面的属性设置为给定值。
  18287. @param out The object that accepts the action.
  18288. @param nx The x part of the normal component.
  18289. @param ny The y part of the normal component.
  18290. @param nz The z part of the normal component.
  18291. @param d Distance from the origin.
  18292. */
  18293. set(out: Plane, nx: number, ny: number, nz: number, d: number): Plane;
  18294. /**
  18295. !#en
  18296. create plane from normal and point
  18297. !#zh
  18298. 用一条法线和一个点创建平面。
  18299. @param out The object that accepts the action.
  18300. @param normal The normal of a plane.
  18301. @param point A point on the plane.
  18302. */
  18303. fromNormalAndPoint(out: Plane, normal: Vec3, point: Vec3): Plane;
  18304. /**
  18305. !#en
  18306. normalize a plane
  18307. !#zh
  18308. 归一化一个平面。
  18309. @param out The object that accepts the action.
  18310. @param a Source data for operations.
  18311. */
  18312. normalize(out: Plane, a: Plane): Plane;
  18313. /** !#en
  18314. A normal vector.
  18315. !#zh
  18316. 法线向量。 */
  18317. n: Vec3;
  18318. /** !#en
  18319. The distance from the origin to the plane.
  18320. !#zh
  18321. 原点到平面的距离。 */
  18322. d: number;
  18323. /**
  18324. !#en
  18325. Transform a plane.
  18326. !#zh
  18327. 变换一个平面。
  18328. @param mat mat
  18329. */
  18330. transform(mat: Mat4): void;
  18331. }
  18332. }
  18333. /****************************************************
  18334. * geomUtils
  18335. *****************************************************/
  18336. export namespace geomUtils {
  18337. /** !#en
  18338. ray
  18339. !#zh
  18340. 射线。 */
  18341. export class Ray {
  18342. /**
  18343. !#en
  18344. create a new ray
  18345. !#zh
  18346. 创建一条射线。
  18347. @param ox The x part of the starting point.
  18348. @param oy The y part of the starting point.
  18349. @param oz The z part of the starting point.
  18350. @param dx X in the direction.
  18351. @param dy Y in the direction.
  18352. @param dz Z in the direction.
  18353. */
  18354. create(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18355. /**
  18356. !#en
  18357. Creates a new ray initialized with values from an existing ray
  18358. !#zh
  18359. 从一条射线克隆出一条新的射线。
  18360. @param a Clone target
  18361. */
  18362. clone(a: Ray): Ray;
  18363. /**
  18364. !#en
  18365. Copy the values from one ray to another
  18366. !#zh
  18367. 将从一个 ray 的值复制到另一个 ray。
  18368. @param out Accept the ray of the operation.
  18369. @param a Copied ray.
  18370. */
  18371. copy(out: Ray, a: Ray): Ray;
  18372. /**
  18373. !#en
  18374. create a ray from two points
  18375. !#zh
  18376. 用两个点创建一条射线。
  18377. @param out Receive the operating ray.
  18378. @param origin Origin of ray
  18379. @param target A point on a ray.
  18380. */
  18381. fromPoints(out: Ray, origin: Vec3, target: Vec3): Ray;
  18382. /**
  18383. !#en
  18384. Set the components of a ray to the given values
  18385. !#zh
  18386. 将给定射线的属性设置为给定的值。
  18387. @param out Receive the operating ray.
  18388. @param ox The x part of the starting point.
  18389. @param oy The y part of the starting point.
  18390. @param oz The z part of the starting point.
  18391. @param dx X in the direction.
  18392. @param dy Y in the direction.
  18393. @param dz Z in the direction.
  18394. */
  18395. set(out: Ray, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18396. /** !#en
  18397. Start point.
  18398. !#zh
  18399. 起点。 */
  18400. o: Vec3;
  18401. /** !#e
  18402. Direction
  18403. !#zh
  18404. 方向。 */
  18405. d: Vec3;
  18406. /**
  18407. !#en Compute hit.
  18408. @param out out
  18409. @param distance distance
  18410. */
  18411. computeHit(out: IVec3Like, distance: number): void;
  18412. }
  18413. }
  18414. /****************************************************
  18415. * geomUtils
  18416. *****************************************************/
  18417. export namespace geomUtils {
  18418. /** !#en
  18419. Sphere.
  18420. !#zh
  18421. 轴对齐球。 */
  18422. export class Sphere {
  18423. /**
  18424. !#en
  18425. create a new sphere
  18426. !#zh
  18427. 创建一个新的 sphere 实例。
  18428. @param cx X coordinates of the shape relative to the origin.
  18429. @param cy Y coordinates of the shape relative to the origin.
  18430. @param cz Z coordinates of the shape relative to the origin.
  18431. @param r Radius of sphere
  18432. */
  18433. create(cx: any, cy: any, cz: any, r: any): Sphere;
  18434. /**
  18435. !#en
  18436. clone a new sphere
  18437. !#zh
  18438. 克隆一个新的 sphere 实例。
  18439. @param p The target of cloning.
  18440. */
  18441. clone(p: Sphere): Sphere;
  18442. /**
  18443. !#en
  18444. copy the values from one sphere to another
  18445. !#zh
  18446. 将从一个 sphere 的值复制到另一个 sphere。
  18447. @param out Accept the sphere of operations.
  18448. @param a Sphere being copied.
  18449. */
  18450. copy(out: Sphere, a: Sphere): Sphere;
  18451. /**
  18452. !#en
  18453. create a new bounding sphere from two corner points
  18454. !#zh
  18455. 从两个点创建一个新的 sphere。
  18456. @param out Accept the sphere of operations.
  18457. @param minPos The smallest point of sphere.
  18458. @param maxPos The maximum point of sphere.
  18459. */
  18460. fromPoints(out: any, minPos: any, maxPos: any): Sphere;
  18461. /**
  18462. !#en Set the components of a sphere to the given values
  18463. !#zh 将球体的属性设置为给定的值。
  18464. @param out Accept the sphere of operations.
  18465. @param cx X coordinates of the shape relative to the origin.
  18466. @param cy Y coordinates of the shape relative to the origin.
  18467. @param cz Z coordinates of the shape relative to the origin.
  18468. @param r Radius.
  18469. */
  18470. set(out: Sphere, cx: any, cy: any, cz: any, r: number): Sphere;
  18471. /** !#en
  18472. The center of the local coordinate.
  18473. !#zh
  18474. 本地坐标的中心点。 */
  18475. center: Vec3;
  18476. /** !#zh
  18477. 半径。 */
  18478. radius: number;
  18479. /**
  18480. !#en
  18481. Clone.
  18482. !#zh
  18483. 获得克隆。
  18484. */
  18485. clone(): void;
  18486. /**
  18487. !#en
  18488. Copy sphere
  18489. !#zh
  18490. 拷贝对象。
  18491. @param a Copy target.
  18492. */
  18493. copy(a: any): void;
  18494. /**
  18495. !#en
  18496. Get the bounding points of this shape
  18497. !#zh
  18498. 获取此形状的边界点。
  18499. @param minPos minPos
  18500. @param maxPos maxPos
  18501. */
  18502. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  18503. /**
  18504. !#en
  18505. Transform this shape
  18506. !#zh
  18507. 将 out 根据这个 sphere 的数据进行变换。
  18508. @param m The transformation matrix.
  18509. @param pos The position part of the transformation.
  18510. @param rot The rotating part of the transformation.
  18511. @param scale The scaling part of the transformation.
  18512. @param out The target of the transformation.
  18513. */
  18514. transform(m: any, pos: any, rot: any, scale: any, out: any): void;
  18515. /**
  18516. !#en
  18517. Scale out based on the sphere data.
  18518. !#zh
  18519. 将 out 根据这个 sphere 的数据进行缩放。
  18520. @param scale Scale value
  18521. @param out Scale target
  18522. */
  18523. setScale(scale: any, out: any): void;
  18524. }
  18525. }
  18526. /****************************************************
  18527. * geomUtils
  18528. *****************************************************/
  18529. export namespace geomUtils {
  18530. /** Triangle */
  18531. export class Triangle {
  18532. /**
  18533. create a new triangle
  18534. @param ax ax
  18535. @param ay ay
  18536. @param az az
  18537. @param bx bx
  18538. @param by by
  18539. @param bz bz
  18540. @param cx cx
  18541. @param cy cy
  18542. @param cz cz
  18543. */
  18544. create(ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Triangle;
  18545. /**
  18546. clone a new triangle
  18547. @param t the source plane
  18548. */
  18549. clone(t: Triangle): Triangle;
  18550. /**
  18551. copy the values from one triangle to another
  18552. @param out the receiving triangle
  18553. @param t the source triangle
  18554. */
  18555. copy(out: Triangle, t: Triangle): Triangle;
  18556. /**
  18557. Create a triangle from three points
  18558. @param out the receiving triangle
  18559. @param a a
  18560. @param b b
  18561. @param c c
  18562. */
  18563. fromPoints(out: Triangle, a: Vec3, b: Vec3, c: Vec3): Triangle;
  18564. /**
  18565. Set the components of a triangle to the given values
  18566. @param out the receiving plane
  18567. @param ax X component of a
  18568. @param ay Y component of a
  18569. @param az Z component of a
  18570. @param bx X component of b
  18571. @param by Y component of b
  18572. @param bz Z component of b
  18573. @param cx X component of c
  18574. @param cy Y component of c
  18575. @param cz Z component of c
  18576. */
  18577. set(out: Triangle, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Plane;
  18578. a: Vec3;
  18579. b: Vec3;
  18580. c: Vec3;
  18581. }
  18582. }
  18583. /****************************************************
  18584. * Graphics
  18585. *****************************************************/
  18586. export namespace Graphics {
  18587. /** !#en Enum for LineCap.
  18588. !#zh 线段末端属性 */
  18589. export enum LineCap {
  18590. BUTT = 0,
  18591. ROUND = 0,
  18592. SQUARE = 0,
  18593. }
  18594. }
  18595. /****************************************************
  18596. * Graphics
  18597. *****************************************************/
  18598. export namespace Graphics {
  18599. /** !#en Enum for LineJoin.
  18600. !#zh 线段拐角属性 */
  18601. export enum LineJoin {
  18602. BEVEL = 0,
  18603. ROUND = 0,
  18604. MITER = 0,
  18605. }
  18606. }
  18607. /****************************************************
  18608. * PhysicsManager
  18609. *****************************************************/
  18610. export namespace PhysicsManager {
  18611. /** !#en
  18612. The draw bits for drawing physics debug information.<br>
  18613. example:<br>
  18614. ```js
  18615. cc.director.getPhysicsManager().debugDrawFlags =
  18616. // cc.PhysicsManager.DrawBits.e_aabbBit |
  18617. // cc.PhysicsManager.DrawBits.e_pairBit |
  18618. // cc.PhysicsManager.DrawBits.e_centerOfMassBit |
  18619. cc.PhysicsManager.DrawBits.e_jointBit |
  18620. cc.PhysicsManager.DrawBits.e_shapeBit;
  18621. ```
  18622. !#zh
  18623. 指定物理系统需要绘制哪些调试信息。<br>
  18624. example:<br>
  18625. ```js
  18626. cc.director.getPhysicsManager().debugDrawFlags =
  18627. // cc.PhysicsManager.DrawBits.e_aabbBit |
  18628. // cc.PhysicsManager.DrawBits.e_pairBit |
  18629. // cc.PhysicsManager.DrawBits.e_centerOfMassBit |
  18630. cc.PhysicsManager.DrawBits.e_jointBit |
  18631. cc.PhysicsManager.DrawBits.e_shapeBit;
  18632. ``` */
  18633. export enum DrawBits {
  18634. e_aabbBit = 0,
  18635. e_jointBit = 0,
  18636. e_shapeBit = 0,
  18637. }
  18638. }
  18639. /****************************************************
  18640. * MeshRenderer
  18641. *****************************************************/
  18642. export namespace MeshRenderer {
  18643. /** !#en Shadow projection mode
  18644. !#ch 阴影投射方式 */
  18645. export enum ShadowCastingMode {
  18646. OFF = 0,
  18647. ON = 0,
  18648. }
  18649. }
  18650. /****************************************************
  18651. * macro
  18652. *****************************************************/
  18653. export namespace macro {
  18654. /** !#en Key map for keyboard event
  18655. !#zh 键盘事件的按键值 */
  18656. export enum KEY {
  18657. none = 0,
  18658. back = 0,
  18659. menu = 0,
  18660. backspace = 0,
  18661. tab = 0,
  18662. enter = 0,
  18663. shift = 0,
  18664. ctrl = 0,
  18665. alt = 0,
  18666. pause = 0,
  18667. capslock = 0,
  18668. escape = 0,
  18669. space = 0,
  18670. pageup = 0,
  18671. pagedown = 0,
  18672. end = 0,
  18673. home = 0,
  18674. left = 0,
  18675. up = 0,
  18676. right = 0,
  18677. down = 0,
  18678. select = 0,
  18679. insert = 0,
  18680. Delete = 0,
  18681. a = 0,
  18682. b = 0,
  18683. c = 0,
  18684. d = 0,
  18685. e = 0,
  18686. f = 0,
  18687. g = 0,
  18688. h = 0,
  18689. i = 0,
  18690. j = 0,
  18691. k = 0,
  18692. l = 0,
  18693. m = 0,
  18694. n = 0,
  18695. o = 0,
  18696. p = 0,
  18697. q = 0,
  18698. r = 0,
  18699. s = 0,
  18700. t = 0,
  18701. u = 0,
  18702. v = 0,
  18703. w = 0,
  18704. x = 0,
  18705. y = 0,
  18706. z = 0,
  18707. num0 = 0,
  18708. num1 = 0,
  18709. num2 = 0,
  18710. num3 = 0,
  18711. num4 = 0,
  18712. num5 = 0,
  18713. num6 = 0,
  18714. num7 = 0,
  18715. num8 = 0,
  18716. num9 = 0,
  18717. '*' = 0,
  18718. '+' = 0,
  18719. '-' = 0,
  18720. numdel = 0,
  18721. '/' = 0,
  18722. f1 = 0,
  18723. f2 = 0,
  18724. f3 = 0,
  18725. f4 = 0,
  18726. f5 = 0,
  18727. f6 = 0,
  18728. f7 = 0,
  18729. f8 = 0,
  18730. f9 = 0,
  18731. f10 = 0,
  18732. f11 = 0,
  18733. f12 = 0,
  18734. numlock = 0,
  18735. scrolllock = 0,
  18736. ';' = 0,
  18737. semicolon = 0,
  18738. equal = 0,
  18739. '=' = 0,
  18740. ',' = 0,
  18741. comma = 0,
  18742. dash = 0,
  18743. '.' = 0,
  18744. period = 0,
  18745. forwardslash = 0,
  18746. grave = 0,
  18747. '[' = 0,
  18748. openbracket = 0,
  18749. backslash = 0,
  18750. ']' = 0,
  18751. closebracket = 0,
  18752. quote = 0,
  18753. dpadLeft = 0,
  18754. dpadRight = 0,
  18755. dpadUp = 0,
  18756. dpadDown = 0,
  18757. dpadCenter = 0,
  18758. }
  18759. }
  18760. /****************************************************
  18761. * macro
  18762. *****************************************************/
  18763. export namespace macro {
  18764. /** Image formats */
  18765. export enum ImageFormat {
  18766. JPG = 0,
  18767. PNG = 0,
  18768. TIFF = 0,
  18769. WEBP = 0,
  18770. PVR = 0,
  18771. ETC = 0,
  18772. S3TC = 0,
  18773. ATITC = 0,
  18774. TGA = 0,
  18775. RAWDATA = 0,
  18776. UNKNOWN = 0,
  18777. }
  18778. }
  18779. /****************************************************
  18780. * macro
  18781. *****************************************************/
  18782. export namespace macro {
  18783. /** !#en
  18784. Enum for blend factor
  18785. Refer to: http://www.andersriggelsen.dk/glblendfunc.php
  18786. !#zh
  18787. 混合因子
  18788. 可参考: http://www.andersriggelsen.dk/glblendfunc.php */
  18789. export enum BlendFactor {
  18790. ONE = 0,
  18791. ZERO = 0,
  18792. SRC_ALPHA = 0,
  18793. SRC_COLOR = 0,
  18794. DST_ALPHA = 0,
  18795. DST_COLOR = 0,
  18796. ONE_MINUS_SRC_ALPHA = 0,
  18797. ONE_MINUS_SRC_COLOR = 0,
  18798. ONE_MINUS_DST_ALPHA = 0,
  18799. ONE_MINUS_DST_COLOR = 0,
  18800. }
  18801. }
  18802. /****************************************************
  18803. * macro
  18804. *****************************************************/
  18805. export namespace macro {
  18806. /** undefined */
  18807. export enum TextAlignment {
  18808. LEFT = 0,
  18809. CENTER = 0,
  18810. RIGHT = 0,
  18811. }
  18812. }
  18813. /****************************************************
  18814. * sys
  18815. *****************************************************/
  18816. export namespace sys {
  18817. /** !#en
  18818. Network type enumeration
  18819. !#zh
  18820. 网络类型枚举 */
  18821. export enum NetworkType {
  18822. NONE = 0,
  18823. LAN = 0,
  18824. WWAN = 0,
  18825. }
  18826. }
  18827. /****************************************************
  18828. * AnimationCurve
  18829. *****************************************************/
  18830. export namespace AnimationCurve {
  18831. /** !#en The wrap mode
  18832. !#zh 循环模式 */
  18833. export enum WrapMode {
  18834. Default = 0,
  18835. Once = 0,
  18836. Loop = 0,
  18837. PingPong = 0,
  18838. ClampForever = 0,
  18839. time = 0,
  18840. value = 0,
  18841. inTangent = 0,
  18842. outTangent = 0,
  18843. }
  18844. }
  18845. /****************************************************
  18846. * ParticleSystem3DAssembler
  18847. *****************************************************/
  18848. export namespace ParticleSystem3DAssembler {
  18849. /** undefined */
  18850. export enum Space {
  18851. }
  18852. }
  18853. /****************************************************
  18854. * ParticleSystem3DAssembler
  18855. *****************************************************/
  18856. export namespace ParticleSystem3DAssembler {
  18857. /** 粒子的生成模式 */
  18858. export enum RenderMode {
  18859. }
  18860. }
  18861. /****************************************************
  18862. * shapeModule
  18863. *****************************************************/
  18864. export namespace shapeModule {
  18865. /** 粒子发射器类型 */
  18866. export enum ShapeType {
  18867. Box = 0,
  18868. Circle = 0,
  18869. Cone = 0,
  18870. Sphere = 0,
  18871. Hemisphere = 0,
  18872. }
  18873. }
  18874. /****************************************************
  18875. * shapeModule
  18876. *****************************************************/
  18877. export namespace shapeModule {
  18878. /** 粒子从发射器的哪个部位发射 */
  18879. export enum EmitLocation {
  18880. Base = 0,
  18881. Edge = 0,
  18882. Shell = 0,
  18883. Volume = 0,
  18884. }
  18885. }
  18886. /****************************************************
  18887. * shapeModule
  18888. *****************************************************/
  18889. export namespace shapeModule {
  18890. /** 粒子在扇形区域的发射方式 */
  18891. export enum ArcMode {
  18892. Random = 0,
  18893. Loop = 0,
  18894. PingPong = 0,
  18895. }
  18896. }
  18897. /****************************************************
  18898. * trailModule
  18899. *****************************************************/
  18900. export namespace trailModule {
  18901. /** 选择如何为粒子系统生成轨迹 */
  18902. export enum TrailMode {
  18903. }
  18904. }
  18905. /****************************************************
  18906. * trailModule
  18907. *****************************************************/
  18908. export namespace trailModule {
  18909. /** 纹理填充模式 */
  18910. export enum TextureMode {
  18911. }
  18912. }
  18913. /****************************************************
  18914. * primitive
  18915. *****************************************************/
  18916. export namespace primitive {
  18917. /** undefined */
  18918. export enum PolyhedronType {
  18919. Tetrahedron = 0,
  18920. Octahedron = 0,
  18921. Dodecahedron = 0,
  18922. Icosahedron = 0,
  18923. Rhombicuboctahedron = 0,
  18924. TriangularPrism = 0,
  18925. PentagonalPrism = 0,
  18926. HexagonalPrism = 0,
  18927. SquarePyramid = 0,
  18928. PentagonalPyramid = 0,
  18929. TriangularDipyramid = 0,
  18930. PentagonalDipyramid = 0,
  18931. ElongatedSquareDipyramid = 0,
  18932. ElongatedPentagonalDipyramid = 0,
  18933. ElongatedPentagonalCupola = 0,
  18934. }
  18935. }
  18936. /****************************************************
  18937. * primitive
  18938. *****************************************************/
  18939. export namespace primitive {
  18940. /** undefined */
  18941. export class VertexData {
  18942. positions: number[];
  18943. normals: number[];
  18944. uvs: number[];
  18945. indices: number[];
  18946. minPos: Vec3;
  18947. maxPos: Vec3;
  18948. boundingRadius: number;
  18949. }
  18950. }
  18951. /****************************************************
  18952. * Material
  18953. *****************************************************/
  18954. export namespace Material {
  18955. /** !#en Material builtin name
  18956. !#zh 内置材质名字 */
  18957. export enum BUILTIN_NAME {
  18958. SPRITE = 0,
  18959. GRAY_SPRITE = 0,
  18960. UNLIT = 0,
  18961. }
  18962. }
  18963. /****************************************************
  18964. * EditBox
  18965. *****************************************************/
  18966. export namespace EditBox {
  18967. /** !#en Enum for keyboard return types
  18968. !#zh 键盘的返回键类型 */
  18969. export enum KeyboardReturnType {
  18970. DEFAULT = 0,
  18971. DONE = 0,
  18972. SEND = 0,
  18973. SEARCH = 0,
  18974. GO = 0,
  18975. NEXT = 0,
  18976. }
  18977. }
  18978. /****************************************************
  18979. * EditBox
  18980. *****************************************************/
  18981. export namespace EditBox {
  18982. /** !#en The EditBox's InputMode defines the type of text that the user is allowed to enter.
  18983. !#zh 输入模式 */
  18984. export enum InputMode {
  18985. ANY = 0,
  18986. EMAIL_ADDR = 0,
  18987. NUMERIC = 0,
  18988. PHONE_NUMBER = 0,
  18989. URL = 0,
  18990. DECIMAL = 0,
  18991. SINGLE_LINE = 0,
  18992. }
  18993. }
  18994. /****************************************************
  18995. * EditBox
  18996. *****************************************************/
  18997. export namespace EditBox {
  18998. /** !#en Enum for the EditBox's input flags
  18999. !#zh 定义了一些用于设置文本显示和文本格式化的标志位。 */
  19000. export enum InputFlag {
  19001. PASSWORD = 0,
  19002. SENSITIVE = 0,
  19003. INITIAL_CAPS_WORD = 0,
  19004. INITIAL_CAPS_SENTENCE = 0,
  19005. INITIAL_CAPS_ALL_CHARACTERS = 0,
  19006. DEFAULT = 0,
  19007. }
  19008. }
  19009. /****************************************************
  19010. * textureAnimationModule
  19011. *****************************************************/
  19012. export namespace textureAnimationModule {
  19013. /** 粒子贴图动画类型 */
  19014. export enum Mode {
  19015. }
  19016. }
  19017. /****************************************************
  19018. * textureAnimationModule
  19019. *****************************************************/
  19020. export namespace textureAnimationModule {
  19021. /** 贴图动画的播放方式 */
  19022. export enum Animation {
  19023. }
  19024. }
  19025. }
  19026. /** !#en
  19027. The global main namespace of Spine, all classes, functions,
  19028. properties and constants of Spine are defined in this namespace
  19029. !#zh
  19030. Spine 的全局的命名空间,
  19031. 与 Spine 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  19032. declare namespace sp {
  19033. /** !#en
  19034. The skeleton of Spine <br/>
  19035. <br/>
  19036. (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
  19037. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  19038. Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>
  19039. !#zh
  19040. Spine 骨骼动画 <br/>
  19041. <br/>
  19042. (Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  19043. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  19044. 多个 Skeleton 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。 */
  19045. export class Skeleton extends cc.RenderComponent {
  19046. /** !#en The skeletal animation is paused?
  19047. !#zh 该骨骼动画是否暂停。 */
  19048. paused: boolean;
  19049. /** !#en
  19050. The skeleton data contains the skeleton information (bind pose bones, slots, draw order,
  19051. attachments, skins, etc) and animations but does not hold any state.<br/>
  19052. Multiple skeletons can share the same skeleton data.
  19053. !#zh
  19054. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  19055. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  19056. 多个 Skeleton 可以共用相同的骨骼数据。 */
  19057. skeletonData: SkeletonData;
  19058. /** !#en The name of default skin.
  19059. !#zh 默认的皮肤名称。 */
  19060. defaultSkin: string;
  19061. /** !#en The name of default animation.
  19062. !#zh 默认的动画名称。 */
  19063. defaultAnimation: string;
  19064. /** !#en The name of current playing animation.
  19065. !#zh 当前播放的动画名称。 */
  19066. animation: string;
  19067. _defaultSkinIndex: number;
  19068. /** !#en TODO
  19069. !#zh 是否循环播放当前骨骼动画。 */
  19070. loop: boolean;
  19071. /** !#en Indicates whether to enable premultiplied alpha.
  19072. You should disable this option when image's transparent area appears to have opaque pixels,
  19073. or enable this option when image's half transparent area appears to be darken.
  19074. !#zh 是否启用贴图预乘。
  19075. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  19076. premultipliedAlpha: boolean;
  19077. /** !#en The time scale of this skeleton.
  19078. !#zh 当前骨骼中所有动画的时间缩放率。 */
  19079. timeScale: number;
  19080. /** !#en Indicates whether open debug slots.
  19081. !#zh 是否显示 slot 的 debug 信息。 */
  19082. debugSlots: boolean;
  19083. /** !#en Indicates whether open debug bones.
  19084. !#zh 是否显示 bone 的 debug 信息。 */
  19085. debugBones: boolean;
  19086. /** !#en Indicates whether open debug mesh.
  19087. !#zh 是否显示 mesh 的 debug 信息。 */
  19088. debugMesh: boolean;
  19089. /** !#en Enabled two color tint.
  19090. !#zh 是否启用染色效果。 */
  19091. useTint: boolean;
  19092. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  19093. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  19094. enableBatch: boolean;
  19095. /**
  19096. !#en
  19097. Sets runtime skeleton data to sp.Skeleton.<br>
  19098. This method is different from the `skeletonData` property. This method is passed in the raw data provided by the Spine runtime, and the skeletonData type is the asset type provided by Creator.
  19099. !#zh
  19100. 设置底层运行时用到的 SkeletonData。<br>
  19101. 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
  19102. @param skeletonData skeletonData
  19103. */
  19104. setSkeletonData(skeletonData: sp.spine.SkeletonData): void;
  19105. /**
  19106. !#en Sets slots visible range.
  19107. !#zh 设置骨骼插槽可视范围。
  19108. @param startSlotIndex startSlotIndex
  19109. @param endSlotIndex endSlotIndex
  19110. */
  19111. setSlotsRange(startSlotIndex: number, endSlotIndex: number): void;
  19112. /**
  19113. !#en Sets animation state data.<br>
  19114. The parameter type is {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData.
  19115. !#zh 设置动画状态数据。<br>
  19116. 参数是 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData。
  19117. @param stateData stateData
  19118. */
  19119. setAnimationStateData(stateData: sp.spine.AnimationStateData): void;
  19120. /**
  19121. !#en
  19122. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  19123. If set the mode in editor, then no need to worry about order problem.
  19124. !#zh
  19125. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  19126. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  19127. @param cacheMode cacheMode
  19128. @example
  19129. ```js
  19130. skeleton.setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.SHARED_CACHE);
  19131. ```
  19132. */
  19133. setAnimationCacheMode(cacheMode: Skeleton.AnimationCacheMode): void;
  19134. /**
  19135. !#en Whether in cached mode.
  19136. !#zh 当前是否处于缓存模式。
  19137. */
  19138. isAnimationCached(): boolean;
  19139. /**
  19140. !#en Sets vertex effect delegate.
  19141. !#zh 设置顶点动画代理
  19142. @param effectDelegate effectDelegate
  19143. */
  19144. setVertexEffectDelegate(effectDelegate: VertexEffectDelegate): void;
  19145. /**
  19146. !#en Computes the world SRT from the local SRT for each bone.
  19147. !#zh 重新更新所有骨骼的世界 Transform,
  19148. 当获取 bone 的数值未更新时,即可使用该函数进行更新数值。
  19149. @example
  19150. ```js
  19151. var bone = spine.findBone('head');
  19152. cc.log(bone.worldX); // return 0;
  19153. spine.updateWorldTransform();
  19154. bone = spine.findBone('head');
  19155. cc.log(bone.worldX); // return -23.12;
  19156. ```
  19157. */
  19158. updateWorldTransform(): void;
  19159. /**
  19160. !#en Sets the bones and slots to the setup pose.
  19161. !#zh 还原到起始动作
  19162. */
  19163. setToSetupPose(): void;
  19164. /**
  19165. !#en
  19166. Sets the bones to the setup pose,
  19167. using the values from the `BoneData` list in the `SkeletonData`.
  19168. !#zh
  19169. 设置 bone 到起始动作
  19170. 使用 SkeletonData 中的 BoneData 列表中的值。
  19171. */
  19172. setBonesToSetupPose(): void;
  19173. /**
  19174. !#en
  19175. Sets the slots to the setup pose,
  19176. using the values from the `SlotData` list in the `SkeletonData`.
  19177. !#zh
  19178. 设置 slot 到起始动作。
  19179. 使用 SkeletonData 中的 SlotData 列表中的值。
  19180. */
  19181. setSlotsToSetupPose(): void;
  19182. /**
  19183. !#en
  19184. Updating an animation cache to calculate all frame data in the animation is a cost in
  19185. performance due to calculating all data in a single frame.
  19186. To update the cache, use the invalidAnimationCache method with high performance.
  19187. !#zh
  19188. 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  19189. 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  19190. @param animName animName
  19191. */
  19192. updateAnimationCache(animName: string): void;
  19193. /**
  19194. !#en
  19195. Invalidates the animation cache, which is then recomputed on each frame..
  19196. !#zh
  19197. 使动画缓存失效,之后会在每帧重新计算。
  19198. */
  19199. invalidAnimationCache(): void;
  19200. /**
  19201. !#en
  19202. Finds a bone by name.
  19203. This does a string comparison for every bone.<br>
  19204. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone object.
  19205. !#zh
  19206. 通过名称查找 bone。
  19207. 这里对每个 bone 的名称进行了对比。<br>
  19208. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone 对象。
  19209. @param boneName boneName
  19210. */
  19211. findBone(boneName: string): sp.spine.Bone;
  19212. /**
  19213. !#en
  19214. Finds a slot by name. This does a string comparison for every slot.<br>
  19215. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot object.
  19216. !#zh
  19217. 通过名称查找 slot。这里对每个 slot 的名称进行了比较。<br>
  19218. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot 对象。
  19219. @param slotName slotName
  19220. */
  19221. findSlot(slotName: string): sp.spine.Slot;
  19222. /**
  19223. !#en
  19224. Finds a skin by name and makes it the active skin.
  19225. This does a string comparison for every skin.<br>
  19226. Note that setting the skin does not change which attachments are visible.<br>
  19227. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin object.
  19228. !#zh
  19229. 按名称查找皮肤,激活该皮肤。这里对每个皮肤的名称进行了比较。<br>
  19230. 注意:设置皮肤不会改变 attachment 的可见性。<br>
  19231. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin 对象。
  19232. @param skinName skinName
  19233. */
  19234. setSkin(skinName: string): void;
  19235. /**
  19236. !#en
  19237. Returns the attachment for the slot and attachment name.
  19238. The skeleton looks first in its skin, then in the skeleton data’s default skin.<br>
  19239. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment object.
  19240. !#zh
  19241. 通过 slot 和 attachment 的名称获取 attachment。Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。<br>
  19242. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment 对象。
  19243. @param slotName slotName
  19244. @param attachmentName attachmentName
  19245. */
  19246. getAttachment(slotName: string, attachmentName: string): sp.spine.Attachment;
  19247. /**
  19248. !#en
  19249. Sets the attachment for the slot and attachment name.
  19250. The skeleton looks first in its skin, then in the skeleton data’s default skin.
  19251. !#zh
  19252. 通过 slot 和 attachment 的名字来设置 attachment。
  19253. Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。
  19254. @param slotName slotName
  19255. @param attachmentName attachmentName
  19256. */
  19257. setAttachment(slotName: string, attachmentName: string): void;
  19258. /**
  19259. Return the renderer of attachment.
  19260. @param regionAttachment regionAttachment
  19261. */
  19262. getTextureAtlas(regionAttachment: sp.spine.RegionAttachment|spine.BoundingBoxAttachment): sp.spine.TextureAtlasRegion;
  19263. /**
  19264. !#en
  19265. Mix applies all keyframe values,
  19266. interpolated for the specified time and mixed with the current values.
  19267. !#zh 为所有关键帧设定混合及混合时间(从当前值开始差值)。
  19268. @param fromAnimation fromAnimation
  19269. @param toAnimation toAnimation
  19270. @param duration duration
  19271. */
  19272. setMix(fromAnimation: string, toAnimation: string, duration: number): void;
  19273. /**
  19274. !#en Set the current animation. Any queued animations are cleared.<br>
  19275. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19276. !#zh 设置当前动画。队列中的任何的动画将被清除。<br>
  19277. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19278. @param trackIndex trackIndex
  19279. @param name name
  19280. @param loop loop
  19281. */
  19282. setAnimation(trackIndex: number, name: string, loop: boolean): sp.spine.TrackEntry;
  19283. /**
  19284. !#en Adds an animation to be played delay seconds after the current or last queued animation.<br>
  19285. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19286. !#zh 添加一个动画到动画队列尾部,还可以延迟指定的秒数。<br>
  19287. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19288. @param trackIndex trackIndex
  19289. @param name name
  19290. @param loop loop
  19291. @param delay delay
  19292. */
  19293. addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): sp.spine.TrackEntry;
  19294. /**
  19295. !#en Find animation with specified name.
  19296. !#zh 查找指定名称的动画
  19297. @param name name
  19298. */
  19299. findAnimation(name: string): sp.spine.Animation;
  19300. /**
  19301. !#en Returns track entry by trackIndex.<br>
  19302. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19303. !#zh 通过 track 索引获取 TrackEntry。<br>
  19304. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19305. @param trackIndex trackIndex
  19306. */
  19307. getCurrent(trackIndex: any): sp.spine.TrackEntry;
  19308. /**
  19309. !#en Clears all tracks of animation state.
  19310. !#zh 清除所有 track 的动画状态。
  19311. */
  19312. clearTracks(): void;
  19313. /**
  19314. !#en Clears track of animation state by trackIndex.
  19315. !#zh 清除出指定 track 的动画状态。
  19316. @param trackIndex trackIndex
  19317. */
  19318. clearTrack(trackIndex: number): void;
  19319. /**
  19320. !#en Set the start event listener.
  19321. !#zh 用来设置开始播放动画的事件监听。
  19322. @param listener listener
  19323. */
  19324. setStartListener(listener: Function): void;
  19325. /**
  19326. !#en Set the interrupt event listener.
  19327. !#zh 用来设置动画被打断的事件监听。
  19328. @param listener listener
  19329. */
  19330. setInterruptListener(listener: Function): void;
  19331. /**
  19332. !#en Set the end event listener.
  19333. !#zh 用来设置动画播放完后的事件监听。
  19334. @param listener listener
  19335. */
  19336. setEndListener(listener: Function): void;
  19337. /**
  19338. !#en Set the dispose event listener.
  19339. !#zh 用来设置动画将被销毁的事件监听。
  19340. @param listener listener
  19341. */
  19342. setDisposeListener(listener: Function): void;
  19343. /**
  19344. !#en Set the complete event listener.
  19345. !#zh 用来设置动画播放一次循环结束后的事件监听。
  19346. @param listener listener
  19347. */
  19348. setCompleteListener(listener: Function): void;
  19349. /**
  19350. !#en Set the animation event listener.
  19351. !#zh 用来设置动画播放过程中帧事件的监听。
  19352. @param listener listener
  19353. */
  19354. setEventListener(listener: Function): void;
  19355. /**
  19356. !#en Set the start event listener for specified TrackEntry.
  19357. !#zh 用来为指定的 TrackEntry 设置动画开始播放的事件监听。
  19358. @param entry entry
  19359. @param listener listener
  19360. */
  19361. setTrackStartListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19362. /**
  19363. !#en Set the interrupt event listener for specified TrackEntry.
  19364. !#zh 用来为指定的 TrackEntry 设置动画被打断的事件监听。
  19365. @param entry entry
  19366. @param listener listener
  19367. */
  19368. setTrackInterruptListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19369. /**
  19370. !#en Set the end event listener for specified TrackEntry.
  19371. !#zh 用来为指定的 TrackEntry 设置动画播放结束的事件监听。
  19372. @param entry entry
  19373. @param listener listener
  19374. */
  19375. setTrackEndListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19376. /**
  19377. !#en Set the dispose event listener for specified TrackEntry.
  19378. !#zh 用来为指定的 TrackEntry 设置动画即将被销毁的事件监听。
  19379. @param entry entry
  19380. @param listener listener
  19381. */
  19382. setTrackDisposeListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19383. /**
  19384. !#en Set the complete event listener for specified TrackEntry.
  19385. !#zh 用来为指定的 TrackEntry 设置动画一次循环播放结束的事件监听。
  19386. @param entry entry
  19387. @param listener listener
  19388. */
  19389. setTrackCompleteListener(entry: sp.spine.TrackEntry, listener: (entry: sp.spine.TrackEntry, loopCount: number) => void): void;
  19390. /**
  19391. !#en Set the event listener for specified TrackEntry.
  19392. !#zh 用来为指定的 TrackEntry 设置动画帧事件的监听。
  19393. @param entry entry
  19394. @param listener listener
  19395. */
  19396. setTrackEventListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19397. /**
  19398. !#en Get the animation state object
  19399. !#zh 获取动画状态
  19400. */
  19401. getState(): sp.spine.AnimationState;
  19402. }
  19403. /** !#en The event type of spine skeleton animation.
  19404. !#zh 骨骼动画事件类型。 */
  19405. export enum AnimationEventType {
  19406. START = 0,
  19407. END = 0,
  19408. COMPLETE = 0,
  19409. EVENT = 0,
  19410. }
  19411. /** !#en The skeleton data of spine.
  19412. !#zh Spine 的 骨骼数据。 */
  19413. export class SkeletonData extends cc.Asset {
  19414. /** !#en See http://en.esotericsoftware.com/spine-json-format
  19415. !#zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format */
  19416. skeletonJson: any;
  19417. atlasText: string;
  19418. textures: cc.Texture2D[];
  19419. /** !#en
  19420. A scale can be specified on the JSON or binary loader which will scale the bone positions,
  19421. image sizes, and animation translations.
  19422. This can be useful when using different sized images than were used when designing the skeleton
  19423. in Spine. For example, if using images that are half the size than were used in Spine,
  19424. a scale of 0.5 can be used. This is commonly used for games that can run with either low or high
  19425. resolution texture atlases.
  19426. see http://en.esotericsoftware.com/spine-using-runtimes#Scaling
  19427. !#zh 可查看 Spine 官方文档: http://zh.esotericsoftware.com/spine-using-runtimes#Scaling */
  19428. scale: number;
  19429. /**
  19430. !#en Get the included SkeletonData used in spine runtime.<br>
  19431. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData object.
  19432. !#zh 获取 Spine Runtime 使用的 SkeletonData。<br>
  19433. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData 对象。
  19434. @param quiet quiet
  19435. */
  19436. getRuntimeData(quiet?: boolean): sp.spine.SkeletonData;
  19437. }
  19438. /** !#en
  19439. The delegate of spine vertex effect
  19440. !#zh
  19441. Spine 顶点动画代理 */
  19442. export class VertexEffectDelegate {
  19443. /**
  19444. !#en Clears vertex effect.
  19445. !#zh 清空顶点效果
  19446. */
  19447. clear(): void;
  19448. /**
  19449. !#en Inits delegate with jitter effect
  19450. !#zh 设置顶点抖动效果
  19451. @param jitterX jitterX
  19452. @param jitterY jitterY
  19453. */
  19454. initJitter(jitterX: number, jitterY: number): void;
  19455. /**
  19456. !#en Inits delegate with swirl effect
  19457. !#zh 设置顶点漩涡效果
  19458. @param radius radius
  19459. @param power power
  19460. */
  19461. initSwirlWithPow(radius: number, power: number): sp.spine.JitterEffect;
  19462. /**
  19463. !#en Inits delegate with swirl effect
  19464. !#zh 设置顶点漩涡效果
  19465. @param radius radius
  19466. @param power power
  19467. */
  19468. initSwirlWithPowOut(radius: number, power: number): sp.spine.SwirlEffect;
  19469. /**
  19470. !#en Gets jitter vertex effect
  19471. !#zh 获取顶点抖动效果
  19472. */
  19473. getJitterVertexEffect(): sp.spine.JitterEffect;
  19474. /**
  19475. !#en Gets swirl vertex effect
  19476. !#zh 获取顶点漩涡效果
  19477. */
  19478. getSwirlVertexEffect(): sp.spine.SwirlEffect;
  19479. /**
  19480. !#en Gets vertex effect
  19481. !#zh 获取顶点效果
  19482. */
  19483. getVertexEffect(): sp.spine.JitterEffect;
  19484. /**
  19485. !#en Gets effect type
  19486. !#zh 获取效果类型
  19487. */
  19488. getEffectType(): string;
  19489. }
  19490. /****************************************************
  19491. * sp
  19492. *****************************************************/
  19493. export namespace sp {
  19494. /** !#en Attach node tool
  19495. !#zh 挂点工具类 */
  19496. export class AttachUtil {
  19497. /**
  19498. !#en Gets attached root node.
  19499. !#zh 获取挂接节点树的根节点
  19500. */
  19501. getAttachedRootNode(): cc.Node;
  19502. /**
  19503. !#en Gets attached node which you want.
  19504. !#zh 获得对应的挂点
  19505. @param boneName boneName
  19506. */
  19507. getAttachedNodes(boneName: string): cc.Node[];
  19508. /**
  19509. !#en Destroy attached node which you want.
  19510. !#zh 销毁对应的挂点
  19511. @param boneName boneName
  19512. */
  19513. destroyAttachedNodes(boneName: string): void;
  19514. /**
  19515. !#en Traverse all bones to generate the minimum node tree containing the given bone names, NOTE that make sure the skeleton has initialized before calling this interface.
  19516. !#zh 遍历所有插槽,生成包含所有给定插槽名称的最小节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19517. @param boneName boneName
  19518. */
  19519. generateAttachedNodes(boneName: string): cc.Node[];
  19520. /**
  19521. !#en Destroy all attached node.
  19522. !#zh 销毁所有挂点
  19523. */
  19524. destroyAllAttachedNodes(): void;
  19525. /**
  19526. !#en Traverse all bones to generate a tree containing all bones nodes, NOTE that make sure the skeleton has initialized before calling this interface.
  19527. !#zh 遍历所有插槽,生成包含所有插槽的节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19528. */
  19529. generateAllAttachedNodes(): cc.Node;
  19530. }
  19531. }
  19532. /****************************************************
  19533. * Skeleton
  19534. *****************************************************/
  19535. export namespace Skeleton {
  19536. /** !#en Enum for animation cache mode type.
  19537. !#zh Spine动画缓存类型 */
  19538. export enum AnimationCacheMode {
  19539. REALTIME = 0,
  19540. SHARED_CACHE = 0,
  19541. PRIVATE_CACHE = 0,
  19542. }
  19543. }
  19544. }
  19545. /** !#en
  19546. `sp.spine` is the namespace for official Spine Runtime, which officially implemented and maintained by Spine.<br>
  19547. Please refer to the official documentation for its detailed usage: [http://en.esotericsoftware.com/spine-using-runtimes](http://en.esotericsoftware.com/spine-using-runtimes)
  19548. !#zh
  19549. sp.spine 模块是 Spine 官方运行库的 API 入口,由 Spine 官方统一实现和维护,具体用法请参考:[http://zh.esotericsoftware.com/spine-using-runtimes](http://zh.esotericsoftware.com/spine-using-runtimes) */
  19550. declare namespace sp.spine {
  19551. }
  19552. /** !#en
  19553. The global main namespace of DragonBones, all classes, functions,
  19554. properties and constants of DragonBones are defined in this namespace
  19555. !#zh
  19556. DragonBones 的全局的命名空间,
  19557. 与 DragonBones 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  19558. declare namespace dragonBones {
  19559. /** !#en
  19560. The Armature Display of DragonBones <br/>
  19561. <br/>
  19562. Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
  19563. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  19564. Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments. <br/>
  19565. !#zh
  19566. DragonBones 骨骼动画 <br/>
  19567. <br/>
  19568. Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  19569. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  19570. 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。<br/> */
  19571. export class ArmatureDisplay extends cc.RenderComponent {
  19572. /** !#en
  19573. The DragonBones data contains the armatures information (bind pose bones, slots, draw order,
  19574. attachments, skins, etc) and animations but does not hold any state.<br/>
  19575. Multiple ArmatureDisplay can share the same DragonBones data.
  19576. !#zh
  19577. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  19578. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  19579. 多个 ArmatureDisplay 可以共用相同的骨骼数据。 */
  19580. dragonAsset: DragonBonesAsset;
  19581. /** !#en
  19582. The atlas asset for the DragonBones.
  19583. !#zh
  19584. 骨骼数据所需的 Atlas Texture 数据。 */
  19585. dragonAtlasAsset: DragonBonesAtlasAsset;
  19586. /** !#en The name of current armature.
  19587. !#zh 当前的 Armature 名称。 */
  19588. armatureName: string;
  19589. /** !#en The name of current playing animation.
  19590. !#zh 当前播放的动画名称。 */
  19591. animationName: string;
  19592. _defaultArmatureIndex: number;
  19593. /** !#en The time scale of this armature.
  19594. !#zh 当前骨骼中所有动画的时间缩放率。 */
  19595. timeScale: number;
  19596. /** !#en The play times of the default animation.
  19597. -1 means using the value of config file;
  19598. 0 means repeat for ever
  19599. >0 means repeat times
  19600. !#zh 播放默认动画的循环次数
  19601. -1 表示使用配置文件中的默认值;
  19602. 0 表示无限循环
  19603. >0 表示循环次数 */
  19604. playTimes: number;
  19605. /** !#en Indicates whether to enable premultiplied alpha.
  19606. You should disable this option when image's transparent area appears to have opaque pixels,
  19607. or enable this option when image's half transparent area appears to be darken.
  19608. !#zh 是否启用贴图预乘。
  19609. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  19610. premultipliedAlpha: boolean;
  19611. /** !#en Indicates whether open debug bones.
  19612. !#zh 是否显示 bone 的 debug 信息。 */
  19613. debugBones: boolean;
  19614. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  19615. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  19616. enableBatch: boolean;
  19617. /**
  19618. !#en
  19619. The key of dragonbones cache data, which is regard as 'dragonbonesName', when you want to change dragonbones cloth.
  19620. !#zh
  19621. 缓存龙骨数据的key值,换装的时会使用到该值,作为dragonbonesName使用
  19622. @example
  19623. ```js
  19624. let factory = dragonBones.CCFactory.getInstance();
  19625. let needChangeSlot = needChangeArmature.armature().getSlot("changeSlotName");
  19626. factory.replaceSlotDisplay(toChangeArmature.getArmatureKey(), "armatureName", "slotName", "displayName", needChangeSlot);
  19627. ```
  19628. */
  19629. getArmatureKey(): string;
  19630. /**
  19631. !#en
  19632. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  19633. If set the mode in editor, then no need to worry about order problem.
  19634. !#zh
  19635. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  19636. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  19637. @param cacheMode cacheMode
  19638. @example
  19639. ```js
  19640. armatureDisplay.setAnimationCacheMode(dragonBones.ArmatureDisplay.AnimationCacheMode.SHARED_CACHE);
  19641. ```
  19642. */
  19643. setAnimationCacheMode(cacheMode: ArmatureDisplay.AnimationCacheMode): void;
  19644. /**
  19645. !#en Whether in cached mode.
  19646. !#zh 当前是否处于缓存模式。
  19647. */
  19648. isAnimationCached(): boolean;
  19649. /**
  19650. !#en
  19651. Play the specified animation.
  19652. Parameter animName specify the animation name.
  19653. Parameter playTimes specify the repeat times of the animation.
  19654. -1 means use the value of the config file.
  19655. 0 means play the animation for ever.
  19656. >0 means repeat times.
  19657. !#zh
  19658. 播放指定的动画.
  19659. animName 指定播放动画的名称。
  19660. playTimes 指定播放动画的次数。
  19661. -1 为使用配置文件中的次数。
  19662. 0 为无限循环播放。
  19663. >0 为动画的重复次数。
  19664. @param animName animName
  19665. @param playTimes playTimes
  19666. */
  19667. playAnimation(animName: string, playTimes: number): dragonBones.AnimationState;
  19668. /**
  19669. !#en
  19670. Updating an animation cache to calculate all frame data in the animation is a cost in
  19671. performance due to calculating all data in a single frame.
  19672. To update the cache, use the invalidAnimationCache method with high performance.
  19673. !#zh
  19674. 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  19675. 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  19676. @param animName animName
  19677. */
  19678. updateAnimationCache(animName: string): void;
  19679. /**
  19680. !#en
  19681. Invalidates the animation cache, which is then recomputed on each frame..
  19682. !#zh
  19683. 使动画缓存失效,之后会在每帧重新计算。
  19684. */
  19685. invalidAnimationCache(): void;
  19686. /**
  19687. !#en
  19688. Get the all armature names in the DragonBones Data.
  19689. !#zh
  19690. 获取 DragonBones 数据中所有的 armature 名称
  19691. */
  19692. getArmatureNames(): any[];
  19693. /**
  19694. !#en
  19695. Get the all animation names of specified armature.
  19696. !#zh
  19697. 获取指定的 armature 的所有动画名称。
  19698. @param armatureName armatureName
  19699. */
  19700. getAnimationNames(armatureName: string): any[];
  19701. /**
  19702. !#en
  19703. Add event listener for the DragonBones Event, the same to addEventListener.
  19704. !#zh
  19705. 添加 DragonBones 事件监听器,与 addEventListener 作用相同。
  19706. @param type A string representing the event type to listen for.
  19707. @param listener The callback that will be invoked when the event is dispatched.
  19708. @param target The target (this object) to invoke the callback, can be null
  19709. */
  19710. on(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19711. /**
  19712. !#en
  19713. Remove the event listener for the DragonBones Event, the same to removeEventListener.
  19714. !#zh
  19715. 移除 DragonBones 事件监听器,与 removeEventListener 作用相同。
  19716. @param type A string representing the event type to listen for.
  19717. @param listener listener
  19718. @param target target
  19719. */
  19720. off(type: string, listener?: Function, target?: any): void;
  19721. /**
  19722. !#en
  19723. Add DragonBones one-time event listener, the callback will remove itself after the first time it is triggered.
  19724. !#zh
  19725. 添加 DragonBones 一次性事件监听器,回调会在第一时间被触发后删除自身。
  19726. @param type A string representing the event type to listen for.
  19727. @param listener The callback that will be invoked when the event is dispatched.
  19728. @param target The target (this object) to invoke the callback, can be null
  19729. */
  19730. once(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19731. /**
  19732. !#en
  19733. Add event listener for the DragonBones Event.
  19734. !#zh
  19735. 添加 DragonBones 事件监听器。
  19736. @param type A string representing the event type to listen for.
  19737. @param listener The callback that will be invoked when the event is dispatched.
  19738. @param target The target (this object) to invoke the callback, can be null
  19739. */
  19740. addEventListener(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19741. /**
  19742. !#en
  19743. Remove the event listener for the DragonBones Event.
  19744. !#zh
  19745. 移除 DragonBones 事件监听器。
  19746. @param type A string representing the event type to listen for.
  19747. @param listener listener
  19748. @param target target
  19749. */
  19750. removeEventListener(type: string, listener?: Function, target?: any): void;
  19751. /**
  19752. !#en
  19753. Build the armature for specified name.
  19754. !#zh
  19755. 构建指定名称的 armature 对象
  19756. @param armatureName armatureName
  19757. @param node node
  19758. */
  19759. buildArmature(armatureName: string, node: cc.Node): ArmatureDisplay;
  19760. /**
  19761. !#en
  19762. Get the current armature object of the ArmatureDisplay.
  19763. !#zh
  19764. 获取 ArmatureDisplay 当前使用的 Armature 对象
  19765. */
  19766. armature(): any;
  19767. }
  19768. /** DragonBones factory */
  19769. export class CCFactory extends BaseFactory {
  19770. /**
  19771. @example
  19772. ```js
  19773. let factory = dragonBones.CCFactory.getInstance();
  19774. ```
  19775. */
  19776. static getInstance(): CCFactory;
  19777. }
  19778. /** !#en The skeleton data of dragonBones.
  19779. !#zh dragonBones 的 骨骼数据。 */
  19780. export class DragonBonesAsset extends cc.Asset {
  19781. /** !#en See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  19782. !#zh 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html */
  19783. dragonBonesJson: string;
  19784. }
  19785. /** !#en The skeleton atlas data of dragonBones.
  19786. !#zh dragonBones 的骨骼纹理数据。 */
  19787. export class DragonBonesAtlasAsset extends cc.Asset {
  19788. atlasJson: string;
  19789. texture: cc.Texture2D;
  19790. }
  19791. /****************************************************
  19792. * ArmatureDisplay
  19793. *****************************************************/
  19794. export namespace ArmatureDisplay {
  19795. /** !#en Enum for cache mode type.
  19796. !#zh Dragonbones渲染类型 */
  19797. export enum AnimationCacheMode {
  19798. REALTIME = 0,
  19799. SHARED_CACHE = 0,
  19800. PRIVATE_CACHE = 0,
  19801. }
  19802. }
  19803. /****************************************************
  19804. * dragonBones
  19805. *****************************************************/
  19806. export namespace dragonBones {
  19807. /** !#en Attach node tool
  19808. !#zh 挂点工具类 */
  19809. export class AttachUtil {
  19810. /**
  19811. !#en Gets attached root node.
  19812. !#zh 获取挂接节点树的根节点
  19813. */
  19814. getAttachedRootNode(): cc.Node;
  19815. /**
  19816. !#en Gets attached node which you want.
  19817. !#zh 获得对应的挂点
  19818. @param boneName boneName
  19819. */
  19820. getAttachedNodes(boneName: string): cc.Node[];
  19821. /**
  19822. !#en Destroy attached node which you want.
  19823. !#zh 销毁对应的挂点
  19824. @param boneName boneName
  19825. */
  19826. destroyAttachedNodes(boneName: string): void;
  19827. /**
  19828. !#en Traverse all bones to generate the minimum node tree containing the given bone names, NOTE that make sure the skeleton has initialized before calling this interface.
  19829. !#zh 遍历所有插槽,生成包含所有给定插槽名称的最小节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19830. @param boneName boneName
  19831. */
  19832. generateAttachedNodes(boneName: string): cc.Node[];
  19833. /**
  19834. !#en Destroy all attached node.
  19835. !#zh 销毁所有挂点
  19836. */
  19837. destroyAllAttachedNodes(): void;
  19838. /**
  19839. !#en Traverse all bones to generate a tree containing all bones nodes, NOTE that make sure the skeleton has initialized before calling this interface.
  19840. !#zh 遍历所有插槽,生成包含所有插槽的节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19841. */
  19842. generateAllAttachedNodes(): cc.Node;
  19843. }
  19844. }
  19845. }
  19846. /** !#en
  19847. This module controls asset's behaviors and information, include loading, releasing etc.
  19848. All member can be accessed with `cc.assetManager`. All class or enum can be accessed with `cc.AssetManager`
  19849. !#zh
  19850. 此模块管理资源的行为和信息,包括加载,释放等,所有成员能够通过 `cc.assetManager` 调用. 所有类型或枚举能通过 `cc.AssetManager` 访问 */
  19851. declare namespace cc.AssetManager {
  19852. /** !#en
  19853. This module contains the builtin asset, it's a singleton, all member can be accessed with `cc.assetManager.builtins`
  19854. !#zh
  19855. 此模块包含内建资源,这是一个单例,所有成员能通过 `cc.assetManager.builtins` 访问 */
  19856. export class Builtins {
  19857. /**
  19858. !#en
  19859. Initialize
  19860. !#zh
  19861. 初始化
  19862. @param cb Callback when finish loading built-in assets
  19863. */
  19864. init (cb: () => void): void;
  19865. /**
  19866. !#en
  19867. Get the built-in asset using specific type and name.
  19868. !#zh
  19869. 通过特定的类型和名称获取内建资源
  19870. @param type The type of asset, such as `effect`
  19871. @param name The name of asset, such as `phong`
  19872. @example
  19873. ```js
  19874. cc.assetManaer.builtins.getBuiltin('effect', 'phone');
  19875. ```
  19876. */
  19877. getBuiltin(type?: string, name?: string): cc.Asset | Cache<cc.Asset>;
  19878. /**
  19879. !#en
  19880. Clear all builtin assets
  19881. !#zh
  19882. 清空所有内置资源
  19883. */
  19884. clear(): void;
  19885. }
  19886. /** !#en
  19887. A bundle contains an amount of assets(includes scene), you can load, preload, release asset which is in this bundle
  19888. !#zh
  19889. 一个包含一定数量资源(包括场景)的包,你可以加载,预加载,释放此包内的资源 */
  19890. export class Bundle {
  19891. /**
  19892. !#en
  19893. Create a bundle
  19894. !#zh
  19895. 创建一个 bundle
  19896. */
  19897. constructor();
  19898. /** !#en
  19899. The name of this bundle
  19900. !#zh
  19901. 此 bundle 的名称 */
  19902. name: string;
  19903. /** !#en
  19904. The dependency of this bundle
  19905. !#zh
  19906. 此 bundle 的依赖 */
  19907. deps: string[];
  19908. /** !#en
  19909. The root path of this bundle, such like 'http://example.com/bundle1'
  19910. !#zh
  19911. 此 bundle 的根路径, 例如 'http://example.com/bundle1' */
  19912. base: string;
  19913. /**
  19914. !#en
  19915. Get asset's info using path, only valid when asset is in bundle folder.
  19916. !#zh
  19917. 使用 path 获取资源的配置信息
  19918. @param path The relative path of asset, such as 'images/a'
  19919. @param type The constructor of asset, such as `cc.Texture2D`
  19920. @example
  19921. ```js
  19922. var info = bundle.getInfoWithPath('image/a', cc.Texture2D);
  19923. ```
  19924. */
  19925. getInfoWithPath (path: string, type?: typeof cc.Asset): Record<string, any>;
  19926. /**
  19927. !#en
  19928. Get all asset's info within specific folder
  19929. !#zh
  19930. 获取在某个指定文件夹下的所有资源信息
  19931. @param path The relative path of folder, such as 'images'
  19932. @param type The constructor should be used to filter paths
  19933. @param out The output array
  19934. @example
  19935. ```js
  19936. var infos = [];
  19937. bundle.getDirWithPath('images', cc.Texture2D, infos);
  19938. ```
  19939. */
  19940. getDirWithPath (path: string, type: typeof cc.Asset, out: Array<Record<string, any>>): Array<Record<string, any>>;
  19941. getDirWithPath (path: string, type: typeof cc.Asset): Array<Record<string, any>>;
  19942. getDirWithPath (path: string): Array<Record<string, any>>;
  19943. /**
  19944. !#en
  19945. Get asset's info with uuid
  19946. !#zh
  19947. 通过 uuid 获取资源信息
  19948. @param uuid The asset's uuid
  19949. @example
  19950. ```js
  19951. var info = bundle.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  19952. ```
  19953. */
  19954. getAssetInfo (uuid: string): Record<string, any>;
  19955. /**
  19956. !#en
  19957. Get scene'info with name
  19958. !#zh
  19959. 通过场景名获取场景信息
  19960. @param name The name of scene
  19961. @example
  19962. ```js
  19963. var info = bundle.getSceneInfo('first.fire');
  19964. ```
  19965. */
  19966. getSceneInfo(name: string): Record<string, any>;
  19967. /**
  19968. !#en
  19969. Initialize this bundle with options
  19970. !#zh
  19971. 初始化此 bundle
  19972. @param options options
  19973. */
  19974. init(options: Record<string, any>): void;
  19975. /**
  19976. !#en
  19977. Load the asset within this bundle by the path which is relative to bundle's path
  19978. !#zh
  19979. 通过相对路径加载分包中的资源。路径是相对分包文件夹路径的相对路径
  19980. @param paths Paths of the target assets.The path is relative to the bundle's folder, extensions must be omitted.
  19981. @param type Only asset of type will be loaded if this argument is supplied.
  19982. @param onProgress Callback invoked when progression change.
  19983. @param onComplete Callback invoked when all assets loaded.
  19984. @example
  19985. ```js
  19986. // load the texture (${project}/assets/resources/textures/background.jpg) from resources
  19987. cc.resources.load('textures/background', cc.Texture2D, (err, texture) => console.log(err));
  19988. // load the audio (${project}/assets/resources/music/hit.mp3) from resources
  19989. cc.resources.load('music/hit', cc.AudioClip, (err, audio) => console.log(err));
  19990. // load the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  19991. bundle1.load('misc/character/cocos', cc.Prefab, (err, prefab) => console.log(err));
  19992. // load the sprite frame (${project}/assets/some/xxx/bundle2/imgs/cocos.png) from bundle2 folder
  19993. bundle2.load('imgs/cocos', cc.SpriteFrame, null, (err, spriteFrame) => console.log(err));
  19994. ```
  19995. */
  19996. load<T extends cc.Asset>(paths: string, type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: T) => void): void;
  19997. load<T extends cc.Asset>(paths: string[], type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: Array<T>) => void): void;
  19998. load<T extends cc.Asset>(paths: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: T) => void): void;
  19999. load<T extends cc.Asset>(paths: string[], onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: Array<T>) => void): void;
  20000. load<T extends cc.Asset>(paths: string, type: typeof cc.Asset, onComplete?: (error: Error, assets: T) => void): void;
  20001. load<T extends cc.Asset>(paths: string[], type: typeof cc.Asset, onComplete?: (error: Error, assets: Array<T>) => void): void;
  20002. load<T extends cc.Asset>(paths: string, onComplete?: (error: Error, assets: T) => void): void;
  20003. load<T extends cc.Asset>(paths: string[], onComplete?: (error: Error, assets: Array<T>) => void): void;
  20004. /**
  20005. !#en
  20006. Preload the asset within this bundle by the path which is relative to bundle's path.
  20007. After calling this method, you still need to finish loading by calling `Bundle.load`.
  20008. It will be totally fine to call `Bundle.load` at any time even if the preloading is not
  20009. yet finished
  20010. !#zh
  20011. 通过相对路径预加载分包中的资源。路径是相对分包文件夹路径的相对路径。调用完后,你仍然需要通过 `Bundle.load` 来完成加载。
  20012. 就算预加载还没完成,你也可以直接调用 `Bundle.load`。
  20013. @param paths Paths of the target asset.The path is relative to bundle folder, extensions must be omitted.
  20014. @param type Only asset of type will be loaded if this argument is supplied.
  20015. @param onProgress Callback invoked when progression change.
  20016. @param onComplete Callback invoked when the resource loaded.
  20017. @example
  20018. ```js
  20019. // preload the texture (${project}/assets/resources/textures/background.jpg) from resources
  20020. cc.resources.preload('textures/background', cc.Texture2D);
  20021. // preload the audio (${project}/assets/resources/music/hit.mp3) from resources
  20022. cc.resources.preload('music/hit', cc.AudioClip);
  20023. // wait for while
  20024. cc.resources.load('music/hit', cc.AudioClip, (err, audioClip) => {});
  20025. * // preload the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  20026. bundle1.preload('misc/character/cocos', cc.Prefab);
  20027. // load the sprite frame of (${project}/assets/bundle2/imgs/cocos.png) from bundle2 folder
  20028. bundle2.preload('imgs/cocos', cc.SpriteFrame);
  20029. // wait for while
  20030. bundle2.load('imgs/cocos', cc.SpriteFrame, (err, spriteFrame) => {});
  20031. ```
  20032. */
  20033. preload(paths: string|string[], type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20034. preload(paths: string|string[], onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20035. preload(paths: string|string[], type: typeof cc.Asset, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20036. preload(paths: string|string[], type: typeof cc.Asset): void;
  20037. preload(paths: string|string[], onComplete: (error: Error, items: RequestItem[]) => void): void;
  20038. preload(paths: string|string[]): void;
  20039. /**
  20040. !#en
  20041. Load all assets under a folder inside the bundle folder.<br>
  20042. <br>
  20043. Note: All asset paths in Creator use forward slashes, paths using backslashes will not work.
  20044. !#zh
  20045. 加载目标文件夹中的所有资源, 注意:路径中只能使用斜杠,反斜杠将停止工作
  20046. @param dir path of the target folder.The path is relative to the bundle folder, extensions must be omitted.
  20047. @param type Only asset of type will be loaded if this argument is supplied.
  20048. @param onProgress Callback invoked when progression change.
  20049. @param onComplete A callback which is called when all assets have been loaded, or an error occurs.
  20050. @example
  20051. ```js
  20052. // load all audios (resources/audios/)
  20053. cc.resources.loadDir('audios', cc.AudioClip, (err, audios) => {});
  20054. // load all textures in "resources/imgs/"
  20055. cc.resources.loadDir('imgs', cc.Texture2D, null, function (err, textures) {
  20056. var texture1 = textures[0];
  20057. var texture2 = textures[1];
  20058. });
  20059. // load all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  20060. bundle1.loadDir('misc/characters', cc.Prefab, (err, prefabs) => console.log(err));
  20061. // load all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  20062. bundle2.loadDir('skills', cc.SpriteFrame, null, (err, spriteFrames) => console.log(err));
  20063. ```
  20064. */
  20065. loadDir<T extends cc.Asset>(dir: string, type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: Array<T>) => void): void;
  20066. loadDir<T extends cc.Asset>(dir: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: Array<T>) => void): void;
  20067. loadDir<T extends cc.Asset>(dir: string, type: typeof cc.Asset, onComplete: (error: Error, assets: Array<T>) => void): void;
  20068. loadDir<T extends cc.Asset>(dir: string, type: typeof cc.Asset): void;
  20069. loadDir<T extends cc.Asset>(dir: string, onComplete: (error: Error, assets: Array<T>) => void): void;
  20070. loadDir<T extends cc.Asset>(dir: string): void;
  20071. /**
  20072. !#en
  20073. Preload all assets under a folder inside the bundle folder.<br> After calling this method, you still need to finish loading by calling `Bundle.loadDir`.
  20074. It will be totally fine to call `Bundle.loadDir` at any time even if the preloading is not yet finished
  20075. !#zh
  20076. 预加载目标文件夹中的所有资源。调用完后,你仍然需要通过 `Bundle.loadDir` 来完成加载。
  20077. 就算预加载还没完成,你也可以直接调用 `Bundle.loadDir`。
  20078. @param dir path of the target folder.The path is relative to the bundle folder, extensions must be omitted.
  20079. @param type Only asset of type will be preloaded if this argument is supplied.
  20080. @param onProgress Callback invoked when progression change.
  20081. @param onComplete A callback which is called when all assets have been loaded, or an error occurs.
  20082. @example
  20083. ```js
  20084. // preload all audios (resources/audios/)
  20085. cc.resources.preloadDir('audios', cc.AudioClip);
  20086. // preload all textures in "resources/imgs/"
  20087. cc.resources.preloadDir('imgs', cc.Texture2D);
  20088. // wait for while
  20089. cc.resources.loadDir('imgs', cc.Texture2D, (err, textures) => {});
  20090. // preload all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  20091. bundle1.preloadDir('misc/characters', cc.Prefab);
  20092. // preload all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  20093. bundle2.preloadDir('skills', cc.SpriteFrame);
  20094. // wait for while
  20095. bundle2.loadDir('skills', cc.SpriteFrame, (err, spriteFrames) => {});
  20096. ```
  20097. */
  20098. preloadDir(dir: string, type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20099. preloadDir(dir: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20100. preloadDir(dir: string, type: typeof cc.Asset, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20101. preloadDir(dir: string, type: typeof cc.Asset): void;
  20102. preloadDir(dir: string, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20103. preloadDir(dir: string): void;
  20104. /**
  20105. !#en
  20106. Loads the scene within this bundle by its name.
  20107. !#zh
  20108. 通过场景名称加载分包中的场景。
  20109. @param sceneName The name of the scene to load.
  20110. @param options Some optional parameters
  20111. @param onProgress Callback invoked when progression change.
  20112. @param onComplete callback, will be called after scene launched.
  20113. @example
  20114. ```js
  20115. bundle1.loadScene('first', (err, sceneAsset) => cc.director.runScene(sceneAsset));
  20116. ```
  20117. */
  20118. loadScene(sceneName: string, options: Record<string, any>, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20119. loadScene(sceneName: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20120. loadScene(sceneName: string, options: Record<string, any>, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20121. loadScene(sceneName: string, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20122. loadScene(sceneName: string, options: Record<string, any>): void;
  20123. loadScene(sceneName: string): void;
  20124. /**
  20125. !#en
  20126. Preloads the scene within this bundle by its name. After calling this method, you still need to finish loading by calling `Bundle.loadScene` or `cc.director.loadScene`.
  20127. It will be totally fine to call `Bundle.loadDir` at any time even if the preloading is not yet finished
  20128. !#zh
  20129. 通过场景名称预加载分包中的场景.调用完后,你仍然需要通过 `Bundle.loadScene` 或 `cc.director.loadScene` 来完成加载。
  20130. 就算预加载还没完成,你也可以直接调用 `Bundle.loadScene` 或 `cc.director.loadScene`。
  20131. @param sceneName The name of the scene to preload.
  20132. @param options Some optional parameters
  20133. @param onProgress callback, will be called when the load progression change.
  20134. @param onComplete callback, will be called after scene loaded.
  20135. @example
  20136. ```js
  20137. bundle1.preloadScene('first');
  20138. // wait for a while
  20139. bundle1.loadScene('first', (err, scene) => cc.director.runScene(scene));
  20140. ```
  20141. */
  20142. preloadScene(sceneName: string, options: Record<string, any>, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error) => void): void;
  20143. preloadScene(sceneName: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error) => void): void;
  20144. preloadScene(sceneName: string, options: Record<string, any>, onComplete: (error: Error) => void): void;
  20145. preloadScene(sceneName: string, onComplete: (error: Error) => void): void;
  20146. preloadScene(sceneName: string, options: Record<string, any>): void;
  20147. preloadScene(sceneName: string): void;
  20148. /**
  20149. !#en
  20150. Get asset within this bundle by path and type. <br>
  20151. After you load asset with {{#crossLink "Bundle/load:method"}}{{/crossLink}} or {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}},
  20152. you can acquire them by passing the path to this API.
  20153. !#zh
  20154. 通过路径与类型获取资源。在你使用 {{#crossLink "Bundle/load:method"}}{{/crossLink}} 或者 {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} 之后,
  20155. 你能通过传路径通过这个 API 获取到这些资源。
  20156. @param path The path of asset
  20157. @param type Only asset of type will be returned if this argument is supplied.
  20158. @example
  20159. ```js
  20160. bundle1.get('music/hit', cc.AudioClip);
  20161. ```
  20162. */
  20163. get<T extends cc.Asset> (path: string, type?: typeof cc.Asset): T;
  20164. /**
  20165. !#en
  20166. Release the asset loaded by {{#crossLink "Bundle/load:method"}}{{/crossLink}} or {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} and it's dependencies.
  20167. Refer to {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} for detailed informations.
  20168. !#zh
  20169. 释放通过 {{#crossLink "Bundle/load:method"}}{{/crossLink}} 或者 {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  20170. @param path The path of asset
  20171. @param type Only asset of type will be released if this argument is supplied.
  20172. @example
  20173. ```js
  20174. // release a texture which is no longer need
  20175. bundle1.release('misc/character/cocos');
  20176. ```
  20177. */
  20178. release(path: string, type: typeof cc.Asset): void;
  20179. release(path: string): void;
  20180. /**
  20181. !#en
  20182. Release all assets within this bundle. Refer to {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}} for detailed informations.
  20183. !#zh
  20184. 释放此包中的所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}}
  20185. @example
  20186. ```js
  20187. // release all asset within bundle1
  20188. bundle1.releaseAll();
  20189. ```
  20190. */
  20191. releaseAll(): void;
  20192. }
  20193. /** !#en
  20194. Cache manager is a module which controls all caches downloaded from server in non-web platform, it is a singleton
  20195. All member can be accessed with `cc.assetManager.cacheManager`.
  20196. !#zh
  20197. 缓存管理器是一个模块,在非 WEB 平台上,用于管理所有从服务器上下载下来的缓存,这是一个单例,所有成员能通过 `cc.assetManager.cacheManager` 访问。 */
  20198. export class CacheManager {
  20199. /** !#en
  20200. The name of cacheDir
  20201. !#zh
  20202. 缓存目录的名称 */
  20203. cacheDir: string;
  20204. /** !#en
  20205. Whether or not cache asset into user's storage space, this property only works on mini-game platforms
  20206. !#zh
  20207. 是否缓存资源到用户存储空间,此属性只在小游戏平台有效 */
  20208. cacheEnabled: boolean;
  20209. /** !#en
  20210. Whether or not auto clear cache when storage ran out, this property only works on mini-game platforms
  20211. !#zh
  20212. 是否在存储空间满了后自动清理缓存,此属性只在小游戏平台有效 */
  20213. autoClear: boolean;
  20214. /** !#en
  20215. The interval between caching resources, this property only works on mini-game platforms, unit: ms
  20216. !#zh
  20217. 缓存资源的间隔时间,此属性只在小游戏平台有效,单位:ms */
  20218. cacheInterval: number;
  20219. /** !#en
  20220. The interval between deleting resources, when you use `cleanLRU`, the resources will be deleted as this interval, unit: ms
  20221. !#zh
  20222. 清理资源的间隔时间,当你使用 `cleanLRU` 时,资源将以此间隔被删除,单位:ms */
  20223. deleteInterval: number;
  20224. /** !#en
  20225. List of all cached files
  20226. !#zh
  20227. 所有缓存文件列表 */
  20228. cachedFiles: Cache<{ bundle: string, url: string, lastTime: url }>;
  20229. /**
  20230. !#en
  20231. Get cached path with origin url
  20232. !#zh
  20233. 通过原始 url 获取缓存后的路径
  20234. @param originUrl originUrl
  20235. */
  20236. getCache(originUrl: string): string;
  20237. /**
  20238. !#en
  20239. Get temporary path with origin url, this method only works on mini-game platforms
  20240. !#zh
  20241. 通过原始 url 获取临时文件的路径,此方法只在小游戏平台有效
  20242. @param originUrl originUrl
  20243. */
  20244. getTemp(originUrl: string): string;
  20245. /**
  20246. !#en
  20247. Clear all caches, please use with caution, If necessary, we recommend using it before the game is launched
  20248. !#zh
  20249. 清空所有缓存,请谨慎使用,如果必要的话,我们建议在游戏启动之前使用
  20250. */
  20251. clearCache(): void;
  20252. /**
  20253. !#en
  20254. Clear part of caches with LRU strategy
  20255. !#zh
  20256. 使用 LRU 策略清空部分缓存
  20257. */
  20258. clearLRU(): void;
  20259. /**
  20260. !#en
  20261. Remove cache with origin url
  20262. !#zh
  20263. 通过原始 url 移除缓存
  20264. */
  20265. removeCache(): void;
  20266. }
  20267. /** !#en
  20268. use to cache something
  20269. !#zh
  20270. 用于缓存某些内容 */
  20271. export class Cache<T = any> {
  20272. /**
  20273. !#en
  20274. Create a cache
  20275. !#zh
  20276. 创建一个 cache
  20277. @param map An object used to initialize
  20278. */
  20279. constructor(map?: Record<string, T>);
  20280. /**
  20281. !#en
  20282. Add Key-Value to cache
  20283. !#zh
  20284. 增加键值对到缓存中
  20285. @param key The key
  20286. @param val The value
  20287. @example
  20288. ```js
  20289. var cache = new Cache();
  20290. cache.add('test', null);
  20291. ```
  20292. */
  20293. add(key: string, val: T): T;
  20294. /**
  20295. !#en
  20296. Get the cached content by key
  20297. !#zh
  20298. 通过 key 获取对应的 value
  20299. @param key The key
  20300. @example
  20301. ```js
  20302. var cache = new Cache();
  20303. var test = cache.get('test');
  20304. ```
  20305. */
  20306. get(key: string): T;
  20307. /**
  20308. !#en
  20309. Check whether or not content exists by key
  20310. !#zh
  20311. 通过 Key 判断是否存在对应的内容
  20312. @param key The key
  20313. @example
  20314. ```js
  20315. var cache = new Cache();
  20316. var exist = cache.has('test');
  20317. ```
  20318. */
  20319. has(key: string): boolean;
  20320. /**
  20321. !#en
  20322. Remove the cached content by key
  20323. !#zh
  20324. 通过 Key 移除对应的内容
  20325. @param key The key
  20326. @example
  20327. ```js
  20328. var cache = new Cache();
  20329. var content = cache.remove('test');
  20330. ```
  20331. */
  20332. remove(key: string): T;
  20333. /**
  20334. !#en
  20335. Clear all content
  20336. !#zh
  20337. 清除所有内容
  20338. @example
  20339. ```js
  20340. var cache = new Cache();
  20341. cache.clear();
  20342. ```
  20343. */
  20344. clear():void;
  20345. /**
  20346. !#en
  20347. Enumerate all content and invoke function
  20348. !#zh
  20349. 枚举所有内容并执行方法
  20350. @param func Function to be invoked
  20351. @example
  20352. ```js
  20353. var cache = new Cache();
  20354. cache.forEach((val, key) => console.log(key));
  20355. ```
  20356. */
  20357. forEach(func: (val: T, key: string) => void): void;
  20358. /**
  20359. !#en
  20360. Enumerate all content to find one element which can fulfill condition
  20361. !#zh
  20362. 枚举所有内容,找到一个可以满足条件的元素
  20363. @param predicate The condition
  20364. @example
  20365. ```js
  20366. var cache = new Cache();
  20367. var val = cache.find((val, key) => key === 'test');
  20368. ```
  20369. */
  20370. find(predicate: (val: T, key: string) => boolean): T;
  20371. /** !#en
  20372. The count of cached content
  20373. !#zh
  20374. 缓存数量 */
  20375. count: number;
  20376. /**
  20377. !#en
  20378. Destroy this cache
  20379. !#zh
  20380. 销毁这个 cache
  20381. */
  20382. destroy(): void;
  20383. }
  20384. /** !#en
  20385. Control asset's dependency list, it is a singleton. All member can be accessed with `cc.assetManager.dependUtil`
  20386. !#zh
  20387. 控制资源的依赖列表,这是一个单例, 所有成员能通过 `cc.assetManager.dependUtil` 访问 */
  20388. export class DependUtil {
  20389. /**
  20390. !#en
  20391. Get asset's native dependency. For example, Texture's native dependency is image.
  20392. !#zh
  20393. 获取资源的原生依赖,例如 Texture 的原生依赖是图片
  20394. @param uuid asset's uuid
  20395. @example
  20396. ```js
  20397. var dep = dependUtil.getNativeDep('fcmR3XADNLgJ1ByKhqcC5Z');
  20398. ```
  20399. */
  20400. getNativeDep(uuid: string): Record<string, any>;
  20401. /**
  20402. !#en
  20403. Get asset's direct referencing non-native dependency list. For example, Material's non-native dependencies are Texture.
  20404. !#zh
  20405. 获取资源直接引用的非原生依赖列表,例如,材质的非原生依赖是 Texture
  20406. @param uuid asset's uuid
  20407. @example
  20408. ```js
  20409. var deps = dependUtil.getDeps('fcmR3XADNLgJ1ByKhqcC5Z');
  20410. ```
  20411. */
  20412. getDeps(uuid: string): string[];
  20413. /**
  20414. !#en
  20415. Get non-native dependency list of the loaded asset, include indirect reference.
  20416. The returned array stores the dependencies with their uuid, after retrieve dependencies,
  20417. !#zh
  20418. 获取某个已经加载好的资源的所有非原生依赖资源列表,包括间接引用的资源,并保存在数组中返回。
  20419. 返回的数组将仅保存依赖资源的 uuid。
  20420. @param uuid The asset's uuid
  20421. @example
  20422. ```js
  20423. var deps = dependUtil.getDepsRecursively('fcmR3XADNLgJ1ByKhqcC5Z');
  20424. ```
  20425. */
  20426. getDepsRecursively(uuid: string): string[];
  20427. }
  20428. /** !#en
  20429. Control all download process, it is a singleton. All member can be accessed with `cc.assetManager.downloader` , it can download several types of files:
  20430. 1. Text
  20431. 2. Image
  20432. 3. Audio
  20433. 4. Assets
  20434. 5. Scripts
  20435. !#zh
  20436. 管理所有下载过程,downloader 是个单例,所有成员能通过 `cc.assetManager.downloader` 访问,它能下载以下几种类型的文件:
  20437. 1. 文本
  20438. 2. 图片
  20439. 3. 音频
  20440. 4. 资源
  20441. 5. 脚本 */
  20442. export class Downloader {
  20443. /** !#en
  20444. The address of remote server
  20445. !#zh
  20446. 远程服务器地址 */
  20447. remoteServerAddress: string;
  20448. /** !#en
  20449. The maximum number of concurrent when downloading
  20450. !#zh
  20451. 下载时的最大并发数 */
  20452. maxConcurrency: number;
  20453. /** !#en
  20454. The maximum number of request can be launched per frame when downloading
  20455. !#zh
  20456. 下载时每帧可以启动的最大请求数 */
  20457. maxRequestsPerFrame: number;
  20458. /** !#en
  20459. The max number of retries when fail
  20460. !#zh
  20461. 失败重试次数 */
  20462. maxRetryCount: number;
  20463. /** !#en
  20464. Wait for while before another retry, unit: ms
  20465. !#zh
  20466. 重试的间隔时间 */
  20467. retryInterval: number;
  20468. /**
  20469. !#en
  20470. Register custom handler if you want to change default behavior or extend downloader to download other format file
  20471. !#zh
  20472. 当你想修改默认行为或者拓展 downloader 来下载其他格式文件时可以注册自定义的 handler
  20473. @param type Extension likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}
  20474. @param handler handler
  20475. @example
  20476. ```js
  20477. downloader.register('.tga', (url, options, onComplete) => onComplete(null, null));
  20478. downloader.register({'.tga': (url, options, onComplete) => onComplete(null, null), '.ext': (url, options, onComplete) => onComplete(null, null)});
  20479. ```
  20480. */
  20481. register(type: string, handler: (url: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void): void;
  20482. register(map: Record<string, (url: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void>): void;
  20483. /**
  20484. !#en
  20485. Use corresponding handler to download file under limitation
  20486. !#zh
  20487. 在限制下使用对应的 handler 来下载文件
  20488. @param url The url should be downloaded
  20489. @param type The type indicates that which handler should be used to download, such as '.jpg'
  20490. @param options some optional paramters will be transferred to the corresponding handler.
  20491. @param onComplete callback when finishing downloading
  20492. @example
  20493. ```js
  20494. download('http://example.com/test.tga', '.tga', {onFileProgress: (loaded, total) => console.lgo(loaded/total)}, onComplete: (err) => console.log(err));
  20495. ```
  20496. */
  20497. download(id: string, url: string, type: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void): void;
  20498. }
  20499. /** !#en
  20500. Provide some helpful function, it is a singleton. All member can be accessed with `cc.assetManager.utils`
  20501. !#zh
  20502. 提供一些辅助方法,helper 是一个单例, 所有成员能通过 `cc.assetManager.utils` 访问 */
  20503. export class Helper {
  20504. /**
  20505. !#en
  20506. Decode uuid, returns the original uuid
  20507. !#zh
  20508. 解码 uuid,返回原始 uuid
  20509. @param base64 the encoded uuid
  20510. @example
  20511. ```js
  20512. var uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  20513. var originalUuid = decodeUuid(uuid); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  20514. ```
  20515. */
  20516. decodeUuid(base64: string): string;
  20517. /**
  20518. !#en
  20519. Extract uuid from url
  20520. !#zh
  20521. 从 url 中提取 uuid
  20522. @param url url
  20523. @example
  20524. ```js
  20525. var url = 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  20526. var uuid = getUuidFromURL(url); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  20527. ```
  20528. */
  20529. getUuidFromURL(url: string): string;
  20530. /**
  20531. !#en
  20532. Transform uuid to url
  20533. !#zh
  20534. 转换 uuid 为 url
  20535. @param uuid The uuid of asset
  20536. @param options Some optional parameters
  20537. @example
  20538. ```js
  20539. // json path, 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  20540. var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: false});
  20541. // png path, 'assets/main/native/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.png';
  20542. var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: true, nativeExt: '.png'});
  20543. ```
  20544. */
  20545. getUrlWithUuid(uuid: string, options?: Record<string, any>): string;
  20546. /**
  20547. !#en
  20548. Check if the type of asset is scene
  20549. !#zh
  20550. 检查资源类型是否是场景
  20551. @param asset asset
  20552. */
  20553. isScene(asset: any): boolean;
  20554. /**
  20555. !#en
  20556. Normalize url, strip './' and '/'
  20557. !#zh
  20558. 标准化 url ,去除 './' 和 '/'
  20559. @param url url
  20560. */
  20561. normalize(url: string): string;
  20562. }
  20563. /** !#en
  20564. Handle the packed asset, include unpacking, loading, cache and so on. It is a singleton. All member can be accessed with `cc.assetManager.packManager`
  20565. !#zh
  20566. 处理打包资源,包括拆包,加载,缓存等等,这是一个单例, 所有成员能通过 `cc.assetManager.packManager` 访问 */
  20567. export class PackManager {
  20568. /**
  20569. !#en
  20570. Unpack the json, revert to what it was before packing
  20571. !#zh
  20572. 拆解 json 包,恢复为打包之前的内容
  20573. @param pack The pack
  20574. @param json The content of pack
  20575. @param options Some optional parameters
  20576. @param onComplete Callback when finish unpacking
  20577. @example
  20578. ```js
  20579. downloader.downloadFile('pack.json', {responseType: 'json'}, null, (err, file) => {
  20580. packManager.unpackJson(['a', 'b'], file, null, (err, data) => console.log(err));
  20581. });
  20582. ```
  20583. */
  20584. unpackJson(pack: string[], json: any, options: Record<string, any>, onComplete?: (err: Error, content: any) => void): void;
  20585. /**
  20586. !#en
  20587. Register custom handler if you want to change default behavior or extend packManager to unpack other format pack
  20588. !#zh
  20589. 当你想修改默认行为或者拓展 packManager 来拆分其他格式的包时可以注册自定义的 handler
  20590. @param type Extension likes '.bin' or map likes {'.bin': binHandler, '.ab': abHandler}
  20591. @param handler handler
  20592. @example
  20593. ```js
  20594. packManager.register('.bin', (packUuid, file, options, onComplete) => onComplete(null, null));
  20595. packManager.register({'.bin': (packUuid, file, options, onComplete) => onComplete(null, null), '.ab': (packUuid, file, options, onComplete) => onComplete(null, null)});
  20596. ```
  20597. */
  20598. register(type: string, handler: (packUuid: string, data: any, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void): void;
  20599. register(map: Record<string, (packUuid: string, data: any, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void>): void;
  20600. /**
  20601. !#en
  20602. Use corresponding handler to unpack package
  20603. !#zh
  20604. 用对应的 handler 来进行解包
  20605. @param pack The uuid of packed assets
  20606. @param data The packed data
  20607. @param type The type indicates that which handler should be used to download, such as '.jpg'
  20608. @param options Some optional parameter
  20609. @param onComplete callback when finishing unpacking
  20610. @example
  20611. ```js
  20612. downloader.downloadFile('pack.json', {responseType: 'json'}, null, (err, file) => {
  20613. packManager.unpack(['2fawq123d', '1zsweq23f'], file, '.json', null, (err, data) => console.log(err));
  20614. });
  20615. ```
  20616. */
  20617. unpack(pack: string[], data: any, type: string, options: Record<string, any>, onComplete?: (err: Error, data: any) => void): void;
  20618. /**
  20619. !#en
  20620. Download request item, If item is not in any package, download as usual. Otherwise, download the corresponding package and unpack it.
  20621. And then retrieve the corresponding content form it.
  20622. !#zh
  20623. 下载请求对象,如果请求对象不在任何包内,则正常下载,否则下载对应的 package 并进行拆解,并取回包内对应的内容
  20624. @param item Some item you want to download
  20625. @param options Some optional parameters
  20626. @param onComplete Callback when finished
  20627. @example
  20628. ```js
  20629. var requestItem = cc.AssetManager.RequestItem.create();
  20630. requestItem.uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  20631. requestItem.info = config.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  20632. packManager.load(requestItem, null, (err, data) => console.log(err));
  20633. ```
  20634. */
  20635. load(item: RequestItem, options: Record<string, any>, onComplete: (err: Error, data: any) => void): void;
  20636. }
  20637. /** !#en
  20638. Parse the downloaded file, it's a singleton, all member can be accessed with `cc.assetManager.parser`
  20639. !#zh
  20640. 解析已下载的文件,parser 是一个单例, 所有成员能通过 `cc.assetManaager.parser` 访问 */
  20641. export class Parser {
  20642. /**
  20643. !#en
  20644. Register custom handler if you want to change default behavior or extend parser to parse other format file
  20645. !#zh
  20646. 当你想修改默认行为或者拓展 parser 来解析其他格式文件时可以注册自定义的handler
  20647. @param type Extension likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}
  20648. @param handler The corresponding handler
  20649. @example
  20650. ```js
  20651. parser.register('.tga', (file, options, onComplete) => onComplete(null, null));
  20652. parser.register({'.tga': (file, options, onComplete) => onComplete(null, null), '.ext': (file, options, onComplete) => onComplete(null, null)});
  20653. ```
  20654. */
  20655. register(type: string, handler: (file: any, options: Record<string, any>, onComplete: (err: Error, data: any) => void) => void): void;
  20656. register(map: Record<string, (file: any, options: Record<string, any>, onComplete: (err: Error, data: any) => void) => void>): void;
  20657. /**
  20658. !#en
  20659. Use corresponding handler to parse file
  20660. !#zh
  20661. 使用对应的handler来解析文件
  20662. @param id The id of file
  20663. @param file File
  20664. @param type The corresponding type of file, likes '.jpg'.
  20665. @param options Some optional paramters will be transferred to the corresponding handler.
  20666. @param onComplete callback when finishing downloading
  20667. @example
  20668. ```js
  20669. downloader.downloadFile('test.jpg', {responseType: 'blob'}, null, (err, file) => {
  20670. parser.parse('test.jpg', file, '.jpg', null, (err, img) => console.log(err));
  20671. });
  20672. ```
  20673. */
  20674. parse(id: string, file: any, type: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void): void;
  20675. }
  20676. /** !#en
  20677. Pipeline can execute the task for some effect.
  20678. !#zh
  20679. 管线能执行任务达到某个效果 */
  20680. export class Pipeline {
  20681. /** !#en
  20682. The id of pipeline
  20683. !#zh
  20684. 管线的 id */
  20685. id: number;
  20686. /** !#en
  20687. The name of pipeline
  20688. !#zh
  20689. 管线的名字 */
  20690. name: string;
  20691. /** !#en
  20692. All pipes of pipeline
  20693. !#zh
  20694. 所有的管道 */
  20695. pipes: Function[];
  20696. /**
  20697. !#en
  20698. Create a new pipeline
  20699. !#zh
  20700. 创建一个管线
  20701. @param name The name of pipeline
  20702. @param funcs The array of pipe, every pipe must be function which take two parameters, the first is a `Task` flowed in pipeline, the second is complete callback
  20703. @example
  20704. ```js
  20705. var pipeline = new Pipeline('download', [
  20706. (task, done) => {
  20707. var url = task.input;
  20708. cc.assetManager.downloader.downloadFile(url, null, null, (err, result) => {
  20709. task.output = result;
  20710. done(err);
  20711. });
  20712. },
  20713. (task, done) => {
  20714. var text = task.input;
  20715. var json = JSON.stringify(text);
  20716. task.output = json;
  20717. done();
  20718. }
  20719. ]);
  20720. ```
  20721. */
  20722. constructor(name: string, funcs: Array<(task: Task, done?: (err: Error) => void) => void>);
  20723. /**
  20724. !#en
  20725. At specific point insert a new pipe to pipeline
  20726. !#zh
  20727. 在某个特定的点为管线插入一个新的 pipe
  20728. @param func The new pipe
  20729. @param index The specific point you want to insert at.
  20730. @example
  20731. ```js
  20732. var pipeline = new Pipeline('test', []);
  20733. pipeline.insert((task, done) => {
  20734. // do something
  20735. done();
  20736. }, 0);
  20737. ```
  20738. */
  20739. insert(func: (task: Task, callback?: (err: Error) => void) => void, index: number): Pipeline;
  20740. /**
  20741. !#en
  20742. Append a new pipe to the pipeline
  20743. !#zh
  20744. 添加一个管道到管线中
  20745. @param func The new pipe
  20746. @example
  20747. ```js
  20748. var pipeline = new Pipeline('test', []);
  20749. pipeline.append((task, done) => {
  20750. // do something
  20751. done();
  20752. });
  20753. ```
  20754. */
  20755. append(func: (task: Task, callback?: (err: Error) => void) => void): Pipeline;
  20756. /**
  20757. !#en
  20758. Remove pipe which at specific point
  20759. !#zh
  20760. 移除特定位置的管道
  20761. @param index The specific point
  20762. @example
  20763. ```js
  20764. var pipeline = new Pipeline('test', (task, done) => {
  20765. // do something
  20766. done();
  20767. });
  20768. pipeline.remove(0);
  20769. ```
  20770. */
  20771. remove(index: number): Pipeline;
  20772. /**
  20773. !#en
  20774. Execute task synchronously
  20775. !#zh
  20776. 同步执行任务
  20777. @param task The task will be executed
  20778. @example
  20779. ```js
  20780. var pipeline = new Pipeline('sync', [(task) => {
  20781. let input = task.input;
  20782. task.output = doSomething(task.input);
  20783. }]);
  20784. var task = new Task({input: 'test'});
  20785. console.log(pipeline.sync(task));
  20786. ```
  20787. */
  20788. sync(task: Task): any;
  20789. /**
  20790. !#en
  20791. Execute task asynchronously
  20792. !#zh
  20793. 异步执行任务
  20794. @param task The task will be executed
  20795. @example
  20796. ```js
  20797. var pipeline = new Pipeline('sync', [(task, done) => {
  20798. let input = task.input;
  20799. task.output = doSomething(task.input);
  20800. done();
  20801. }]);
  20802. var task = new Task({input: 'test', onComplete: (err, result) => console.log(result)});
  20803. pipeline.async(task);
  20804. ```
  20805. */
  20806. async(task: Task): void;
  20807. }
  20808. /** !#en
  20809. A collection of information about a request
  20810. !#zh
  20811. 请求的相关信息集合 */
  20812. export class RequestItem {
  20813. /** !#en
  20814. The uuid of request
  20815. !#zh
  20816. 请求资源的uuid */
  20817. uuid: string;
  20818. /** !#en
  20819. The final url of request
  20820. !#zh
  20821. 请求的最终url */
  20822. url: string;
  20823. /** !#en
  20824. The extension name of asset
  20825. !#zh
  20826. 资源的扩展名 */
  20827. ext: string;
  20828. /** !#en
  20829. The content of asset
  20830. !#zh
  20831. 资源的内容 */
  20832. content: any;
  20833. /** !#en
  20834. The file of asset
  20835. !#zh
  20836. 资源的文件 */
  20837. file: any;
  20838. /** !#en
  20839. The information of asset
  20840. !#zh
  20841. 资源的相关信息 */
  20842. info: any;
  20843. /** !#en
  20844. Whether or not it is native asset
  20845. !#zh
  20846. 资源是否是原生资源 */
  20847. isNative: boolean;
  20848. /** !#en
  20849. Custom options
  20850. !#zh
  20851. 自定义参数 */
  20852. options: any;
  20853. /**
  20854. !#en
  20855. Create a request item
  20856. !#zh
  20857. 创建一个 request item
  20858. */
  20859. constructor();
  20860. /** !#en
  20861. The id of request, combined from uuid and isNative
  20862. !#zh
  20863. 请求的 id, 由 uuid 和 isNative 组合而成 */
  20864. id: string;
  20865. /**
  20866. !#en
  20867. Recycle this for reuse
  20868. !#zh
  20869. 回收 requestItem 用于复用
  20870. */
  20871. recycle(): void;
  20872. /**
  20873. !#en
  20874. Create a new request item from pool
  20875. !#zh
  20876. 从对象池中创建 requestItem
  20877. */
  20878. static create(): RequestItem;
  20879. }
  20880. /** !#en
  20881. The builtin bundles
  20882. !#zh
  20883. 内置 bundle */
  20884. export enum BuiltinBundleName {
  20885. RESOURCES = 0,
  20886. INTERNAL = 0,
  20887. MAIN = 0,
  20888. START_SCENE = 0,
  20889. }
  20890. /** !#en
  20891. Task is used to run in the pipeline for some effect
  20892. !#zh
  20893. 任务用于在管线中运行以达成某种效果 */
  20894. export class Task {
  20895. /** !#en
  20896. The id of task
  20897. !#zh
  20898. 任务id */
  20899. id: number;
  20900. /** !#en
  20901. The callback when task is completed
  20902. !#zh
  20903. 完成回调 */
  20904. onComplete: Function;
  20905. /** !#en
  20906. The callback of progression
  20907. !#zh
  20908. 进度回调 */
  20909. onProgress: Function;
  20910. /** !#en
  20911. The callback when something goes wrong
  20912. !#zh
  20913. 错误回调 */
  20914. onError: Function;
  20915. /** !#en
  20916. The source of task
  20917. !#zh
  20918. 任务的源 */
  20919. source: any;
  20920. /** !#en
  20921. The output of task
  20922. !#zh
  20923. 任务的输出 */
  20924. output: any;
  20925. /** !#en
  20926. The input of task
  20927. !#zh
  20928. 任务的输入 */
  20929. input: any;
  20930. /** !#en
  20931. The progression of task
  20932. !#zh
  20933. 任务的进度 */
  20934. progress: any;
  20935. /** !#en
  20936. Custom options
  20937. !#zh
  20938. 自定义参数 */
  20939. options: any;
  20940. /**
  20941. !#en
  20942. Create a new Task
  20943. !#zh
  20944. 创建一个任务
  20945. @param options Some optional paramters
  20946. */
  20947. constructor(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>});
  20948. /**
  20949. !#en
  20950. Set paramters of this task
  20951. !#zh
  20952. 设置任务的参数
  20953. @param options Some optional paramters
  20954. @example
  20955. ```js
  20956. var task = new Task();
  20957. task.set({input: ['test'], onComplete: (err, result) => console.log(err), onProgress: (finish, total) => console.log(finish / total)});
  20958. ```
  20959. */
  20960. set(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>}): void;
  20961. /**
  20962. !#en
  20963. Dispatch event
  20964. !#zh
  20965. 发布事件
  20966. @param event The event name
  20967. @param param1 Parameter 1
  20968. @param param2 Parameter 2
  20969. @param param3 Parameter 3
  20970. @param param4 Parameter 4
  20971. @example
  20972. ```js
  20973. var task = Task.create();
  20974. Task.onComplete = (msg) => console.log(msg);
  20975. Task.dispatch('complete', 'hello world');
  20976. ```
  20977. */
  20978. dispatch(event: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
  20979. /**
  20980. !#en
  20981. Recycle this for reuse
  20982. !#zh
  20983. 回收 task 用于复用
  20984. */
  20985. recycle(): void;
  20986. /** !#en
  20987. Whether or not this task is completed
  20988. !#zh
  20989. 此任务是否已经完成 */
  20990. isFinish: boolean;
  20991. /**
  20992. !#en
  20993. Create a new task from pool
  20994. !#zh
  20995. 从对象池中创建 task
  20996. @param options Some optional paramters
  20997. */
  20998. static create(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>}): Task;
  20999. }
  21000. }
  21001. /** Some helpful utilities */
  21002. declare namespace cc.geomUtils {
  21003. /**
  21004. !#en
  21005. the distance between a point and a plane
  21006. !#zh
  21007. 计算点和平面之间的距离。
  21008. @param point point
  21009. @param plane plane
  21010. */
  21011. export function point_plane(point: cc.Vec3, plane: cc.Plane): number;
  21012. /**
  21013. !#en
  21014. the closest point on plane to a given point
  21015. !#zh
  21016. 计算平面上最接近给定点的点。
  21017. @param out Closest point
  21018. @param point Given point
  21019. @param plane plane
  21020. */
  21021. export function pt_point_plane(out: cc.Vec3, point: cc.Vec3, plane: cc.Plane): cc.Vec3;
  21022. /**
  21023. !#en
  21024. the closest point on aabb to a given point
  21025. !#zh
  21026. 计算 aabb 上最接近给定点的点。
  21027. @param out Closest point.
  21028. @param point Given point.
  21029. @param aabb Align the axis around the box.
  21030. */
  21031. export function pt_point_aabb(out: cc.Vec3, point: cc.Vec3, aabb: cc.Aabb): cc.Vec3;
  21032. /**
  21033. !#en
  21034. the closest point on obb to a given point
  21035. !#zh
  21036. 计算 obb 上最接近给定点的点。
  21037. @param out Closest point
  21038. @param point Given point
  21039. @param obb Direction box
  21040. */
  21041. export function pt_point_obb(out: cc.Vec3, point: cc.Vec3, obb: cc.Obb): cc.Vec3;
  21042. }
  21043. /** !#en Some JavaScript decorators which can be accessed with "cc._decorator".
  21044. !#zh 一些 JavaScript 装饰器,目前可以通过 "cc._decorator" 来访问。
  21045. (这些 API 仍不完全稳定,有可能随着 JavaScript 装饰器的标准实现而调整) */
  21046. declare namespace cc._decorator {
  21047. /**
  21048. !#en
  21049. Declare the standard [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
  21050. as CCClass, please see [Class](../../../manual/en/scripting/class.html) for details.
  21051. !#zh
  21052. 将标准写法的 [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) 声明为 CCClass,具体用法请参阅[类型定义](../../../manual/zh/scripting/class.html)。
  21053. @param name The class name used for serialization.
  21054. @example
  21055. ```js
  21056. const {ccclass} = cc._decorator;
  21057. // define a CCClass, omit the name
  21058. &#64;ccclass
  21059. class NewScript extends cc.Component {
  21060. // ...
  21061. }
  21062. // define a CCClass with a name
  21063. &#64;ccclass('LoginData')
  21064. class LoginData {
  21065. // ...
  21066. }
  21067. ```
  21068. */
  21069. export function ccclass(name?: string): Function;
  21070. export function ccclass(_class?: Function): void;
  21071. /**
  21072. !#en
  21073. Declare property for [CCClass](../../../manual/en/scripting/reference/attributes.html).
  21074. !#zh
  21075. 定义 [CCClass](../../../manual/zh/scripting/reference/attributes.html) 所用的属性。
  21076. @param options an object with some property attributes
  21077. @example
  21078. ```js
  21079. const {ccclass, property} = cc._decorator;
  21080. &#64;ccclass
  21081. class NewScript extends cc.Component {
  21082. &#64;property({
  21083. type: cc.Node
  21084. })
  21085. targetNode1 = null;
  21086. &#64;property(cc.Node)
  21087. targetNode2 = null;
  21088. &#64;property(cc.Button)
  21089. targetButton = null;
  21090. &#64;property
  21091. _width = 100;
  21092. &#64;property
  21093. get width () {
  21094. return this._width;
  21095. }
  21096. &#64;property
  21097. set width (value) {
  21098. this._width = value;
  21099. }
  21100. &#64;property
  21101. offset = new cc.Vec2(100, 100);
  21102. &#64;property(cc.Vec2)
  21103. offsets = [];
  21104. &#64;property(cc.SpriteFrame)
  21105. frame = null;
  21106. }
  21107. // above is equivalent to (上面的代码相当于):
  21108. var NewScript = cc.Class({
  21109. properties: {
  21110. targetNode1: {
  21111. default: null,
  21112. type: cc.Node
  21113. },
  21114. targetNode2: {
  21115. default: null,
  21116. type: cc.Node
  21117. },
  21118. targetButton: {
  21119. default: null,
  21120. type: cc.Button
  21121. },
  21122. _width: 100,
  21123. width: {
  21124. get () {
  21125. return this._width;
  21126. },
  21127. set (value) {
  21128. this._width = value;
  21129. }
  21130. },
  21131. offset: new cc.Vec2(100, 100)
  21132. offsets: {
  21133. default: [],
  21134. type: cc.Vec2
  21135. }
  21136. frame: {
  21137. default: null,
  21138. type: cc.SpriteFrame
  21139. },
  21140. }
  21141. });
  21142. ```
  21143. */
  21144. export function property(options?: {type?: any; visible?: boolean|(() => boolean); displayName?: string; tooltip?: string; multiline?: boolean; readonly?: boolean; min?: number; max?: number; step?: number; range?: number[]; slide?: boolean; serializable?: boolean; formerlySerializedAs?: string; editorOnly?: boolean; override?: boolean; animatable?: boolean} | any[]|Function|cc.ValueType|number|string|boolean): Function;
  21145. export function property(_target: Object, _key: any, _desc?: any): void;
  21146. /**
  21147. !#en
  21148. Makes a CCClass that inherit from component execute in edit mode.<br>
  21149. By default, all components are only executed in play mode,
  21150. which means they will not have their callback functions executed while the Editor is in edit mode.
  21151. !#zh
  21152. 允许继承自 Component 的 CCClass 在编辑器里执行。<br>
  21153. 默认情况下,所有 Component 都只会在运行时才会执行,也就是说它们的生命周期回调不会在编辑器里触发。
  21154. @example
  21155. ```js
  21156. const {ccclass, executeInEditMode} = cc._decorator;
  21157. &#64;ccclass
  21158. &#64;executeInEditMode
  21159. class NewScript extends cc.Component {
  21160. // ...
  21161. }
  21162. ```
  21163. */
  21164. export function executeInEditMode(): Function;
  21165. export function executeInEditMode(_class: Function): void;
  21166. /**
  21167. !#en
  21168. Automatically add required component as a dependency for the CCClass that inherit from component.
  21169. !#zh
  21170. 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
  21171. @param requiredComponent requiredComponent
  21172. @example
  21173. ```js
  21174. const {ccclass, requireComponent} = cc._decorator;
  21175. &#64;ccclass
  21176. &#64;requireComponent(cc.Sprite)
  21177. class SpriteCtrl extends cc.Component {
  21178. // ...
  21179. }
  21180. ```
  21181. */
  21182. export function requireComponent(requiredComponent: typeof cc.Component): Function;
  21183. /**
  21184. !#en
  21185. The menu path to register a component to the editors "Component" menu. Eg. "Rendering/CameraCtrl".
  21186. !#zh
  21187. 将当前组件添加到组件菜单中,方便用户查找。例如 "Rendering/CameraCtrl"。
  21188. @param path The path is the menu represented like a pathname.
  21189. For example the menu could be "Rendering/CameraCtrl".
  21190. @example
  21191. ```js
  21192. const {ccclass, menu} = cc._decorator;
  21193. &#64;ccclass
  21194. &#64;menu("Rendering/CameraCtrl")
  21195. class NewScript extends cc.Component {
  21196. // ...
  21197. }
  21198. ```
  21199. */
  21200. export function menu(path: string): Function;
  21201. /**
  21202. !#en
  21203. The execution order of lifecycle methods for Component.
  21204. Those less than 0 will execute before while those greater than 0 will execute after.
  21205. The order will only affect onLoad, onEnable, start, update and lateUpdate while onDisable and onDestroy will not be affected.
  21206. !#zh
  21207. 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
  21208. @param order The execution order of lifecycle methods for Component. Those less than 0 will execute before while those greater than 0 will execute after.
  21209. @example
  21210. ```js
  21211. const {ccclass, executionOrder} = cc._decorator;
  21212. &#64;ccclass
  21213. &#64;executionOrder(1)
  21214. class CameraCtrl extends cc.Component {
  21215. // ...
  21216. }
  21217. ```
  21218. */
  21219. export function executionOrder(order: number): Function;
  21220. /**
  21221. !#en
  21222. Prevents Component of the same type (or subtype) to be added more than once to a Node.
  21223. !#zh
  21224. 防止多个相同类型(或子类型)的组件被添加到同一个节点。
  21225. @example
  21226. ```js
  21227. const {ccclass, disallowMultiple} = cc._decorator;
  21228. &#64;ccclass
  21229. &#64;disallowMultiple
  21230. class CameraCtrl extends cc.Component {
  21231. // ...
  21232. }
  21233. ```
  21234. */
  21235. export function disallowMultiple(): Function;
  21236. export function disallowMultiple(_class: Function): void;
  21237. /**
  21238. !#en
  21239. If specified, the editor's scene view will keep updating this node in 60 fps when it is selected, otherwise, it will update only if necessary.<br>
  21240. This property is only available if executeInEditMode is true.
  21241. !#zh
  21242. 当指定了 "executeInEditMode" 以后,playOnFocus 可以在选中当前组件所在的节点时,提高编辑器的场景刷新频率到 60 FPS,否则场景就只会在必要的时候进行重绘。
  21243. @example
  21244. ```js
  21245. const {ccclass, playOnFocus, executeInEditMode} = cc._decorator;
  21246. &#64;ccclass
  21247. &#64;executeInEditMode
  21248. &#64;playOnFocus
  21249. class CameraCtrl extends cc.Component {
  21250. // ...
  21251. }
  21252. ```
  21253. */
  21254. export function playOnFocus(): Function;
  21255. export function playOnFocus(_class: Function): void;
  21256. /**
  21257. !#en
  21258. Specifying the url of the custom html to draw the component in **Properties**.
  21259. !#zh
  21260. 自定义当前组件在 **属性检查器** 中渲染时所用的网页 url。
  21261. @param url url
  21262. @example
  21263. ```js
  21264. const {ccclass, inspector} = cc._decorator;
  21265. &#64;ccclass
  21266. &#64;inspector("packages://inspector/inspectors/comps/camera-ctrl.js")
  21267. class NewScript extends cc.Component {
  21268. // ...
  21269. }
  21270. ```
  21271. */
  21272. export function inspector(path: string): Function;
  21273. /**
  21274. !#en
  21275. The custom documentation URL.
  21276. !#zh
  21277. 指定当前组件的帮助文档的 url,设置过后,在 **属性检查器** 中就会出现一个帮助图标,用户点击将打开指定的网页。
  21278. @param url url
  21279. @example
  21280. ```js
  21281. const {ccclass, help} = cc._decorator;
  21282. &#64;ccclass
  21283. &#64;help("app://docs/html/components/spine.html")
  21284. class NewScript extends cc.Component {
  21285. // ...
  21286. }
  21287. ```
  21288. */
  21289. export function help(path: string): Function;
  21290. /**
  21291. NOTE:<br>
  21292. The old mixins implemented in cc.Class(ES5) behaves exact the same as multiple inheritance.
  21293. But since ES6, class constructor can't be function-called and class methods become non-enumerable,
  21294. so we can not mix in ES6 Classes.<br>
  21295. See:<br>
  21296. [https://esdiscuss.org/topic/traits-are-now-impossible-in-es6-until-es7-since-rev32](https://esdiscuss.org/topic/traits-are-now-impossible-in-es6-until-es7-since-rev32)<br>
  21297. One possible solution (but IDE unfriendly):<br>
  21298. [http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/)<br>
  21299. <br>
  21300. NOTE:<br>
  21301. You must manually call mixins constructor, this is different from cc.Class(ES5).
  21302. @param ctor constructors to mix, only support ES5 constructors or classes defined by using `cc.Class`,
  21303. not support ES6 Classes.
  21304. @example
  21305. ```js
  21306. const {ccclass, mixins} = cc._decorator;
  21307. class Animal { ... }
  21308. const Fly = cc.Class({
  21309. constructor () { ... }
  21310. });
  21311. &#64;ccclass
  21312. &#64;mixins(cc.EventTarget, Fly)
  21313. class Bird extends Animal {
  21314. constructor () {
  21315. super();
  21316. // You must manually call mixins constructor, this is different from cc.Class(ES5)
  21317. cc.EventTarget.call(this);
  21318. Fly.call(this);
  21319. }
  21320. // ...
  21321. }
  21322. ```
  21323. */
  21324. export function mixins(ctor: Function, ...rest: Function[]): Function;
  21325. }
  21326. /** !#en This module provides some JavaScript utilities. All members can be accessed with `cc.js`.
  21327. !#zh 这个模块封装了 JavaScript 相关的一些实用函数,你可以通过 `cc.js` 来访问这个模块。 */
  21328. declare namespace cc.js {
  21329. /**
  21330. Check the obj whether is number or not
  21331. If a number is created by using 'new Number(10086)', the typeof it will be "object"...
  21332. Then you can use this function if you care about this case.
  21333. @param obj obj
  21334. */
  21335. export function isNumber(obj: any): boolean;
  21336. /**
  21337. Check the obj whether is string or not.
  21338. If a string is created by using 'new String("blabla")', the typeof it will be "object"...
  21339. Then you can use this function if you care about this case.
  21340. @param obj obj
  21341. */
  21342. export function isString(obj: any): boolean;
  21343. /**
  21344. Copy all properties not defined in obj from arguments[1...n]
  21345. @param obj object to extend its properties
  21346. @param sourceObj source object to copy properties from
  21347. */
  21348. export function addon(obj: any, ...sourceObj: any[]): any;
  21349. /**
  21350. copy all properties from arguments[1...n] to obj
  21351. @param obj obj
  21352. @param sourceObj sourceObj
  21353. */
  21354. export function mixin(obj: any, ...sourceObj: any[]): any;
  21355. /**
  21356. Derive the class from the supplied base class.
  21357. Both classes are just native javascript constructors, not created by cc.Class, so
  21358. usually you will want to inherit using {{#crossLink "cc/Class:method"}}cc.Class {{/crossLink}} instead.
  21359. @param cls cls
  21360. @param base the baseclass to inherit
  21361. */
  21362. export function extend(cls: Function, base: Function): Function;
  21363. /**
  21364. Get super class
  21365. @param ctor the constructor of subclass
  21366. */
  21367. export function getSuper(ctor: Function): Function;
  21368. /**
  21369. Checks whether subclass is child of superclass or equals to superclass
  21370. @param subclass subclass
  21371. @param superclass superclass
  21372. */
  21373. export function isChildClassOf(subclass: Function, superclass: Function): boolean;
  21374. /**
  21375. Removes all enumerable properties from object
  21376. @param obj obj
  21377. */
  21378. export function clear(obj: any): void;
  21379. /**
  21380. Checks whether obj is an empty object
  21381. @param obj obj
  21382. */
  21383. export function isEmptyObject(obj: any): boolean;
  21384. /**
  21385. Get property descriptor in object and all its ancestors
  21386. @param obj obj
  21387. @param name name
  21388. */
  21389. export function getPropertyDescriptor(obj: any, name: string): any;
  21390. /**
  21391. Define value, just help to call Object.defineProperty.<br>
  21392. The configurable will be true.
  21393. @param obj obj
  21394. @param prop prop
  21395. @param value value
  21396. @param writable writable
  21397. @param enumerable enumerable
  21398. */
  21399. export function value(obj: any, prop: string, value: any, writable?: boolean, enumerable?: boolean): void;
  21400. /**
  21401. Define get set accessor, just help to call Object.defineProperty(...)
  21402. @param obj obj
  21403. @param prop prop
  21404. @param getter getter
  21405. @param setter setter
  21406. @param enumerable enumerable
  21407. @param configurable configurable
  21408. */
  21409. export function getset(obj: any, prop: string, getter: Function, setter?: Function, enumerable?: boolean, configurable?: boolean): void;
  21410. /**
  21411. Define get accessor, just help to call Object.defineProperty(...)
  21412. @param obj obj
  21413. @param prop prop
  21414. @param getter getter
  21415. @param enumerable enumerable
  21416. @param configurable configurable
  21417. */
  21418. export function get(obj: any, prop: string, getter: Function, enumerable?: boolean, configurable?: boolean): void;
  21419. /**
  21420. Define set accessor, just help to call Object.defineProperty(...)
  21421. @param obj obj
  21422. @param prop prop
  21423. @param setter setter
  21424. @param enumerable enumerable
  21425. @param configurable configurable
  21426. */
  21427. export function set(obj: any, prop: string, setter: Function, enumerable?: boolean, configurable?: boolean): void;
  21428. /**
  21429. Get class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
  21430. (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code from this stackoverflow post</a>)
  21431. @param objOrCtor instance or constructor
  21432. */
  21433. export function getClassName(objOrCtor: any|Function): string;
  21434. /** !#en All classes registered in the engine, indexed by ID.
  21435. !#zh 引擎中已注册的所有类型,通过 ID 进行索引。 */
  21436. export var _registeredClassIds: any;
  21437. /** !#en All classes registered in the engine, indexed by name.
  21438. !#zh 引擎中已注册的所有类型,通过名称进行索引。 */
  21439. export var _registeredClassNames: any;
  21440. /**
  21441. Register the class by specified name manually
  21442. @param className className
  21443. @param constructor constructor
  21444. */
  21445. export function setClassName(className: string, constructor: Function): void;
  21446. /**
  21447. Unregister a class from fireball.
  21448. If you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.
  21449. Please note that its still your responsibility to free other references to the class.
  21450. @param constructor the class you will want to unregister, any number of classes can be added
  21451. */
  21452. export function unregisterClass(...constructor: Function[]): void;
  21453. /**
  21454. Get the registered class by name
  21455. @param classname classname
  21456. */
  21457. export function getClassByName(classname: string): Function;
  21458. /**
  21459. Defines a polyfill field for deprecated codes.
  21460. @param obj YourObject or YourClass.prototype
  21461. @param obsoleted "OldParam" or "YourClass.OldParam"
  21462. @param newExpr "NewParam" or "YourClass.NewParam"
  21463. @param writable writable
  21464. */
  21465. export function obsolete(obj: any, obsoleted: string, newExpr: string, writable?: boolean): void;
  21466. /**
  21467. Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.
  21468. @param obj YourObject or YourClass.prototype
  21469. @param objName "YourObject" or "YourClass"
  21470. @param props props
  21471. @param writable writable
  21472. */
  21473. export function obsoletes(obj: any, objName: any, props: any, writable?: boolean): void;
  21474. /**
  21475. A string tool to construct a string with format string.
  21476. @param msg A JavaScript string containing zero or more substitution strings (%s).
  21477. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  21478. @example
  21479. ```js
  21480. cc.js.formatStr("a: %s, b: %s", a, b);
  21481. cc.js.formatStr(a, b, c);
  21482. ```
  21483. */
  21484. export function formatStr(msg: string|any, ...subst: any[]): string;
  21485. /**
  21486. !#en
  21487. A simple wrapper of `Object.create(null)` which ensures the return object have no prototype (and thus no inherited members). So we can skip `hasOwnProperty` calls on property lookups. It is a worthwhile optimization than the `{}` literal when `hasOwnProperty` calls are necessary.
  21488. !#zh
  21489. 该方法是对 `Object.create(null)` 的简单封装。`Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断。在需要频繁判断 `hasOwnProperty` 时,使用这个方法性能会比 `{}` 更高。
  21490. @param forceDictMode Apply the delete operator to newly created map object. This causes V8 to put the object in "dictionary mode" and disables creation of hidden classes which are very expensive for objects that are constantly changing shape.
  21491. */
  21492. export function createMap(forceDictMode?: boolean): any;
  21493. /** undefined */
  21494. export class array {
  21495. /**
  21496. Removes the array item at the specified index.
  21497. @param array array
  21498. @param index index
  21499. */
  21500. static removeAt(array: any[], index: number): void;
  21501. /**
  21502. Removes the array item at the specified index.
  21503. It's faster but the order of the array will be changed.
  21504. @param array array
  21505. @param index index
  21506. */
  21507. static fastRemoveAt(array: any[], index: number): void;
  21508. /**
  21509. Removes the first occurrence of a specific object from the array.
  21510. @param array array
  21511. @param value value
  21512. */
  21513. static remove(array: any[], value: any): boolean;
  21514. /**
  21515. Removes the first occurrence of a specific object from the array.
  21516. It's faster but the order of the array will be changed.
  21517. @param array array
  21518. @param value value
  21519. */
  21520. static fastRemove(array: any[], value: number): void;
  21521. /**
  21522. Verify array's Type
  21523. @param array array
  21524. @param type type
  21525. */
  21526. static verifyType(array: any[], type: Function): boolean;
  21527. /**
  21528. Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.
  21529. @param array Source Array
  21530. @param minusArr minus Array
  21531. */
  21532. static removeArray(array: any[], minusArr: any[]): void;
  21533. /**
  21534. Inserts some objects at index
  21535. @param array array
  21536. @param addObjs addObjs
  21537. @param index index
  21538. */
  21539. static appendObjectsAt(array: any[], addObjs: any[], index: number): any[];
  21540. /**
  21541. Determines whether the array contains a specific value.
  21542. @param array array
  21543. @param value value
  21544. */
  21545. static contains(array: any[], value: any): boolean;
  21546. /**
  21547. Copy an array's item to a new array (its performance is better than Array.slice)
  21548. @param array array
  21549. */
  21550. static copy(array: any[]): any[];
  21551. }
  21552. /** !#en
  21553. A fixed-length object pool designed for general type.<br>
  21554. The implementation of this object pool is very simple,
  21555. it can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  21556. !#zh
  21557. 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
  21558. 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。 */
  21559. export class Pool {
  21560. /**
  21561. !#en
  21562. Constructor for creating an object pool for the specific object type.
  21563. You can pass a callback argument for process the cleanup logic when the object is recycled.
  21564. !#zh
  21565. 使用构造函数来创建一个指定对象类型的对象池,您可以传递一个回调函数,用于处理对象回收时的清理逻辑。
  21566. @param cleanupFunc the callback method used to process the cleanup logic when the object is recycled.
  21567. @param size initializes the length of the array
  21568. */
  21569. constructor(cleanupFunc: (obj: any) => void, size: number);
  21570. constructor(size: number);
  21571. /**
  21572. !#en
  21573. Get and initialize an object from pool. This method defaults to null and requires the user to implement it.
  21574. !#zh
  21575. 获取并初始化对象池中的对象。这个方法默认为空,需要用户自己实现。
  21576. @param params parameters to used to initialize the object
  21577. */
  21578. get(...params: any[]): any;
  21579. /** !#en
  21580. The current number of available objects, the default is 0, it will gradually increase with the recycle of the object,
  21581. the maximum will not exceed the size specified when the constructor is called.
  21582. !#zh
  21583. 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。 */
  21584. count: number;
  21585. /**
  21586. !#en
  21587. Get an object from pool, if no available object in the pool, null will be returned.
  21588. !#zh
  21589. 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  21590. */
  21591. _get(): any;
  21592. /**
  21593. !#en Put an object into the pool.
  21594. !#zh 向对象池返还一个不再需要的对象。
  21595. */
  21596. put(): void;
  21597. /**
  21598. !#en Resize the pool.
  21599. !#zh 设置对象池容量。
  21600. */
  21601. resize(): void;
  21602. }
  21603. }
  21604. /** !#en A basic module for creating vertex data for 3D objects. You can access this module by `cc.primitive`.
  21605. !#zh 一个创建 3D 物体顶点数据的基础模块,你可以通过 `cc.primitive` 来访问这个模块。 */
  21606. declare namespace cc.primitive {
  21607. /**
  21608. !#en Create box vertex data
  21609. !#zh 创建长方体顶点数据
  21610. @param width width
  21611. @param height height
  21612. @param length length
  21613. @param opts opts
  21614. */
  21615. export function box(width: number, height: number, length: number, opts: {widthSegments: number; heightSegments: number; lengthSegments: number; }): cc.VertexData;
  21616. /**
  21617. !#en Create cone vertex data
  21618. !#zh 创建圆锥体顶点数据
  21619. @param radius radius
  21620. @param height height
  21621. @param opts opts
  21622. */
  21623. export function cone(radius: number, height: number, opts: {radialSegments: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21624. /**
  21625. !#en Create cylinder vertex data
  21626. !#zh 创建圆柱体顶点数据
  21627. @param radiusTop radiusTop
  21628. @param radiusBottom radiusBottom
  21629. @param height height
  21630. @param opts opts
  21631. */
  21632. export function cylinder(radiusTop: number, radiusBottom: number, height: number, opts: {radialSegments: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21633. /**
  21634. !#en Create plane vertex data
  21635. !#zh 创建平台顶点数据
  21636. @param width width
  21637. @param length length
  21638. @param opts opts
  21639. */
  21640. export function plane(width: number, length: number, opts: {widthSegments: number; lengthSegments: number; }): cc.VertexData;
  21641. /**
  21642. !#en Create quad vertex data
  21643. !#zh 创建面片顶点数据
  21644. */
  21645. export function quad(): cc.VertexData;
  21646. /**
  21647. !#en Create sphere vertex data
  21648. !#zh 创建球体顶点数据
  21649. @param radius radius
  21650. @param opts opts
  21651. */
  21652. export function sphere(radius: number, opts: {segments: number; }): cc.VertexData;
  21653. /**
  21654. !#en Create torus vertex data
  21655. !#zh 创建圆环顶点数据
  21656. @param radius radius
  21657. @param tube tube
  21658. @param opts opts
  21659. */
  21660. export function torus(radius: number, tube: number, opts: {radialSegments: number; tubularSegments: number; arc: number; }): cc.VertexData;
  21661. /**
  21662. !#en Create capsule vertex data
  21663. !#zh 创建胶囊体顶点数据
  21664. @param radiusTop radiusTop
  21665. @param radiusBottom radiusBottom
  21666. @param height height
  21667. @param opts opts
  21668. */
  21669. export function capsule(radiusTop: number, radiusBottom: number, height: number, opts: {sides: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21670. /**
  21671. !#en Create polyhedron vertex data
  21672. !#zh 创建多面体顶点数据
  21673. @param type type
  21674. @param Size Size
  21675. @param opts opts
  21676. */
  21677. export function polyhedron(type: cc.primitive.PolyhedronType, Size: number, opts: {sizeX: number; sizeY: number; sizeZ: number; }): cc.VertexData;
  21678. }
  21679. declare let CC_JSB: boolean
  21680. declare let CC_NATIVERENDERER: boolean
  21681. declare let CC_EDITOR: boolean
  21682. declare let CC_PREVIEW: boolean
  21683. declare let CC_TEST: boolean
  21684. declare let CC_DEBUG: boolean
  21685. declare let cc: {
  21686. // polyfills: {
  21687. // destroyObject? (object: any): void;
  21688. // };
  21689. [x: string]: any;
  21690. }
  21691. declare let Editor: any;
  21692. // https://medium.com/dailyjs/typescript-create-a-condition-based-subset-types-9d902cea5b8c
  21693. type FlagExcludedType<Base, Type> = { [Key in keyof Base]: Base[Key] extends Type ? never : Key };
  21694. type AllowedNames<Base, Type> = FlagExcludedType<Base, Type>[keyof Base];
  21695. type KeyPartial<T, K extends keyof T> = { [P in K]?: T[P] };
  21696. type OmitType<Base, Type> = KeyPartial<Base, AllowedNames<Base, Type>>;
  21697. type ConstructorType<T> = OmitType<T, Function>;
  21698. declare interface IWritableArrayLike<T> {
  21699. readonly length: number;
  21700. [index: number]: T;
  21701. }
  21702. declare let module: {
  21703. exports: object
  21704. }
  21705. declare interface Math {
  21706. sign(v: number);
  21707. }
  21708. declare interface Object {
  21709. assign(target: {}, source: {});
  21710. }
  21711. type FloatArray = Float64Array | Float32Array;
  21712. interface IColorLike {
  21713. r: number;
  21714. g: number;
  21715. b: number;
  21716. a: number;
  21717. _val: number;
  21718. }
  21719. interface IMat3Like {
  21720. m: FloatArray
  21721. }
  21722. interface IMat4Like {
  21723. m: FloatArray
  21724. }
  21725. interface IQuatLike {
  21726. x: number;
  21727. y: number;
  21728. z: number;
  21729. w: number;
  21730. }
  21731. interface IRectLike {
  21732. x: number;
  21733. y: number;
  21734. width: number;
  21735. height: number;
  21736. }
  21737. interface ISizeLike {
  21738. width: number;
  21739. height: number;
  21740. }
  21741. interface IVec2Like {
  21742. x: number;
  21743. y: number;
  21744. }
  21745. interface IVec3Like {
  21746. x: number;
  21747. y: number;
  21748. z: number;
  21749. }
  21750. interface IVec4Like {
  21751. x: number;
  21752. y: number;
  21753. z: number;
  21754. w: number;
  21755. }
  21756. declare namespace dragonBones {
  21757. /**
  21758. * @internal
  21759. * @private
  21760. */
  21761. const webAssemblyModule: {
  21762. HEAP16: Int16Array;
  21763. _malloc(byteSize: number): number;
  21764. _free(pointer: number): void;
  21765. setDataBinary(data: DragonBonesData, binaryPointer: number, intBytesLength: number, floatBytesLength: number, frameIntBytesLength: number, frameFloatBytesLength: number, frameBytesLength: number, timelineBytesLength: number): void;
  21766. };
  21767. }
  21768. /**
  21769. * The MIT License (MIT)
  21770. *
  21771. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21772. *
  21773. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21774. * this software and associated documentation files (the "Software"), to deal in
  21775. * the Software without restriction, including without limitation the rights to
  21776. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21777. * the Software, and to permit persons to whom the Software is furnished to do so,
  21778. * subject to the following conditions:
  21779. *
  21780. * The above copyright notice and this permission notice shall be included in all
  21781. * copies or substantial portions of the Software.
  21782. *
  21783. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21784. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21785. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21786. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21787. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21788. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21789. */
  21790. declare namespace dragonBones {
  21791. /**
  21792. * @internal
  21793. * @private
  21794. */
  21795. const enum BinaryOffset {
  21796. WeigthBoneCount = 0,
  21797. WeigthFloatOffset = 1,
  21798. WeigthBoneIndices = 2,
  21799. MeshVertexCount = 0,
  21800. MeshTriangleCount = 1,
  21801. MeshFloatOffset = 2,
  21802. MeshWeightOffset = 3,
  21803. MeshVertexIndices = 4,
  21804. TimelineScale = 0,
  21805. TimelineOffset = 1,
  21806. TimelineKeyFrameCount = 2,
  21807. TimelineFrameValueCount = 3,
  21808. TimelineFrameValueOffset = 4,
  21809. TimelineFrameOffset = 5,
  21810. FramePosition = 0,
  21811. FrameTweenType = 1,
  21812. FrameTweenEasingOrCurveSampleCount = 2,
  21813. FrameCurveSamples = 3,
  21814. DeformMeshOffset = 0,
  21815. DeformCount = 1,
  21816. DeformValueCount = 2,
  21817. DeformValueOffset = 3,
  21818. DeformFloatOffset = 4,
  21819. }
  21820. /**
  21821. * @internal
  21822. * @private
  21823. */
  21824. const enum ArmatureType {
  21825. Armature = 0,
  21826. MovieClip = 1,
  21827. Stage = 2,
  21828. }
  21829. /**
  21830. * @internal
  21831. * @private
  21832. */
  21833. const enum BoneType {
  21834. Bone = 0,
  21835. Surface = 1,
  21836. }
  21837. /**
  21838. * @private
  21839. */
  21840. const enum DisplayType {
  21841. Image = 0,
  21842. Armature = 1,
  21843. Mesh = 2,
  21844. BoundingBox = 3,
  21845. }
  21846. /**
  21847. * - Bounding box type.
  21848. * @version DragonBones 5.0
  21849. * @language en_US
  21850. */
  21851. /**
  21852. * - 边界框类型。
  21853. * @version DragonBones 5.0
  21854. * @language zh_CN
  21855. */
  21856. const enum BoundingBoxType {
  21857. Rectangle = 0,
  21858. Ellipse = 1,
  21859. Polygon = 2,
  21860. }
  21861. /**
  21862. * @internal
  21863. * @private
  21864. */
  21865. const enum ActionType {
  21866. Play = 0,
  21867. Frame = 10,
  21868. Sound = 11,
  21869. }
  21870. /**
  21871. * @internal
  21872. * @private
  21873. */
  21874. const enum BlendMode {
  21875. Normal = 0,
  21876. Add = 1,
  21877. Alpha = 2,
  21878. Darken = 3,
  21879. Difference = 4,
  21880. Erase = 5,
  21881. HardLight = 6,
  21882. Invert = 7,
  21883. Layer = 8,
  21884. Lighten = 9,
  21885. Multiply = 10,
  21886. Overlay = 11,
  21887. Screen = 12,
  21888. Subtract = 13,
  21889. }
  21890. /**
  21891. * @internal
  21892. * @private
  21893. */
  21894. const enum TweenType {
  21895. None = 0,
  21896. Line = 1,
  21897. Curve = 2,
  21898. QuadIn = 3,
  21899. QuadOut = 4,
  21900. QuadInOut = 5,
  21901. }
  21902. /**
  21903. * @internal
  21904. * @private
  21905. */
  21906. const enum TimelineType {
  21907. Action = 0,
  21908. ZOrder = 1,
  21909. BoneAll = 10,
  21910. BoneTranslate = 11,
  21911. BoneRotate = 12,
  21912. BoneScale = 13,
  21913. Surface = 50,
  21914. SlotDisplay = 20,
  21915. SlotColor = 21,
  21916. SlotFFD = 22,
  21917. IKConstraint = 30,
  21918. AnimationTime = 40,
  21919. AnimationWeight = 41,
  21920. }
  21921. /**
  21922. * - Offset mode.
  21923. * @version DragonBones 5.5
  21924. * @language en_US
  21925. */
  21926. /**
  21927. * - 偏移模式。
  21928. * @version DragonBones 5.5
  21929. * @language zh_CN
  21930. */
  21931. const enum OffsetMode {
  21932. None = 0,
  21933. Additive = 1,
  21934. Override = 2,
  21935. }
  21936. /**
  21937. * - Animation fade out mode.
  21938. * @version DragonBones 4.5
  21939. * @language en_US
  21940. */
  21941. /**
  21942. * - 动画淡出模式。
  21943. * @version DragonBones 4.5
  21944. * @language zh_CN
  21945. */
  21946. const enum AnimationFadeOutMode {
  21947. /**
  21948. * - Do not fade out of any animation states.
  21949. * @language en_US
  21950. */
  21951. /**
  21952. * - 不淡出任何的动画状态。
  21953. * @language zh_CN
  21954. */
  21955. None = 0,
  21956. /**
  21957. * - Fade out the animation states of the same layer.
  21958. * @language en_US
  21959. */
  21960. /**
  21961. * - 淡出同层的动画状态。
  21962. * @language zh_CN
  21963. */
  21964. SameLayer = 1,
  21965. /**
  21966. * - Fade out the animation states of the same group.
  21967. * @language en_US
  21968. */
  21969. /**
  21970. * - 淡出同组的动画状态。
  21971. * @language zh_CN
  21972. */
  21973. SameGroup = 2,
  21974. /**
  21975. * - Fade out the animation states of the same layer and group.
  21976. * @language en_US
  21977. */
  21978. /**
  21979. * - 淡出同层并且同组的动画状态。
  21980. * @language zh_CN
  21981. */
  21982. SameLayerAndGroup = 3,
  21983. /**
  21984. * - Fade out of all animation states.
  21985. * @language en_US
  21986. */
  21987. /**
  21988. * - 淡出所有的动画状态。
  21989. * @language zh_CN
  21990. */
  21991. All = 4,
  21992. /**
  21993. * - Does not replace the animation state with the same name.
  21994. * @language en_US
  21995. */
  21996. /**
  21997. * - 不替换同名的动画状态。
  21998. * @language zh_CN
  21999. */
  22000. Single = 5,
  22001. }
  22002. /**
  22003. * @private
  22004. */
  22005. interface Map<T> {
  22006. [key: string]: T;
  22007. }
  22008. /**
  22009. * @private
  22010. */
  22011. class DragonBones {
  22012. static readonly VERSION: string;
  22013. static yDown: boolean;
  22014. static debug: boolean;
  22015. static debugDraw: boolean;
  22016. static webAssembly: boolean;
  22017. private readonly _clock;
  22018. private readonly _events;
  22019. private readonly _objects;
  22020. private _eventManager;
  22021. constructor(eventManager: IEventDispatcher);
  22022. advanceTime(passedTime: number): void;
  22023. bufferEvent(value: EventObject): void;
  22024. bufferObject(object: BaseObject): void;
  22025. readonly clock: WorldClock;
  22026. readonly eventManager: IEventDispatcher;
  22027. }
  22028. }
  22029. /**
  22030. * The MIT License (MIT)
  22031. *
  22032. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22033. *
  22034. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22035. * this software and associated documentation files (the "Software"), to deal in
  22036. * the Software without restriction, including without limitation the rights to
  22037. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22038. * the Software, and to permit persons to whom the Software is furnished to do so,
  22039. * subject to the following conditions:
  22040. *
  22041. * The above copyright notice and this permission notice shall be included in all
  22042. * copies or substantial portions of the Software.
  22043. *
  22044. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22045. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22046. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22047. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22048. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22049. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22050. */
  22051. declare namespace dragonBones {
  22052. /**
  22053. * - The BaseObject is the base class for all objects in the DragonBones framework.
  22054. * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery.
  22055. * @version DragonBones 4.5
  22056. * @language en_US
  22057. */
  22058. /**
  22059. * - 基础对象,通常 DragonBones 的对象都继承自该类。
  22060. * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。
  22061. * @version DragonBones 4.5
  22062. * @language zh_CN
  22063. */
  22064. abstract class BaseObject {
  22065. private static _hashCode;
  22066. private static _defaultMaxCount;
  22067. private static readonly _maxCountMap;
  22068. private static readonly _poolsMap;
  22069. private static _returnObject(object);
  22070. static toString(): string;
  22071. /**
  22072. * - Set the maximum cache count of the specify object pool.
  22073. * @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
  22074. * @param maxCount - Max count.
  22075. * @version DragonBones 4.5
  22076. * @language en_US
  22077. */
  22078. /**
  22079. * - 设置特定对象池的最大缓存数量。
  22080. * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量)
  22081. * @param maxCount - 最大缓存数量。
  22082. * @version DragonBones 4.5
  22083. * @language zh_CN
  22084. */
  22085. static setMaxCount(objectConstructor: (typeof BaseObject) | null, maxCount: number): void;
  22086. /**
  22087. * - Clear the cached instances of a specify object pool.
  22088. * @param objectConstructor - Specify class. (Clear all cached instances if not set)
  22089. * @version DragonBones 4.5
  22090. * @language en_US
  22091. */
  22092. /**
  22093. * - 清除特定对象池的缓存实例。
  22094. * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例)
  22095. * @version DragonBones 4.5
  22096. * @language zh_CN
  22097. */
  22098. static clearPool(objectConstructor?: (typeof BaseObject) | null): void;
  22099. /**
  22100. * - Get an instance of the specify class from object pool.
  22101. * @param objectConstructor - The specify class.
  22102. * @version DragonBones 4.5
  22103. * @language en_US
  22104. */
  22105. /**
  22106. * - 从对象池中获取特定类的实例。
  22107. * @param objectConstructor - 特定的类。
  22108. * @version DragonBones 4.5
  22109. * @language zh_CN
  22110. */
  22111. static borrowObject<T extends BaseObject>(objectConstructor: {
  22112. new (): T;
  22113. }): T;
  22114. /**
  22115. * - A unique identification number assigned to the object.
  22116. * @version DragonBones 4.5
  22117. * @language en_US
  22118. */
  22119. /**
  22120. * - 分配给此实例的唯一标识号。
  22121. * @version DragonBones 4.5
  22122. * @language zh_CN
  22123. */
  22124. readonly hashCode: number;
  22125. private _isInPool;
  22126. /**
  22127. * @private
  22128. */
  22129. protected abstract _onClear(): void;
  22130. /**
  22131. * - Clear the object and return it back to object pool。
  22132. * @version DragonBones 4.5
  22133. * @language en_US
  22134. */
  22135. /**
  22136. * - 清除该实例的所有数据并将其返还对象池。
  22137. * @version DragonBones 4.5
  22138. * @language zh_CN
  22139. */
  22140. returnToPool(): void;
  22141. }
  22142. }
  22143. /**
  22144. * The MIT License (MIT)
  22145. *
  22146. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22147. *
  22148. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22149. * this software and associated documentation files (the "Software"), to deal in
  22150. * the Software without restriction, including without limitation the rights to
  22151. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22152. * the Software, and to permit persons to whom the Software is furnished to do so,
  22153. * subject to the following conditions:
  22154. *
  22155. * The above copyright notice and this permission notice shall be included in all
  22156. * copies or substantial portions of the Software.
  22157. *
  22158. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22159. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22160. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22161. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22162. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22163. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22164. */
  22165. declare namespace dragonBones {
  22166. /**
  22167. * - 2D Transform matrix.
  22168. * @version DragonBones 3.0
  22169. * @language en_US
  22170. */
  22171. /**
  22172. * - 2D 转换矩阵。
  22173. * @version DragonBones 3.0
  22174. * @language zh_CN
  22175. */
  22176. class Matrix {
  22177. /**
  22178. * - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  22179. * @default 1.0
  22180. * @version DragonBones 3.0
  22181. * @language en_US
  22182. */
  22183. /**
  22184. * - 缩放或旋转图像时影响像素沿 x 轴定位的值。
  22185. * @default 1.0
  22186. * @version DragonBones 3.0
  22187. * @language zh_CN
  22188. */
  22189. a: number;
  22190. /**
  22191. * - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  22192. * @default 0.0
  22193. * @version DragonBones 3.0
  22194. * @language en_US
  22195. */
  22196. /**
  22197. * - 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  22198. * @default 0.0
  22199. * @version DragonBones 3.0
  22200. * @language zh_CN
  22201. */
  22202. b: number;
  22203. /**
  22204. * - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  22205. * @default 0.0
  22206. * @version DragonBones 3.0
  22207. * @language en_US
  22208. */
  22209. /**
  22210. * - 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  22211. * @default 0.0
  22212. * @version DragonBones 3.0
  22213. * @language zh_CN
  22214. */
  22215. c: number;
  22216. /**
  22217. * - The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  22218. * @default 1.0
  22219. * @version DragonBones 3.0
  22220. * @language en_US
  22221. */
  22222. /**
  22223. * - 缩放或旋转图像时影响像素沿 y 轴定位的值。
  22224. * @default 1.0
  22225. * @version DragonBones 3.0
  22226. * @language zh_CN
  22227. */
  22228. d: number;
  22229. /**
  22230. * - The distance by which to translate each point along the x axis.
  22231. * @default 0.0
  22232. * @version DragonBones 3.0
  22233. * @language en_US
  22234. */
  22235. /**
  22236. * - 沿 x 轴平移每个点的距离。
  22237. * @default 0.0
  22238. * @version DragonBones 3.0
  22239. * @language zh_CN
  22240. */
  22241. tx: number;
  22242. /**
  22243. * - The distance by which to translate each point along the y axis.
  22244. * @default 0.0
  22245. * @version DragonBones 3.0
  22246. * @language en_US
  22247. */
  22248. /**
  22249. * - 沿 y 轴平移每个点的距离。
  22250. * @default 0.0
  22251. * @version DragonBones 3.0
  22252. * @language zh_CN
  22253. */
  22254. ty: number;
  22255. /**
  22256. * @private
  22257. */
  22258. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  22259. toString(): string;
  22260. /**
  22261. * @private
  22262. */
  22263. copyFrom(value: Matrix): Matrix;
  22264. /**
  22265. * @private
  22266. */
  22267. copyFromArray(value: Array<number>, offset?: number): Matrix;
  22268. /**
  22269. * - Convert to unit matrix.
  22270. * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  22271. * @version DragonBones 3.0
  22272. * @language en_US
  22273. */
  22274. /**
  22275. * - 转换为单位矩阵。
  22276. * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。
  22277. * @version DragonBones 3.0
  22278. * @language zh_CN
  22279. */
  22280. identity(): Matrix;
  22281. /**
  22282. * - Multiplies the current matrix with another matrix.
  22283. * @param value - The matrix that needs to be multiplied.
  22284. * @version DragonBones 3.0
  22285. * @language en_US
  22286. */
  22287. /**
  22288. * - 将当前矩阵与另一个矩阵相乘。
  22289. * @param value - 需要相乘的矩阵。
  22290. * @version DragonBones 3.0
  22291. * @language zh_CN
  22292. */
  22293. concat(value: Matrix): Matrix;
  22294. /**
  22295. * - Convert to inverse matrix.
  22296. * @version DragonBones 3.0
  22297. * @language en_US
  22298. */
  22299. /**
  22300. * - 转换为逆矩阵。
  22301. * @version DragonBones 3.0
  22302. * @language zh_CN
  22303. */
  22304. invert(): Matrix;
  22305. /**
  22306. * - Apply a matrix transformation to a specific point.
  22307. * @param x - X coordinate.
  22308. * @param y - Y coordinate.
  22309. * @param result - The point after the transformation is applied.
  22310. * @param delta - Whether to ignore tx, ty's conversion to point.
  22311. * @version DragonBones 3.0
  22312. * @language en_US
  22313. */
  22314. /**
  22315. * - 将矩阵转换应用于特定点。
  22316. * @param x - 横坐标。
  22317. * @param y - 纵坐标。
  22318. * @param result - 应用转换之后的点。
  22319. * @param delta - 是否忽略 tx,ty 对点的转换。
  22320. * @version DragonBones 3.0
  22321. * @language zh_CN
  22322. */
  22323. transformPoint(x: number, y: number, result: {
  22324. x: number;
  22325. y: number;
  22326. }, delta?: boolean): void;
  22327. /**
  22328. * @private
  22329. */
  22330. transformRectangle(rectangle: {
  22331. x: number;
  22332. y: number;
  22333. width: number;
  22334. height: number;
  22335. }, delta?: boolean): void;
  22336. }
  22337. }
  22338. /**
  22339. * The MIT License (MIT)
  22340. *
  22341. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22342. *
  22343. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22344. * this software and associated documentation files (the "Software"), to deal in
  22345. * the Software without restriction, including without limitation the rights to
  22346. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22347. * the Software, and to permit persons to whom the Software is furnished to do so,
  22348. * subject to the following conditions:
  22349. *
  22350. * The above copyright notice and this permission notice shall be included in all
  22351. * copies or substantial portions of the Software.
  22352. *
  22353. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22354. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22355. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22356. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22357. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22358. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22359. */
  22360. declare namespace dragonBones {
  22361. /**
  22362. * - 2D Transform.
  22363. * @version DragonBones 3.0
  22364. * @language en_US
  22365. */
  22366. /**
  22367. * - 2D 变换。
  22368. * @version DragonBones 3.0
  22369. * @language zh_CN
  22370. */
  22371. class Transform {
  22372. /**
  22373. * @private
  22374. */
  22375. static readonly PI: number;
  22376. /**
  22377. * @private
  22378. */
  22379. static readonly PI_D: number;
  22380. /**
  22381. * @private
  22382. */
  22383. static readonly PI_H: number;
  22384. /**
  22385. * @private
  22386. */
  22387. static readonly PI_Q: number;
  22388. /**
  22389. * @private
  22390. */
  22391. static readonly RAD_DEG: number;
  22392. /**
  22393. * @private
  22394. */
  22395. static readonly DEG_RAD: number;
  22396. /**
  22397. * @private
  22398. */
  22399. static normalizeRadian(value: number): number;
  22400. /**
  22401. * - Horizontal translate.
  22402. * @version DragonBones 3.0
  22403. * @language en_US
  22404. */
  22405. /**
  22406. * - 水平位移。
  22407. * @version DragonBones 3.0
  22408. * @language zh_CN
  22409. */
  22410. x: number;
  22411. /**
  22412. * - Vertical translate.
  22413. * @version DragonBones 3.0
  22414. * @language en_US
  22415. */
  22416. /**
  22417. * - 垂直位移。
  22418. * @version DragonBones 3.0
  22419. * @language zh_CN
  22420. */
  22421. y: number;
  22422. /**
  22423. * - Skew. (In radians)
  22424. * @version DragonBones 3.0
  22425. * @language en_US
  22426. */
  22427. /**
  22428. * - 倾斜。 (以弧度为单位)
  22429. * @version DragonBones 3.0
  22430. * @language zh_CN
  22431. */
  22432. skew: number;
  22433. /**
  22434. * - rotation. (In radians)
  22435. * @version DragonBones 3.0
  22436. * @language en_US
  22437. */
  22438. /**
  22439. * - 旋转。 (以弧度为单位)
  22440. * @version DragonBones 3.0
  22441. * @language zh_CN
  22442. */
  22443. rotation: number;
  22444. /**
  22445. * - Horizontal Scaling.
  22446. * @version DragonBones 3.0
  22447. * @language en_US
  22448. */
  22449. /**
  22450. * - 水平缩放。
  22451. * @version DragonBones 3.0
  22452. * @language zh_CN
  22453. */
  22454. scaleX: number;
  22455. /**
  22456. * - Vertical scaling.
  22457. * @version DragonBones 3.0
  22458. * @language en_US
  22459. */
  22460. /**
  22461. * - 垂直缩放。
  22462. * @version DragonBones 3.0
  22463. * @language zh_CN
  22464. */
  22465. scaleY: number;
  22466. /**
  22467. * @private
  22468. */
  22469. constructor(x?: number, y?: number, skew?: number, rotation?: number, scaleX?: number, scaleY?: number);
  22470. toString(): string;
  22471. /**
  22472. * @private
  22473. */
  22474. copyFrom(value: Transform): Transform;
  22475. /**
  22476. * @private
  22477. */
  22478. identity(): Transform;
  22479. /**
  22480. * @private
  22481. */
  22482. add(value: Transform): Transform;
  22483. /**
  22484. * @private
  22485. */
  22486. minus(value: Transform): Transform;
  22487. /**
  22488. * @private
  22489. */
  22490. fromMatrix(matrix: Matrix): Transform;
  22491. /**
  22492. * @private
  22493. */
  22494. toMatrix(matrix: Matrix): Transform;
  22495. }
  22496. }
  22497. /**
  22498. * The MIT License (MIT)
  22499. *
  22500. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22501. *
  22502. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22503. * this software and associated documentation files (the "Software"), to deal in
  22504. * the Software without restriction, including without limitation the rights to
  22505. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22506. * the Software, and to permit persons to whom the Software is furnished to do so,
  22507. * subject to the following conditions:
  22508. *
  22509. * The above copyright notice and this permission notice shall be included in all
  22510. * copies or substantial portions of the Software.
  22511. *
  22512. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22513. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22514. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22515. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22516. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22517. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22518. */
  22519. declare namespace dragonBones {
  22520. /**
  22521. * @internal
  22522. * @private
  22523. */
  22524. class ColorTransform {
  22525. alphaMultiplier: number;
  22526. redMultiplier: number;
  22527. greenMultiplier: number;
  22528. blueMultiplier: number;
  22529. alphaOffset: number;
  22530. redOffset: number;
  22531. greenOffset: number;
  22532. blueOffset: number;
  22533. constructor(alphaMultiplier?: number, redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaOffset?: number, redOffset?: number, greenOffset?: number, blueOffset?: number);
  22534. copyFrom(value: ColorTransform): void;
  22535. identity(): void;
  22536. }
  22537. }
  22538. /**
  22539. * The MIT License (MIT)
  22540. *
  22541. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22542. *
  22543. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22544. * this software and associated documentation files (the "Software"), to deal in
  22545. * the Software without restriction, including without limitation the rights to
  22546. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22547. * the Software, and to permit persons to whom the Software is furnished to do so,
  22548. * subject to the following conditions:
  22549. *
  22550. * The above copyright notice and this permission notice shall be included in all
  22551. * copies or substantial portions of the Software.
  22552. *
  22553. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22554. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22555. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22556. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22557. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22558. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22559. */
  22560. declare namespace dragonBones {
  22561. /**
  22562. * - The Point object represents a location in a two-dimensional coordinate system.
  22563. * @version DragonBones 3.0
  22564. * @language en_US
  22565. */
  22566. /**
  22567. * - Point 对象表示二维坐标系统中的某个位置。
  22568. * @version DragonBones 3.0
  22569. * @language zh_CN
  22570. */
  22571. class Point {
  22572. /**
  22573. * - The horizontal coordinate.
  22574. * @default 0.0
  22575. * @version DragonBones 3.0
  22576. * @language en_US
  22577. */
  22578. /**
  22579. * - 该点的水平坐标。
  22580. * @default 0.0
  22581. * @version DragonBones 3.0
  22582. * @language zh_CN
  22583. */
  22584. x: number;
  22585. /**
  22586. * - The vertical coordinate.
  22587. * @default 0.0
  22588. * @version DragonBones 3.0
  22589. * @language en_US
  22590. */
  22591. /**
  22592. * - 该点的垂直坐标。
  22593. * @default 0.0
  22594. * @version DragonBones 3.0
  22595. * @language zh_CN
  22596. */
  22597. y: number;
  22598. /**
  22599. * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  22600. * @param x - The horizontal coordinate.
  22601. * @param y - The vertical coordinate.
  22602. * @version DragonBones 3.0
  22603. * @language en_US
  22604. */
  22605. /**
  22606. * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  22607. * @param x - 该对象的x属性值,默认为 0.0。
  22608. * @param y - 该对象的y属性值,默认为 0.0。
  22609. * @version DragonBones 3.0
  22610. * @language zh_CN
  22611. */
  22612. constructor(x?: number, y?: number);
  22613. /**
  22614. * @private
  22615. */
  22616. copyFrom(value: Point): void;
  22617. /**
  22618. * @private
  22619. */
  22620. clear(): void;
  22621. }
  22622. }
  22623. /**
  22624. * The MIT License (MIT)
  22625. *
  22626. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22627. *
  22628. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22629. * this software and associated documentation files (the "Software"), to deal in
  22630. * the Software without restriction, including without limitation the rights to
  22631. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22632. * the Software, and to permit persons to whom the Software is furnished to do so,
  22633. * subject to the following conditions:
  22634. *
  22635. * The above copyright notice and this permission notice shall be included in all
  22636. * copies or substantial portions of the Software.
  22637. *
  22638. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22639. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22640. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22641. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22642. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22643. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22644. */
  22645. declare namespace dragonBones {
  22646. /**
  22647. * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  22648. * width and its height.<br/>
  22649. * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
  22650. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  22651. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  22652. * if you change the bottom property, the value of the height property changes.
  22653. * @version DragonBones 3.0
  22654. * @language en_US
  22655. */
  22656. /**
  22657. * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  22658. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  22659. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  22660. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  22661. * @version DragonBones 3.0
  22662. * @language zh_CN
  22663. */
  22664. class Rectangle {
  22665. /**
  22666. * - The x coordinate of the top-left corner of the rectangle.
  22667. * @default 0.0
  22668. * @version DragonBones 3.0
  22669. * @language en_US
  22670. */
  22671. /**
  22672. * - 矩形左上角的 x 坐标。
  22673. * @default 0.0
  22674. * @version DragonBones 3.0
  22675. * @language zh_CN
  22676. */
  22677. x: number;
  22678. /**
  22679. * - The y coordinate of the top-left corner of the rectangle.
  22680. * @default 0.0
  22681. * @version DragonBones 3.0
  22682. * @language en_US
  22683. */
  22684. /**
  22685. * - 矩形左上角的 y 坐标。
  22686. * @default 0.0
  22687. * @version DragonBones 3.0
  22688. * @language zh_CN
  22689. */
  22690. y: number;
  22691. /**
  22692. * - The width of the rectangle, in pixels.
  22693. * @default 0.0
  22694. * @version DragonBones 3.0
  22695. * @language en_US
  22696. */
  22697. /**
  22698. * - 矩形的宽度(以像素为单位)。
  22699. * @default 0.0
  22700. * @version DragonBones 3.0
  22701. * @language zh_CN
  22702. */
  22703. width: number;
  22704. /**
  22705. * - 矩形的高度(以像素为单位)。
  22706. * @default 0.0
  22707. * @version DragonBones 3.0
  22708. * @language en_US
  22709. */
  22710. /**
  22711. * - The height of the rectangle, in pixels.
  22712. * @default 0.0
  22713. * @version DragonBones 3.0
  22714. * @language zh_CN
  22715. */
  22716. height: number;
  22717. /**
  22718. * @private
  22719. */
  22720. constructor(x?: number, y?: number, width?: number, height?: number);
  22721. /**
  22722. * @private
  22723. */
  22724. copyFrom(value: Rectangle): void;
  22725. /**
  22726. * @private
  22727. */
  22728. clear(): void;
  22729. }
  22730. }
  22731. /**
  22732. * The MIT License (MIT)
  22733. *
  22734. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22735. *
  22736. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22737. * this software and associated documentation files (the "Software"), to deal in
  22738. * the Software without restriction, including without limitation the rights to
  22739. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22740. * the Software, and to permit persons to whom the Software is furnished to do so,
  22741. * subject to the following conditions:
  22742. *
  22743. * The above copyright notice and this permission notice shall be included in all
  22744. * copies or substantial portions of the Software.
  22745. *
  22746. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22747. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22748. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22749. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22750. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22751. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22752. */
  22753. declare namespace dragonBones {
  22754. /**
  22755. * - The user custom data.
  22756. * @version DragonBones 5.0
  22757. * @language en_US
  22758. */
  22759. /**
  22760. * - 用户自定义数据。
  22761. * @version DragonBones 5.0
  22762. * @language zh_CN
  22763. */
  22764. class UserData extends BaseObject {
  22765. static toString(): string;
  22766. /**
  22767. * - The custom int numbers.
  22768. * @version DragonBones 5.0
  22769. * @language en_US
  22770. */
  22771. /**
  22772. * - 自定义整数。
  22773. * @version DragonBones 5.0
  22774. * @language zh_CN
  22775. */
  22776. readonly ints: Array<number>;
  22777. /**
  22778. * - The custom float numbers.
  22779. * @version DragonBones 5.0
  22780. * @language en_US
  22781. */
  22782. /**
  22783. * - 自定义浮点数。
  22784. * @version DragonBones 5.0
  22785. * @language zh_CN
  22786. */
  22787. readonly floats: Array<number>;
  22788. /**
  22789. * - The custom strings.
  22790. * @version DragonBones 5.0
  22791. * @language en_US
  22792. */
  22793. /**
  22794. * - 自定义字符串。
  22795. * @version DragonBones 5.0
  22796. * @language zh_CN
  22797. */
  22798. readonly strings: Array<string>;
  22799. /**
  22800. * @inheritDoc
  22801. */
  22802. protected _onClear(): void;
  22803. /**
  22804. * @internal
  22805. * @private
  22806. */
  22807. addInt(value: number): void;
  22808. /**
  22809. * @internal
  22810. * @private
  22811. */
  22812. addFloat(value: number): void;
  22813. /**
  22814. * @internal
  22815. * @private
  22816. */
  22817. addString(value: string): void;
  22818. /**
  22819. * - Get the custom int number.
  22820. * @version DragonBones 5.0
  22821. * @language en_US
  22822. */
  22823. /**
  22824. * - 获取自定义整数。
  22825. * @version DragonBones 5.0
  22826. * @language zh_CN
  22827. */
  22828. getInt(index?: number): number;
  22829. /**
  22830. * - Get the custom float number.
  22831. * @version DragonBones 5.0
  22832. * @language en_US
  22833. */
  22834. /**
  22835. * - 获取自定义浮点数。
  22836. * @version DragonBones 5.0
  22837. * @language zh_CN
  22838. */
  22839. getFloat(index?: number): number;
  22840. /**
  22841. * - Get the custom string.
  22842. * @version DragonBones 5.0
  22843. * @language en_US
  22844. */
  22845. /**
  22846. * - 获取自定义字符串。
  22847. * @version DragonBones 5.0
  22848. * @language zh_CN
  22849. */
  22850. getString(index?: number): string;
  22851. }
  22852. /**
  22853. * @internal
  22854. * @private
  22855. */
  22856. class ActionData extends BaseObject {
  22857. static toString(): string;
  22858. type: ActionType;
  22859. name: string;
  22860. bone: BoneData | null;
  22861. slot: SlotData | null;
  22862. data: UserData | null;
  22863. protected _onClear(): void;
  22864. }
  22865. }
  22866. /**
  22867. * The MIT License (MIT)
  22868. *
  22869. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22870. *
  22871. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22872. * this software and associated documentation files (the "Software"), to deal in
  22873. * the Software without restriction, including without limitation the rights to
  22874. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22875. * the Software, and to permit persons to whom the Software is furnished to do so,
  22876. * subject to the following conditions:
  22877. *
  22878. * The above copyright notice and this permission notice shall be included in all
  22879. * copies or substantial portions of the Software.
  22880. *
  22881. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22882. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22883. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22884. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22885. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22886. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22887. */
  22888. declare namespace dragonBones {
  22889. /**
  22890. * - The DragonBones data.
  22891. * A DragonBones data contains multiple armature data.
  22892. * @see dragonBones.ArmatureData
  22893. * @version DragonBones 3.0
  22894. * @language en_US
  22895. */
  22896. /**
  22897. * - 龙骨数据。
  22898. * 一个龙骨数据包含多个骨架数据。
  22899. * @see dragonBones.ArmatureData
  22900. * @version DragonBones 3.0
  22901. * @language zh_CN
  22902. */
  22903. class DragonBonesData extends BaseObject {
  22904. static toString(): string;
  22905. /**
  22906. * @private
  22907. */
  22908. autoSearch: boolean;
  22909. /**
  22910. * - The animation frame rate.
  22911. * @version DragonBones 3.0
  22912. * @language en_US
  22913. */
  22914. /**
  22915. * - 动画帧频。
  22916. * @version DragonBones 3.0
  22917. * @language zh_CN
  22918. */
  22919. frameRate: number;
  22920. /**
  22921. * - The data version.
  22922. * @version DragonBones 3.0
  22923. * @language en_US
  22924. */
  22925. /**
  22926. * - 数据版本。
  22927. * @version DragonBones 3.0
  22928. * @language zh_CN
  22929. */
  22930. version: string;
  22931. /**
  22932. * - The DragonBones data name.
  22933. * The name is consistent with the DragonBones project name.
  22934. * @version DragonBones 3.0
  22935. * @language en_US
  22936. */
  22937. /**
  22938. * - 龙骨数据名称。
  22939. * 该名称与龙骨项目名保持一致。
  22940. * @version DragonBones 3.0
  22941. * @language zh_CN
  22942. */
  22943. name: string;
  22944. /**
  22945. * @private
  22946. */
  22947. stage: ArmatureData | null;
  22948. /**
  22949. * @internal
  22950. * @private
  22951. */
  22952. readonly frameIndices: Array<number>;
  22953. /**
  22954. * @internal
  22955. * @private
  22956. */
  22957. readonly cachedFrames: Array<number>;
  22958. /**
  22959. * - All armature data names.
  22960. * @version DragonBones 3.0
  22961. * @language en_US
  22962. */
  22963. /**
  22964. * - 所有的骨架数据名称。
  22965. * @version DragonBones 3.0
  22966. * @language zh_CN
  22967. */
  22968. readonly armatureNames: Array<string>;
  22969. /**
  22970. * @private
  22971. */
  22972. readonly armatures: Map<ArmatureData>;
  22973. /**
  22974. * @internal
  22975. * @private
  22976. */
  22977. binary: ArrayBuffer;
  22978. /**
  22979. * @internal
  22980. * @private
  22981. */
  22982. intArray: Int16Array;
  22983. /**
  22984. * @internal
  22985. * @private
  22986. */
  22987. floatArray: Float32Array;
  22988. /**
  22989. * @internal
  22990. * @private
  22991. */
  22992. frameIntArray: Int16Array;
  22993. /**
  22994. * @internal
  22995. * @private
  22996. */
  22997. frameFloatArray: Float32Array;
  22998. /**
  22999. * @internal
  23000. * @private
  23001. */
  23002. frameArray: Int16Array;
  23003. /**
  23004. * @internal
  23005. * @private
  23006. */
  23007. timelineArray: Uint16Array;
  23008. /**
  23009. * @private
  23010. */
  23011. userData: UserData | null;
  23012. /**
  23013. * @inheritDoc
  23014. */
  23015. protected _onClear(): void;
  23016. /**
  23017. * @internal
  23018. * @private
  23019. */
  23020. addArmature(value: ArmatureData): void;
  23021. /**
  23022. * - Get a specific armature data.
  23023. * @param name - The armature data name.
  23024. * @version DragonBones 3.0
  23025. * @language en_US
  23026. */
  23027. /**
  23028. * - 获取特定的骨架数据。
  23029. * @param name - 骨架数据名称。
  23030. * @version DragonBones 3.0
  23031. * @language zh_CN
  23032. */
  23033. getArmature(name: string): ArmatureData | null;
  23034. /**
  23035. * - Deprecated, please refer to {@link #dragonBones.BaseFactory#removeDragonBonesData()}.
  23036. * @deprecated
  23037. * @language en_US
  23038. */
  23039. /**
  23040. * - 已废弃,请参考 {@link #dragonBones.BaseFactory#removeDragonBonesData()}。
  23041. * @deprecated
  23042. * @language zh_CN
  23043. */
  23044. dispose(): void;
  23045. }
  23046. }
  23047. /**
  23048. * The MIT License (MIT)
  23049. *
  23050. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23051. *
  23052. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23053. * this software and associated documentation files (the "Software"), to deal in
  23054. * the Software without restriction, including without limitation the rights to
  23055. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23056. * the Software, and to permit persons to whom the Software is furnished to do so,
  23057. * subject to the following conditions:
  23058. *
  23059. * The above copyright notice and this permission notice shall be included in all
  23060. * copies or substantial portions of the Software.
  23061. *
  23062. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23063. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23064. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23065. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23066. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23067. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23068. */
  23069. declare namespace dragonBones {
  23070. /**
  23071. * - The armature data.
  23072. * @version DragonBones 3.0
  23073. * @language en_US
  23074. */
  23075. /**
  23076. * - 骨架数据。
  23077. * @version DragonBones 3.0
  23078. * @language zh_CN
  23079. */
  23080. class ArmatureData extends BaseObject {
  23081. static toString(): string;
  23082. /**
  23083. * @private
  23084. */
  23085. type: ArmatureType;
  23086. /**
  23087. * - The animation frame rate.
  23088. * @version DragonBones 3.0
  23089. * @language en_US
  23090. */
  23091. /**
  23092. * - 动画帧率。
  23093. * @version DragonBones 3.0
  23094. * @language zh_CN
  23095. */
  23096. frameRate: number;
  23097. /**
  23098. * @private
  23099. */
  23100. cacheFrameRate: number;
  23101. /**
  23102. * @private
  23103. */
  23104. scale: number;
  23105. /**
  23106. * - The armature name.
  23107. * @version DragonBones 3.0
  23108. * @language en_US
  23109. */
  23110. /**
  23111. * - 骨架名称。
  23112. * @version DragonBones 3.0
  23113. * @language zh_CN
  23114. */
  23115. name: string;
  23116. /**
  23117. * @private
  23118. */
  23119. readonly aabb: Rectangle;
  23120. /**
  23121. * - The names of all the animation data.
  23122. * @version DragonBones 3.0
  23123. * @language en_US
  23124. */
  23125. /**
  23126. * - 所有的动画数据名称。
  23127. * @version DragonBones 3.0
  23128. * @language zh_CN
  23129. */
  23130. readonly animationNames: Array<string>;
  23131. /**
  23132. * @private
  23133. */
  23134. readonly sortedBones: Array<BoneData>;
  23135. /**
  23136. * @private
  23137. */
  23138. readonly sortedSlots: Array<SlotData>;
  23139. /**
  23140. * @private
  23141. */
  23142. readonly defaultActions: Array<ActionData>;
  23143. /**
  23144. * @private
  23145. */
  23146. readonly actions: Array<ActionData>;
  23147. /**
  23148. * @private
  23149. */
  23150. readonly bones: Map<BoneData>;
  23151. /**
  23152. * @private
  23153. */
  23154. readonly slots: Map<SlotData>;
  23155. /**
  23156. * @private
  23157. */
  23158. readonly constraints: Map<ConstraintData>;
  23159. /**
  23160. * @private
  23161. */
  23162. readonly skins: Map<SkinData>;
  23163. /**
  23164. * @private
  23165. */
  23166. readonly animations: Map<AnimationData>;
  23167. /**
  23168. * - The default skin data.
  23169. * @version DragonBones 4.5
  23170. * @language en_US
  23171. */
  23172. /**
  23173. * - 默认插槽数据。
  23174. * @version DragonBones 4.5
  23175. * @language zh_CN
  23176. */
  23177. defaultSkin: SkinData | null;
  23178. /**
  23179. * - The default animation data.
  23180. * @version DragonBones 4.5
  23181. * @language en_US
  23182. */
  23183. /**
  23184. * - 默认动画数据。
  23185. * @version DragonBones 4.5
  23186. * @language zh_CN
  23187. */
  23188. defaultAnimation: AnimationData | null;
  23189. /**
  23190. * @private
  23191. */
  23192. canvas: CanvasData | null;
  23193. /**
  23194. * @private
  23195. */
  23196. userData: UserData | null;
  23197. /**
  23198. * @private
  23199. */
  23200. parent: DragonBonesData;
  23201. /**
  23202. * @inheritDoc
  23203. */
  23204. protected _onClear(): void;
  23205. /**
  23206. * @internal
  23207. * @private
  23208. */
  23209. sortBones(): void;
  23210. /**
  23211. * @internal
  23212. * @private
  23213. */
  23214. cacheFrames(frameRate: number): void;
  23215. /**
  23216. * @internal
  23217. * @private
  23218. */
  23219. setCacheFrame(globalTransformMatrix: Matrix, transform: Transform): number;
  23220. /**
  23221. * @internal
  23222. * @private
  23223. */
  23224. getCacheFrame(globalTransformMatrix: Matrix, transform: Transform, arrayOffset: number): void;
  23225. /**
  23226. * @internal
  23227. * @private
  23228. */
  23229. addBone(value: BoneData): void;
  23230. /**
  23231. * @internal
  23232. * @private
  23233. */
  23234. addSlot(value: SlotData): void;
  23235. /**
  23236. * @internal
  23237. * @private
  23238. */
  23239. addConstraint(value: ConstraintData): void;
  23240. /**
  23241. * @internal
  23242. * @private
  23243. */
  23244. addSkin(value: SkinData): void;
  23245. /**
  23246. * @internal
  23247. * @private
  23248. */
  23249. addAnimation(value: AnimationData): void;
  23250. /**
  23251. * @internal
  23252. * @private
  23253. */
  23254. addAction(value: ActionData, isDefault: boolean): void;
  23255. /**
  23256. * - Get a specific done data.
  23257. * @param name - The bone name.
  23258. * @version DragonBones 3.0
  23259. * @language en_US
  23260. */
  23261. /**
  23262. * - 获取特定的骨骼数据。
  23263. * @param name - 骨骼名称。
  23264. * @version DragonBones 3.0
  23265. * @language zh_CN
  23266. */
  23267. getBone(name: string): BoneData | null;
  23268. /**
  23269. * - Get a specific slot data.
  23270. * @param name - The slot name.
  23271. * @version DragonBones 3.0
  23272. * @language en_US
  23273. */
  23274. /**
  23275. * - 获取特定的插槽数据。
  23276. * @param name - 插槽名称。
  23277. * @version DragonBones 3.0
  23278. * @language zh_CN
  23279. */
  23280. getSlot(name: string): SlotData | null;
  23281. /**
  23282. * @private
  23283. */
  23284. getConstraint(name: string): ConstraintData | null;
  23285. /**
  23286. * - Get a specific skin data.
  23287. * @param name - The skin name.
  23288. * @version DragonBones 3.0
  23289. * @language en_US
  23290. */
  23291. /**
  23292. * - 获取特定皮肤数据。
  23293. * @param name - 皮肤名称。
  23294. * @version DragonBones 3.0
  23295. * @language zh_CN
  23296. */
  23297. getSkin(name: string): SkinData | null;
  23298. /**
  23299. * @internal
  23300. * @private
  23301. */
  23302. getMesh(skinName: string, slotName: string, meshName: string): MeshDisplayData | null;
  23303. /**
  23304. * - Get a specific animation data.
  23305. * @param name - The animation name.
  23306. * @version DragonBones 3.0
  23307. * @language en_US
  23308. */
  23309. /**
  23310. * - 获取特定的动画数据。
  23311. * @param name - 动画名称。
  23312. * @version DragonBones 3.0
  23313. * @language zh_CN
  23314. */
  23315. getAnimation(name: string): AnimationData | null;
  23316. }
  23317. /**
  23318. * - The bone data.
  23319. * @version DragonBones 3.0
  23320. * @language en_US
  23321. */
  23322. /**
  23323. * - 骨骼数据。
  23324. * @version DragonBones 3.0
  23325. * @language zh_CN
  23326. */
  23327. class BoneData extends BaseObject {
  23328. static toString(): string;
  23329. /**
  23330. * @private
  23331. */
  23332. inheritTranslation: boolean;
  23333. /**
  23334. * @private
  23335. */
  23336. inheritRotation: boolean;
  23337. /**
  23338. * @private
  23339. */
  23340. inheritScale: boolean;
  23341. /**
  23342. * @private
  23343. */
  23344. inheritReflection: boolean;
  23345. /**
  23346. * @private
  23347. */
  23348. type: BoneType;
  23349. /**
  23350. * - The bone length.
  23351. * @version DragonBones 3.0
  23352. * @language en_US
  23353. */
  23354. /**
  23355. * - 骨骼长度。
  23356. * @version DragonBones 3.0
  23357. * @language zh_CN
  23358. */
  23359. length: number;
  23360. /**
  23361. * - The bone name.
  23362. * @version DragonBones 3.0
  23363. * @language en_US
  23364. */
  23365. /**
  23366. * - 骨骼名称。
  23367. * @version DragonBones 3.0
  23368. * @language zh_CN
  23369. */
  23370. name: string;
  23371. /**
  23372. * @private
  23373. */
  23374. readonly transform: Transform;
  23375. /**
  23376. * @private
  23377. */
  23378. userData: UserData | null;
  23379. /**
  23380. * - The parent bone data.
  23381. * @version DragonBones 3.0
  23382. * @language en_US
  23383. */
  23384. /**
  23385. * - 父骨骼数据。
  23386. * @version DragonBones 3.0
  23387. * @language zh_CN
  23388. */
  23389. parent: BoneData | null;
  23390. /**
  23391. * @inheritDoc
  23392. */
  23393. protected _onClear(): void;
  23394. }
  23395. /**
  23396. * @internal
  23397. * @private
  23398. */
  23399. class SurfaceData extends BoneData {
  23400. static toString(): string;
  23401. segmentX: number;
  23402. segmentY: number;
  23403. readonly vertices: Array<number>;
  23404. /**
  23405. * @inheritDoc
  23406. */
  23407. protected _onClear(): void;
  23408. }
  23409. /**
  23410. * - The slot data.
  23411. * @version DragonBones 3.0
  23412. * @language en_US
  23413. */
  23414. /**
  23415. * - 插槽数据。
  23416. * @version DragonBones 3.0
  23417. * @language zh_CN
  23418. */
  23419. class SlotData extends BaseObject {
  23420. /**
  23421. * @internal
  23422. * @private
  23423. */
  23424. static readonly DEFAULT_COLOR: ColorTransform;
  23425. /**
  23426. * @internal
  23427. * @private
  23428. */
  23429. static createColor(): ColorTransform;
  23430. static toString(): string;
  23431. /**
  23432. * @private
  23433. */
  23434. blendMode: BlendMode;
  23435. /**
  23436. * @private
  23437. */
  23438. displayIndex: number;
  23439. /**
  23440. * @private
  23441. */
  23442. zOrder: number;
  23443. /**
  23444. * - The slot name.
  23445. * @version DragonBones 3.0
  23446. * @language en_US
  23447. */
  23448. /**
  23449. * - 插槽名称。
  23450. * @version DragonBones 3.0
  23451. * @language zh_CN
  23452. */
  23453. name: string;
  23454. /**
  23455. * @private
  23456. */
  23457. color: ColorTransform;
  23458. /**
  23459. * @private
  23460. */
  23461. userData: UserData | null;
  23462. /**
  23463. * - The parent bone data.
  23464. * @version DragonBones 3.0
  23465. * @language en_US
  23466. */
  23467. /**
  23468. * - 父骨骼数据。
  23469. * @version DragonBones 3.0
  23470. * @language zh_CN
  23471. */
  23472. parent: BoneData;
  23473. /**
  23474. * @inheritDoc
  23475. */
  23476. protected _onClear(): void;
  23477. }
  23478. }
  23479. /**
  23480. * The MIT License (MIT)
  23481. *
  23482. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23483. *
  23484. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23485. * this software and associated documentation files (the "Software"), to deal in
  23486. * the Software without restriction, including without limitation the rights to
  23487. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23488. * the Software, and to permit persons to whom the Software is furnished to do so,
  23489. * subject to the following conditions:
  23490. *
  23491. * The above copyright notice and this permission notice shall be included in all
  23492. * copies or substantial portions of the Software.
  23493. *
  23494. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23495. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23496. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23497. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23498. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23499. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23500. */
  23501. declare namespace dragonBones {
  23502. /**
  23503. * @internal
  23504. * @private
  23505. */
  23506. abstract class ConstraintData extends BaseObject {
  23507. order: number;
  23508. name: string;
  23509. target: BoneData;
  23510. root: BoneData;
  23511. bone: BoneData | null;
  23512. protected _onClear(): void;
  23513. }
  23514. /**
  23515. * @internal
  23516. * @private
  23517. */
  23518. class IKConstraintData extends ConstraintData {
  23519. static toString(): string;
  23520. scaleEnabled: boolean;
  23521. bendPositive: boolean;
  23522. weight: number;
  23523. protected _onClear(): void;
  23524. }
  23525. }
  23526. /**
  23527. * The MIT License (MIT)
  23528. *
  23529. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23530. *
  23531. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23532. * this software and associated documentation files (the "Software"), to deal in
  23533. * the Software without restriction, including without limitation the rights to
  23534. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23535. * the Software, and to permit persons to whom the Software is furnished to do so,
  23536. * subject to the following conditions:
  23537. *
  23538. * The above copyright notice and this permission notice shall be included in all
  23539. * copies or substantial portions of the Software.
  23540. *
  23541. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23542. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23543. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23544. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23545. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23546. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23547. */
  23548. declare namespace dragonBones {
  23549. /**
  23550. * @internal
  23551. * @private
  23552. */
  23553. class CanvasData extends BaseObject {
  23554. static toString(): string;
  23555. hasBackground: boolean;
  23556. color: number;
  23557. x: number;
  23558. y: number;
  23559. width: number;
  23560. height: number;
  23561. protected _onClear(): void;
  23562. }
  23563. }
  23564. /**
  23565. * The MIT License (MIT)
  23566. *
  23567. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23568. *
  23569. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23570. * this software and associated documentation files (the "Software"), to deal in
  23571. * the Software without restriction, including without limitation the rights to
  23572. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23573. * the Software, and to permit persons to whom the Software is furnished to do so,
  23574. * subject to the following conditions:
  23575. *
  23576. * The above copyright notice and this permission notice shall be included in all
  23577. * copies or substantial portions of the Software.
  23578. *
  23579. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23580. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23581. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23582. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23583. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23584. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23585. */
  23586. declare namespace dragonBones {
  23587. /**
  23588. * - The skin data, typically a armature data instance contains at least one skinData.
  23589. * @version DragonBones 3.0
  23590. * @language en_US
  23591. */
  23592. /**
  23593. * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。
  23594. * @version DragonBones 3.0
  23595. * @language zh_CN
  23596. */
  23597. class SkinData extends BaseObject {
  23598. static toString(): string;
  23599. /**
  23600. * - The skin name.
  23601. * @version DragonBones 3.0
  23602. * @language en_US
  23603. */
  23604. /**
  23605. * - 皮肤名称。
  23606. * @version DragonBones 3.0
  23607. * @language zh_CN
  23608. */
  23609. name: string;
  23610. /**
  23611. * @private
  23612. */
  23613. readonly displays: Map<Array<DisplayData | null>>;
  23614. /**
  23615. * @private
  23616. */
  23617. parent: ArmatureData;
  23618. /**
  23619. * @inheritDoc
  23620. */
  23621. protected _onClear(): void;
  23622. /**
  23623. * @internal
  23624. * @private
  23625. */
  23626. addDisplay(slotName: string, value: DisplayData | null): void;
  23627. /**
  23628. * @private
  23629. */
  23630. getDisplay(slotName: string, displayName: string): DisplayData | null;
  23631. /**
  23632. * @private
  23633. */
  23634. getDisplays(slotName: string): Array<DisplayData | null> | null;
  23635. }
  23636. }
  23637. /**
  23638. * The MIT License (MIT)
  23639. *
  23640. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23641. *
  23642. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23643. * this software and associated documentation files (the "Software"), to deal in
  23644. * the Software without restriction, including without limitation the rights to
  23645. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23646. * the Software, and to permit persons to whom the Software is furnished to do so,
  23647. * subject to the following conditions:
  23648. *
  23649. * The above copyright notice and this permission notice shall be included in all
  23650. * copies or substantial portions of the Software.
  23651. *
  23652. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23653. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23654. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23655. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23656. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23657. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23658. */
  23659. declare namespace dragonBones {
  23660. /**
  23661. * @internal
  23662. * @private
  23663. */
  23664. abstract class DisplayData extends BaseObject {
  23665. type: DisplayType;
  23666. name: string;
  23667. path: string;
  23668. parent: SkinData;
  23669. readonly transform: Transform;
  23670. protected _onClear(): void;
  23671. }
  23672. /**
  23673. * @internal
  23674. * @private
  23675. */
  23676. class ImageDisplayData extends DisplayData {
  23677. static toString(): string;
  23678. readonly pivot: Point;
  23679. texture: TextureData | null;
  23680. protected _onClear(): void;
  23681. }
  23682. /**
  23683. * @internal
  23684. * @private
  23685. */
  23686. class ArmatureDisplayData extends DisplayData {
  23687. static toString(): string;
  23688. inheritAnimation: boolean;
  23689. readonly actions: Array<ActionData>;
  23690. armature: ArmatureData | null;
  23691. protected _onClear(): void;
  23692. /**
  23693. * @private
  23694. */
  23695. addAction(value: ActionData): void;
  23696. }
  23697. /**
  23698. * @internal
  23699. * @private
  23700. */
  23701. class MeshDisplayData extends DisplayData {
  23702. static toString(): string;
  23703. inheritDeform: boolean;
  23704. offset: number;
  23705. weight: WeightData | null;
  23706. glue: GlueData | null;
  23707. texture: TextureData | null;
  23708. protected _onClear(): void;
  23709. }
  23710. /**
  23711. * @internal
  23712. * @private
  23713. */
  23714. class BoundingBoxDisplayData extends DisplayData {
  23715. static toString(): string;
  23716. boundingBox: BoundingBoxData | null;
  23717. protected _onClear(): void;
  23718. }
  23719. /**
  23720. * @internal
  23721. * @private
  23722. */
  23723. class WeightData extends BaseObject {
  23724. static toString(): string;
  23725. count: number;
  23726. offset: number;
  23727. readonly bones: Array<BoneData>;
  23728. protected _onClear(): void;
  23729. addBone(value: BoneData): void;
  23730. }
  23731. /**
  23732. * @internal
  23733. * @private
  23734. */
  23735. class GlueData extends BaseObject {
  23736. static toString(): string;
  23737. readonly weights: Array<number>;
  23738. readonly meshes: Array<MeshDisplayData | null>;
  23739. protected _onClear(): void;
  23740. addMesh(value: MeshDisplayData | null): void;
  23741. }
  23742. }
  23743. /**
  23744. * The MIT License (MIT)
  23745. *
  23746. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23747. *
  23748. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23749. * this software and associated documentation files (the "Software"), to deal in
  23750. * the Software without restriction, including without limitation the rights to
  23751. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23752. * the Software, and to permit persons to whom the Software is furnished to do so,
  23753. * subject to the following conditions:
  23754. *
  23755. * The above copyright notice and this permission notice shall be included in all
  23756. * copies or substantial portions of the Software.
  23757. *
  23758. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23759. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23760. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23761. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23762. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23763. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23764. */
  23765. declare namespace dragonBones {
  23766. /**
  23767. * - The base class of bounding box data.
  23768. * @see dragonBones.RectangleData
  23769. * @see dragonBones.EllipseData
  23770. * @see dragonBones.PolygonData
  23771. * @version DragonBones 5.0
  23772. * @language en_US
  23773. */
  23774. /**
  23775. * - 边界框数据基类。
  23776. * @see dragonBones.RectangleData
  23777. * @see dragonBones.EllipseData
  23778. * @see dragonBones.PolygonData
  23779. * @version DragonBones 5.0
  23780. * @language zh_CN
  23781. */
  23782. abstract class BoundingBoxData extends BaseObject {
  23783. /**
  23784. * - The bounding box type.
  23785. * @version DragonBones 5.0
  23786. * @language en_US
  23787. */
  23788. /**
  23789. * - 边界框类型。
  23790. * @version DragonBones 5.0
  23791. * @language zh_CN
  23792. */
  23793. type: BoundingBoxType;
  23794. /**
  23795. * @private
  23796. */
  23797. color: number;
  23798. /**
  23799. * @private
  23800. */
  23801. width: number;
  23802. /**
  23803. * @private
  23804. */
  23805. height: number;
  23806. /**
  23807. * @private
  23808. */
  23809. protected _onClear(): void;
  23810. /**
  23811. * - Check whether the bounding box contains a specific point. (Local coordinate system)
  23812. * @version DragonBones 5.0
  23813. * @language en_US
  23814. */
  23815. /**
  23816. * - 检查边界框是否包含特定点。(本地坐标系)
  23817. * @version DragonBones 5.0
  23818. * @language zh_CN
  23819. */
  23820. abstract containsPoint(pX: number, pY: number): boolean;
  23821. /**
  23822. * - Check whether the bounding box intersects a specific segment. (Local coordinate system)
  23823. * @version DragonBones 5.0
  23824. * @language en_US
  23825. */
  23826. /**
  23827. * - 检查边界框是否与特定线段相交。(本地坐标系)
  23828. * @version DragonBones 5.0
  23829. * @language zh_CN
  23830. */
  23831. abstract intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA: {
  23832. x: number;
  23833. y: number;
  23834. } | null, intersectionPointB: {
  23835. x: number;
  23836. y: number;
  23837. } | null, normalRadians: {
  23838. x: number;
  23839. y: number;
  23840. } | null): number;
  23841. }
  23842. /**
  23843. * - The rectangle bounding box data.
  23844. * @version DragonBones 5.1
  23845. * @language en_US
  23846. */
  23847. /**
  23848. * - 矩形边界框数据。
  23849. * @version DragonBones 5.1
  23850. * @language zh_CN
  23851. */
  23852. class RectangleBoundingBoxData extends BoundingBoxData {
  23853. static toString(): string;
  23854. /**
  23855. * - Compute the bit code for a point (x, y) using the clip rectangle
  23856. */
  23857. private static _computeOutCode(x, y, xMin, yMin, xMax, yMax);
  23858. /**
  23859. * @private
  23860. */
  23861. static rectangleIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xMin: number, yMin: number, xMax: number, yMax: number, intersectionPointA?: {
  23862. x: number;
  23863. y: number;
  23864. } | null, intersectionPointB?: {
  23865. x: number;
  23866. y: number;
  23867. } | null, normalRadians?: {
  23868. x: number;
  23869. y: number;
  23870. } | null): number;
  23871. /**
  23872. * @inheritDoc
  23873. * @private
  23874. */
  23875. protected _onClear(): void;
  23876. /**
  23877. * @inheritDoc
  23878. */
  23879. containsPoint(pX: number, pY: number): boolean;
  23880. /**
  23881. * @inheritDoc
  23882. */
  23883. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23884. x: number;
  23885. y: number;
  23886. } | null, intersectionPointB?: {
  23887. x: number;
  23888. y: number;
  23889. } | null, normalRadians?: {
  23890. x: number;
  23891. y: number;
  23892. } | null): number;
  23893. }
  23894. /**
  23895. * - The ellipse bounding box data.
  23896. * @version DragonBones 5.1
  23897. * @language en_US
  23898. */
  23899. /**
  23900. * - 椭圆边界框数据。
  23901. * @version DragonBones 5.1
  23902. * @language zh_CN
  23903. */
  23904. class EllipseBoundingBoxData extends BoundingBoxData {
  23905. static toString(): string;
  23906. /**
  23907. * @private
  23908. */
  23909. static ellipseIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, widthH: number, heightH: number, intersectionPointA?: {
  23910. x: number;
  23911. y: number;
  23912. } | null, intersectionPointB?: {
  23913. x: number;
  23914. y: number;
  23915. } | null, normalRadians?: {
  23916. x: number;
  23917. y: number;
  23918. } | null): number;
  23919. /**
  23920. * @inheritDoc
  23921. * @private
  23922. */
  23923. protected _onClear(): void;
  23924. /**
  23925. * @inheritDoc
  23926. */
  23927. containsPoint(pX: number, pY: number): boolean;
  23928. /**
  23929. * @inheritDoc
  23930. */
  23931. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23932. x: number;
  23933. y: number;
  23934. } | null, intersectionPointB?: {
  23935. x: number;
  23936. y: number;
  23937. } | null, normalRadians?: {
  23938. x: number;
  23939. y: number;
  23940. } | null): number;
  23941. }
  23942. /**
  23943. * - The polygon bounding box data.
  23944. * @version DragonBones 5.1
  23945. * @language en_US
  23946. */
  23947. /**
  23948. * - 多边形边界框数据。
  23949. * @version DragonBones 5.1
  23950. * @language zh_CN
  23951. */
  23952. class PolygonBoundingBoxData extends BoundingBoxData {
  23953. static toString(): string;
  23954. /**
  23955. * @private
  23956. */
  23957. static polygonIntersectsSegment(xA: number, yA: number, xB: number, yB: number, vertices: Array<number>, intersectionPointA?: {
  23958. x: number;
  23959. y: number;
  23960. } | null, intersectionPointB?: {
  23961. x: number;
  23962. y: number;
  23963. } | null, normalRadians?: {
  23964. x: number;
  23965. y: number;
  23966. } | null): number;
  23967. /**
  23968. * @private
  23969. */
  23970. x: number;
  23971. /**
  23972. * @private
  23973. */
  23974. y: number;
  23975. /**
  23976. * - The polygon vertices.
  23977. * @version DragonBones 5.1
  23978. * @language en_US
  23979. */
  23980. /**
  23981. * - 多边形顶点。
  23982. * @version DragonBones 5.1
  23983. * @language zh_CN
  23984. */
  23985. readonly vertices: Array<number>;
  23986. /**
  23987. * @private
  23988. */
  23989. weight: WeightData | null;
  23990. /**
  23991. * @inheritDoc
  23992. * @private
  23993. */
  23994. protected _onClear(): void;
  23995. /**
  23996. * @inheritDoc
  23997. */
  23998. containsPoint(pX: number, pY: number): boolean;
  23999. /**
  24000. * @inheritDoc
  24001. */
  24002. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  24003. x: number;
  24004. y: number;
  24005. } | null, intersectionPointB?: {
  24006. x: number;
  24007. y: number;
  24008. } | null, normalRadians?: {
  24009. x: number;
  24010. y: number;
  24011. } | null): number;
  24012. }
  24013. }
  24014. /**
  24015. * The MIT License (MIT)
  24016. *
  24017. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24018. *
  24019. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24020. * this software and associated documentation files (the "Software"), to deal in
  24021. * the Software without restriction, including without limitation the rights to
  24022. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24023. * the Software, and to permit persons to whom the Software is furnished to do so,
  24024. * subject to the following conditions:
  24025. *
  24026. * The above copyright notice and this permission notice shall be included in all
  24027. * copies or substantial portions of the Software.
  24028. *
  24029. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24030. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24031. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24032. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24033. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24034. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24035. */
  24036. declare namespace dragonBones {
  24037. /**
  24038. * - The animation data.
  24039. * @version DragonBones 3.0
  24040. * @language en_US
  24041. */
  24042. /**
  24043. * - 动画数据。
  24044. * @version DragonBones 3.0
  24045. * @language zh_CN
  24046. */
  24047. class AnimationData extends BaseObject {
  24048. static toString(): string;
  24049. /**
  24050. * - FrameIntArray.
  24051. * @internal
  24052. * @private
  24053. */
  24054. frameIntOffset: number;
  24055. /**
  24056. * - FrameFloatArray.
  24057. * @internal
  24058. * @private
  24059. */
  24060. frameFloatOffset: number;
  24061. /**
  24062. * - FrameArray.
  24063. * @internal
  24064. * @private
  24065. */
  24066. frameOffset: number;
  24067. /**
  24068. * - The frame count of the animation.
  24069. * @version DragonBones 3.0
  24070. * @language en_US
  24071. */
  24072. /**
  24073. * - 动画的帧数。
  24074. * @version DragonBones 3.0
  24075. * @language zh_CN
  24076. */
  24077. frameCount: number;
  24078. /**
  24079. * - The play times of the animation. [0: Loop play, [1~N]: Play N times]
  24080. * @version DragonBones 3.0
  24081. * @language en_US
  24082. */
  24083. /**
  24084. * - 动画的播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  24085. * @version DragonBones 3.0
  24086. * @language zh_CN
  24087. */
  24088. playTimes: number;
  24089. /**
  24090. * - The duration of the animation. (In seconds)
  24091. * @version DragonBones 3.0
  24092. * @language en_US
  24093. */
  24094. /**
  24095. * - 动画的持续时间。 (以秒为单位)
  24096. * @version DragonBones 3.0
  24097. * @language zh_CN
  24098. */
  24099. duration: number;
  24100. /**
  24101. * @private
  24102. */
  24103. scale: number;
  24104. /**
  24105. * - The fade in time of the animation. (In seconds)
  24106. * @version DragonBones 3.0
  24107. * @language en_US
  24108. */
  24109. /**
  24110. * - 动画的淡入时间。 (以秒为单位)
  24111. * @version DragonBones 3.0
  24112. * @language zh_CN
  24113. */
  24114. fadeInTime: number;
  24115. /**
  24116. * @private
  24117. */
  24118. cacheFrameRate: number;
  24119. /**
  24120. * - The animation name.
  24121. * @version DragonBones 3.0
  24122. * @language en_US
  24123. */
  24124. /**
  24125. * - 动画名称。
  24126. * @version DragonBones 3.0
  24127. * @language zh_CN
  24128. */
  24129. name: string;
  24130. /**
  24131. * @private
  24132. */
  24133. readonly cachedFrames: Array<boolean>;
  24134. /**
  24135. * @private
  24136. */
  24137. readonly boneTimelines: Map<Array<TimelineData>>;
  24138. /**
  24139. * @private
  24140. */
  24141. readonly surfaceTimelines: Map<Array<TimelineData>>;
  24142. /**
  24143. * @private
  24144. */
  24145. readonly slotTimelines: Map<Array<TimelineData>>;
  24146. /**
  24147. * @private
  24148. */
  24149. readonly constraintTimelines: Map<Array<TimelineData>>;
  24150. /**
  24151. * @private
  24152. */
  24153. readonly animationTimelines: Map<Array<TimelineData>>;
  24154. /**
  24155. * @private
  24156. */
  24157. readonly boneCachedFrameIndices: Map<Array<number>>;
  24158. /**
  24159. * @private
  24160. */
  24161. readonly slotCachedFrameIndices: Map<Array<number>>;
  24162. /**
  24163. * @private
  24164. */
  24165. actionTimeline: TimelineData | null;
  24166. /**
  24167. * @private
  24168. */
  24169. zOrderTimeline: TimelineData | null;
  24170. /**
  24171. * @private
  24172. */
  24173. parent: ArmatureData;
  24174. /**
  24175. * @inheritDoc
  24176. */
  24177. protected _onClear(): void;
  24178. /**
  24179. * @internal
  24180. * @private
  24181. */
  24182. cacheFrames(frameRate: number): void;
  24183. /**
  24184. * @private
  24185. */
  24186. addBoneTimeline(bone: BoneData, timeline: TimelineData): void;
  24187. /**
  24188. * @private
  24189. */
  24190. addSurfaceTimeline(surface: SurfaceData, timeline: TimelineData): void;
  24191. /**
  24192. * @private
  24193. */
  24194. addSlotTimeline(slot: SlotData, timeline: TimelineData): void;
  24195. /**
  24196. * @private
  24197. */
  24198. addConstraintTimeline(constraint: ConstraintData, timeline: TimelineData): void;
  24199. /**
  24200. * @private
  24201. */
  24202. addAnimationTimeline(name: string, timeline: TimelineData): void;
  24203. /**
  24204. * @private
  24205. */
  24206. getBoneTimelines(name: string): Array<TimelineData> | null;
  24207. /**
  24208. * @private
  24209. */
  24210. getSurfaceTimelines(name: string): Array<TimelineData> | null;
  24211. /**
  24212. * @private
  24213. */
  24214. getSlotTimelines(name: string): Array<TimelineData> | null;
  24215. /**
  24216. * @private
  24217. */
  24218. getConstraintTimelines(name: string): Array<TimelineData> | null;
  24219. /**
  24220. * @private
  24221. */
  24222. getAnimationTimelines(name: string): Array<TimelineData> | null;
  24223. /**
  24224. * @private
  24225. */
  24226. getBoneCachedFrameIndices(name: string): Array<number> | null;
  24227. /**
  24228. * @private
  24229. */
  24230. getSlotCachedFrameIndices(name: string): Array<number> | null;
  24231. }
  24232. /**
  24233. * @internal
  24234. * @private
  24235. */
  24236. class TimelineData extends BaseObject {
  24237. static toString(): string;
  24238. type: TimelineType;
  24239. offset: number;
  24240. frameIndicesOffset: number;
  24241. protected _onClear(): void;
  24242. }
  24243. }
  24244. /**
  24245. * The MIT License (MIT)
  24246. *
  24247. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24248. *
  24249. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24250. * this software and associated documentation files (the "Software"), to deal in
  24251. * the Software without restriction, including without limitation the rights to
  24252. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24253. * the Software, and to permit persons to whom the Software is furnished to do so,
  24254. * subject to the following conditions:
  24255. *
  24256. * The above copyright notice and this permission notice shall be included in all
  24257. * copies or substantial portions of the Software.
  24258. *
  24259. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24260. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24261. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24262. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24263. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24264. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24265. */
  24266. declare namespace dragonBones {
  24267. /**
  24268. * - The animation config is used to describe all the information needed to play an animation state.
  24269. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  24270. * @see dragonBones.AnimationState
  24271. * @beta
  24272. * @version DragonBones 5.0
  24273. * @language en_US
  24274. */
  24275. /**
  24276. * - 动画配置用来描述播放一个动画状态所需要的全部信息。
  24277. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  24278. * @see dragonBones.AnimationState
  24279. * @beta
  24280. * @version DragonBones 5.0
  24281. * @language zh_CN
  24282. */
  24283. class AnimationConfig extends BaseObject {
  24284. static toString(): string;
  24285. /**
  24286. * @private
  24287. */
  24288. pauseFadeOut: boolean;
  24289. /**
  24290. * - Fade out the pattern of other animation states when the animation state is fade in.
  24291. * This property is typically used to specify the substitution of multiple animation states blend.
  24292. * @default dragonBones.AnimationFadeOutMode.All
  24293. * @version DragonBones 5.0
  24294. * @language en_US
  24295. */
  24296. /**
  24297. * - 淡入动画状态时淡出其他动画状态的模式。
  24298. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  24299. * @default dragonBones.AnimationFadeOutMode.All
  24300. * @version DragonBones 5.0
  24301. * @language zh_CN
  24302. */
  24303. fadeOutMode: AnimationFadeOutMode;
  24304. /**
  24305. * @private
  24306. */
  24307. fadeOutTweenType: TweenType;
  24308. /**
  24309. * @private
  24310. */
  24311. fadeOutTime: number;
  24312. /**
  24313. * @private
  24314. */
  24315. pauseFadeIn: boolean;
  24316. /**
  24317. * @private
  24318. */
  24319. actionEnabled: boolean;
  24320. /**
  24321. * @private
  24322. */
  24323. additiveBlending: boolean;
  24324. /**
  24325. * - Whether the animation state has control over the display property of the slots.
  24326. * Sometimes blend a animation state does not want it to control the display properties of the slots,
  24327. * especially if other animation state are controlling the display properties of the slots.
  24328. * @default true
  24329. * @version DragonBones 5.0
  24330. * @language en_US
  24331. */
  24332. /**
  24333. * - 动画状态是否对插槽的显示对象属性有控制权。
  24334. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  24335. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  24336. * @default true
  24337. * @version DragonBones 5.0
  24338. * @language zh_CN
  24339. */
  24340. displayControl: boolean;
  24341. /**
  24342. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  24343. * This property should usually be set to false when blend multiple animation states.
  24344. * @default true
  24345. * @version DragonBones 5.1
  24346. * @language en_US
  24347. */
  24348. /**
  24349. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  24350. * 通常在混合多个动画状态时应该将该属性设置为 false。
  24351. * @default true
  24352. * @version DragonBones 5.1
  24353. * @language zh_CN
  24354. */
  24355. resetToPose: boolean;
  24356. /**
  24357. * @private
  24358. */
  24359. fadeInTweenType: TweenType;
  24360. /**
  24361. * - The play times. [0: Loop play, [1~N]: Play N times]
  24362. * @version DragonBones 3.0
  24363. * @language en_US
  24364. */
  24365. /**
  24366. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  24367. * @version DragonBones 3.0
  24368. * @language zh_CN
  24369. */
  24370. playTimes: number;
  24371. /**
  24372. * - The blend layer.
  24373. * High layer animation state will get the blend weight first.
  24374. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  24375. * @readonly
  24376. * @version DragonBones 5.0
  24377. * @language en_US
  24378. */
  24379. /**
  24380. * - 混合图层。
  24381. * 图层高的动画状态会优先获取混合权重。
  24382. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  24383. * @readonly
  24384. * @version DragonBones 5.0
  24385. * @language zh_CN
  24386. */
  24387. layer: number;
  24388. /**
  24389. * - The start time of play. (In seconds)
  24390. * @default 0.0
  24391. * @version DragonBones 5.0
  24392. * @language en_US
  24393. */
  24394. /**
  24395. * - 播放的开始时间。 (以秒为单位)
  24396. * @default 0.0
  24397. * @version DragonBones 5.0
  24398. * @language zh_CN
  24399. */
  24400. position: number;
  24401. /**
  24402. * - The duration of play.
  24403. * [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
  24404. * @default -1.0
  24405. * @version DragonBones 5.0
  24406. * @language en_US
  24407. */
  24408. /**
  24409. * - 播放的持续时间。
  24410. * [-1: 使用动画数据默认值, 0: 动画停止, (0~N]: 持续时间] (以秒为单位)
  24411. * @default -1.0
  24412. * @version DragonBones 5.0
  24413. * @language zh_CN
  24414. */
  24415. duration: number;
  24416. /**
  24417. * - The play speed.
  24418. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  24419. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  24420. * @default 1.0
  24421. * @version DragonBones 3.0
  24422. * @language en_US
  24423. */
  24424. /**
  24425. * - 播放速度。
  24426. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  24427. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  24428. * @default 1.0
  24429. * @version DragonBones 3.0
  24430. * @language zh_CN
  24431. */
  24432. timeScale: number;
  24433. /**
  24434. * - The blend weight.
  24435. * @default 1.0
  24436. * @version DragonBones 5.0
  24437. * @language en_US
  24438. */
  24439. /**
  24440. * - 混合权重。
  24441. * @default 1.0
  24442. * @version DragonBones 5.0
  24443. * @language zh_CN
  24444. */
  24445. weight: number;
  24446. /**
  24447. * - The fade in time.
  24448. * [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
  24449. * @default -1.0
  24450. * @version DragonBones 5.0
  24451. * @language en_US
  24452. */
  24453. /**
  24454. * - 淡入时间。
  24455. * [-1: 使用动画数据默认值, [0~N]: 淡入时间] (以秒为单位)
  24456. * @default -1.0
  24457. * @version DragonBones 5.0
  24458. * @language zh_CN
  24459. */
  24460. fadeInTime: number;
  24461. /**
  24462. * - The auto fade out time when the animation state play completed.
  24463. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  24464. * @default -1.0
  24465. * @version DragonBones 5.0
  24466. * @language en_US
  24467. */
  24468. /**
  24469. * - 动画状态播放完成后的自动淡出时间。
  24470. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  24471. * @default -1.0
  24472. * @version DragonBones 5.0
  24473. * @language zh_CN
  24474. */
  24475. autoFadeOutTime: number;
  24476. /**
  24477. * - The name of the animation state. (Can be different from the name of the animation data)
  24478. * @version DragonBones 5.0
  24479. * @language en_US
  24480. */
  24481. /**
  24482. * - 动画状态名称。 (可以不同于动画数据)
  24483. * @version DragonBones 5.0
  24484. * @language zh_CN
  24485. */
  24486. name: string;
  24487. /**
  24488. * - The animation data name.
  24489. * @version DragonBones 5.0
  24490. * @language en_US
  24491. */
  24492. /**
  24493. * - 动画数据名称。
  24494. * @version DragonBones 5.0
  24495. * @language zh_CN
  24496. */
  24497. animation: string;
  24498. /**
  24499. * - The blend group name of the animation state.
  24500. * This property is typically used to specify the substitution of multiple animation states blend.
  24501. * @readonly
  24502. * @version DragonBones 5.0
  24503. * @language en_US
  24504. */
  24505. /**
  24506. * - 混合组名称。
  24507. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  24508. * @readonly
  24509. * @version DragonBones 5.0
  24510. * @language zh_CN
  24511. */
  24512. group: string;
  24513. /**
  24514. * @private
  24515. */
  24516. readonly boneMask: Array<string>;
  24517. /**
  24518. * @private
  24519. */
  24520. protected _onClear(): void;
  24521. /**
  24522. * @private
  24523. */
  24524. clear(): void;
  24525. /**
  24526. * @private
  24527. */
  24528. copyFrom(value: AnimationConfig): void;
  24529. /**
  24530. * @private
  24531. */
  24532. containsBoneMask(name: string): boolean;
  24533. /**
  24534. * @private
  24535. */
  24536. addBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  24537. /**
  24538. * @private
  24539. */
  24540. removeBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  24541. }
  24542. }
  24543. /**
  24544. * The MIT License (MIT)
  24545. *
  24546. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24547. *
  24548. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24549. * this software and associated documentation files (the "Software"), to deal in
  24550. * the Software without restriction, including without limitation the rights to
  24551. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24552. * the Software, and to permit persons to whom the Software is furnished to do so,
  24553. * subject to the following conditions:
  24554. *
  24555. * The above copyright notice and this permission notice shall be included in all
  24556. * copies or substantial portions of the Software.
  24557. *
  24558. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24559. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24560. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24561. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24562. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24563. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24564. */
  24565. declare namespace dragonBones {
  24566. /**
  24567. * - The texture atlas data.
  24568. * @version DragonBones 3.0
  24569. * @language en_US
  24570. */
  24571. /**
  24572. * - 贴图集数据。
  24573. * @version DragonBones 3.0
  24574. * @language zh_CN
  24575. */
  24576. abstract class TextureAtlasData extends BaseObject {
  24577. /**
  24578. * @private
  24579. */
  24580. autoSearch: boolean;
  24581. /**
  24582. * @private
  24583. */
  24584. width: number;
  24585. /**
  24586. * @private
  24587. */
  24588. height: number;
  24589. /**
  24590. * @private
  24591. */
  24592. scale: number;
  24593. /**
  24594. * - The texture atlas name.
  24595. * @version DragonBones 3.0
  24596. * @language en_US
  24597. */
  24598. /**
  24599. * - 贴图集名称。
  24600. * @version DragonBones 3.0
  24601. * @language zh_CN
  24602. */
  24603. name: string;
  24604. /**
  24605. * - The image path of the texture atlas.
  24606. * @version DragonBones 3.0
  24607. * @language en_US
  24608. */
  24609. /**
  24610. * - 贴图集图片路径。
  24611. * @version DragonBones 3.0
  24612. * @language zh_CN
  24613. */
  24614. imagePath: string;
  24615. /**
  24616. * @private
  24617. */
  24618. readonly textures: Map<TextureData>;
  24619. /**
  24620. * @inheritDoc
  24621. */
  24622. protected _onClear(): void;
  24623. /**
  24624. * @private
  24625. */
  24626. copyFrom(value: TextureAtlasData): void;
  24627. /**
  24628. * @internal
  24629. * @private
  24630. */
  24631. abstract createTexture(): TextureData;
  24632. /**
  24633. * @internal
  24634. * @private
  24635. */
  24636. addTexture(value: TextureData): void;
  24637. /**
  24638. * @private
  24639. */
  24640. getTexture(name: string): TextureData | null;
  24641. }
  24642. /**
  24643. * @internal
  24644. * @private
  24645. */
  24646. abstract class TextureData extends BaseObject {
  24647. static createRectangle(): Rectangle;
  24648. rotated: boolean;
  24649. name: string;
  24650. readonly region: Rectangle;
  24651. parent: TextureAtlasData;
  24652. frame: Rectangle | null;
  24653. protected _onClear(): void;
  24654. copyFrom(value: TextureData): void;
  24655. }
  24656. }
  24657. /**
  24658. * The MIT License (MIT)
  24659. *
  24660. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24661. *
  24662. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24663. * this software and associated documentation files (the "Software"), to deal in
  24664. * the Software without restriction, including without limitation the rights to
  24665. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24666. * the Software, and to permit persons to whom the Software is furnished to do so,
  24667. * subject to the following conditions:
  24668. *
  24669. * The above copyright notice and this permission notice shall be included in all
  24670. * copies or substantial portions of the Software.
  24671. *
  24672. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24673. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24674. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24675. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24676. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24677. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24678. */
  24679. declare namespace dragonBones {
  24680. /**
  24681. * - The armature proxy interface, the docking engine needs to implement it concretely.
  24682. * @see dragonBones.Armature
  24683. * @version DragonBones 5.0
  24684. * @language en_US
  24685. */
  24686. /**
  24687. * - 骨架代理接口,对接的引擎需要对其进行具体实现。
  24688. * @see dragonBones.Armature
  24689. * @version DragonBones 5.0
  24690. * @language zh_CN
  24691. */
  24692. interface IArmatureProxy extends IEventDispatcher {
  24693. /**
  24694. * @internal
  24695. * @private
  24696. */
  24697. dbInit(armature: Armature): void;
  24698. /**
  24699. * @internal
  24700. * @private
  24701. */
  24702. dbClear(): void;
  24703. /**
  24704. * @internal
  24705. * @private
  24706. */
  24707. dbUpdate(): void;
  24708. /**
  24709. * - Dispose the instance and the Armature instance. (The Armature instance will return to the object pool)
  24710. * @example
  24711. * <pre>
  24712. * removeChild(armatureDisplay);
  24713. * armatureDisplay.dispose();
  24714. * </pre>
  24715. * @version DragonBones 4.5
  24716. * @language en_US
  24717. */
  24718. /**
  24719. * - 释放该实例和骨架。 (骨架会回收到对象池)
  24720. * @example
  24721. * <pre>
  24722. * removeChild(armatureDisplay);
  24723. * armatureDisplay.dispose();
  24724. * </pre>
  24725. * @version DragonBones 4.5
  24726. * @language zh_CN
  24727. */
  24728. dispose(disposeProxy: boolean): void;
  24729. /**
  24730. * - The armature.
  24731. * @version DragonBones 4.5
  24732. * @language en_US
  24733. */
  24734. /**
  24735. * - 骨架。
  24736. * @version DragonBones 4.5
  24737. * @language zh_CN
  24738. */
  24739. readonly armature: Armature;
  24740. /**
  24741. * - The animation player.
  24742. * @version DragonBones 3.0
  24743. * @language en_US
  24744. */
  24745. /**
  24746. * - 动画播放器。
  24747. * @version DragonBones 3.0
  24748. * @language zh_CN
  24749. */
  24750. readonly animation: Animation;
  24751. }
  24752. }
  24753. /**
  24754. * The MIT License (MIT)
  24755. *
  24756. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24757. *
  24758. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24759. * this software and associated documentation files (the "Software"), to deal in
  24760. * the Software without restriction, including without limitation the rights to
  24761. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24762. * the Software, and to permit persons to whom the Software is furnished to do so,
  24763. * subject to the following conditions:
  24764. *
  24765. * The above copyright notice and this permission notice shall be included in all
  24766. * copies or substantial portions of the Software.
  24767. *
  24768. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24769. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24770. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24771. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24772. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24773. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24774. */
  24775. declare namespace dragonBones {
  24776. /**
  24777. * - Armature is the core of the skeleton animation system.
  24778. * @see dragonBones.ArmatureData
  24779. * @see dragonBones.Bone
  24780. * @see dragonBones.Slot
  24781. * @see dragonBones.Animation
  24782. * @version DragonBones 3.0
  24783. * @language en_US
  24784. */
  24785. /**
  24786. * - 骨架是骨骼动画系统的核心。
  24787. * @see dragonBones.ArmatureData
  24788. * @see dragonBones.Bone
  24789. * @see dragonBones.Slot
  24790. * @see dragonBones.Animation
  24791. * @version DragonBones 3.0
  24792. * @language zh_CN
  24793. */
  24794. class Armature extends BaseObject implements IAnimatable {
  24795. static toString(): string;
  24796. private static _onSortSlots(a, b);
  24797. /**
  24798. * - Whether to inherit the animation control of the parent armature.
  24799. * True to try to have the child armature play an animation with the same name when the parent armature play the animation.
  24800. * @default true
  24801. * @version DragonBones 4.5
  24802. * @language en_US
  24803. */
  24804. /**
  24805. * - 是否继承父骨架的动画控制。
  24806. * 如果该值为 true,当父骨架播放动画时,会尝试让子骨架播放同名动画。
  24807. * @default true
  24808. * @version DragonBones 4.5
  24809. * @language zh_CN
  24810. */
  24811. inheritAnimation: boolean;
  24812. /**
  24813. * @private
  24814. */
  24815. userData: any;
  24816. private _lockUpdate;
  24817. private _bonesDirty;
  24818. private _slotsDirty;
  24819. private _zOrderDirty;
  24820. private _flipX;
  24821. private _flipY;
  24822. /**
  24823. * @internal
  24824. * @private
  24825. */
  24826. _cacheFrameIndex: number;
  24827. private readonly _bones;
  24828. private readonly _slots;
  24829. /**
  24830. * @internal
  24831. * @private
  24832. */
  24833. readonly _glueSlots: Array<Slot>;
  24834. /**
  24835. * @internal
  24836. * @private
  24837. */
  24838. readonly _constraints: Array<Constraint>;
  24839. private readonly _actions;
  24840. /**
  24841. * @internal
  24842. * @private
  24843. */
  24844. _armatureData: ArmatureData;
  24845. private _animation;
  24846. private _proxy;
  24847. private _display;
  24848. /**
  24849. * @internal
  24850. * @private
  24851. */
  24852. _replaceTextureAtlasData: TextureAtlasData | null;
  24853. private _replacedTexture;
  24854. /**
  24855. * @internal
  24856. * @private
  24857. */
  24858. _dragonBones: DragonBones;
  24859. private _clock;
  24860. /**
  24861. * @internal
  24862. * @private
  24863. */
  24864. _parent: Slot | null;
  24865. /**
  24866. * @private
  24867. */
  24868. protected _onClear(): void;
  24869. private _sortBones();
  24870. private _sortSlots();
  24871. /**
  24872. * @internal
  24873. * @private
  24874. */
  24875. _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void;
  24876. /**
  24877. * @internal
  24878. * @private
  24879. */
  24880. _addBoneToBoneList(value: Bone): void;
  24881. /**
  24882. * @internal
  24883. * @private
  24884. */
  24885. _removeBoneFromBoneList(value: Bone): void;
  24886. /**
  24887. * @internal
  24888. * @private
  24889. */
  24890. _addSlotToSlotList(value: Slot): void;
  24891. /**
  24892. * @internal
  24893. * @private
  24894. */
  24895. _removeSlotFromSlotList(value: Slot): void;
  24896. /**
  24897. * @internal
  24898. * @private
  24899. */
  24900. _bufferAction(action: ActionData, append: boolean): void;
  24901. /**
  24902. * - Dispose the armature. (Return to the object pool)
  24903. * @example
  24904. * <pre>
  24905. * removeChild(armature.display);
  24906. * armature.dispose();
  24907. * </pre>
  24908. * @version DragonBones 3.0
  24909. * @language en_US
  24910. */
  24911. /**
  24912. * - 释放骨架。 (回收到对象池)
  24913. * @example
  24914. * <pre>
  24915. * removeChild(armature.display);
  24916. * armature.dispose();
  24917. * </pre>
  24918. * @version DragonBones 3.0
  24919. * @language zh_CN
  24920. */
  24921. dispose(): void;
  24922. /**
  24923. * @internal
  24924. * @private
  24925. */
  24926. init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void;
  24927. /**
  24928. * @inheritDoc
  24929. */
  24930. advanceTime(passedTime: number): void;
  24931. /**
  24932. * - Forces a specific bone or its owning slot to update the transform or display property in the next frame.
  24933. * @param boneName - The bone name. (If not set, all bones will be update)
  24934. * @param updateSlot - Whether to update the bone's slots. (Default: false)
  24935. * @see dragonBones.Bone#invalidUpdate()
  24936. * @see dragonBones.Slot#invalidUpdate()
  24937. * @version DragonBones 3.0
  24938. * @language en_US
  24939. */
  24940. /**
  24941. * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。
  24942. * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼)
  24943. * @param updateSlot - 是否更新骨骼的插槽。 (默认: false)
  24944. * @see dragonBones.Bone#invalidUpdate()
  24945. * @see dragonBones.Slot#invalidUpdate()
  24946. * @version DragonBones 3.0
  24947. * @language zh_CN
  24948. */
  24949. invalidUpdate(boneName?: string | null, updateSlot?: boolean): void;
  24950. /**
  24951. * - Check whether a specific point is inside a custom bounding box in a slot.
  24952. * The coordinate system of the point is the inner coordinate system of the armature.
  24953. * Custom bounding boxes need to be customized in Dragonbones Pro.
  24954. * @param x - The horizontal coordinate of the point.
  24955. * @param y - The vertical coordinate of the point.
  24956. * @version DragonBones 5.0
  24957. * @language en_US
  24958. */
  24959. /**
  24960. * - 检查特定点是否在某个插槽的自定义边界框内。
  24961. * 点的坐标系为骨架内坐标系。
  24962. * 自定义边界框需要在 DragonBones Pro 中自定义。
  24963. * @param x - 点的水平坐标。
  24964. * @param y - 点的垂直坐标。
  24965. * @version DragonBones 5.0
  24966. * @language zh_CN
  24967. */
  24968. containsPoint(x: number, y: number): Slot | null;
  24969. /**
  24970. * - Check whether a specific segment intersects a custom bounding box for a slot in the armature.
  24971. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  24972. * Custom bounding boxes need to be customized in Dragonbones Pro.
  24973. * @param xA - The horizontal coordinate of the beginning of the segment.
  24974. * @param yA - The vertical coordinate of the beginning of the segment.
  24975. * @param xB - The horizontal coordinate of the end point of the segment.
  24976. * @param yB - The vertical coordinate of the end point of the segment.
  24977. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
  24978. * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
  24979. * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
  24980. * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point.
  24981. * @version DragonBones 5.0
  24982. * @language en_US
  24983. */
  24984. /**
  24985. * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。
  24986. * 线段和交点的坐标系均为骨架内坐标系。
  24987. * 自定义边界框需要在 DragonBones Pro 中自定义。
  24988. * @param xA - 线段起点的水平坐标。
  24989. * @param yA - 线段起点的垂直坐标。
  24990. * @param xB - 线段终点的水平坐标。
  24991. * @param yB - 线段终点的垂直坐标。
  24992. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  24993. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  24994. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  24995. * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。
  24996. * @version DragonBones 5.0
  24997. * @language zh_CN
  24998. */
  24999. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  25000. x: number;
  25001. y: number;
  25002. } | null, intersectionPointB?: {
  25003. x: number;
  25004. y: number;
  25005. } | null, normalRadians?: {
  25006. x: number;
  25007. y: number;
  25008. } | null): Slot | null;
  25009. /**
  25010. * - Get a specific bone.
  25011. * @param name - The bone name.
  25012. * @see dragonBones.Bone
  25013. * @version DragonBones 3.0
  25014. * @language en_US
  25015. */
  25016. /**
  25017. * - 获取特定的骨骼。
  25018. * @param name - 骨骼名称。
  25019. * @see dragonBones.Bone
  25020. * @version DragonBones 3.0
  25021. * @language zh_CN
  25022. */
  25023. getBone(name: string): Bone | null;
  25024. /**
  25025. * - Get a specific bone by the display.
  25026. * @param display - The display object.
  25027. * @see dragonBones.Bone
  25028. * @version DragonBones 3.0
  25029. * @language en_US
  25030. */
  25031. /**
  25032. * - 通过显示对象获取特定的骨骼。
  25033. * @param display - 显示对象。
  25034. * @see dragonBones.Bone
  25035. * @version DragonBones 3.0
  25036. * @language zh_CN
  25037. */
  25038. getBoneByDisplay(display: any): Bone | null;
  25039. /**
  25040. * - Get a specific slot.
  25041. * @param name - The slot name.
  25042. * @see dragonBones.Slot
  25043. * @version DragonBones 3.0
  25044. * @language en_US
  25045. */
  25046. /**
  25047. * - 获取特定的插槽。
  25048. * @param name - 插槽名称。
  25049. * @see dragonBones.Slot
  25050. * @version DragonBones 3.0
  25051. * @language zh_CN
  25052. */
  25053. getSlot(name: string): Slot | null;
  25054. /**
  25055. * - Get a specific slot by the display.
  25056. * @param display - The display object.
  25057. * @see dragonBones.Slot
  25058. * @version DragonBones 3.0
  25059. * @language en_US
  25060. */
  25061. /**
  25062. * - 通过显示对象获取特定的插槽。
  25063. * @param display - 显示对象。
  25064. * @see dragonBones.Slot
  25065. * @version DragonBones 3.0
  25066. * @language zh_CN
  25067. */
  25068. getSlotByDisplay(display: any): Slot | null;
  25069. /**
  25070. * @deprecated
  25071. */
  25072. addBone(value: Bone, parentName: string): void;
  25073. /**
  25074. * @deprecated
  25075. */
  25076. addSlot(value: Slot, parentName: string): void;
  25077. /**
  25078. * @private
  25079. */
  25080. addConstraint(value: Constraint): void;
  25081. /**
  25082. * @deprecated
  25083. */
  25084. removeBone(value: Bone): void;
  25085. /**
  25086. * @deprecated
  25087. */
  25088. removeSlot(value: Slot): void;
  25089. /**
  25090. * - Get all bones.
  25091. * @see dragonBones.Bone
  25092. * @version DragonBones 3.0
  25093. * @language en_US
  25094. */
  25095. /**
  25096. * - 获取所有的骨骼。
  25097. * @see dragonBones.Bone
  25098. * @version DragonBones 3.0
  25099. * @language zh_CN
  25100. */
  25101. getBones(): Array<Bone>;
  25102. /**
  25103. * - Get all slots.
  25104. * @see dragonBones.Slot
  25105. * @version DragonBones 3.0
  25106. * @language en_US
  25107. */
  25108. /**
  25109. * - 获取所有的插槽。
  25110. * @see dragonBones.Slot
  25111. * @version DragonBones 3.0
  25112. * @language zh_CN
  25113. */
  25114. getSlots(): Array<Slot>;
  25115. /**
  25116. * - Whether to flip the armature horizontally.
  25117. * @version DragonBones 5.5
  25118. * @language en_US
  25119. */
  25120. /**
  25121. * - 是否将骨架水平翻转。
  25122. * @version DragonBones 5.5
  25123. * @language zh_CN
  25124. */
  25125. flipX: boolean;
  25126. /**
  25127. * - Whether to flip the armature vertically.
  25128. * @version DragonBones 5.5
  25129. * @language en_US
  25130. */
  25131. /**
  25132. * - 是否将骨架垂直翻转。
  25133. * @version DragonBones 5.5
  25134. * @language zh_CN
  25135. */
  25136. flipY: boolean;
  25137. /**
  25138. * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0.
  25139. * There is a certain amount of memory overhead to improve performance by caching animation data in memory.
  25140. * The frame rate should not be set too high, usually with the frame rate of the animation is similar and lower than the program running frame rate.
  25141. * When the animation cache is turned on, some features will fail, such as the offset property of bone.
  25142. * @example
  25143. * <pre>
  25144. * armature.cacheFrameRate = 24;
  25145. * </pre>
  25146. * @see dragonBones.DragonBonesData#frameRate
  25147. * @see dragonBones.ArmatureData#frameRate
  25148. * @version DragonBones 4.5
  25149. * @language en_US
  25150. */
  25151. /**
  25152. * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。
  25153. * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。
  25154. * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。
  25155. * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。
  25156. * @example
  25157. * <pre>
  25158. * armature.cacheFrameRate = 24;
  25159. * </pre>
  25160. * @see dragonBones.DragonBonesData#frameRate
  25161. * @see dragonBones.ArmatureData#frameRate
  25162. * @version DragonBones 4.5
  25163. * @language zh_CN
  25164. */
  25165. cacheFrameRate: number;
  25166. /**
  25167. * - The armature name.
  25168. * @version DragonBones 3.0
  25169. * @language en_US
  25170. */
  25171. /**
  25172. * - 骨架名称。
  25173. * @version DragonBones 3.0
  25174. * @language zh_CN
  25175. */
  25176. readonly name: string;
  25177. /**
  25178. * - The armature data.
  25179. * @see dragonBones.ArmatureData
  25180. * @version DragonBones 4.5
  25181. * @language en_US
  25182. */
  25183. /**
  25184. * - 骨架数据。
  25185. * @see dragonBones.ArmatureData
  25186. * @version DragonBones 4.5
  25187. * @language zh_CN
  25188. */
  25189. readonly armatureData: ArmatureData;
  25190. /**
  25191. * - The animation player.
  25192. * @see dragonBones.Animation
  25193. * @version DragonBones 3.0
  25194. * @language en_US
  25195. */
  25196. /**
  25197. * - 动画播放器。
  25198. * @see dragonBones.Animation
  25199. * @version DragonBones 3.0
  25200. * @language zh_CN
  25201. */
  25202. readonly animation: Animation;
  25203. /**
  25204. * @pivate
  25205. */
  25206. readonly proxy: IArmatureProxy;
  25207. /**
  25208. * - The EventDispatcher instance of the armature.
  25209. * @version DragonBones 4.5
  25210. * @language en_US
  25211. */
  25212. /**
  25213. * - 该骨架的 EventDispatcher 实例。
  25214. * @version DragonBones 4.5
  25215. * @language zh_CN
  25216. */
  25217. readonly eventDispatcher: IEventDispatcher;
  25218. /**
  25219. * - The display container.
  25220. * The display of the slot is displayed as the parent.
  25221. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.
  25222. * @version DragonBones 3.0
  25223. * @language en_US
  25224. */
  25225. /**
  25226. * - 显示容器实例。
  25227. * 插槽的显示对象都会以此显示容器为父级。
  25228. * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。
  25229. * @version DragonBones 3.0
  25230. * @language zh_CN
  25231. */
  25232. readonly display: any;
  25233. /**
  25234. * @private
  25235. */
  25236. replacedTexture: any;
  25237. /**
  25238. * @inheritDoc
  25239. */
  25240. clock: WorldClock | null;
  25241. /**
  25242. * - Get the parent slot which the armature belongs to.
  25243. * @see dragonBones.Slot
  25244. * @version DragonBones 4.5
  25245. * @language en_US
  25246. */
  25247. /**
  25248. * - 该骨架所属的父插槽。
  25249. * @see dragonBones.Slot
  25250. * @version DragonBones 4.5
  25251. * @language zh_CN
  25252. */
  25253. readonly parent: Slot | null;
  25254. /**
  25255. * @deprecated
  25256. * @private
  25257. */
  25258. replaceTexture(texture: any): void;
  25259. /**
  25260. * - Deprecated, please refer to {@link #eventDispatcher}.
  25261. * @deprecated
  25262. * @language en_US
  25263. */
  25264. /**
  25265. * - 已废弃,请参考 {@link #eventDispatcher}。
  25266. * @deprecated
  25267. * @language zh_CN
  25268. */
  25269. hasEventListener(type: EventStringType): boolean;
  25270. /**
  25271. * - Deprecated, please refer to {@link #eventDispatcher}.
  25272. * @deprecated
  25273. * @language en_US
  25274. */
  25275. /**
  25276. * - 已废弃,请参考 {@link #eventDispatcher}。
  25277. * @deprecated
  25278. * @language zh_CN
  25279. */
  25280. addEventListener(type: EventStringType, listener: Function, target: any): void;
  25281. /**
  25282. * - Deprecated, please refer to {@link #eventDispatcher}.
  25283. * @deprecated
  25284. * @language en_US
  25285. */
  25286. /**
  25287. * - 已废弃,请参考 {@link #eventDispatcher}。
  25288. * @deprecated
  25289. * @language zh_CN
  25290. */
  25291. removeEventListener(type: EventStringType, listener: Function, target: any): void;
  25292. /**
  25293. * - Deprecated, please refer to {@link #cacheFrameRate}.
  25294. * @deprecated
  25295. * @language en_US
  25296. */
  25297. /**
  25298. * - 已废弃,请参考 {@link #cacheFrameRate}。
  25299. * @deprecated
  25300. * @language zh_CN
  25301. */
  25302. enableAnimationCache(frameRate: number): void;
  25303. /**
  25304. * - Deprecated, please refer to {@link #display}.
  25305. * @deprecated
  25306. * @language en_US
  25307. */
  25308. /**
  25309. * - 已废弃,请参考 {@link #display}。
  25310. * @deprecated
  25311. * @language zh_CN
  25312. */
  25313. getDisplay(): any;
  25314. }
  25315. }
  25316. /**
  25317. * The MIT License (MIT)
  25318. *
  25319. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25320. *
  25321. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25322. * this software and associated documentation files (the "Software"), to deal in
  25323. * the Software without restriction, including without limitation the rights to
  25324. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25325. * the Software, and to permit persons to whom the Software is furnished to do so,
  25326. * subject to the following conditions:
  25327. *
  25328. * The above copyright notice and this permission notice shall be included in all
  25329. * copies or substantial portions of the Software.
  25330. *
  25331. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25332. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25333. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25334. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25335. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25336. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25337. */
  25338. declare namespace dragonBones {
  25339. /**
  25340. * - The base class of the transform object.
  25341. * @see dragonBones.Transform
  25342. * @version DragonBones 4.5
  25343. * @language en_US
  25344. */
  25345. /**
  25346. * - 变换对象的基类。
  25347. * @see dragonBones.Transform
  25348. * @version DragonBones 4.5
  25349. * @language zh_CN
  25350. */
  25351. abstract class TransformObject extends BaseObject {
  25352. /**
  25353. * @private
  25354. */
  25355. protected static readonly _helpMatrix: Matrix;
  25356. /**
  25357. * @private
  25358. */
  25359. protected static readonly _helpTransform: Transform;
  25360. /**
  25361. * @private
  25362. */
  25363. protected static readonly _helpPoint: Point;
  25364. /**
  25365. * - A matrix relative to the armature coordinate system.
  25366. * @version DragonBones 3.0
  25367. * @language en_US
  25368. */
  25369. /**
  25370. * - 相对于骨架坐标系的矩阵。
  25371. * @version DragonBones 3.0
  25372. * @language zh_CN
  25373. */
  25374. readonly globalTransformMatrix: Matrix;
  25375. /**
  25376. * - A transform relative to the armature coordinate system.
  25377. * @see #updateGlobalTransform()
  25378. * @version DragonBones 3.0
  25379. * @language en_US
  25380. */
  25381. /**
  25382. * - 相对于骨架坐标系的变换。
  25383. * @see #updateGlobalTransform()
  25384. * @version DragonBones 3.0
  25385. * @language zh_CN
  25386. */
  25387. readonly global: Transform;
  25388. /**
  25389. * - The offset transform relative to the armature or the parent bone coordinate system.
  25390. * @see #dragonBones.Bone#invalidUpdate()
  25391. * @version DragonBones 3.0
  25392. * @language en_US
  25393. */
  25394. /**
  25395. * - 相对于骨架或父骨骼坐标系的偏移变换。
  25396. * @see #dragonBones.Bone#invalidUpdate()
  25397. * @version DragonBones 3.0
  25398. * @language zh_CN
  25399. */
  25400. readonly offset: Transform;
  25401. /**
  25402. * @private
  25403. */
  25404. origin: Transform | null;
  25405. /**
  25406. * @private
  25407. */
  25408. userData: any;
  25409. /**
  25410. * @private
  25411. */
  25412. protected _globalDirty: boolean;
  25413. /**
  25414. * @internal
  25415. * @private
  25416. */
  25417. _armature: Armature;
  25418. /**
  25419. * @internal
  25420. * @private
  25421. */
  25422. _parent: Bone;
  25423. /**
  25424. * @private
  25425. */
  25426. protected _onClear(): void;
  25427. /**
  25428. * @internal
  25429. * @private
  25430. */
  25431. _setArmature(value: Armature | null): void;
  25432. /**
  25433. * @internal
  25434. * @private
  25435. */
  25436. _setParent(value: Bone | null): void;
  25437. /**
  25438. * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
  25439. * some engines do not rely on these attributes to update rendering, such as Egret.
  25440. * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
  25441. * @example
  25442. * <pre>
  25443. * bone.updateGlobalTransform();
  25444. * let rotation = bone.global.rotation;
  25445. * </pre>
  25446. * @version DragonBones 3.0
  25447. * @language en_US
  25448. */
  25449. /**
  25450. * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。
  25451. * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。
  25452. * @example
  25453. * <pre>
  25454. * bone.updateGlobalTransform();
  25455. * let rotation = bone.global.rotation;
  25456. * </pre>
  25457. * @version DragonBones 3.0
  25458. * @language zh_CN
  25459. */
  25460. updateGlobalTransform(): void;
  25461. /**
  25462. * - The armature to which it belongs.
  25463. * @version DragonBones 3.0
  25464. * @language en_US
  25465. */
  25466. /**
  25467. * - 所属的骨架。
  25468. * @version DragonBones 3.0
  25469. * @language zh_CN
  25470. */
  25471. readonly armature: Armature;
  25472. /**
  25473. * - The parent bone to which it belongs.
  25474. * @version DragonBones 3.0
  25475. * @language en_US
  25476. */
  25477. /**
  25478. * - 所属的父骨骼。
  25479. * @version DragonBones 3.0
  25480. * @language zh_CN
  25481. */
  25482. readonly parent: Bone;
  25483. }
  25484. }
  25485. /**
  25486. * The MIT License (MIT)
  25487. *
  25488. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25489. *
  25490. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25491. * this software and associated documentation files (the "Software"), to deal in
  25492. * the Software without restriction, including without limitation the rights to
  25493. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25494. * the Software, and to permit persons to whom the Software is furnished to do so,
  25495. * subject to the following conditions:
  25496. *
  25497. * The above copyright notice and this permission notice shall be included in all
  25498. * copies or substantial portions of the Software.
  25499. *
  25500. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25501. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25502. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25503. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25504. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25505. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25506. */
  25507. declare namespace dragonBones {
  25508. /**
  25509. * - Bone is one of the most important logical units in the armature animation system,
  25510. * and is responsible for the realization of translate, rotation, scaling in the animations.
  25511. * A armature can contain multiple bones.
  25512. * @see dragonBones.BoneData
  25513. * @see dragonBones.Armature
  25514. * @see dragonBones.Slot
  25515. * @version DragonBones 3.0
  25516. * @language en_US
  25517. */
  25518. /**
  25519. * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。
  25520. * 一个骨架中可以包含多个骨骼。
  25521. * @see dragonBones.BoneData
  25522. * @see dragonBones.Armature
  25523. * @see dragonBones.Slot
  25524. * @version DragonBones 3.0
  25525. * @language zh_CN
  25526. */
  25527. class Bone extends TransformObject {
  25528. static toString(): string;
  25529. /**
  25530. * - The offset mode.
  25531. * @see #offset
  25532. * @version DragonBones 5.5
  25533. * @language en_US
  25534. */
  25535. /**
  25536. * - 偏移模式。
  25537. * @see #offset
  25538. * @version DragonBones 5.5
  25539. * @language zh_CN
  25540. */
  25541. offsetMode: OffsetMode;
  25542. /**
  25543. * @internal
  25544. * @private
  25545. */
  25546. readonly animationPose: Transform;
  25547. /**
  25548. * @internal
  25549. * @private
  25550. */
  25551. _transformDirty: boolean;
  25552. /**
  25553. * @internal
  25554. * @private
  25555. */
  25556. _childrenTransformDirty: boolean;
  25557. protected _localDirty: boolean;
  25558. /**
  25559. * @internal
  25560. * @private
  25561. */
  25562. _hasConstraint: boolean;
  25563. private _visible;
  25564. protected _cachedFrameIndex: number;
  25565. /**
  25566. * @internal
  25567. * @private
  25568. */
  25569. readonly _blendState: BlendState;
  25570. /**
  25571. * @internal
  25572. * @private
  25573. */
  25574. _boneData: BoneData;
  25575. /**
  25576. * @internal
  25577. * @private
  25578. */
  25579. _cachedFrameIndices: Array<number> | null;
  25580. /**
  25581. * @inheritDoc
  25582. */
  25583. protected _onClear(): void;
  25584. /**
  25585. * @private
  25586. */
  25587. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25588. /**
  25589. * @inheritDoc
  25590. */
  25591. _setArmature(value: Armature | null): void;
  25592. /**
  25593. * @internal
  25594. * @private
  25595. */
  25596. init(boneData: BoneData): void;
  25597. /**
  25598. * @internal
  25599. * @private
  25600. */
  25601. update(cacheFrameIndex: number): void;
  25602. /**
  25603. * @internal
  25604. * @private
  25605. */
  25606. updateByConstraint(): void;
  25607. /**
  25608. * - Forces the bone to update the transform in the next frame.
  25609. * When the bone is not animated or its animation state is finished, the bone will not continue to update,
  25610. * and when the skeleton must be updated for some reason, the method needs to be called explicitly.
  25611. * @example
  25612. * <pre>
  25613. * let bone = armature.getBone("arm");
  25614. * bone.offset.scaleX = 2.0;
  25615. * bone.invalidUpdate();
  25616. * </pre>
  25617. * @version DragonBones 3.0
  25618. * @language en_US
  25619. */
  25620. /**
  25621. * - 强制骨骼在下一帧更新变换。
  25622. * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。
  25623. * @example
  25624. * <pre>
  25625. * let bone = armature.getBone("arm");
  25626. * bone.offset.scaleX = 2.0;
  25627. * bone.invalidUpdate();
  25628. * </pre>
  25629. * @version DragonBones 3.0
  25630. * @language zh_CN
  25631. */
  25632. invalidUpdate(): void;
  25633. /**
  25634. * - Check whether the bone contains a specific bone or slot.
  25635. * @see dragonBones.Bone
  25636. * @see dragonBones.Slot
  25637. * @version DragonBones 3.0
  25638. * @language en_US
  25639. */
  25640. /**
  25641. * - 检查该骨骼是否包含特定的骨骼或插槽。
  25642. * @see dragonBones.Bone
  25643. * @see dragonBones.Slot
  25644. * @version DragonBones 3.0
  25645. * @language zh_CN
  25646. */
  25647. contains(value: TransformObject): boolean;
  25648. /**
  25649. * - The bone data.
  25650. * @version DragonBones 4.5
  25651. * @language en_US
  25652. */
  25653. /**
  25654. * - 骨骼数据。
  25655. * @version DragonBones 4.5
  25656. * @language zh_CN
  25657. */
  25658. readonly boneData: BoneData;
  25659. /**
  25660. * - The visible of all slots in the bone.
  25661. * @default true
  25662. * @see dragonBones.Slot#visible
  25663. * @version DragonBones 3.0
  25664. * @language en_US
  25665. */
  25666. /**
  25667. * - 此骨骼所有插槽的可见。
  25668. * @default true
  25669. * @see dragonBones.Slot#visible
  25670. * @version DragonBones 3.0
  25671. * @language zh_CN
  25672. */
  25673. visible: boolean;
  25674. /**
  25675. * - The bone name.
  25676. * @version DragonBones 3.0
  25677. * @language en_US
  25678. */
  25679. /**
  25680. * - 骨骼名称。
  25681. * @version DragonBones 3.0
  25682. * @language zh_CN
  25683. */
  25684. readonly name: string;
  25685. /**
  25686. * - Deprecated, please refer to {@link dragonBones.Armature#getBones()}.
  25687. * @deprecated
  25688. * @language en_US
  25689. */
  25690. /**
  25691. * - 已废弃,请参考 {@link dragonBones.Armature#getBones()}。
  25692. * @deprecated
  25693. * @language zh_CN
  25694. */
  25695. getBones(): Array<Bone>;
  25696. /**
  25697. * - Deprecated, please refer to {@link dragonBones.Armature#getSlots()}.
  25698. * @deprecated
  25699. * @language en_US
  25700. */
  25701. /**
  25702. * - 已废弃,请参考 {@link dragonBones.Armature#getSlots()}。
  25703. * @deprecated
  25704. * @language zh_CN
  25705. */
  25706. getSlots(): Array<Slot>;
  25707. /**
  25708. * - Deprecated, please refer to {@link dragonBones.Armature#getSlot()}.
  25709. * @deprecated
  25710. * @language en_US
  25711. */
  25712. /**
  25713. * - 已废弃,请参考 {@link dragonBones.Armature#getSlot()}。
  25714. * @deprecated
  25715. * @language zh_CN
  25716. */
  25717. readonly slot: Slot | null;
  25718. }
  25719. }
  25720. /**
  25721. * The MIT License (MIT)
  25722. *
  25723. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25724. *
  25725. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25726. * this software and associated documentation files (the "Software"), to deal in
  25727. * the Software without restriction, including without limitation the rights to
  25728. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25729. * the Software, and to permit persons to whom the Software is furnished to do so,
  25730. * subject to the following conditions:
  25731. *
  25732. * The above copyright notice and this permission notice shall be included in all
  25733. * copies or substantial portions of the Software.
  25734. *
  25735. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25736. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25737. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25738. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25739. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25740. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25741. */
  25742. declare namespace dragonBones {
  25743. /**
  25744. * @internal
  25745. * @private
  25746. */
  25747. class Surface extends Bone {
  25748. static toString(): string;
  25749. private _dX;
  25750. private _dY;
  25751. private _k;
  25752. private _kX;
  25753. private _kY;
  25754. /**
  25755. * For debug draw.
  25756. * @internal
  25757. * @private
  25758. */
  25759. readonly _vertices: Array<number>;
  25760. /**
  25761. * For timeline state.
  25762. * @internal
  25763. * @private
  25764. */
  25765. readonly _deformVertices: Array<number>;
  25766. /**
  25767. * x1, y1, x2, y2, x3, y3, x4, y4, d1X, d1Y, d2X, d2Y
  25768. */
  25769. private readonly _hullCache;
  25770. /**
  25771. * Inside [flag, a, b, c, d, tx, ty], Outside [flag, a, b, c, d, tx, ty]
  25772. */
  25773. private readonly _matrixCahce;
  25774. /**
  25775. * @inheritDoc
  25776. */
  25777. protected _onClear(): void;
  25778. private _getAffineTransform(x, y, lX, lY, aX, aY, bX, bY, cX, cY, transform, matrix, isDown);
  25779. private _updateVertices();
  25780. /**
  25781. * @private
  25782. */
  25783. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25784. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  25785. init(surfaceData: SurfaceData): void;
  25786. /**
  25787. * @internal
  25788. * @private
  25789. */
  25790. update(cacheFrameIndex: number): void;
  25791. }
  25792. }
  25793. /**
  25794. * The MIT License (MIT)
  25795. *
  25796. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25797. *
  25798. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25799. * this software and associated documentation files (the "Software"), to deal in
  25800. * the Software without restriction, including without limitation the rights to
  25801. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25802. * the Software, and to permit persons to whom the Software is furnished to do so,
  25803. * subject to the following conditions:
  25804. *
  25805. * The above copyright notice and this permission notice shall be included in all
  25806. * copies or substantial portions of the Software.
  25807. *
  25808. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25809. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25810. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25811. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25812. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25813. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25814. */
  25815. declare namespace dragonBones {
  25816. /**
  25817. * - The slot attached to the armature, controls the display status and properties of the display object.
  25818. * A bone can contain multiple slots.
  25819. * A slot can contain multiple display objects, displaying only one of the display objects at a time,
  25820. * but you can toggle the display object into frame animation while the animation is playing.
  25821. * The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
  25822. * and a custom other display object.
  25823. * @see dragonBones.Armature
  25824. * @see dragonBones.Bone
  25825. * @see dragonBones.SlotData
  25826. * @version DragonBones 3.0
  25827. * @language en_US
  25828. */
  25829. /**
  25830. * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  25831. * 一个骨骼上可以包含多个插槽。
  25832. * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。
  25833. * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。
  25834. * @see dragonBones.Armature
  25835. * @see dragonBones.Bone
  25836. * @see dragonBones.SlotData
  25837. * @version DragonBones 3.0
  25838. * @language zh_CN
  25839. */
  25840. abstract class Slot extends TransformObject {
  25841. /**
  25842. * - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
  25843. * @default null
  25844. * @see dragonBones.AnimationState#displayControl
  25845. * @see dragonBones.AnimationState#name
  25846. * @see dragonBones.AnimationState#group
  25847. * @version DragonBones 4.5
  25848. * @language en_US
  25849. */
  25850. /**
  25851. * - 显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。
  25852. * @default null
  25853. * @see dragonBones.AnimationState#displayControl
  25854. * @see dragonBones.AnimationState#name
  25855. * @see dragonBones.AnimationState#group
  25856. * @version DragonBones 4.5
  25857. * @language zh_CN
  25858. */
  25859. displayController: string | null;
  25860. /**
  25861. * @private
  25862. */
  25863. protected _displayDirty: boolean;
  25864. /**
  25865. * @private
  25866. */
  25867. protected _zOrderDirty: boolean;
  25868. /**
  25869. * @private
  25870. */
  25871. protected _visibleDirty: boolean;
  25872. /**
  25873. * @private
  25874. */
  25875. protected _blendModeDirty: boolean;
  25876. /**
  25877. * @internal
  25878. * @private
  25879. */
  25880. _colorDirty: boolean;
  25881. /**
  25882. * @internal
  25883. * @private
  25884. */
  25885. _meshDirty: boolean;
  25886. /**
  25887. * @private
  25888. */
  25889. protected _transformDirty: boolean;
  25890. /**
  25891. * @private
  25892. */
  25893. protected _visible: boolean;
  25894. /**
  25895. * @private
  25896. */
  25897. protected _blendMode: BlendMode;
  25898. /**
  25899. * @private
  25900. */
  25901. protected _displayIndex: number;
  25902. /**
  25903. * @private
  25904. */
  25905. protected _animationDisplayIndex: number;
  25906. /**
  25907. * @internal
  25908. * @private
  25909. */
  25910. _zOrder: number;
  25911. /**
  25912. * @private
  25913. */
  25914. protected _cachedFrameIndex: number;
  25915. /**
  25916. * @internal
  25917. * @private
  25918. */
  25919. _pivotX: number;
  25920. /**
  25921. * @internal
  25922. * @private
  25923. */
  25924. _pivotY: number;
  25925. /**
  25926. * @private
  25927. */
  25928. protected readonly _localMatrix: Matrix;
  25929. /**
  25930. * @internal
  25931. * @private
  25932. */
  25933. readonly _colorTransform: ColorTransform;
  25934. /**
  25935. * @internal
  25936. * @private
  25937. */
  25938. readonly _deformVertices: Array<number>;
  25939. /**
  25940. * @private
  25941. */
  25942. readonly _displayDatas: Array<DisplayData | null>;
  25943. /**
  25944. * @private
  25945. */
  25946. protected readonly _displayList: Array<any | Armature>;
  25947. /**
  25948. * @private
  25949. */
  25950. protected readonly _meshBones: Array<Bone | null>;
  25951. /**
  25952. * @private
  25953. */
  25954. protected readonly _meshSlots: Array<Slot | null>;
  25955. /**
  25956. * @internal
  25957. * @private
  25958. */
  25959. _slotData: SlotData;
  25960. /**
  25961. * @private
  25962. */
  25963. protected _rawDisplayDatas: Array<DisplayData | null> | null;
  25964. /**
  25965. * @private
  25966. */
  25967. protected _displayData: DisplayData | null;
  25968. /**
  25969. * @private
  25970. */
  25971. protected _textureData: TextureData | null;
  25972. /**
  25973. * @internal
  25974. * @private
  25975. */
  25976. _meshData: MeshDisplayData | null;
  25977. /**
  25978. * @private
  25979. */
  25980. protected _boundingBoxData: BoundingBoxData | null;
  25981. /**
  25982. * @private
  25983. */
  25984. protected _rawDisplay: any;
  25985. /**
  25986. * @private
  25987. */
  25988. protected _meshDisplay: any;
  25989. /**
  25990. * @private
  25991. */
  25992. protected _display: any;
  25993. /**
  25994. * @private
  25995. */
  25996. protected _childArmature: Armature | null;
  25997. /**
  25998. * @internal
  25999. * @private
  26000. */
  26001. _cachedFrameIndices: Array<number> | null;
  26002. /**
  26003. * @inheritDoc
  26004. */
  26005. protected _onClear(): void;
  26006. /**
  26007. * @private
  26008. */
  26009. protected abstract _initDisplay(value: any, isRetain: boolean): void;
  26010. /**
  26011. * @private
  26012. */
  26013. protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
  26014. /**
  26015. * @private
  26016. */
  26017. protected abstract _onUpdateDisplay(): void;
  26018. /**
  26019. * @private
  26020. */
  26021. protected abstract _addDisplay(): void;
  26022. /**
  26023. * @private
  26024. */
  26025. protected abstract _replaceDisplay(value: any): void;
  26026. /**
  26027. * @private
  26028. */
  26029. protected abstract _removeDisplay(): void;
  26030. /**
  26031. * @private
  26032. */
  26033. protected abstract _updateZOrder(): void;
  26034. /**
  26035. * @private
  26036. */
  26037. abstract _updateVisible(): void;
  26038. /**
  26039. * @private
  26040. */
  26041. protected abstract _updateBlendMode(): void;
  26042. /**
  26043. * @private
  26044. */
  26045. protected abstract _updateColor(): void;
  26046. /**
  26047. * @private
  26048. */
  26049. protected abstract _updateFrame(): void;
  26050. /**
  26051. * @private
  26052. */
  26053. protected abstract _updateMesh(): void;
  26054. /**
  26055. * @internal
  26056. * @private
  26057. */
  26058. abstract _updateGlueMesh(): void;
  26059. /**
  26060. * @private
  26061. */
  26062. protected abstract _updateTransform(): void;
  26063. /**
  26064. * @private
  26065. */
  26066. protected abstract _identityTransform(): void;
  26067. /**
  26068. * @private
  26069. */
  26070. protected _getDefaultRawDisplayData(): DisplayData | null;
  26071. /**
  26072. * @private
  26073. */
  26074. protected _updateDisplayData(): void;
  26075. /**
  26076. * @private
  26077. */
  26078. protected _updateDisplay(): void;
  26079. /**
  26080. * @private
  26081. */
  26082. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  26083. /**
  26084. * @private
  26085. */
  26086. protected _isMeshBonesUpdate(): boolean;
  26087. /**
  26088. * @inheritDoc
  26089. */
  26090. _setArmature(value: Armature | null): void;
  26091. /**
  26092. * @internal
  26093. * @private
  26094. */
  26095. _setDisplayIndex(value: number, isAnimation?: boolean): boolean;
  26096. /**
  26097. * @internal
  26098. * @private
  26099. */
  26100. _setZorder(value: number): boolean;
  26101. /**
  26102. * @internal
  26103. * @private
  26104. */
  26105. _setColor(value: ColorTransform): boolean;
  26106. /**
  26107. * @internal
  26108. * @private
  26109. */
  26110. _setDisplayList(value: Array<any> | null): boolean;
  26111. /**
  26112. * @internal
  26113. * @private
  26114. */
  26115. init(slotData: SlotData, displayDatas: Array<DisplayData | null> | null, rawDisplay: any, meshDisplay: any): void;
  26116. /**
  26117. * @internal
  26118. * @private
  26119. */
  26120. update(cacheFrameIndex: number): void;
  26121. /**
  26122. * @private
  26123. */
  26124. updateTransformAndMatrix(): void;
  26125. /**
  26126. * @private
  26127. */
  26128. replaceDisplayData(value: DisplayData | null, displayIndex?: number): void;
  26129. /**
  26130. * - Check whether a specific point is inside a custom bounding box in the slot.
  26131. * The coordinate system of the point is the inner coordinate system of the armature.
  26132. * Custom bounding boxes need to be customized in Dragonbones Pro.
  26133. * @param x - The horizontal coordinate of the point.
  26134. * @param y - The vertical coordinate of the point.
  26135. * @version DragonBones 5.0
  26136. * @language en_US
  26137. */
  26138. /**
  26139. * - 检查特定点是否在插槽的自定义边界框内。
  26140. * 点的坐标系为骨架内坐标系。
  26141. * 自定义边界框需要在 DragonBones Pro 中自定义。
  26142. * @param x - 点的水平坐标。
  26143. * @param y - 点的垂直坐标。
  26144. * @version DragonBones 5.0
  26145. * @language zh_CN
  26146. */
  26147. containsPoint(x: number, y: number): boolean;
  26148. /**
  26149. * - Check whether a specific segment intersects a custom bounding box for the slot.
  26150. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  26151. * Custom bounding boxes need to be customized in Dragonbones Pro.
  26152. * @param xA - The horizontal coordinate of the beginning of the segment.
  26153. * @param yA - The vertical coordinate of the beginning of the segment.
  26154. * @param xB - The horizontal coordinate of the end point of the segment.
  26155. * @param yB - The vertical coordinate of the end point of the segment.
  26156. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
  26157. * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
  26158. * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
  26159. * @returns Intersection situation. [1: Disjoint and segments within the bounding box, 0: Disjoint, 1: Intersecting and having a nodal point and ending in the bounding box, 2: Intersecting and having a nodal point and starting at the bounding box, 3: Intersecting and having two intersections, N: Intersecting and having N intersections]
  26160. * @version DragonBones 5.0
  26161. * @language en_US
  26162. */
  26163. /**
  26164. * - 检查特定线段是否与插槽的自定义边界框相交。
  26165. * 线段和交点的坐标系均为骨架内坐标系。
  26166. * 自定义边界框需要在 DragonBones Pro 中自定义。
  26167. * @param xA - 线段起点的水平坐标。
  26168. * @param yA - 线段起点的垂直坐标。
  26169. * @param xB - 线段终点的水平坐标。
  26170. * @param yB - 线段终点的垂直坐标。
  26171. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  26172. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  26173. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  26174. * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]
  26175. * @version DragonBones 5.0
  26176. * @language zh_CN
  26177. */
  26178. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  26179. x: number;
  26180. y: number;
  26181. } | null, intersectionPointB?: {
  26182. x: number;
  26183. y: number;
  26184. } | null, normalRadians?: {
  26185. x: number;
  26186. y: number;
  26187. } | null): number;
  26188. /**
  26189. * - Forces the slot to update the state of the display object in the next frame.
  26190. * @version DragonBones 4.5
  26191. * @language en_US
  26192. */
  26193. /**
  26194. * - 强制插槽在下一帧更新显示对象的状态。
  26195. * @version DragonBones 4.5
  26196. * @language zh_CN
  26197. */
  26198. invalidUpdate(): void;
  26199. /**
  26200. * - The visible of slot's display object.
  26201. * @default true
  26202. * @version DragonBones 5.6
  26203. * @language en_US
  26204. */
  26205. /**
  26206. * - 插槽的显示对象的可见。
  26207. * @default true
  26208. * @version DragonBones 5.6
  26209. * @language zh_CN
  26210. */
  26211. visible: boolean;
  26212. /**
  26213. * - The index of the display object displayed in the display list.
  26214. * @example
  26215. * <pre>
  26216. * let slot = armature.getSlot("weapon");
  26217. * slot.displayIndex = 3;
  26218. * slot.displayController = "none";
  26219. * </pre>
  26220. * @version DragonBones 4.5
  26221. * @language en_US
  26222. */
  26223. /**
  26224. * - 此时显示的显示对象在显示列表中的索引。
  26225. * @example
  26226. * <pre>
  26227. * let slot = armature.getSlot("weapon");
  26228. * slot.displayIndex = 3;
  26229. * slot.displayController = "none";
  26230. * </pre>
  26231. * @version DragonBones 4.5
  26232. * @language zh_CN
  26233. */
  26234. displayIndex: number;
  26235. /**
  26236. * - The slot name.
  26237. * @see dragonBones.SlotData#name
  26238. * @version DragonBones 3.0
  26239. * @language en_US
  26240. */
  26241. /**
  26242. * - 插槽名称。
  26243. * @see dragonBones.SlotData#name
  26244. * @version DragonBones 3.0
  26245. * @language zh_CN
  26246. */
  26247. readonly name: string;
  26248. /**
  26249. * - Contains a display list of display objects or child armatures.
  26250. * @version DragonBones 3.0
  26251. * @language en_US
  26252. */
  26253. /**
  26254. * - 包含显示对象或子骨架的显示列表。
  26255. * @version DragonBones 3.0
  26256. * @language zh_CN
  26257. */
  26258. displayList: Array<any>;
  26259. /**
  26260. * - The slot data.
  26261. * @see dragonBones.SlotData
  26262. * @version DragonBones 4.5
  26263. * @language en_US
  26264. */
  26265. /**
  26266. * - 插槽数据。
  26267. * @see dragonBones.SlotData
  26268. * @version DragonBones 4.5
  26269. * @language zh_CN
  26270. */
  26271. readonly slotData: SlotData;
  26272. /**
  26273. * @private
  26274. */
  26275. rawDisplayDatas: Array<DisplayData | null> | null;
  26276. /**
  26277. * - The custom bounding box data for the slot at current time.
  26278. * @version DragonBones 5.0
  26279. * @language en_US
  26280. */
  26281. /**
  26282. * - 插槽此时的自定义包围盒数据。
  26283. * @version DragonBones 5.0
  26284. * @language zh_CN
  26285. */
  26286. readonly boundingBoxData: BoundingBoxData | null;
  26287. /**
  26288. * @private
  26289. */
  26290. readonly rawDisplay: any;
  26291. /**
  26292. * @private
  26293. */
  26294. readonly meshDisplay: any;
  26295. /**
  26296. * - The display object that the slot displays at this time.
  26297. * @example
  26298. * <pre>
  26299. * let slot = armature.getSlot("text");
  26300. * slot.display = new yourEngine.TextField();
  26301. * </pre>
  26302. * @version DragonBones 3.0
  26303. * @language en_US
  26304. */
  26305. /**
  26306. * - 插槽此时显示的显示对象。
  26307. * @example
  26308. * <pre>
  26309. * let slot = armature.getSlot("text");
  26310. * slot.display = new yourEngine.TextField();
  26311. * </pre>
  26312. * @version DragonBones 3.0
  26313. * @language zh_CN
  26314. */
  26315. display: any;
  26316. /**
  26317. * - The child armature that the slot displayed at current time.
  26318. * @example
  26319. * <pre>
  26320. * let slot = armature.getSlot("weapon");
  26321. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  26322. * </pre>
  26323. * @version DragonBones 3.0
  26324. * @language en_US
  26325. */
  26326. /**
  26327. * - 插槽此时显示的子骨架。
  26328. * @example
  26329. * <pre>
  26330. * let slot = armature.getSlot("weapon");
  26331. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  26332. * </pre>
  26333. * @version DragonBones 3.0
  26334. * @language zh_CN
  26335. */
  26336. childArmature: Armature | null;
  26337. /**
  26338. * - Deprecated, please refer to {@link #display}.
  26339. * @deprecated
  26340. * @language en_US
  26341. */
  26342. /**
  26343. * - 已废弃,请参考 {@link #display}。
  26344. * @deprecated
  26345. * @language zh_CN
  26346. */
  26347. getDisplay(): any;
  26348. /**
  26349. * - Deprecated, please refer to {@link #display}.
  26350. * @deprecated
  26351. * @language en_US
  26352. */
  26353. /**
  26354. * - 已废弃,请参考 {@link #display}。
  26355. * @deprecated
  26356. * @language zh_CN
  26357. */
  26358. setDisplay(value: any): void;
  26359. }
  26360. }
  26361. /**
  26362. * The MIT License (MIT)
  26363. *
  26364. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26365. *
  26366. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26367. * this software and associated documentation files (the "Software"), to deal in
  26368. * the Software without restriction, including without limitation the rights to
  26369. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26370. * the Software, and to permit persons to whom the Software is furnished to do so,
  26371. * subject to the following conditions:
  26372. *
  26373. * The above copyright notice and this permission notice shall be included in all
  26374. * copies or substantial portions of the Software.
  26375. *
  26376. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26377. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26378. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26379. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26380. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26381. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26382. */
  26383. declare namespace dragonBones {
  26384. /**
  26385. * @internal
  26386. * @private
  26387. */
  26388. abstract class Constraint extends BaseObject {
  26389. protected static readonly _helpMatrix: Matrix;
  26390. protected static readonly _helpTransform: Transform;
  26391. protected static readonly _helpPoint: Point;
  26392. /**
  26393. * - For timeline state.
  26394. * @internal
  26395. */
  26396. _constraintData: ConstraintData;
  26397. protected _armature: Armature;
  26398. /**
  26399. * - For sort bones.
  26400. * @internal
  26401. */
  26402. _target: Bone;
  26403. /**
  26404. * - For sort bones.
  26405. * @internal
  26406. */
  26407. _root: Bone;
  26408. protected _bone: Bone | null;
  26409. protected _onClear(): void;
  26410. abstract init(constraintData: ConstraintData, armature: Armature): void;
  26411. abstract update(): void;
  26412. abstract invalidUpdate(): void;
  26413. readonly name: string;
  26414. }
  26415. /**
  26416. * @internal
  26417. * @private
  26418. */
  26419. class IKConstraint extends Constraint {
  26420. static toString(): string;
  26421. private _scaleEnabled;
  26422. /**
  26423. * - For timeline state.
  26424. * @internal
  26425. */
  26426. _bendPositive: boolean;
  26427. /**
  26428. * - For timeline state.
  26429. * @internal
  26430. */
  26431. _weight: number;
  26432. protected _onClear(): void;
  26433. private _computeA();
  26434. private _computeB();
  26435. init(constraintData: ConstraintData, armature: Armature): void;
  26436. update(): void;
  26437. invalidUpdate(): void;
  26438. }
  26439. }
  26440. /**
  26441. * The MIT License (MIT)
  26442. *
  26443. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26444. *
  26445. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26446. * this software and associated documentation files (the "Software"), to deal in
  26447. * the Software without restriction, including without limitation the rights to
  26448. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26449. * the Software, and to permit persons to whom the Software is furnished to do so,
  26450. * subject to the following conditions:
  26451. *
  26452. * The above copyright notice and this permission notice shall be included in all
  26453. * copies or substantial portions of the Software.
  26454. *
  26455. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26456. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26457. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26458. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26459. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26460. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26461. */
  26462. declare namespace dragonBones {
  26463. /**
  26464. * - Play animation interface. (Both Armature and Wordclock implement the interface)
  26465. * Any instance that implements the interface can be added to the Worldclock instance and advance time by Worldclock instance uniformly.
  26466. * @see dragonBones.WorldClock
  26467. * @see dragonBones.Armature
  26468. * @version DragonBones 3.0
  26469. * @language en_US
  26470. */
  26471. /**
  26472. * - 播放动画接口。 (Armature 和 WordClock 都实现了该接口)
  26473. * 任何实现了此接口的实例都可以添加到 WorldClock 实例中,由 WorldClock 实例统一更新时间。
  26474. * @see dragonBones.WorldClock
  26475. * @see dragonBones.Armature
  26476. * @version DragonBones 3.0
  26477. * @language zh_CN
  26478. */
  26479. interface IAnimatable {
  26480. /**
  26481. * - Advance time.
  26482. * @param passedTime - Passed time. (In seconds)
  26483. * @version DragonBones 3.0
  26484. * @language en_US
  26485. */
  26486. /**
  26487. * - 更新时间。
  26488. * @param passedTime - 前进的时间。 (以秒为单位)
  26489. * @version DragonBones 3.0
  26490. * @language zh_CN
  26491. */
  26492. advanceTime(passedTime: number): void;
  26493. /**
  26494. * - The Wordclock instance to which the current belongs.
  26495. * @example
  26496. * <pre>
  26497. * armature.clock = factory.clock; // Add armature to clock.
  26498. * armature.clock = null; // Remove armature from clock.
  26499. * </pre>
  26500. * @version DragonBones 5.0
  26501. * @language en_US
  26502. */
  26503. /**
  26504. * - 当前所属的 WordClock 实例。
  26505. * @example
  26506. * <pre>
  26507. * armature.clock = factory.clock; // 将骨架添加到时钟。
  26508. * armature.clock = null; // 将骨架从时钟移除。
  26509. * </pre>
  26510. * @version DragonBones 5.0
  26511. * @language zh_CN
  26512. */
  26513. clock: WorldClock | null;
  26514. }
  26515. }
  26516. /**
  26517. * The MIT License (MIT)
  26518. *
  26519. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26520. *
  26521. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26522. * this software and associated documentation files (the "Software"), to deal in
  26523. * the Software without restriction, including without limitation the rights to
  26524. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26525. * the Software, and to permit persons to whom the Software is furnished to do so,
  26526. * subject to the following conditions:
  26527. *
  26528. * The above copyright notice and this permission notice shall be included in all
  26529. * copies or substantial portions of the Software.
  26530. *
  26531. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26532. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26533. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26534. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26535. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26536. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26537. */
  26538. declare namespace dragonBones {
  26539. /**
  26540. * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.
  26541. * @see dragonBones.IAnimateble
  26542. * @see dragonBones.Armature
  26543. * @version DragonBones 3.0
  26544. * @language en_US
  26545. */
  26546. /**
  26547. * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。
  26548. * @see dragonBones.IAnimateble
  26549. * @see dragonBones.Armature
  26550. * @version DragonBones 3.0
  26551. * @language zh_CN
  26552. */
  26553. class WorldClock implements IAnimatable {
  26554. /**
  26555. * - Current time. (In seconds)
  26556. * @version DragonBones 3.0
  26557. * @language en_US
  26558. */
  26559. /**
  26560. * - 当前的时间。 (以秒为单位)
  26561. * @version DragonBones 3.0
  26562. * @language zh_CN
  26563. */
  26564. time: number;
  26565. /**
  26566. * - The play speed, used to control animation speed-shift play.
  26567. * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  26568. * @default 1.0
  26569. * @version DragonBones 3.0
  26570. * @language en_US
  26571. */
  26572. /**
  26573. * - 播放速度,用于控制动画变速播放。
  26574. * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  26575. * @default 1.0
  26576. * @version DragonBones 3.0
  26577. * @language zh_CN
  26578. */
  26579. timeScale: number;
  26580. private readonly _animatebles;
  26581. private _clock;
  26582. /**
  26583. * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
  26584. * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
  26585. * @version DragonBones 3.0
  26586. * @language en_US
  26587. */
  26588. /**
  26589. * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。
  26590. * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。
  26591. * @version DragonBones 3.0
  26592. * @language zh_CN
  26593. */
  26594. constructor(time?: number);
  26595. /**
  26596. * - Advance time for all IAnimatable instances.
  26597. * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
  26598. * @version DragonBones 3.0
  26599. * @language en_US
  26600. */
  26601. /**
  26602. * - 为所有的 IAnimatable 实例更新时间。
  26603. * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位)
  26604. * @version DragonBones 3.0
  26605. * @language zh_CN
  26606. */
  26607. advanceTime(passedTime: number): void;
  26608. /**
  26609. * - Check whether contains a specific instance of IAnimatable.
  26610. * @param value - The IAnimatable instance.
  26611. * @version DragonBones 3.0
  26612. * @language en_US
  26613. */
  26614. /**
  26615. * - 检查是否包含特定的 IAnimatable 实例。
  26616. * @param value - IAnimatable 实例。
  26617. * @version DragonBones 3.0
  26618. * @language zh_CN
  26619. */
  26620. contains(value: IAnimatable): boolean;
  26621. /**
  26622. * - Add IAnimatable instance.
  26623. * @param value - The IAnimatable instance.
  26624. * @version DragonBones 3.0
  26625. * @language en_US
  26626. */
  26627. /**
  26628. * - 添加 IAnimatable 实例。
  26629. * @param value - IAnimatable 实例。
  26630. * @version DragonBones 3.0
  26631. * @language zh_CN
  26632. */
  26633. add(value: IAnimatable): void;
  26634. /**
  26635. * - Removes a specified IAnimatable instance.
  26636. * @param value - The IAnimatable instance.
  26637. * @version DragonBones 3.0
  26638. * @language en_US
  26639. */
  26640. /**
  26641. * - 移除特定的 IAnimatable 实例。
  26642. * @param value - IAnimatable 实例。
  26643. * @version DragonBones 3.0
  26644. * @language zh_CN
  26645. */
  26646. remove(value: IAnimatable): void;
  26647. /**
  26648. * - Clear all IAnimatable instances.
  26649. * @version DragonBones 3.0
  26650. * @language en_US
  26651. */
  26652. /**
  26653. * - 清除所有的 IAnimatable 实例。
  26654. * @version DragonBones 3.0
  26655. * @language zh_CN
  26656. */
  26657. clear(): void;
  26658. /**
  26659. * @inheritDoc
  26660. */
  26661. clock: WorldClock | null;
  26662. /**
  26663. * - Deprecated, please refer to {@link dragonBones.BaseFactory#clock}.
  26664. * @deprecated
  26665. * @language en_US
  26666. */
  26667. /**
  26668. * - 已废弃,请参考 {@link dragonBones.BaseFactory#clock}。
  26669. * @deprecated
  26670. * @language zh_CN
  26671. */
  26672. static readonly clock: WorldClock;
  26673. }
  26674. }
  26675. /**
  26676. * The MIT License (MIT)
  26677. *
  26678. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26679. *
  26680. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26681. * this software and associated documentation files (the "Software"), to deal in
  26682. * the Software without restriction, including without limitation the rights to
  26683. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26684. * the Software, and to permit persons to whom the Software is furnished to do so,
  26685. * subject to the following conditions:
  26686. *
  26687. * The above copyright notice and this permission notice shall be included in all
  26688. * copies or substantial portions of the Software.
  26689. *
  26690. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26691. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26692. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26693. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26694. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26695. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26696. */
  26697. declare namespace dragonBones {
  26698. /**
  26699. * - The animation player is used to play the animation data and manage the animation states.
  26700. * @see dragonBones.AnimationData
  26701. * @see dragonBones.AnimationState
  26702. * @version DragonBones 3.0
  26703. * @language en_US
  26704. */
  26705. /**
  26706. * - 动画播放器用来播放动画数据和管理动画状态。
  26707. * @see dragonBones.AnimationData
  26708. * @see dragonBones.AnimationState
  26709. * @version DragonBones 3.0
  26710. * @language zh_CN
  26711. */
  26712. class Animation extends BaseObject {
  26713. static toString(): string;
  26714. /**
  26715. * - The play speed of all animations. [0: Stop, (0~1): Slow, 1: Normal, (1~N): Fast]
  26716. * @default 1.0
  26717. * @version DragonBones 3.0
  26718. * @language en_US
  26719. */
  26720. /**
  26721. * - 所有动画的播放速度。 [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  26722. * @default 1.0
  26723. * @version DragonBones 3.0
  26724. * @language zh_CN
  26725. */
  26726. timeScale: number;
  26727. private _lockUpdate;
  26728. private _animationDirty;
  26729. private _inheritTimeScale;
  26730. private readonly _animationNames;
  26731. private readonly _animationStates;
  26732. private readonly _animations;
  26733. private _armature;
  26734. private _animationConfig;
  26735. private _lastAnimationState;
  26736. /**
  26737. * @private
  26738. */
  26739. protected _onClear(): void;
  26740. private _fadeOut(animationConfig);
  26741. /**
  26742. * @internal
  26743. * @private
  26744. */
  26745. init(armature: Armature): void;
  26746. /**
  26747. * @internal
  26748. * @private
  26749. */
  26750. advanceTime(passedTime: number): void;
  26751. /**
  26752. * - Clear all animations states.
  26753. * @see dragonBones.AnimationState
  26754. * @version DragonBones 4.5
  26755. * @language en_US
  26756. */
  26757. /**
  26758. * - 清除所有的动画状态。
  26759. * @see dragonBones.AnimationState
  26760. * @version DragonBones 4.5
  26761. * @language zh_CN
  26762. */
  26763. reset(): void;
  26764. /**
  26765. * - Pause a specific animation state.
  26766. * @param animationName - The name of animation state. (If not set, it will pause all animations)
  26767. * @see dragonBones.AnimationState
  26768. * @version DragonBones 3.0
  26769. * @language en_US
  26770. */
  26771. /**
  26772. * - 暂停指定动画状态的播放。
  26773. * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画)
  26774. * @see dragonBones.AnimationState
  26775. * @version DragonBones 3.0
  26776. * @language zh_CN
  26777. */
  26778. stop(animationName?: string | null): void;
  26779. /**
  26780. * - Play animation with a specific animation config.
  26781. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  26782. * @param animationConfig - The animation config.
  26783. * @returns The playing animation state.
  26784. * @see dragonBones.AnimationConfig
  26785. * @beta
  26786. * @version DragonBones 5.0
  26787. * @language en_US
  26788. */
  26789. /**
  26790. * - 通过指定的动画配置来播放动画。
  26791. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  26792. * @param animationConfig - 动画配置。
  26793. * @returns 播放的动画状态。
  26794. * @see dragonBones.AnimationConfig
  26795. * @beta
  26796. * @version DragonBones 5.0
  26797. * @language zh_CN
  26798. */
  26799. playConfig(animationConfig: AnimationConfig): AnimationState | null;
  26800. /**
  26801. * - Play a specific animation.
  26802. * @param animationName - The name of animation data. (If not set, The default animation will be played, or resume the animation playing from pause status, or replay the last playing animation)
  26803. * @param playTimes - Playing repeat times. [-1: Use default value of the animation data, 0: No end loop playing, [1~N]: Repeat N times] (default: -1)
  26804. * @returns The playing animation state.
  26805. * @example
  26806. * <pre>
  26807. * armature.animation.play("walk");
  26808. * </pre>
  26809. * @version DragonBones 3.0
  26810. * @language en_US
  26811. */
  26812. /**
  26813. * - 播放指定动画。
  26814. * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画)
  26815. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26816. * @returns 播放的动画状态。
  26817. * @example
  26818. * <pre>
  26819. * armature.animation.play("walk");
  26820. * </pre>
  26821. * @version DragonBones 3.0
  26822. * @language zh_CN
  26823. */
  26824. play(animationName?: string | null, playTimes?: number): AnimationState | null;
  26825. /**
  26826. * - Fade in a specific animation.
  26827. * @param animationName - The name of animation data.
  26828. * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1)
  26829. * @param playTimes - playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26830. * @param layer - The blending layer, the animation states in high level layer will get the blending weights with high priority, when the total blending weights are more than 1.0, there will be no more weights can be allocated to the other animation states. (Default: 0)
  26831. * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null)
  26832. * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup)
  26833. * @returns The playing animation state.
  26834. * @example
  26835. * <pre>
  26836. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  26837. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  26838. * </pre>
  26839. * @version DragonBones 4.5
  26840. * @language en_US
  26841. */
  26842. /**
  26843. * - 淡入播放指定的动画。
  26844. * @param animationName - 动画数据名称。
  26845. * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1)
  26846. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26847. * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0)
  26848. * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null)
  26849. * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup)
  26850. * @returns 播放的动画状态。
  26851. * @example
  26852. * <pre>
  26853. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  26854. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  26855. * </pre>
  26856. * @version DragonBones 4.5
  26857. * @language zh_CN
  26858. */
  26859. fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode): AnimationState | null;
  26860. /**
  26861. * - Play a specific animation from the specific time.
  26862. * @param animationName - The name of animation data.
  26863. * @param time - The start time point of playing. (In seconds)
  26864. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26865. * @returns The played animation state.
  26866. * @version DragonBones 4.5
  26867. * @language en_US
  26868. */
  26869. /**
  26870. * - 从指定时间开始播放指定的动画。
  26871. * @param animationName - 动画数据名称。
  26872. * @param time - 播放开始的时间。 (以秒为单位)
  26873. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26874. * @returns 播放的动画状态。
  26875. * @version DragonBones 4.5
  26876. * @language zh_CN
  26877. */
  26878. gotoAndPlayByTime(animationName: string, time?: number, playTimes?: number): AnimationState | null;
  26879. /**
  26880. * - Play a specific animation from the specific frame.
  26881. * @param animationName - The name of animation data.
  26882. * @param frame - The start frame of playing.
  26883. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26884. * @returns The played animation state.
  26885. * @version DragonBones 4.5
  26886. * @language en_US
  26887. */
  26888. /**
  26889. * - 从指定帧开始播放指定的动画。
  26890. * @param animationName - 动画数据名称。
  26891. * @param frame - 播放开始的帧数。
  26892. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26893. * @returns 播放的动画状态。
  26894. * @version DragonBones 4.5
  26895. * @language zh_CN
  26896. */
  26897. gotoAndPlayByFrame(animationName: string, frame?: number, playTimes?: number): AnimationState | null;
  26898. /**
  26899. * - Play a specific animation from the specific progress.
  26900. * @param animationName - The name of animation data.
  26901. * @param progress - The start progress value of playing.
  26902. * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1)
  26903. * @returns The played animation state.
  26904. * @version DragonBones 4.5
  26905. * @language en_US
  26906. */
  26907. /**
  26908. * - 从指定进度开始播放指定的动画。
  26909. * @param animationName - 动画数据名称。
  26910. * @param progress - 开始播放的进度。
  26911. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26912. * @returns 播放的动画状态。
  26913. * @version DragonBones 4.5
  26914. * @language zh_CN
  26915. */
  26916. gotoAndPlayByProgress(animationName: string, progress?: number, playTimes?: number): AnimationState | null;
  26917. /**
  26918. * - Stop a specific animation at the specific time.
  26919. * @param animationName - The name of animation data.
  26920. * @param time - The stop time. (In seconds)
  26921. * @returns The played animation state.
  26922. * @version DragonBones 4.5
  26923. * @language en_US
  26924. */
  26925. /**
  26926. * - 在指定时间停止指定动画播放
  26927. * @param animationName - 动画数据名称。
  26928. * @param time - 停止的时间。 (以秒为单位)
  26929. * @returns 播放的动画状态。
  26930. * @version DragonBones 4.5
  26931. * @language zh_CN
  26932. */
  26933. gotoAndStopByTime(animationName: string, time?: number): AnimationState | null;
  26934. /**
  26935. * - Stop a specific animation at the specific frame.
  26936. * @param animationName - The name of animation data.
  26937. * @param frame - The stop frame.
  26938. * @returns The played animation state.
  26939. * @version DragonBones 4.5
  26940. * @language en_US
  26941. */
  26942. /**
  26943. * - 在指定帧停止指定动画的播放
  26944. * @param animationName - 动画数据名称。
  26945. * @param frame - 停止的帧数。
  26946. * @returns 播放的动画状态。
  26947. * @version DragonBones 4.5
  26948. * @language zh_CN
  26949. */
  26950. gotoAndStopByFrame(animationName: string, frame?: number): AnimationState | null;
  26951. /**
  26952. * - Stop a specific animation at the specific progress.
  26953. * @param animationName - The name of animation data.
  26954. * @param progress - The stop progress value.
  26955. * @returns The played animation state.
  26956. * @version DragonBones 4.5
  26957. * @language en_US
  26958. */
  26959. /**
  26960. * - 在指定的进度停止指定的动画播放。
  26961. * @param animationName - 动画数据名称。
  26962. * @param progress - 停止进度。
  26963. * @returns 播放的动画状态。
  26964. * @version DragonBones 4.5
  26965. * @language zh_CN
  26966. */
  26967. gotoAndStopByProgress(animationName: string, progress?: number): AnimationState | null;
  26968. /**
  26969. * - Get a specific animation state.
  26970. * @param animationName - The name of animation state.
  26971. * @example
  26972. * <pre>
  26973. * armature.animation.play("walk");
  26974. * let walkState = armature.animation.getState("walk");
  26975. * walkState.timeScale = 0.5;
  26976. * </pre>
  26977. * @version DragonBones 3.0
  26978. * @language en_US
  26979. */
  26980. /**
  26981. * - 获取指定的动画状态
  26982. * @param animationName - 动画状态名称。
  26983. * @example
  26984. * <pre>
  26985. * armature.animation.play("walk");
  26986. * let walkState = armature.animation.getState("walk");
  26987. * walkState.timeScale = 0.5;
  26988. * </pre>
  26989. * @version DragonBones 3.0
  26990. * @language zh_CN
  26991. */
  26992. getState(animationName: string): AnimationState | null;
  26993. /**
  26994. * - Check whether a specific animation data is included.
  26995. * @param animationName - The name of animation data.
  26996. * @see dragonBones.AnimationData
  26997. * @version DragonBones 3.0
  26998. * @language en_US
  26999. */
  27000. /**
  27001. * - 检查是否包含指定的动画数据
  27002. * @param animationName - 动画数据名称。
  27003. * @see dragonBones.AnimationData
  27004. * @version DragonBones 3.0
  27005. * @language zh_CN
  27006. */
  27007. hasAnimation(animationName: string): boolean;
  27008. /**
  27009. * - Get all the animation states.
  27010. * @version DragonBones 5.1
  27011. * @language en_US
  27012. */
  27013. /**
  27014. * - 获取所有的动画状态
  27015. * @version DragonBones 5.1
  27016. * @language zh_CN
  27017. */
  27018. getStates(): Array<AnimationState>;
  27019. /**
  27020. * - Check whether there is an animation state is playing
  27021. * @see dragonBones.AnimationState
  27022. * @version DragonBones 3.0
  27023. * @language en_US
  27024. */
  27025. /**
  27026. * - 检查是否有动画状态正在播放
  27027. * @see dragonBones.AnimationState
  27028. * @version DragonBones 3.0
  27029. * @language zh_CN
  27030. */
  27031. readonly isPlaying: boolean;
  27032. /**
  27033. * - Check whether all the animation states' playing were finished.
  27034. * @see dragonBones.AnimationState
  27035. * @version DragonBones 3.0
  27036. * @language en_US
  27037. */
  27038. /**
  27039. * - 检查是否所有的动画状态均已播放完毕。
  27040. * @see dragonBones.AnimationState
  27041. * @version DragonBones 3.0
  27042. * @language zh_CN
  27043. */
  27044. readonly isCompleted: boolean;
  27045. /**
  27046. * - The name of the last playing animation state.
  27047. * @see #lastAnimationState
  27048. * @version DragonBones 3.0
  27049. * @language en_US
  27050. */
  27051. /**
  27052. * - 上一个播放的动画状态名称
  27053. * @see #lastAnimationState
  27054. * @version DragonBones 3.0
  27055. * @language zh_CN
  27056. */
  27057. readonly lastAnimationName: string;
  27058. /**
  27059. * - The name of all animation data
  27060. * @version DragonBones 4.5
  27061. * @language en_US
  27062. */
  27063. /**
  27064. * - 所有动画数据的名称
  27065. * @version DragonBones 4.5
  27066. * @language zh_CN
  27067. */
  27068. readonly animationNames: Array<string>;
  27069. /**
  27070. * - All animation data.
  27071. * @version DragonBones 4.5
  27072. * @language en_US
  27073. */
  27074. /**
  27075. * - 所有的动画数据。
  27076. * @version DragonBones 4.5
  27077. * @language zh_CN
  27078. */
  27079. animations: Map<AnimationData>;
  27080. /**
  27081. * - An AnimationConfig instance that can be used quickly.
  27082. * @see dragonBones.AnimationConfig
  27083. * @version DragonBones 5.0
  27084. * @language en_US
  27085. */
  27086. /**
  27087. * - 一个可以快速使用的动画配置实例。
  27088. * @see dragonBones.AnimationConfig
  27089. * @version DragonBones 5.0
  27090. * @language zh_CN
  27091. */
  27092. readonly animationConfig: AnimationConfig;
  27093. /**
  27094. * - The last playing animation state
  27095. * @see dragonBones.AnimationState
  27096. * @version DragonBones 3.0
  27097. * @language en_US
  27098. */
  27099. /**
  27100. * - 上一个播放的动画状态
  27101. * @see dragonBones.AnimationState
  27102. * @version DragonBones 3.0
  27103. * @language zh_CN
  27104. */
  27105. readonly lastAnimationState: AnimationState | null;
  27106. /**
  27107. * - Deprecated, please refer to {@link #play()} {@link #fadeIn()}.
  27108. * @deprecated
  27109. * @language en_US
  27110. */
  27111. /**
  27112. * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
  27113. * @deprecated
  27114. * @language zh_CN
  27115. */
  27116. gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
  27117. /**
  27118. * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
  27119. * @deprecated
  27120. * @language en_US
  27121. */
  27122. /**
  27123. * - 已废弃,请参考 {@link #gotoAndStopByTime()}。
  27124. * @deprecated
  27125. * @language zh_CN
  27126. */
  27127. gotoAndStop(animationName: string, time?: number): AnimationState | null;
  27128. /**
  27129. * - Deprecated, please refer to {@link #animationNames}.
  27130. * @deprecated
  27131. * @language en_US
  27132. */
  27133. /**
  27134. * - 已废弃,请参考 {@link #animationNames}。
  27135. * @deprecated
  27136. * @language zh_CN
  27137. */
  27138. readonly animationList: Array<string>;
  27139. /**
  27140. * - Deprecated, please refer to {@link #animationNames}.
  27141. * @deprecated
  27142. * @language en_US
  27143. */
  27144. /**
  27145. * - 已废弃,请参考 {@link #animationNames}。
  27146. * @deprecated
  27147. * @language zh_CN
  27148. */
  27149. readonly animationDataList: Array<AnimationData>;
  27150. }
  27151. }
  27152. /**
  27153. * The MIT License (MIT)
  27154. *
  27155. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27156. *
  27157. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27158. * this software and associated documentation files (the "Software"), to deal in
  27159. * the Software without restriction, including without limitation the rights to
  27160. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27161. * the Software, and to permit persons to whom the Software is furnished to do so,
  27162. * subject to the following conditions:
  27163. *
  27164. * The above copyright notice and this permission notice shall be included in all
  27165. * copies or substantial portions of the Software.
  27166. *
  27167. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27168. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27169. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27170. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27171. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27172. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27173. */
  27174. declare namespace dragonBones {
  27175. /**
  27176. * - The animation state is generated when the animation data is played.
  27177. * @see dragonBones.Animation
  27178. * @see dragonBones.AnimationData
  27179. * @version DragonBones 3.0
  27180. * @language en_US
  27181. */
  27182. /**
  27183. * - 动画状态由播放动画数据时产生。
  27184. * @see dragonBones.Animation
  27185. * @see dragonBones.AnimationData
  27186. * @version DragonBones 3.0
  27187. * @language zh_CN
  27188. */
  27189. class AnimationState extends BaseObject {
  27190. static toString(): string;
  27191. /**
  27192. * @private
  27193. */
  27194. actionEnabled: boolean;
  27195. /**
  27196. * @private
  27197. */
  27198. additiveBlending: boolean;
  27199. /**
  27200. * - Whether the animation state has control over the display object properties of the slots.
  27201. * Sometimes blend a animation state does not want it to control the display object properties of the slots,
  27202. * especially if other animation state are controlling the display object properties of the slots.
  27203. * @default true
  27204. * @version DragonBones 5.0
  27205. * @language en_US
  27206. */
  27207. /**
  27208. * - 动画状态是否对插槽的显示对象属性有控制权。
  27209. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  27210. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  27211. * @default true
  27212. * @version DragonBones 5.0
  27213. * @language zh_CN
  27214. */
  27215. displayControl: boolean;
  27216. /**
  27217. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  27218. * This property should usually be set to false when blend multiple animation states.
  27219. * @default true
  27220. * @version DragonBones 5.1
  27221. * @language en_US
  27222. */
  27223. /**
  27224. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  27225. * 通常在混合多个动画状态时应该将该属性设置为 false。
  27226. * @default true
  27227. * @version DragonBones 5.1
  27228. * @language zh_CN
  27229. */
  27230. resetToPose: boolean;
  27231. /**
  27232. * - The play times. [0: Loop play, [1~N]: Play N times]
  27233. * @version DragonBones 3.0
  27234. * @language en_US
  27235. */
  27236. /**
  27237. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  27238. * @version DragonBones 3.0
  27239. * @language zh_CN
  27240. */
  27241. playTimes: number;
  27242. /**
  27243. * - The blend layer.
  27244. * High layer animation state will get the blend weight first.
  27245. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  27246. * @readonly
  27247. * @version DragonBones 5.0
  27248. * @language en_US
  27249. */
  27250. /**
  27251. * - 混合图层。
  27252. * 图层高的动画状态会优先获取混合权重。
  27253. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  27254. * @readonly
  27255. * @version DragonBones 5.0
  27256. * @language zh_CN
  27257. */
  27258. layer: number;
  27259. /**
  27260. * - The play speed.
  27261. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  27262. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  27263. * @default 1.0
  27264. * @version DragonBones 3.0
  27265. * @language en_US
  27266. */
  27267. /**
  27268. * - 播放速度。
  27269. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  27270. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  27271. * @default 1.0
  27272. * @version DragonBones 3.0
  27273. * @language zh_CN
  27274. */
  27275. timeScale: number;
  27276. /**
  27277. * - The blend weight.
  27278. * @default 1.0
  27279. * @version DragonBones 5.0
  27280. * @language en_US
  27281. */
  27282. /**
  27283. * - 混合权重。
  27284. * @default 1.0
  27285. * @version DragonBones 5.0
  27286. * @language zh_CN
  27287. */
  27288. weight: number;
  27289. /**
  27290. * - The auto fade out time when the animation state play completed.
  27291. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  27292. * @default -1.0
  27293. * @version DragonBones 5.0
  27294. * @language en_US
  27295. */
  27296. /**
  27297. * - 动画状态播放完成后的自动淡出时间。
  27298. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  27299. * @default -1.0
  27300. * @version DragonBones 5.0
  27301. * @language zh_CN
  27302. */
  27303. autoFadeOutTime: number;
  27304. /**
  27305. * @private
  27306. */
  27307. fadeTotalTime: number;
  27308. /**
  27309. * - The name of the animation state. (Can be different from the name of the animation data)
  27310. * @readonly
  27311. * @version DragonBones 5.0
  27312. * @language en_US
  27313. */
  27314. /**
  27315. * - 动画状态名称。 (可以不同于动画数据)
  27316. * @readonly
  27317. * @version DragonBones 5.0
  27318. * @language zh_CN
  27319. */
  27320. name: string;
  27321. /**
  27322. * - The blend group name of the animation state.
  27323. * This property is typically used to specify the substitution of multiple animation states blend.
  27324. * @readonly
  27325. * @version DragonBones 5.0
  27326. * @language en_US
  27327. */
  27328. /**
  27329. * - 混合组名称。
  27330. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  27331. * @readonly
  27332. * @version DragonBones 5.0
  27333. * @language zh_CN
  27334. */
  27335. group: string;
  27336. private _timelineDirty;
  27337. /**
  27338. * - xx: Play Enabled, Fade Play Enabled
  27339. * @internal
  27340. * @private
  27341. */
  27342. _playheadState: number;
  27343. /**
  27344. * -1: Fade in, 0: Fade complete, 1: Fade out;
  27345. * @internal
  27346. * @private
  27347. */
  27348. _fadeState: number;
  27349. /**
  27350. * -1: Fade start, 0: Fading, 1: Fade complete;
  27351. * @internal
  27352. * @private
  27353. */
  27354. _subFadeState: number;
  27355. /**
  27356. * @internal
  27357. * @private
  27358. */
  27359. _position: number;
  27360. /**
  27361. * @internal
  27362. * @private
  27363. */
  27364. _duration: number;
  27365. private _fadeTime;
  27366. private _time;
  27367. /**
  27368. * @internal
  27369. * @private
  27370. */
  27371. _fadeProgress: number;
  27372. /**
  27373. * @internal
  27374. * @private
  27375. */
  27376. _weightResult: number;
  27377. /**
  27378. * @internal
  27379. * @private
  27380. */
  27381. readonly _blendState: BlendState;
  27382. private readonly _boneMask;
  27383. private readonly _boneTimelines;
  27384. private readonly _surfaceTimelines;
  27385. private readonly _slotTimelines;
  27386. private readonly _constraintTimelines;
  27387. private readonly _animationTimelines;
  27388. private readonly _poseTimelines;
  27389. private readonly _bonePoses;
  27390. /**
  27391. * @internal
  27392. * @private
  27393. */
  27394. _animationData: AnimationData;
  27395. private _armature;
  27396. /**
  27397. * @internal
  27398. * @private
  27399. */
  27400. _actionTimeline: ActionTimelineState;
  27401. private _zOrderTimeline;
  27402. /**
  27403. * @internal
  27404. * @private
  27405. */
  27406. _parent: AnimationState;
  27407. /**
  27408. * @private
  27409. */
  27410. protected _onClear(): void;
  27411. private _updateTimelines();
  27412. private _updateBoneAndSlotTimelines();
  27413. private _advanceFadeTime(passedTime);
  27414. /**
  27415. * @internal
  27416. * @private
  27417. */
  27418. init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void;
  27419. /**
  27420. * @internal
  27421. * @private
  27422. */
  27423. advanceTime(passedTime: number, cacheFrameRate: number): void;
  27424. /**
  27425. * - Continue play.
  27426. * @version DragonBones 3.0
  27427. * @language en_US
  27428. */
  27429. /**
  27430. * - 继续播放。
  27431. * @version DragonBones 3.0
  27432. * @language zh_CN
  27433. */
  27434. play(): void;
  27435. /**
  27436. * - Stop play.
  27437. * @version DragonBones 3.0
  27438. * @language en_US
  27439. */
  27440. /**
  27441. * - 暂停播放。
  27442. * @version DragonBones 3.0
  27443. * @language zh_CN
  27444. */
  27445. stop(): void;
  27446. /**
  27447. * - Fade out the animation state.
  27448. * @param fadeOutTime - The fade out time. (In seconds)
  27449. * @param pausePlayhead - Whether to pause the animation playing when fade out.
  27450. * @version DragonBones 3.0
  27451. * @language en_US
  27452. */
  27453. /**
  27454. * - 淡出动画状态。
  27455. * @param fadeOutTime - 淡出时间。 (以秒为单位)
  27456. * @param pausePlayhead - 淡出时是否暂停播放。
  27457. * @version DragonBones 3.0
  27458. * @language zh_CN
  27459. */
  27460. fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void;
  27461. /**
  27462. * - Check if a specific bone mask is included.
  27463. * @param name - The bone name.
  27464. * @version DragonBones 3.0
  27465. * @language en_US
  27466. */
  27467. /**
  27468. * - 检查是否包含特定骨骼遮罩。
  27469. * @param name - 骨骼名称。
  27470. * @version DragonBones 3.0
  27471. * @language zh_CN
  27472. */
  27473. containsBoneMask(name: string): boolean;
  27474. /**
  27475. * - Add a specific bone mask.
  27476. * @param name - The bone name.
  27477. * @param recursive - Whether or not to add a mask to the bone's sub-bone.
  27478. * @version DragonBones 3.0
  27479. * @language en_US
  27480. */
  27481. /**
  27482. * - 添加特定的骨骼遮罩。
  27483. * @param name - 骨骼名称。
  27484. * @param recursive - 是否为该骨骼的子骨骼添加遮罩。
  27485. * @version DragonBones 3.0
  27486. * @language zh_CN
  27487. */
  27488. addBoneMask(name: string, recursive?: boolean): void;
  27489. /**
  27490. * - Remove the mask of a specific bone.
  27491. * @param name - The bone name.
  27492. * @param recursive - Whether to remove the bone's sub-bone mask.
  27493. * @version DragonBones 3.0
  27494. * @language en_US
  27495. */
  27496. /**
  27497. * - 删除特定骨骼的遮罩。
  27498. * @param name - 骨骼名称。
  27499. * @param recursive - 是否删除该骨骼的子骨骼遮罩。
  27500. * @version DragonBones 3.0
  27501. * @language zh_CN
  27502. */
  27503. removeBoneMask(name: string, recursive?: boolean): void;
  27504. /**
  27505. * - Remove all bone masks.
  27506. * @version DragonBones 3.0
  27507. * @language en_US
  27508. */
  27509. /**
  27510. * - 删除所有骨骼遮罩。
  27511. * @version DragonBones 3.0
  27512. * @language zh_CN
  27513. */
  27514. removeAllBoneMask(): void;
  27515. /**
  27516. * - Whether the animation state is fading in.
  27517. * @version DragonBones 5.1
  27518. * @language en_US
  27519. */
  27520. /**
  27521. * - 是否正在淡入。
  27522. * @version DragonBones 5.1
  27523. * @language zh_CN
  27524. */
  27525. readonly isFadeIn: boolean;
  27526. /**
  27527. * - Whether the animation state is fading out.
  27528. * @version DragonBones 5.1
  27529. * @language en_US
  27530. */
  27531. /**
  27532. * - 是否正在淡出。
  27533. * @version DragonBones 5.1
  27534. * @language zh_CN
  27535. */
  27536. readonly isFadeOut: boolean;
  27537. /**
  27538. * - Whether the animation state is fade completed.
  27539. * @version DragonBones 5.1
  27540. * @language en_US
  27541. */
  27542. /**
  27543. * - 是否淡入或淡出完毕。
  27544. * @version DragonBones 5.1
  27545. * @language zh_CN
  27546. */
  27547. readonly isFadeComplete: boolean;
  27548. /**
  27549. * - Whether the animation state is playing.
  27550. * @version DragonBones 3.0
  27551. * @language en_US
  27552. */
  27553. /**
  27554. * - 是否正在播放。
  27555. * @version DragonBones 3.0
  27556. * @language zh_CN
  27557. */
  27558. readonly isPlaying: boolean;
  27559. /**
  27560. * - Whether the animation state is play completed.
  27561. * @version DragonBones 3.0
  27562. * @language en_US
  27563. */
  27564. /**
  27565. * - 是否播放完毕。
  27566. * @version DragonBones 3.0
  27567. * @language zh_CN
  27568. */
  27569. readonly isCompleted: boolean;
  27570. /**
  27571. * - The times has been played.
  27572. * @version DragonBones 3.0
  27573. * @language en_US
  27574. */
  27575. /**
  27576. * - 已经循环播放的次数。
  27577. * @version DragonBones 3.0
  27578. * @language zh_CN
  27579. */
  27580. readonly currentPlayTimes: number;
  27581. /**
  27582. * - The total time. (In seconds)
  27583. * @version DragonBones 3.0
  27584. * @language en_US
  27585. */
  27586. /**
  27587. * - 总播放时间。 (以秒为单位)
  27588. * @version DragonBones 3.0
  27589. * @language zh_CN
  27590. */
  27591. readonly totalTime: number;
  27592. /**
  27593. * - The time is currently playing. (In seconds)
  27594. * @version DragonBones 3.0
  27595. * @language en_US
  27596. */
  27597. /**
  27598. * - 当前播放的时间。 (以秒为单位)
  27599. * @version DragonBones 3.0
  27600. * @language zh_CN
  27601. */
  27602. currentTime: number;
  27603. /**
  27604. * - The animation data.
  27605. * @see dragonBones.AnimationData
  27606. * @version DragonBones 3.0
  27607. * @language en_US
  27608. */
  27609. /**
  27610. * - 动画数据。
  27611. * @see dragonBones.AnimationData
  27612. * @version DragonBones 3.0
  27613. * @language zh_CN
  27614. */
  27615. readonly animationData: AnimationData;
  27616. }
  27617. /**
  27618. * @internal
  27619. * @private
  27620. */
  27621. class BonePose extends BaseObject {
  27622. static toString(): string;
  27623. readonly current: Transform;
  27624. readonly delta: Transform;
  27625. readonly result: Transform;
  27626. protected _onClear(): void;
  27627. }
  27628. /**
  27629. * @internal
  27630. * @private
  27631. */
  27632. class BlendState {
  27633. dirty: boolean;
  27634. layer: number;
  27635. leftWeight: number;
  27636. layerWeight: number;
  27637. blendWeight: number;
  27638. update(weight: number, layer: number): number;
  27639. clear(): void;
  27640. }
  27641. }
  27642. /**
  27643. * The MIT License (MIT)
  27644. *
  27645. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27646. *
  27647. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27648. * this software and associated documentation files (the "Software"), to deal in
  27649. * the Software without restriction, including without limitation the rights to
  27650. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27651. * the Software, and to permit persons to whom the Software is furnished to do so,
  27652. * subject to the following conditions:
  27653. *
  27654. * The above copyright notice and this permission notice shall be included in all
  27655. * copies or substantial portions of the Software.
  27656. *
  27657. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27658. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27659. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27660. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27661. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27662. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27663. */
  27664. declare namespace dragonBones {
  27665. /**
  27666. * @internal
  27667. * @private
  27668. */
  27669. const enum TweenState {
  27670. None = 0,
  27671. Once = 1,
  27672. Always = 2,
  27673. }
  27674. /**
  27675. * @internal
  27676. * @private
  27677. */
  27678. abstract class TimelineState extends BaseObject {
  27679. playState: number;
  27680. currentPlayTimes: number;
  27681. currentTime: number;
  27682. protected _tweenState: TweenState;
  27683. protected _frameRate: number;
  27684. protected _frameValueOffset: number;
  27685. protected _frameCount: number;
  27686. protected _frameOffset: number;
  27687. protected _frameIndex: number;
  27688. protected _frameRateR: number;
  27689. protected _position: number;
  27690. protected _duration: number;
  27691. protected _timeScale: number;
  27692. protected _timeOffset: number;
  27693. protected _dragonBonesData: DragonBonesData;
  27694. protected _animationData: AnimationData;
  27695. protected _timelineData: TimelineData | null;
  27696. protected _armature: Armature;
  27697. protected _animationState: AnimationState;
  27698. protected _actionTimeline: TimelineState;
  27699. protected _frameArray: Array<number> | Int16Array;
  27700. protected _frameIntArray: Array<number> | Int16Array;
  27701. protected _frameFloatArray: Array<number> | Int16Array;
  27702. protected _timelineArray: Array<number> | Uint16Array;
  27703. protected _frameIndices: Array<number>;
  27704. protected _onClear(): void;
  27705. protected abstract _onArriveAtFrame(): void;
  27706. protected abstract _onUpdateFrame(): void;
  27707. protected _setCurrentTime(passedTime: number): boolean;
  27708. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27709. fadeOut(): void;
  27710. update(passedTime: number): void;
  27711. }
  27712. /**
  27713. * @internal
  27714. * @private
  27715. */
  27716. abstract class TweenTimelineState extends TimelineState {
  27717. private static _getEasingValue(tweenType, progress, easing);
  27718. private static _getEasingCurveValue(progress, samples, count, offset);
  27719. protected _tweenType: TweenType;
  27720. protected _curveCount: number;
  27721. protected _framePosition: number;
  27722. protected _frameDurationR: number;
  27723. protected _tweenProgress: number;
  27724. protected _tweenEasing: number;
  27725. protected _onClear(): void;
  27726. protected _onArriveAtFrame(): void;
  27727. protected _onUpdateFrame(): void;
  27728. }
  27729. /**
  27730. * @internal
  27731. * @private
  27732. */
  27733. abstract class BoneTimelineState extends TweenTimelineState {
  27734. bone: Bone;
  27735. bonePose: BonePose;
  27736. protected _onClear(): void;
  27737. blend(state: number): void;
  27738. }
  27739. /**
  27740. * @internal
  27741. * @private
  27742. */
  27743. abstract class SlotTimelineState extends TweenTimelineState {
  27744. slot: Slot;
  27745. protected _onClear(): void;
  27746. }
  27747. /**
  27748. * @internal
  27749. * @private
  27750. */
  27751. abstract class ConstraintTimelineState extends TweenTimelineState {
  27752. constraint: Constraint;
  27753. protected _onClear(): void;
  27754. }
  27755. }
  27756. /**
  27757. * The MIT License (MIT)
  27758. *
  27759. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27760. *
  27761. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27762. * this software and associated documentation files (the "Software"), to deal in
  27763. * the Software without restriction, including without limitation the rights to
  27764. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27765. * the Software, and to permit persons to whom the Software is furnished to do so,
  27766. * subject to the following conditions:
  27767. *
  27768. * The above copyright notice and this permission notice shall be included in all
  27769. * copies or substantial portions of the Software.
  27770. *
  27771. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27772. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27773. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27774. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27775. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27776. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27777. */
  27778. declare namespace dragonBones {
  27779. /**
  27780. * @internal
  27781. * @private
  27782. */
  27783. class ActionTimelineState extends TimelineState {
  27784. static toString(): string;
  27785. private _onCrossFrame(frameIndex);
  27786. protected _onArriveAtFrame(): void;
  27787. protected _onUpdateFrame(): void;
  27788. update(passedTime: number): void;
  27789. setCurrentTime(value: number): void;
  27790. }
  27791. /**
  27792. * @internal
  27793. * @private
  27794. */
  27795. class ZOrderTimelineState extends TimelineState {
  27796. static toString(): string;
  27797. protected _onArriveAtFrame(): void;
  27798. protected _onUpdateFrame(): void;
  27799. }
  27800. /**
  27801. * @internal
  27802. * @private
  27803. */
  27804. class BoneAllTimelineState extends BoneTimelineState {
  27805. static toString(): string;
  27806. protected _onArriveAtFrame(): void;
  27807. protected _onUpdateFrame(): void;
  27808. fadeOut(): void;
  27809. }
  27810. /**
  27811. * @internal
  27812. * @private
  27813. */
  27814. class BoneTranslateTimelineState extends BoneTimelineState {
  27815. static toString(): string;
  27816. protected _onArriveAtFrame(): void;
  27817. protected _onUpdateFrame(): void;
  27818. }
  27819. /**
  27820. * @internal
  27821. * @private
  27822. */
  27823. class BoneRotateTimelineState extends BoneTimelineState {
  27824. static toString(): string;
  27825. protected _onArriveAtFrame(): void;
  27826. protected _onUpdateFrame(): void;
  27827. fadeOut(): void;
  27828. }
  27829. /**
  27830. * @internal
  27831. * @private
  27832. */
  27833. class BoneScaleTimelineState extends BoneTimelineState {
  27834. static toString(): string;
  27835. protected _onArriveAtFrame(): void;
  27836. protected _onUpdateFrame(): void;
  27837. }
  27838. /**
  27839. * @internal
  27840. * @private
  27841. */
  27842. class SurfaceTimelineState extends TweenTimelineState {
  27843. static toString(): string;
  27844. surface: Surface;
  27845. private _frameFloatOffset;
  27846. private _valueCount;
  27847. private _deformCount;
  27848. private _valueOffset;
  27849. private readonly _current;
  27850. private readonly _delta;
  27851. private readonly _result;
  27852. protected _onClear(): void;
  27853. protected _onArriveAtFrame(): void;
  27854. protected _onUpdateFrame(): void;
  27855. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27856. blend(state: number): void;
  27857. }
  27858. /**
  27859. * @internal
  27860. * @private
  27861. */
  27862. class SlotDislayTimelineState extends SlotTimelineState {
  27863. static toString(): string;
  27864. protected _onArriveAtFrame(): void;
  27865. }
  27866. /**
  27867. * @internal
  27868. * @private
  27869. */
  27870. class SlotColorTimelineState extends SlotTimelineState {
  27871. static toString(): string;
  27872. private _dirty;
  27873. private readonly _current;
  27874. private readonly _delta;
  27875. private readonly _result;
  27876. protected _onClear(): void;
  27877. protected _onArriveAtFrame(): void;
  27878. protected _onUpdateFrame(): void;
  27879. fadeOut(): void;
  27880. update(passedTime: number): void;
  27881. }
  27882. /**
  27883. * @internal
  27884. * @private
  27885. */
  27886. class SlotFFDTimelineState extends SlotTimelineState {
  27887. static toString(): string;
  27888. meshOffset: number;
  27889. private _dirty;
  27890. private _frameFloatOffset;
  27891. private _valueCount;
  27892. private _deformCount;
  27893. private _valueOffset;
  27894. private readonly _current;
  27895. private readonly _delta;
  27896. private readonly _result;
  27897. protected _onClear(): void;
  27898. protected _onArriveAtFrame(): void;
  27899. protected _onUpdateFrame(): void;
  27900. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27901. fadeOut(): void;
  27902. update(passedTime: number): void;
  27903. }
  27904. /**
  27905. * @internal
  27906. * @private
  27907. */
  27908. class IKConstraintTimelineState extends ConstraintTimelineState {
  27909. static toString(): string;
  27910. private _current;
  27911. private _delta;
  27912. protected _onClear(): void;
  27913. protected _onArriveAtFrame(): void;
  27914. protected _onUpdateFrame(): void;
  27915. }
  27916. /**
  27917. * @internal
  27918. * @private
  27919. */
  27920. class AnimationTimelineState extends TweenTimelineState {
  27921. static toString(): string;
  27922. animationState: AnimationState;
  27923. private readonly _floats;
  27924. protected _onClear(): void;
  27925. protected _onArriveAtFrame(): void;
  27926. protected _onUpdateFrame(): void;
  27927. blend(state: number): void;
  27928. }
  27929. }
  27930. /**
  27931. * The MIT License (MIT)
  27932. *
  27933. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27934. *
  27935. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27936. * this software and associated documentation files (the "Software"), to deal in
  27937. * the Software without restriction, including without limitation the rights to
  27938. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27939. * the Software, and to permit persons to whom the Software is furnished to do so,
  27940. * subject to the following conditions:
  27941. *
  27942. * The above copyright notice and this permission notice shall be included in all
  27943. * copies or substantial portions of the Software.
  27944. *
  27945. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27946. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27947. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27948. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27949. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27950. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27951. */
  27952. declare namespace dragonBones {
  27953. /**
  27954. * - The properties of the object carry basic information about an event,
  27955. * which are passed as parameter or parameter's parameter to event listeners when an event occurs.
  27956. * @version DragonBones 4.5
  27957. * @language en_US
  27958. */
  27959. /**
  27960. * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。
  27961. * @version DragonBones 4.5
  27962. * @language zh_CN
  27963. */
  27964. class EventObject extends BaseObject {
  27965. /**
  27966. * - Animation start play.
  27967. * @version DragonBones 4.5
  27968. * @language en_US
  27969. */
  27970. /**
  27971. * - 动画开始播放。
  27972. * @version DragonBones 4.5
  27973. * @language zh_CN
  27974. */
  27975. static readonly START: string;
  27976. /**
  27977. * - Animation loop play complete once.
  27978. * @version DragonBones 4.5
  27979. * @language en_US
  27980. */
  27981. /**
  27982. * - 动画循环播放完成一次。
  27983. * @version DragonBones 4.5
  27984. * @language zh_CN
  27985. */
  27986. static readonly LOOP_COMPLETE: string;
  27987. /**
  27988. * - Animation play complete.
  27989. * @version DragonBones 4.5
  27990. * @language en_US
  27991. */
  27992. /**
  27993. * - 动画播放完成。
  27994. * @version DragonBones 4.5
  27995. * @language zh_CN
  27996. */
  27997. static readonly COMPLETE: string;
  27998. /**
  27999. * - Animation fade in start.
  28000. * @version DragonBones 4.5
  28001. * @language en_US
  28002. */
  28003. /**
  28004. * - 动画淡入开始。
  28005. * @version DragonBones 4.5
  28006. * @language zh_CN
  28007. */
  28008. static readonly FADE_IN: string;
  28009. /**
  28010. * - Animation fade in complete.
  28011. * @version DragonBones 4.5
  28012. * @language en_US
  28013. */
  28014. /**
  28015. * - 动画淡入完成。
  28016. * @version DragonBones 4.5
  28017. * @language zh_CN
  28018. */
  28019. static readonly FADE_IN_COMPLETE: string;
  28020. /**
  28021. * - Animation fade out start.
  28022. * @version DragonBones 4.5
  28023. * @language en_US
  28024. */
  28025. /**
  28026. * - 动画淡出开始。
  28027. * @version DragonBones 4.5
  28028. * @language zh_CN
  28029. */
  28030. static readonly FADE_OUT: string;
  28031. /**
  28032. * - Animation fade out complete.
  28033. * @version DragonBones 4.5
  28034. * @language en_US
  28035. */
  28036. /**
  28037. * - 动画淡出完成。
  28038. * @version DragonBones 4.5
  28039. * @language zh_CN
  28040. */
  28041. static readonly FADE_OUT_COMPLETE: string;
  28042. /**
  28043. * - Animation frame event.
  28044. * @version DragonBones 4.5
  28045. * @language en_US
  28046. */
  28047. /**
  28048. * - 动画帧事件。
  28049. * @version DragonBones 4.5
  28050. * @language zh_CN
  28051. */
  28052. static readonly FRAME_EVENT: string;
  28053. /**
  28054. * - Animation frame sound event.
  28055. * @version DragonBones 4.5
  28056. * @language en_US
  28057. */
  28058. /**
  28059. * - 动画帧声音事件。
  28060. * @version DragonBones 4.5
  28061. * @language zh_CN
  28062. */
  28063. static readonly SOUND_EVENT: string;
  28064. static toString(): string;
  28065. /**
  28066. * - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
  28067. * @version DragonBones 4.5
  28068. * @language en_US
  28069. */
  28070. /**
  28071. * - 如果是帧事件,此值用来描述该事件在动画时间轴中所处的时间。(以秒为单位)
  28072. * @version DragonBones 4.5
  28073. * @language zh_CN
  28074. */
  28075. time: number;
  28076. /**
  28077. * - The event type。
  28078. * @version DragonBones 4.5
  28079. * @language en_US
  28080. */
  28081. /**
  28082. * - 事件类型。
  28083. * @version DragonBones 4.5
  28084. * @language zh_CN
  28085. */
  28086. type: EventStringType;
  28087. /**
  28088. * - The event name. (The frame event name or the frame sound name)
  28089. * @version DragonBones 4.5
  28090. * @language en_US
  28091. */
  28092. /**
  28093. * - 事件名称。 (帧事件的名称或帧声音的名称)
  28094. * @version DragonBones 4.5
  28095. * @language zh_CN
  28096. */
  28097. name: string;
  28098. /**
  28099. * - The armature that dispatch the event.
  28100. * @see dragonBones.Armature
  28101. * @version DragonBones 4.5
  28102. * @language en_US
  28103. */
  28104. /**
  28105. * - 发出该事件的骨架。
  28106. * @see dragonBones.Armature
  28107. * @version DragonBones 4.5
  28108. * @language zh_CN
  28109. */
  28110. armature: Armature;
  28111. /**
  28112. * - The bone that dispatch the event.
  28113. * @see dragonBones.Bone
  28114. * @version DragonBones 4.5
  28115. * @language en_US
  28116. */
  28117. /**
  28118. * - 发出该事件的骨骼。
  28119. * @see dragonBones.Bone
  28120. * @version DragonBones 4.5
  28121. * @language zh_CN
  28122. */
  28123. bone: Bone | null;
  28124. /**
  28125. * - The slot that dispatch the event.
  28126. * @see dragonBones.Slot
  28127. * @version DragonBones 4.5
  28128. * @language en_US
  28129. */
  28130. /**
  28131. * - 发出该事件的插槽。
  28132. * @see dragonBones.Slot
  28133. * @version DragonBones 4.5
  28134. * @language zh_CN
  28135. */
  28136. slot: Slot | null;
  28137. /**
  28138. * - The animation state that dispatch the event.
  28139. * @see dragonBones.AnimationState
  28140. * @version DragonBones 4.5
  28141. * @language en_US
  28142. */
  28143. /**
  28144. * - 发出该事件的动画状态。
  28145. * @see dragonBones.AnimationState
  28146. * @version DragonBones 4.5
  28147. * @language zh_CN
  28148. */
  28149. animationState: AnimationState;
  28150. /**
  28151. * - The custom data.
  28152. * @see dragonBones.CustomData
  28153. * @version DragonBones 5.0
  28154. * @language en_US
  28155. */
  28156. /**
  28157. * - 自定义数据。
  28158. * @see dragonBones.CustomData
  28159. * @version DragonBones 5.0
  28160. * @language zh_CN
  28161. */
  28162. data: UserData | null;
  28163. /**
  28164. * @private
  28165. */
  28166. protected _onClear(): void;
  28167. }
  28168. }
  28169. /**
  28170. * The MIT License (MIT)
  28171. *
  28172. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28173. *
  28174. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28175. * this software and associated documentation files (the "Software"), to deal in
  28176. * the Software without restriction, including without limitation the rights to
  28177. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28178. * the Software, and to permit persons to whom the Software is furnished to do so,
  28179. * subject to the following conditions:
  28180. *
  28181. * The above copyright notice and this permission notice shall be included in all
  28182. * copies or substantial portions of the Software.
  28183. *
  28184. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28185. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28186. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28187. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28188. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28189. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28190. */
  28191. declare namespace dragonBones {
  28192. /**
  28193. * @private
  28194. */
  28195. type EventStringType = string | "start" | "loopComplete" | "complete" | "fadeIn" | "fadeInComplete" | "fadeOut" | "fadeOutComplete" | "frameEvent" | "soundEvent";
  28196. /**
  28197. * - The event dispatcher interface.
  28198. * Dragonbones event dispatch usually relies on docking engine to implement, which defines the event method to be implemented when docking the engine.
  28199. * @version DragonBones 4.5
  28200. * @language en_US
  28201. */
  28202. /**
  28203. * - 事件派发接口。
  28204. * DragonBones 的事件派发通常依赖于对接的引擎来实现,该接口定义了对接引擎时需要实现的事件方法。
  28205. * @version DragonBones 4.5
  28206. * @language zh_CN
  28207. */
  28208. interface IEventDispatcher {
  28209. /**
  28210. * - Checks whether the object has any listeners registered for a specific type of event。
  28211. * @param type - Event type.
  28212. * @version DragonBones 4.5
  28213. * @language en_US
  28214. */
  28215. /**
  28216. * - 检查是否为特定的事件类型注册了任何侦听器。
  28217. * @param type - 事件类型。
  28218. * @version DragonBones 4.5
  28219. * @language zh_CN
  28220. */
  28221. hasDBEventListener(type: EventStringType): boolean;
  28222. /**
  28223. * - Dispatches an event into the event flow.
  28224. * @param type - Event type.
  28225. * @param eventObject - Event object.
  28226. * @see dragonBones.EventObject
  28227. * @version DragonBones 4.5
  28228. * @language en_US
  28229. */
  28230. /**
  28231. * - 分派特定的事件到事件流中。
  28232. * @param type - 事件类型。
  28233. * @param eventObject - 事件数据。
  28234. * @see dragonBones.EventObject
  28235. * @version DragonBones 4.5
  28236. * @language zh_CN
  28237. */
  28238. dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
  28239. /**
  28240. * - Add an event listener object so that the listener receives notification of an event.
  28241. * @param type - Event type.
  28242. * @param listener - Event listener.
  28243. * @param thisObject - The listener function's "this".
  28244. * @version DragonBones 4.5
  28245. * @language en_US
  28246. */
  28247. /**
  28248. * - 添加特定事件类型的事件侦听器,以使侦听器能够接收事件通知。
  28249. * @param type - 事件类型。
  28250. * @param listener - 事件侦听器。
  28251. * @param thisObject - 侦听函数绑定的 this 对象。
  28252. * @version DragonBones 4.5
  28253. * @language zh_CN
  28254. */
  28255. addDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  28256. /**
  28257. * - Removes a listener from the object.
  28258. * @param type - Event type.
  28259. * @param listener - Event listener.
  28260. * @param thisObject - The listener function's "this".
  28261. * @version DragonBones 4.5
  28262. * @language en_US
  28263. */
  28264. /**
  28265. * - 删除特定事件类型的侦听器。
  28266. * @param type - 事件类型。
  28267. * @param listener - 事件侦听器。
  28268. * @param thisObject - 侦听函数绑定的 this 对象。
  28269. * @version DragonBones 4.5
  28270. * @language zh_CN
  28271. */
  28272. removeDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  28273. /**
  28274. * - Deprecated, please refer to {@link #hasDBEventListener()}.
  28275. * @deprecated
  28276. * @language en_US
  28277. */
  28278. /**
  28279. * - 已废弃,请参考 {@link #hasDBEventListener()}。
  28280. * @deprecated
  28281. * @language zh_CN
  28282. */
  28283. hasEvent(type: EventStringType): boolean;
  28284. /**
  28285. * - Deprecated, please refer to {@link #addDBEventListener()}.
  28286. * @deprecated
  28287. * @language en_US
  28288. */
  28289. /**
  28290. * - 已废弃,请参考 {@link #addDBEventListener()}。
  28291. * @deprecated
  28292. * @language zh_CN
  28293. */
  28294. addEvent(type: EventStringType, listener: Function, thisObject: any): void;
  28295. /**
  28296. * - Deprecated, please refer to {@link #removeDBEventListener()}.
  28297. * @deprecated
  28298. * @language en_US
  28299. */
  28300. /**
  28301. * - 已废弃,请参考 {@link #removeDBEventListener()}。
  28302. * @deprecated
  28303. * @language zh_CN
  28304. */
  28305. removeEvent(type: EventStringType, listener: Function, thisObject: any): void;
  28306. }
  28307. }
  28308. /**
  28309. * The MIT License (MIT)
  28310. *
  28311. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28312. *
  28313. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28314. * this software and associated documentation files (the "Software"), to deal in
  28315. * the Software without restriction, including without limitation the rights to
  28316. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28317. * the Software, and to permit persons to whom the Software is furnished to do so,
  28318. * subject to the following conditions:
  28319. *
  28320. * The above copyright notice and this permission notice shall be included in all
  28321. * copies or substantial portions of the Software.
  28322. *
  28323. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28324. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28325. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28326. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28327. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28328. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28329. */
  28330. declare namespace dragonBones {
  28331. /**
  28332. * @internal
  28333. * @private
  28334. */
  28335. abstract class DataParser {
  28336. protected static readonly DATA_VERSION_2_3: string;
  28337. protected static readonly DATA_VERSION_3_0: string;
  28338. protected static readonly DATA_VERSION_4_0: string;
  28339. protected static readonly DATA_VERSION_4_5: string;
  28340. protected static readonly DATA_VERSION_5_0: string;
  28341. protected static readonly DATA_VERSION_5_5: string;
  28342. protected static readonly DATA_VERSION: string;
  28343. protected static readonly DATA_VERSIONS: Array<string>;
  28344. protected static readonly TEXTURE_ATLAS: string;
  28345. protected static readonly SUB_TEXTURE: string;
  28346. protected static readonly FORMAT: string;
  28347. protected static readonly IMAGE_PATH: string;
  28348. protected static readonly WIDTH: string;
  28349. protected static readonly HEIGHT: string;
  28350. protected static readonly ROTATED: string;
  28351. protected static readonly FRAME_X: string;
  28352. protected static readonly FRAME_Y: string;
  28353. protected static readonly FRAME_WIDTH: string;
  28354. protected static readonly FRAME_HEIGHT: string;
  28355. protected static readonly DRADON_BONES: string;
  28356. protected static readonly USER_DATA: string;
  28357. protected static readonly ARMATURE: string;
  28358. protected static readonly BONE: string;
  28359. protected static readonly SURFACE: string;
  28360. protected static readonly SLOT: string;
  28361. protected static readonly CONSTRAINT: string;
  28362. protected static readonly IK: string;
  28363. protected static readonly SKIN: string;
  28364. protected static readonly DISPLAY: string;
  28365. protected static readonly ANIMATION: string;
  28366. protected static readonly Z_ORDER: string;
  28367. protected static readonly FFD: string;
  28368. protected static readonly FRAME: string;
  28369. protected static readonly TRANSLATE_FRAME: string;
  28370. protected static readonly ROTATE_FRAME: string;
  28371. protected static readonly SCALE_FRAME: string;
  28372. protected static readonly DISPLAY_FRAME: string;
  28373. protected static readonly COLOR_FRAME: string;
  28374. protected static readonly DEFAULT_ACTIONS: string;
  28375. protected static readonly ACTIONS: string;
  28376. protected static readonly EVENTS: string;
  28377. protected static readonly INTS: string;
  28378. protected static readonly FLOATS: string;
  28379. protected static readonly STRINGS: string;
  28380. protected static readonly CANVAS: string;
  28381. protected static readonly TRANSFORM: string;
  28382. protected static readonly PIVOT: string;
  28383. protected static readonly AABB: string;
  28384. protected static readonly COLOR: string;
  28385. protected static readonly VERSION: string;
  28386. protected static readonly COMPATIBLE_VERSION: string;
  28387. protected static readonly FRAME_RATE: string;
  28388. protected static readonly TYPE: string;
  28389. protected static readonly SUB_TYPE: string;
  28390. protected static readonly NAME: string;
  28391. protected static readonly PARENT: string;
  28392. protected static readonly TARGET: string;
  28393. protected static readonly STAGE: string;
  28394. protected static readonly SHARE: string;
  28395. protected static readonly PATH: string;
  28396. protected static readonly LENGTH: string;
  28397. protected static readonly DISPLAY_INDEX: string;
  28398. protected static readonly BLEND_MODE: string;
  28399. protected static readonly INHERIT_TRANSLATION: string;
  28400. protected static readonly INHERIT_ROTATION: string;
  28401. protected static readonly INHERIT_SCALE: string;
  28402. protected static readonly INHERIT_REFLECTION: string;
  28403. protected static readonly INHERIT_ANIMATION: string;
  28404. protected static readonly INHERIT_DEFORM: string;
  28405. protected static readonly SEGMENT_X: string;
  28406. protected static readonly SEGMENT_Y: string;
  28407. protected static readonly BEND_POSITIVE: string;
  28408. protected static readonly CHAIN: string;
  28409. protected static readonly WEIGHT: string;
  28410. protected static readonly FADE_IN_TIME: string;
  28411. protected static readonly PLAY_TIMES: string;
  28412. protected static readonly SCALE: string;
  28413. protected static readonly OFFSET: string;
  28414. protected static readonly POSITION: string;
  28415. protected static readonly DURATION: string;
  28416. protected static readonly TWEEN_EASING: string;
  28417. protected static readonly TWEEN_ROTATE: string;
  28418. protected static readonly TWEEN_SCALE: string;
  28419. protected static readonly CLOCK_WISE: string;
  28420. protected static readonly CURVE: string;
  28421. protected static readonly SOUND: string;
  28422. protected static readonly EVENT: string;
  28423. protected static readonly ACTION: string;
  28424. protected static readonly X: string;
  28425. protected static readonly Y: string;
  28426. protected static readonly SKEW_X: string;
  28427. protected static readonly SKEW_Y: string;
  28428. protected static readonly SCALE_X: string;
  28429. protected static readonly SCALE_Y: string;
  28430. protected static readonly VALUE: string;
  28431. protected static readonly ROTATE: string;
  28432. protected static readonly SKEW: string;
  28433. protected static readonly ALPHA_OFFSET: string;
  28434. protected static readonly RED_OFFSET: string;
  28435. protected static readonly GREEN_OFFSET: string;
  28436. protected static readonly BLUE_OFFSET: string;
  28437. protected static readonly ALPHA_MULTIPLIER: string;
  28438. protected static readonly RED_MULTIPLIER: string;
  28439. protected static readonly GREEN_MULTIPLIER: string;
  28440. protected static readonly BLUE_MULTIPLIER: string;
  28441. protected static readonly UVS: string;
  28442. protected static readonly VERTICES: string;
  28443. protected static readonly TRIANGLES: string;
  28444. protected static readonly WEIGHTS: string;
  28445. protected static readonly SLOT_POSE: string;
  28446. protected static readonly BONE_POSE: string;
  28447. protected static readonly GLUE_WEIGHTS: string;
  28448. protected static readonly GLUE_MESHES: string;
  28449. protected static readonly GOTO_AND_PLAY: string;
  28450. protected static readonly DEFAULT_NAME: string;
  28451. protected static _getArmatureType(value: string): ArmatureType;
  28452. protected static _getBoneType(value: string): BoneType;
  28453. protected static _getDisplayType(value: string): DisplayType;
  28454. protected static _getBoundingBoxType(value: string): BoundingBoxType;
  28455. protected static _getActionType(value: string): ActionType;
  28456. protected static _getBlendMode(value: string): BlendMode;
  28457. abstract parseDragonBonesData(rawData: any, scale: number): DragonBonesData | null;
  28458. abstract parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale: number): boolean;
  28459. /**
  28460. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  28461. * @deprecated
  28462. * @language en_US
  28463. */
  28464. /**
  28465. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  28466. * @deprecated
  28467. * @language zh_CN
  28468. */
  28469. static parseDragonBonesData(rawData: any): DragonBonesData | null;
  28470. /**
  28471. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  28472. * @deprecated
  28473. * @language en_US
  28474. */
  28475. /**
  28476. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  28477. * @deprecated
  28478. * @language zh_CN
  28479. */
  28480. static parseTextureAtlasData(rawData: any, scale?: number): any;
  28481. }
  28482. }
  28483. /**
  28484. * The MIT License (MIT)
  28485. *
  28486. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28487. *
  28488. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28489. * this software and associated documentation files (the "Software"), to deal in
  28490. * the Software without restriction, including without limitation the rights to
  28491. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28492. * the Software, and to permit persons to whom the Software is furnished to do so,
  28493. * subject to the following conditions:
  28494. *
  28495. * The above copyright notice and this permission notice shall be included in all
  28496. * copies or substantial portions of the Software.
  28497. *
  28498. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28499. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28500. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28501. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28502. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28503. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28504. */
  28505. declare namespace dragonBones {
  28506. /**
  28507. * @internal
  28508. * @private
  28509. */
  28510. class ObjectDataParser extends DataParser {
  28511. protected static _getBoolean(rawData: any, key: string, defaultValue: boolean): boolean;
  28512. protected static _getNumber(rawData: any, key: string, defaultValue: number): number;
  28513. protected static _getString(rawData: any, key: string, defaultValue: string): string;
  28514. protected _rawTextureAtlasIndex: number;
  28515. protected readonly _rawBones: Array<BoneData>;
  28516. protected _data: DragonBonesData;
  28517. protected _armature: ArmatureData;
  28518. protected _bone: BoneData;
  28519. protected _surface: SurfaceData;
  28520. protected _slot: SlotData;
  28521. protected _skin: SkinData;
  28522. protected _mesh: MeshDisplayData;
  28523. protected _animation: AnimationData;
  28524. protected _timeline: TimelineData;
  28525. protected _rawTextureAtlases: Array<any> | null;
  28526. private _defaultColorOffset;
  28527. private _prevClockwise;
  28528. private _prevRotation;
  28529. private readonly _helpMatrixA;
  28530. private readonly _helpMatrixB;
  28531. private readonly _helpTransform;
  28532. private readonly _helpColorTransform;
  28533. private readonly _helpPoint;
  28534. private readonly _helpArray;
  28535. private readonly _intArray;
  28536. private readonly _floatArray;
  28537. private readonly _frameIntArray;
  28538. private readonly _frameFloatArray;
  28539. private readonly _frameArray;
  28540. private readonly _timelineArray;
  28541. private readonly _cacheRawMeshes;
  28542. private readonly _cacheMeshes;
  28543. private readonly _actionFrames;
  28544. private readonly _weightSlotPose;
  28545. private readonly _weightBonePoses;
  28546. private readonly _cacheBones;
  28547. private readonly _slotChildActions;
  28548. private _getCurvePoint(x1, y1, x2, y2, x3, y3, x4, y4, t, result);
  28549. private _samplingEasingCurve(curve, samples);
  28550. private _parseActionDataInFrame(rawData, frameStart, bone, slot);
  28551. private _mergeActionFrame(rawData, frameStart, type, bone, slot);
  28552. protected _parseArmature(rawData: any, scale: number): ArmatureData;
  28553. protected _parseBone(rawData: any): BoneData;
  28554. protected _parseIKConstraint(rawData: any): ConstraintData | null;
  28555. protected _parseSlot(rawData: any, zOrder: number): SlotData;
  28556. protected _parseSkin(rawData: any): SkinData;
  28557. protected _parseDisplay(rawData: any): DisplayData | null;
  28558. protected _parsePivot(rawData: any, display: ImageDisplayData): void;
  28559. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  28560. protected _parseMeshGlue(rawData: any, mesh: MeshDisplayData): void;
  28561. protected _parseBoundingBox(rawData: any): BoundingBoxData | null;
  28562. protected _parsePolygonBoundingBox(rawData: any): PolygonBoundingBoxData;
  28563. protected _parseAnimation(rawData: any): AnimationData;
  28564. protected _parseTimeline(rawData: any, rawFrames: Array<any> | null, framesKey: string, type: TimelineType, addIntOffset: boolean, addFloatOffset: boolean, frameValueCount: number, frameParser: (rawData: any, frameStart: number, frameCount: number) => number): TimelineData | null;
  28565. protected _parseBoneTimeline(rawData: any): void;
  28566. protected _parseSlotTimeline(rawData: any): void;
  28567. protected _parseFrame(rawData: any, frameStart: number, frameCount: number): number;
  28568. protected _parseTweenFrame(rawData: any, frameStart: number, frameCount: number): number;
  28569. protected _parseActionFrame(frame: ActionFrame, frameStart: number, frameCount: number): number;
  28570. protected _parseZOrderFrame(rawData: any, frameStart: number, frameCount: number): number;
  28571. protected _parseBoneAllFrame(rawData: any, frameStart: number, frameCount: number): number;
  28572. protected _parseBoneTranslateFrame(rawData: any, frameStart: number, frameCount: number): number;
  28573. protected _parseBoneRotateFrame(rawData: any, frameStart: number, frameCount: number): number;
  28574. protected _parseBoneScaleFrame(rawData: any, frameStart: number, frameCount: number): number;
  28575. protected _parseSurfaceFrame(rawData: any, frameStart: number, frameCount: number): number;
  28576. protected _parseSlotDisplayFrame(rawData: any, frameStart: number, frameCount: number): number;
  28577. protected _parseSlotColorFrame(rawData: any, frameStart: number, frameCount: number): number;
  28578. protected _parseSlotFFDFrame(rawData: any, frameStart: number, frameCount: number): number;
  28579. protected _parseIKConstraintFrame(rawData: any, frameStart: number, frameCount: number): number;
  28580. protected _parseAnimationFrame(rawData: any, frameStart: number, frameCount: number): number;
  28581. protected _parseActionData(rawData: any, type: ActionType, bone: BoneData | null, slot: SlotData | null): Array<ActionData>;
  28582. protected _parseTransform(rawData: any, transform: Transform, scale: number): void;
  28583. protected _parseColorTransform(rawData: any, color: ColorTransform): void;
  28584. protected _parseArray(rawData: any): void;
  28585. protected _modifyArray(): void;
  28586. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  28587. parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale?: number): boolean;
  28588. private static _objectDataParserInstance;
  28589. /**
  28590. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  28591. * @deprecated
  28592. * @language en_US
  28593. */
  28594. /**
  28595. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  28596. * @deprecated
  28597. * @language zh_CN
  28598. */
  28599. static getInstance(): ObjectDataParser;
  28600. }
  28601. /**
  28602. * @internal
  28603. * @private
  28604. */
  28605. class ActionFrame {
  28606. frameStart: number;
  28607. readonly actions: Array<number>;
  28608. }
  28609. }
  28610. /**
  28611. * The MIT License (MIT)
  28612. *
  28613. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28614. *
  28615. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28616. * this software and associated documentation files (the "Software"), to deal in
  28617. * the Software without restriction, including without limitation the rights to
  28618. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28619. * the Software, and to permit persons to whom the Software is furnished to do so,
  28620. * subject to the following conditions:
  28621. *
  28622. * The above copyright notice and this permission notice shall be included in all
  28623. * copies or substantial portions of the Software.
  28624. *
  28625. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28626. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28627. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28628. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28629. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28630. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28631. */
  28632. declare namespace dragonBones {
  28633. /**
  28634. * @internal
  28635. * @private
  28636. */
  28637. class BinaryDataParser extends ObjectDataParser {
  28638. private _binaryOffset;
  28639. private _binary;
  28640. private _intArrayBuffer;
  28641. private _floatArrayBuffer;
  28642. private _frameIntArrayBuffer;
  28643. private _frameFloatArrayBuffer;
  28644. private _frameArrayBuffer;
  28645. private _timelineArrayBuffer;
  28646. private _inRange(a, min, max);
  28647. private _decodeUTF8(data);
  28648. private _getUTF16Key(value);
  28649. private _parseBinaryTimeline(type, offset, timelineData?);
  28650. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  28651. protected _parseAnimation(rawData: any): AnimationData;
  28652. protected _parseArray(rawData: any): void;
  28653. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  28654. private static _binaryDataParserInstance;
  28655. /**
  28656. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  28657. * @deprecated
  28658. * @language en_US
  28659. */
  28660. /**
  28661. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  28662. * @deprecated
  28663. * @language zh_CN
  28664. */
  28665. static getInstance(): BinaryDataParser;
  28666. }
  28667. }
  28668. /**
  28669. * The MIT License (MIT)
  28670. *
  28671. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28672. *
  28673. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28674. * this software and associated documentation files (the "Software"), to deal in
  28675. * the Software without restriction, including without limitation the rights to
  28676. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28677. * the Software, and to permit persons to whom the Software is furnished to do so,
  28678. * subject to the following conditions:
  28679. *
  28680. * The above copyright notice and this permission notice shall be included in all
  28681. * copies or substantial portions of the Software.
  28682. *
  28683. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28684. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28685. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28686. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28687. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28688. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28689. */
  28690. declare namespace dragonBones {
  28691. /**
  28692. * - Base class for the factory that create the armatures. (Typically only one global factory instance is required)
  28693. * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances.
  28694. * Once the data has been parsed, it has been cached in the factory instance and does not need to be parsed again until it is cleared by the factory instance.
  28695. * @see dragonBones.DragonBonesData
  28696. * @see dragonBones.TextureAtlasData
  28697. * @see dragonBones.ArmatureData
  28698. * @see dragonBones.Armature
  28699. * @version DragonBones 3.0
  28700. * @language en_US
  28701. */
  28702. /**
  28703. * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例)
  28704. * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。
  28705. * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。
  28706. * @see dragonBones.DragonBonesData
  28707. * @see dragonBones.TextureAtlasData
  28708. * @see dragonBones.ArmatureData
  28709. * @see dragonBones.Armature
  28710. * @version DragonBones 3.0
  28711. * @language zh_CN
  28712. */
  28713. abstract class BaseFactory {
  28714. /**
  28715. * @private
  28716. */
  28717. protected static _objectParser: ObjectDataParser;
  28718. /**
  28719. * @private
  28720. */
  28721. protected static _binaryParser: BinaryDataParser;
  28722. /**
  28723. * @private
  28724. */
  28725. autoSearch: boolean;
  28726. /**
  28727. * @private
  28728. */
  28729. protected readonly _dragonBonesDataMap: Map<DragonBonesData>;
  28730. /**
  28731. * @private
  28732. */
  28733. protected readonly _textureAtlasDataMap: Map<Array<TextureAtlasData>>;
  28734. /**
  28735. * @private
  28736. */
  28737. protected _dragonBones: DragonBones;
  28738. /**
  28739. * @private
  28740. */
  28741. protected _dataParser: DataParser;
  28742. /**
  28743. * - Create a factory instance. (typically only one global factory instance is required)
  28744. * @version DragonBones 3.0
  28745. * @language en_US
  28746. */
  28747. /**
  28748. * - 创建一个工厂实例。 (通常只需要一个全局工厂实例)
  28749. * @version DragonBones 3.0
  28750. * @language zh_CN
  28751. */
  28752. constructor(dataParser?: DataParser | null);
  28753. /**
  28754. * @private
  28755. */
  28756. protected _isSupportMesh(): boolean;
  28757. /**
  28758. * @private
  28759. */
  28760. protected _getTextureData(textureAtlasName: string, textureName: string): TextureData | null;
  28761. /**
  28762. * @private
  28763. */
  28764. protected _fillBuildArmaturePackage(dataPackage: BuildArmaturePackage, dragonBonesName: string, armatureName: string, skinName: string, textureAtlasName: string): boolean;
  28765. /**
  28766. * @private
  28767. */
  28768. protected _buildBones(dataPackage: BuildArmaturePackage, armature: Armature): void;
  28769. /**
  28770. * @private
  28771. */
  28772. protected _buildSlots(dataPackage: BuildArmaturePackage, armature: Armature): void;
  28773. /**
  28774. * @private
  28775. */
  28776. protected _buildChildArmature(dataPackage: BuildArmaturePackage | null, slot: Slot, displayData: DisplayData): Armature | null;
  28777. /**
  28778. * @private
  28779. */
  28780. protected _getSlotDisplay(dataPackage: BuildArmaturePackage | null, displayData: DisplayData, rawDisplayData: DisplayData | null, slot: Slot): any;
  28781. /**
  28782. * @private
  28783. */
  28784. protected abstract _buildTextureAtlasData(textureAtlasData: TextureAtlasData | null, textureAtlas: any): TextureAtlasData;
  28785. /**
  28786. * @private
  28787. */
  28788. protected abstract _buildArmature(dataPackage: BuildArmaturePackage): Armature;
  28789. /**
  28790. * @private
  28791. */
  28792. protected abstract _buildSlot(dataPackage: BuildArmaturePackage, slotData: SlotData, displays: Array<DisplayData | null> | null, armature: Armature): Slot;
  28793. /**
  28794. * - Parse the raw data to a DragonBonesData instance and cache it to the factory.
  28795. * @param rawData - The raw data.
  28796. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead)
  28797. * @param scale - Specify a scaling value for all armatures. (Default: 1.0)
  28798. * @returns DragonBonesData instance
  28799. * @see #getDragonBonesData()
  28800. * @see #addDragonBonesData()
  28801. * @see #removeDragonBonesData()
  28802. * @see dragonBones.DragonBonesData
  28803. * @version DragonBones 4.5
  28804. * @language en_US
  28805. */
  28806. /**
  28807. * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。
  28808. * @param rawData - 原始数据。
  28809. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28810. * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0)
  28811. * @returns DragonBonesData 实例
  28812. * @see #getDragonBonesData()
  28813. * @see #addDragonBonesData()
  28814. * @see #removeDragonBonesData()
  28815. * @see dragonBones.DragonBonesData
  28816. * @version DragonBones 4.5
  28817. * @language zh_CN
  28818. */
  28819. parseDragonBonesData(rawData: any, name?: string | null, scale?: number): DragonBonesData | null;
  28820. /**
  28821. * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory.
  28822. * @param rawData - The raw texture atlas data.
  28823. * @param textureAtlas - The texture atlas object.
  28824. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead)
  28825. * @param scale - Specify a scaling value for the map set. (Default: 1.0)
  28826. * @returns TextureAtlasData instance
  28827. * @see #getTextureAtlasData()
  28828. * @see #addTextureAtlasData()
  28829. * @see #removeTextureAtlasData()
  28830. * @see dragonBones.TextureAtlasData
  28831. * @version DragonBones 4.5
  28832. * @language en_US
  28833. */
  28834. /**
  28835. * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  28836. * @param rawData - 原始贴图集数据。
  28837. * @param textureAtlas - 贴图集对象。
  28838. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28839. * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0)
  28840. * @returns TextureAtlasData 实例
  28841. * @see #getTextureAtlasData()
  28842. * @see #addTextureAtlasData()
  28843. * @see #removeTextureAtlasData()
  28844. * @see dragonBones.TextureAtlasData
  28845. * @version DragonBones 4.5
  28846. * @language zh_CN
  28847. */
  28848. parseTextureAtlasData(rawData: any, textureAtlas: any, name?: string | null, scale?: number): TextureAtlasData;
  28849. /**
  28850. * @private
  28851. */
  28852. updateTextureAtlasData(name: string, textureAtlases: Array<any>): void;
  28853. /**
  28854. * - Get a specific DragonBonesData instance.
  28855. * @param name - The DragonBonesData instance cache name.
  28856. * @returns DragonBonesData instance
  28857. * @see #parseDragonBonesData()
  28858. * @see #addDragonBonesData()
  28859. * @see #removeDragonBonesData()
  28860. * @see dragonBones.DragonBonesData
  28861. * @version DragonBones 3.0
  28862. * @language en_US
  28863. */
  28864. /**
  28865. * - 获取特定的 DragonBonesData 实例。
  28866. * @param name - DragonBonesData 实例的缓存名称。
  28867. * @returns DragonBonesData 实例
  28868. * @see #parseDragonBonesData()
  28869. * @see #addDragonBonesData()
  28870. * @see #removeDragonBonesData()
  28871. * @see dragonBones.DragonBonesData
  28872. * @version DragonBones 3.0
  28873. * @language zh_CN
  28874. */
  28875. getDragonBonesData(name: string): DragonBonesData | null;
  28876. /**
  28877. * - Cache a DragonBonesData instance to the factory.
  28878. * @param data - The DragonBonesData instance.
  28879. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)
  28880. * @see #parseDragonBonesData()
  28881. * @see #getDragonBonesData()
  28882. * @see #removeDragonBonesData()
  28883. * @see dragonBones.DragonBonesData
  28884. * @version DragonBones 3.0
  28885. * @language en_US
  28886. */
  28887. /**
  28888. * - 将 DragonBonesData 实例缓存到工厂中。
  28889. * @param data - DragonBonesData 实例。
  28890. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28891. * @see #parseDragonBonesData()
  28892. * @see #getDragonBonesData()
  28893. * @see #removeDragonBonesData()
  28894. * @see dragonBones.DragonBonesData
  28895. * @version DragonBones 3.0
  28896. * @language zh_CN
  28897. */
  28898. addDragonBonesData(data: DragonBonesData, name?: string | null): void;
  28899. /**
  28900. * - Remove a DragonBonesData instance.
  28901. * @param name - The DragonBonesData instance cache name.
  28902. * @param disposeData - Whether to dispose data. (Default: true)
  28903. * @see #parseDragonBonesData()
  28904. * @see #getDragonBonesData()
  28905. * @see #addDragonBonesData()
  28906. * @see dragonBones.DragonBonesData
  28907. * @version DragonBones 3.0
  28908. * @language en_US
  28909. */
  28910. /**
  28911. * - 移除 DragonBonesData 实例。
  28912. * @param name - DragonBonesData 实例缓存名称。
  28913. * @param disposeData - 是否释放数据。 (默认: true)
  28914. * @see #parseDragonBonesData()
  28915. * @see #getDragonBonesData()
  28916. * @see #addDragonBonesData()
  28917. * @see dragonBones.DragonBonesData
  28918. * @version DragonBones 3.0
  28919. * @language zh_CN
  28920. */
  28921. removeDragonBonesData(name: string, disposeData?: boolean): void;
  28922. /**
  28923. * - Get a list of specific TextureAtlasData instances.
  28924. * @param name - The TextureAtlasData cahce name.
  28925. * @see #parseTextureAtlasData()
  28926. * @see #addTextureAtlasData()
  28927. * @see #removeTextureAtlasData()
  28928. * @see dragonBones.TextureAtlasData
  28929. * @version DragonBones 3.0
  28930. * @language en_US
  28931. */
  28932. /**
  28933. * - 获取特定的 TextureAtlasData 实例列表。
  28934. * @param name - TextureAtlasData 实例缓存名称。
  28935. * @see #parseTextureAtlasData()
  28936. * @see #addTextureAtlasData()
  28937. * @see #removeTextureAtlasData()
  28938. * @see dragonBones.TextureAtlasData
  28939. * @version DragonBones 3.0
  28940. * @language zh_CN
  28941. */
  28942. getTextureAtlasData(name: string): Array<TextureAtlasData> | null;
  28943. /**
  28944. * - Cache a TextureAtlasData instance to the factory.
  28945. * @param data - The TextureAtlasData instance.
  28946. * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead)
  28947. * @see #parseTextureAtlasData()
  28948. * @see #getTextureAtlasData()
  28949. * @see #removeTextureAtlasData()
  28950. * @see dragonBones.TextureAtlasData
  28951. * @version DragonBones 3.0
  28952. * @language en_US
  28953. */
  28954. /**
  28955. * - 将 TextureAtlasData 实例缓存到工厂中。
  28956. * @param data - TextureAtlasData 实例。
  28957. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28958. * @see #parseTextureAtlasData()
  28959. * @see #getTextureAtlasData()
  28960. * @see #removeTextureAtlasData()
  28961. * @see dragonBones.TextureAtlasData
  28962. * @version DragonBones 3.0
  28963. * @language zh_CN
  28964. */
  28965. addTextureAtlasData(data: TextureAtlasData, name?: string | null): void;
  28966. /**
  28967. * - Remove a TextureAtlasData instance.
  28968. * @param name - The TextureAtlasData instance cache name.
  28969. * @param disposeData - Whether to dispose data.
  28970. * @see #parseTextureAtlasData()
  28971. * @see #getTextureAtlasData()
  28972. * @see #addTextureAtlasData()
  28973. * @see dragonBones.TextureAtlasData
  28974. * @version DragonBones 3.0
  28975. * @language en_US
  28976. */
  28977. /**
  28978. * - 移除 TextureAtlasData 实例。
  28979. * @param name - TextureAtlasData 实例的缓存名称。
  28980. * @param disposeData - 是否释放数据。
  28981. * @see #parseTextureAtlasData()
  28982. * @see #getTextureAtlasData()
  28983. * @see #addTextureAtlasData()
  28984. * @see dragonBones.TextureAtlasData
  28985. * @version DragonBones 3.0
  28986. * @language zh_CN
  28987. */
  28988. removeTextureAtlasData(name: string, disposeData?: boolean): void;
  28989. /**
  28990. * - Get a specific armature data.
  28991. * @param name - The armature data name.
  28992. * @param dragonBonesName - The cached name for DragonbonesData instance.
  28993. * @see dragonBones.ArmatureData
  28994. * @version DragonBones 5.1
  28995. * @language en_US
  28996. */
  28997. /**
  28998. * - 获取特定的骨架数据。
  28999. * @param name - 骨架数据名称。
  29000. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  29001. * @see dragonBones.ArmatureData
  29002. * @version DragonBones 5.1
  29003. * @language zh_CN
  29004. */
  29005. getArmatureData(name: string, dragonBonesName?: string): ArmatureData | null;
  29006. /**
  29007. * - Clear all cached DragonBonesData instances and TextureAtlasData instances.
  29008. * @param disposeData - Whether to dispose data.
  29009. * @version DragonBones 4.5
  29010. * @language en_US
  29011. */
  29012. /**
  29013. * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。
  29014. * @param disposeData - 是否释放数据。
  29015. * @version DragonBones 4.5
  29016. * @language zh_CN
  29017. */
  29018. clear(disposeData?: boolean): void;
  29019. /**
  29020. * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances.
  29021. * @param armatureName - The armature data name.
  29022. * @param dragonBonesName - The cached name of the DragonBonesData instance. (If not set, all DragonBonesData instances are retrieved, and when multiple DragonBonesData instances contain a the same name armature data, it may not be possible to accurately create a specific armature)
  29023. * @param skinName - The skin name, you can set a different ArmatureData name to share it's skin data. (If not set, use the default skin data)
  29024. * @returns The armature.
  29025. * @example
  29026. * <pre>
  29027. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  29028. * armature.clock = factory.clock;
  29029. * </pre>
  29030. * @see dragonBones.DragonBonesData
  29031. * @see dragonBones.ArmatureData
  29032. * @see dragonBones.Armature
  29033. * @version DragonBones 3.0
  29034. * @language en_US
  29035. */
  29036. /**
  29037. * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。
  29038. * @param armatureName - 骨架数据名称。
  29039. * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
  29040. * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据(如果未设置,则使用默认的皮肤数据)。
  29041. * @returns 骨架。
  29042. * @example
  29043. * <pre>
  29044. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  29045. * armature.clock = factory.clock;
  29046. * </pre>
  29047. * @see dragonBones.DragonBonesData
  29048. * @see dragonBones.ArmatureData
  29049. * @see dragonBones.Armature
  29050. * @version DragonBones 3.0
  29051. * @language zh_CN
  29052. */
  29053. buildArmature(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): Armature | null;
  29054. /**
  29055. * @private
  29056. */
  29057. replaceDisplay(slot: Slot, displayData: DisplayData, displayIndex?: number): void;
  29058. /**
  29059. * - Replaces the current display data for a particular slot with a specific display data.
  29060. * Specify display data with "dragonBonesName/armatureName/slotName/displayName".
  29061. * @param dragonBonesName - The DragonBonesData instance cache name.
  29062. * @param armatureName - The armature data name.
  29063. * @param slotName - The slot data name.
  29064. * @param displayName - The display data name.
  29065. * @param slot - The slot.
  29066. * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data)
  29067. * @example
  29068. * <pre>
  29069. * let slot = armature.getSlot("weapon");
  29070. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  29071. * </pre>
  29072. * @version DragonBones 4.5
  29073. * @language en_US
  29074. */
  29075. /**
  29076. * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。
  29077. * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。
  29078. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  29079. * @param armatureName - 骨架数据名称。
  29080. * @param slotName - 插槽数据名称。
  29081. * @param displayName - 显示对象数据名称。
  29082. * @param slot - 插槽。
  29083. * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据)
  29084. * @example
  29085. * <pre>
  29086. * let slot = armature.getSlot("weapon");
  29087. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  29088. * </pre>
  29089. * @version DragonBones 4.5
  29090. * @language zh_CN
  29091. */
  29092. replaceSlotDisplay(dragonBonesName: string, armatureName: string, slotName: string, displayName: string, slot: Slot, displayIndex?: number): boolean;
  29093. /**
  29094. * @private
  29095. */
  29096. replaceSlotDisplayList(dragonBonesName: string | null, armatureName: string, slotName: string, slot: Slot): boolean;
  29097. /**
  29098. * - Share specific skin data with specific armature.
  29099. * @param armature - The armature.
  29100. * @param skin - The skin data.
  29101. * @param isOverride - Whether it completely override the original skin. (Default: false)
  29102. * @param exclude - A list of slot names that do not need to be replace.
  29103. * @example
  29104. * <pre>
  29105. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29106. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29107. * if (armatureDataB && armatureDataB.defaultSkin) {
  29108. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  29109. * }
  29110. * </pre>
  29111. * @see dragonBones.Armature
  29112. * @see dragonBones.SkinData
  29113. * @version DragonBones 5.6
  29114. * @language en_US
  29115. */
  29116. /**
  29117. * - 将特定的皮肤数据共享给特定的骨架使用。
  29118. * @param armature - 骨架。
  29119. * @param skin - 皮肤数据。
  29120. * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false)
  29121. * @param exclude - 不需要被替换的插槽名称列表。
  29122. * @example
  29123. * <pre>
  29124. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29125. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29126. * if (armatureDataB && armatureDataB.defaultSkin) {
  29127. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  29128. * }
  29129. * </pre>
  29130. * @see dragonBones.Armature
  29131. * @see dragonBones.SkinData
  29132. * @version DragonBones 5.6
  29133. * @language zh_CN
  29134. */
  29135. replaceSkin(armature: Armature, skin: SkinData, isOverride?: boolean, exclude?: Array<string> | null): boolean;
  29136. /**
  29137. * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data.
  29138. * This enables you to make a armature template so that other armature without animations can share it's animations.
  29139. * @param armature - The armtaure.
  29140. * @param armatureData - The armature data.
  29141. * @param isOverride - Whether to completely overwrite the original animation. (Default: false)
  29142. * @example
  29143. * <pre>
  29144. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29145. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29146. * if (armatureDataB) {
  29147. * factory.replaceAnimation(armatureA, armatureDataB);
  29148. * }
  29149. * </pre>
  29150. * @see dragonBones.Armature
  29151. * @see dragonBones.ArmatureData
  29152. * @version DragonBones 5.6
  29153. * @language en_US
  29154. */
  29155. /**
  29156. * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。
  29157. * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。
  29158. * @param armature - 骨架。
  29159. * @param armatureData - 骨架数据。
  29160. * @param isOverride - 是否完全覆盖原来的动画。(默认: false)。
  29161. * @example
  29162. * <pre>
  29163. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29164. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29165. * if (armatureDataB) {
  29166. * factory.replaceAnimation(armatureA, armatureDataB);
  29167. * }
  29168. * </pre>
  29169. * @see dragonBones.Armature
  29170. * @see dragonBones.ArmatureData
  29171. * @version DragonBones 5.6
  29172. * @language zh_CN
  29173. */
  29174. replaceAnimation(armature: Armature, armatureData: ArmatureData, isOverride?: boolean): boolean;
  29175. /**
  29176. * @private
  29177. */
  29178. getAllDragonBonesData(): Map<DragonBonesData>;
  29179. /**
  29180. * @private
  29181. */
  29182. getAllTextureAtlasData(): Map<Array<TextureAtlasData>>;
  29183. /**
  29184. * - An Worldclock instance updated by engine.
  29185. * @version DragonBones 5.7
  29186. * @language en_US
  29187. */
  29188. /**
  29189. * - 由引擎驱动的 WorldClock 实例。
  29190. * @version DragonBones 5.7
  29191. * @language zh_CN
  29192. */
  29193. readonly clock: WorldClock;
  29194. /**
  29195. * @private
  29196. */
  29197. readonly dragonBones: DragonBones;
  29198. /**
  29199. * - Deprecated, please refer to {@link #replaceSkin}.
  29200. * @deprecated
  29201. * @language en_US
  29202. */
  29203. /**
  29204. * - 已废弃,请参考 {@link #replaceSkin}。
  29205. * @deprecated
  29206. * @language zh_CN
  29207. */
  29208. changeSkin(armature: Armature, skin: SkinData, exclude?: Array<string> | null): boolean;
  29209. /**
  29210. * - Deprecated, please refer to {@link #replaceAnimation}.
  29211. * @deprecated
  29212. * @language en_US
  29213. */
  29214. /**
  29215. * - 已废弃,请参考 {@link #replaceAnimation}。
  29216. * @deprecated
  29217. * @language zh_CN
  29218. */
  29219. copyAnimationsToArmature(toArmature: Armature, fromArmatreName: string, fromSkinName?: string, fromDragonBonesDataName?: string, replaceOriginalAnimation?: boolean): boolean;
  29220. }
  29221. /**
  29222. * @internal
  29223. * @private
  29224. */
  29225. class BuildArmaturePackage {
  29226. dataName: string;
  29227. textureAtlasName: string;
  29228. data: DragonBonesData;
  29229. armature: ArmatureData;
  29230. skin: SkinData | null;
  29231. }
  29232. }
  29233. declare namespace sp.spine {
  29234. class Animation {
  29235. name: string;
  29236. timelines: Array<Timeline>;
  29237. timelineIds: Array<boolean>;
  29238. duration: number;
  29239. constructor(name: string, timelines: Array<Timeline>, duration: number);
  29240. hasTimeline(id: number): boolean;
  29241. apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29242. static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
  29243. static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
  29244. }
  29245. interface Timeline {
  29246. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29247. getPropertyId(): number;
  29248. }
  29249. enum MixBlend {
  29250. setup = 0,
  29251. first = 1,
  29252. replace = 2,
  29253. add = 3
  29254. }
  29255. enum MixDirection {
  29256. mixIn = 0,
  29257. mixOut = 1
  29258. }
  29259. enum TimelineType {
  29260. rotate = 0,
  29261. translate = 1,
  29262. scale = 2,
  29263. shear = 3,
  29264. attachment = 4,
  29265. color = 5,
  29266. deform = 6,
  29267. event = 7,
  29268. drawOrder = 8,
  29269. ikConstraint = 9,
  29270. transformConstraint = 10,
  29271. pathConstraintPosition = 11,
  29272. pathConstraintSpacing = 12,
  29273. pathConstraintMix = 13,
  29274. twoColor = 14
  29275. }
  29276. abstract class CurveTimeline implements Timeline {
  29277. static LINEAR: number;
  29278. static STEPPED: number;
  29279. static BEZIER: number;
  29280. static BEZIER_SIZE: number;
  29281. private curves;
  29282. abstract getPropertyId(): number;
  29283. constructor(frameCount: number);
  29284. getFrameCount(): number;
  29285. setLinear(frameIndex: number): void;
  29286. setStepped(frameIndex: number): void;
  29287. getCurveType(frameIndex: number): number;
  29288. setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  29289. getCurvePercent(frameIndex: number, percent: number): number;
  29290. abstract apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29291. }
  29292. class RotateTimeline extends CurveTimeline {
  29293. static ENTRIES: number;
  29294. static PREV_TIME: number;
  29295. static PREV_ROTATION: number;
  29296. static ROTATION: number;
  29297. boneIndex: number;
  29298. frames: ArrayLike<number>;
  29299. constructor(frameCount: number);
  29300. getPropertyId(): number;
  29301. setFrame(frameIndex: number, time: number, degrees: number): void;
  29302. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29303. }
  29304. class TranslateTimeline extends CurveTimeline {
  29305. static ENTRIES: number;
  29306. static PREV_TIME: number;
  29307. static PREV_X: number;
  29308. static PREV_Y: number;
  29309. static X: number;
  29310. static Y: number;
  29311. boneIndex: number;
  29312. frames: ArrayLike<number>;
  29313. constructor(frameCount: number);
  29314. getPropertyId(): number;
  29315. setFrame(frameIndex: number, time: number, x: number, y: number): void;
  29316. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29317. }
  29318. class ScaleTimeline extends TranslateTimeline {
  29319. constructor(frameCount: number);
  29320. getPropertyId(): number;
  29321. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29322. }
  29323. class ShearTimeline extends TranslateTimeline {
  29324. constructor(frameCount: number);
  29325. getPropertyId(): number;
  29326. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29327. }
  29328. class ColorTimeline extends CurveTimeline {
  29329. static ENTRIES: number;
  29330. static PREV_TIME: number;
  29331. static PREV_R: number;
  29332. static PREV_G: number;
  29333. static PREV_B: number;
  29334. static PREV_A: number;
  29335. static R: number;
  29336. static G: number;
  29337. static B: number;
  29338. static A: number;
  29339. slotIndex: number;
  29340. frames: ArrayLike<number>;
  29341. constructor(frameCount: number);
  29342. getPropertyId(): number;
  29343. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
  29344. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29345. }
  29346. class TwoColorTimeline extends CurveTimeline {
  29347. static ENTRIES: number;
  29348. static PREV_TIME: number;
  29349. static PREV_R: number;
  29350. static PREV_G: number;
  29351. static PREV_B: number;
  29352. static PREV_A: number;
  29353. static PREV_R2: number;
  29354. static PREV_G2: number;
  29355. static PREV_B2: number;
  29356. static R: number;
  29357. static G: number;
  29358. static B: number;
  29359. static A: number;
  29360. static R2: number;
  29361. static G2: number;
  29362. static B2: number;
  29363. slotIndex: number;
  29364. frames: ArrayLike<number>;
  29365. constructor(frameCount: number);
  29366. getPropertyId(): number;
  29367. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number): void;
  29368. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29369. }
  29370. class AttachmentTimeline implements Timeline {
  29371. slotIndex: number;
  29372. frames: ArrayLike<number>;
  29373. attachmentNames: Array<string>;
  29374. constructor(frameCount: number);
  29375. getPropertyId(): number;
  29376. getFrameCount(): number;
  29377. setFrame(frameIndex: number, time: number, attachmentName: string): void;
  29378. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29379. }
  29380. class DeformTimeline extends CurveTimeline {
  29381. slotIndex: number;
  29382. attachment: VertexAttachment;
  29383. frames: ArrayLike<number>;
  29384. frameVertices: Array<ArrayLike<number>>;
  29385. constructor(frameCount: number);
  29386. getPropertyId(): number;
  29387. setFrame(frameIndex: number, time: number, vertices: ArrayLike<number>): void;
  29388. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29389. }
  29390. class EventTimeline implements Timeline {
  29391. frames: ArrayLike<number>;
  29392. events: Array<Event>;
  29393. constructor(frameCount: number);
  29394. getPropertyId(): number;
  29395. getFrameCount(): number;
  29396. setFrame(frameIndex: number, event: Event): void;
  29397. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29398. }
  29399. class DrawOrderTimeline implements Timeline {
  29400. frames: ArrayLike<number>;
  29401. drawOrders: Array<Array<number>>;
  29402. constructor(frameCount: number);
  29403. getPropertyId(): number;
  29404. getFrameCount(): number;
  29405. setFrame(frameIndex: number, time: number, drawOrder: Array<number>): void;
  29406. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29407. }
  29408. class IkConstraintTimeline extends CurveTimeline {
  29409. static ENTRIES: number;
  29410. static PREV_TIME: number;
  29411. static PREV_MIX: number;
  29412. static PREV_SOFTNESS: number;
  29413. static PREV_BEND_DIRECTION: number;
  29414. static PREV_COMPRESS: number;
  29415. static PREV_STRETCH: number;
  29416. static MIX: number;
  29417. static SOFTNESS: number;
  29418. static BEND_DIRECTION: number;
  29419. static COMPRESS: number;
  29420. static STRETCH: number;
  29421. ikConstraintIndex: number;
  29422. frames: ArrayLike<number>;
  29423. constructor(frameCount: number);
  29424. getPropertyId(): number;
  29425. setFrame(frameIndex: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean): void;
  29426. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29427. }
  29428. class TransformConstraintTimeline extends CurveTimeline {
  29429. static ENTRIES: number;
  29430. static PREV_TIME: number;
  29431. static PREV_ROTATE: number;
  29432. static PREV_TRANSLATE: number;
  29433. static PREV_SCALE: number;
  29434. static PREV_SHEAR: number;
  29435. static ROTATE: number;
  29436. static TRANSLATE: number;
  29437. static SCALE: number;
  29438. static SHEAR: number;
  29439. transformConstraintIndex: number;
  29440. frames: ArrayLike<number>;
  29441. constructor(frameCount: number);
  29442. getPropertyId(): number;
  29443. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number, scaleMix: number, shearMix: number): void;
  29444. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29445. }
  29446. class PathConstraintPositionTimeline extends CurveTimeline {
  29447. static ENTRIES: number;
  29448. static PREV_TIME: number;
  29449. static PREV_VALUE: number;
  29450. static VALUE: number;
  29451. pathConstraintIndex: number;
  29452. frames: ArrayLike<number>;
  29453. constructor(frameCount: number);
  29454. getPropertyId(): number;
  29455. setFrame(frameIndex: number, time: number, value: number): void;
  29456. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29457. }
  29458. class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {
  29459. constructor(frameCount: number);
  29460. getPropertyId(): number;
  29461. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29462. }
  29463. class PathConstraintMixTimeline extends CurveTimeline {
  29464. static ENTRIES: number;
  29465. static PREV_TIME: number;
  29466. static PREV_ROTATE: number;
  29467. static PREV_TRANSLATE: number;
  29468. static ROTATE: number;
  29469. static TRANSLATE: number;
  29470. pathConstraintIndex: number;
  29471. frames: ArrayLike<number>;
  29472. constructor(frameCount: number);
  29473. getPropertyId(): number;
  29474. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number): void;
  29475. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29476. }
  29477. }
  29478. declare namespace sp.spine {
  29479. class AnimationState {
  29480. static emptyAnimation: Animation;
  29481. static SUBSEQUENT: number;
  29482. static FIRST: number;
  29483. static HOLD: number;
  29484. static HOLD_MIX: number;
  29485. static NOT_LAST: number;
  29486. data: AnimationStateData;
  29487. tracks: TrackEntry[];
  29488. timeScale: number;
  29489. events: Event[];
  29490. listeners: AnimationStateListener[];
  29491. queue: EventQueue;
  29492. propertyIDs: IntSet;
  29493. animationsChanged: boolean;
  29494. trackEntryPool: Pool<TrackEntry>;
  29495. constructor(data: AnimationStateData);
  29496. update(delta: number): void;
  29497. updateMixingFrom(to: TrackEntry, delta: number): boolean;
  29498. apply(skeleton: Skeleton): boolean;
  29499. applyMixingFrom(to: TrackEntry, skeleton: Skeleton, blend: MixBlend): number;
  29500. applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
  29501. queueEvents(entry: TrackEntry, animationTime: number): void;
  29502. clearTracks(): void;
  29503. clearTrack(trackIndex: number): void;
  29504. setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
  29505. setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
  29506. setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
  29507. addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;
  29508. addAnimationWith(trackIndex: number, animation: Animation, loop: boolean, delay: number): TrackEntry;
  29509. setEmptyAnimation(trackIndex: number, mixDuration: number): TrackEntry;
  29510. addEmptyAnimation(trackIndex: number, mixDuration: number, delay: number): TrackEntry;
  29511. setEmptyAnimations(mixDuration: number): void;
  29512. expandToIndex(index: number): TrackEntry;
  29513. trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
  29514. disposeNext(entry: TrackEntry): void;
  29515. _animationsChanged(): void;
  29516. computeHold(entry: TrackEntry): void;
  29517. computeNotLast(entry: TrackEntry): void;
  29518. getCurrent(trackIndex: number): TrackEntry;
  29519. addListener(listener: AnimationStateListener): void;
  29520. removeListener(listener: AnimationStateListener): void;
  29521. clearListeners(): void;
  29522. clearListenerNotifications(): void;
  29523. }
  29524. class TrackEntry {
  29525. animation: Animation;
  29526. next: TrackEntry;
  29527. mixingFrom: TrackEntry;
  29528. mixingTo: TrackEntry;
  29529. listener: AnimationStateListener;
  29530. trackIndex: number;
  29531. loop: boolean;
  29532. holdPrevious: boolean;
  29533. eventThreshold: number;
  29534. attachmentThreshold: number;
  29535. drawOrderThreshold: number;
  29536. animationStart: number;
  29537. animationEnd: number;
  29538. animationLast: number;
  29539. nextAnimationLast: number;
  29540. delay: number;
  29541. trackTime: number;
  29542. trackLast: number;
  29543. nextTrackLast: number;
  29544. trackEnd: number;
  29545. timeScale: number;
  29546. alpha: number;
  29547. mixTime: number;
  29548. mixDuration: number;
  29549. interruptAlpha: number;
  29550. totalAlpha: number;
  29551. mixBlend: MixBlend;
  29552. timelineMode: number[];
  29553. timelineHoldMix: TrackEntry[];
  29554. timelinesRotation: number[];
  29555. reset(): void;
  29556. getAnimationTime(): number;
  29557. setAnimationLast(animationLast: number): void;
  29558. isComplete(): boolean;
  29559. resetRotationDirections(): void;
  29560. }
  29561. class EventQueue {
  29562. objects: Array<any>;
  29563. drainDisabled: boolean;
  29564. animState: AnimationState;
  29565. constructor(animState: AnimationState);
  29566. start(entry: TrackEntry): void;
  29567. interrupt(entry: TrackEntry): void;
  29568. end(entry: TrackEntry): void;
  29569. dispose(entry: TrackEntry): void;
  29570. complete(entry: TrackEntry): void;
  29571. event(entry: TrackEntry, event: Event): void;
  29572. drain(): void;
  29573. clear(): void;
  29574. }
  29575. enum EventType {
  29576. start = 0,
  29577. interrupt = 1,
  29578. end = 2,
  29579. dispose = 3,
  29580. complete = 4,
  29581. event = 5
  29582. }
  29583. interface AnimationStateListener {
  29584. start(entry: TrackEntry): void;
  29585. interrupt(entry: TrackEntry): void;
  29586. end(entry: TrackEntry): void;
  29587. dispose(entry: TrackEntry): void;
  29588. complete(entry: TrackEntry): void;
  29589. event(entry: TrackEntry, event: Event): void;
  29590. }
  29591. abstract class AnimationStateAdapter implements AnimationStateListener {
  29592. start(entry: TrackEntry): void;
  29593. interrupt(entry: TrackEntry): void;
  29594. end(entry: TrackEntry): void;
  29595. dispose(entry: TrackEntry): void;
  29596. complete(entry: TrackEntry): void;
  29597. event(entry: TrackEntry, event: Event): void;
  29598. }
  29599. }
  29600. declare namespace sp.spine {
  29601. class AnimationStateData {
  29602. skeletonData: SkeletonData;
  29603. animationToMixTime: Map<number>;
  29604. defaultMix: number;
  29605. constructor(skeletonData: SkeletonData);
  29606. setMix(fromName: string, toName: string, duration: number): void;
  29607. setMixWith(from: Animation, to: Animation, duration: number): void;
  29608. getMix(from: Animation, to: Animation): number;
  29609. }
  29610. }
  29611. declare namespace sp.spine {
  29612. class AssetManager implements Disposable {
  29613. private pathPrefix;
  29614. private textureLoader;
  29615. private assets;
  29616. private errors;
  29617. private toLoad;
  29618. private loaded;
  29619. constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
  29620. private static downloadText;
  29621. private static downloadBinary;
  29622. loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, error: string) => void): void;
  29623. loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
  29624. loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  29625. loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  29626. loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, error: string) => void): void;
  29627. get(path: string): any;
  29628. remove(path: string): void;
  29629. removeAll(): void;
  29630. isLoadingComplete(): boolean;
  29631. getToLoad(): number;
  29632. getLoaded(): number;
  29633. dispose(): void;
  29634. hasErrors(): boolean;
  29635. getErrors(): Map<string>;
  29636. }
  29637. }
  29638. declare namespace sp.spine {
  29639. class AtlasAttachmentLoader implements AttachmentLoader {
  29640. atlas: TextureAtlas;
  29641. constructor(atlas: TextureAtlas);
  29642. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  29643. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  29644. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  29645. newPathAttachment(skin: Skin, name: string): PathAttachment;
  29646. newPointAttachment(skin: Skin, name: string): PointAttachment;
  29647. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  29648. }
  29649. }
  29650. declare namespace sp.spine {
  29651. enum BlendMode {
  29652. Normal = 0,
  29653. Additive = 1,
  29654. Multiply = 2,
  29655. Screen = 3
  29656. }
  29657. }
  29658. declare namespace sp.spine {
  29659. class Bone implements Updatable {
  29660. data: BoneData;
  29661. skeleton: Skeleton;
  29662. parent: Bone;
  29663. children: Bone[];
  29664. x: number;
  29665. y: number;
  29666. rotation: number;
  29667. scaleX: number;
  29668. scaleY: number;
  29669. shearX: number;
  29670. shearY: number;
  29671. ax: number;
  29672. ay: number;
  29673. arotation: number;
  29674. ascaleX: number;
  29675. ascaleY: number;
  29676. ashearX: number;
  29677. ashearY: number;
  29678. appliedValid: boolean;
  29679. a: number;
  29680. b: number;
  29681. c: number;
  29682. d: number;
  29683. worldY: number;
  29684. worldX: number;
  29685. sorted: boolean;
  29686. active: boolean;
  29687. constructor(data: BoneData, skeleton: Skeleton, parent: Bone);
  29688. isActive(): boolean;
  29689. update(): void;
  29690. updateWorldTransform(): void;
  29691. updateWorldTransformWith(x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number): void;
  29692. setToSetupPose(): void;
  29693. getWorldRotationX(): number;
  29694. getWorldRotationY(): number;
  29695. getWorldScaleX(): number;
  29696. getWorldScaleY(): number;
  29697. updateAppliedTransform(): void;
  29698. worldToLocal(world: Vector2): Vector2;
  29699. localToWorld(local: Vector2): Vector2;
  29700. worldToLocalRotation(worldRotation: number): number;
  29701. localToWorldRotation(localRotation: number): number;
  29702. rotateWorld(degrees: number): void;
  29703. }
  29704. }
  29705. declare namespace sp.spine {
  29706. class BoneData {
  29707. index: number;
  29708. name: string;
  29709. parent: BoneData;
  29710. length: number;
  29711. x: number;
  29712. y: number;
  29713. rotation: number;
  29714. scaleX: number;
  29715. scaleY: number;
  29716. shearX: number;
  29717. shearY: number;
  29718. transformMode: TransformMode;
  29719. skinRequired: boolean;
  29720. color: Color;
  29721. constructor(index: number, name: string, parent: BoneData);
  29722. }
  29723. enum TransformMode {
  29724. Normal = 0,
  29725. OnlyTranslation = 1,
  29726. NoRotationOrReflection = 2,
  29727. NoScale = 3,
  29728. NoScaleOrReflection = 4
  29729. }
  29730. }
  29731. declare namespace sp.spine {
  29732. abstract class ConstraintData {
  29733. name: string;
  29734. order: number;
  29735. skinRequired: boolean;
  29736. constructor(name: string, order: number, skinRequired: boolean);
  29737. }
  29738. }
  29739. declare namespace sp.spine {
  29740. class Event {
  29741. data: EventData;
  29742. intValue: number;
  29743. floatValue: number;
  29744. stringValue: string;
  29745. time: number;
  29746. volume: number;
  29747. balance: number;
  29748. constructor(time: number, data: EventData);
  29749. }
  29750. }
  29751. declare namespace sp.spine {
  29752. class EventData {
  29753. name: string;
  29754. intValue: number;
  29755. floatValue: number;
  29756. stringValue: string;
  29757. audioPath: string;
  29758. volume: number;
  29759. balance: number;
  29760. constructor(name: string);
  29761. }
  29762. }
  29763. declare namespace sp.spine {
  29764. class IkConstraint implements Updatable {
  29765. data: IkConstraintData;
  29766. bones: Array<Bone>;
  29767. target: Bone;
  29768. bendDirection: number;
  29769. compress: boolean;
  29770. stretch: boolean;
  29771. mix: number;
  29772. softness: number;
  29773. active: boolean;
  29774. constructor(data: IkConstraintData, skeleton: Skeleton);
  29775. isActive(): boolean;
  29776. apply(): void;
  29777. update(): void;
  29778. apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
  29779. apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
  29780. }
  29781. }
  29782. declare namespace sp.spine {
  29783. class IkConstraintData extends ConstraintData {
  29784. bones: BoneData[];
  29785. target: BoneData;
  29786. bendDirection: number;
  29787. compress: boolean;
  29788. stretch: boolean;
  29789. uniform: boolean;
  29790. mix: number;
  29791. softness: number;
  29792. constructor(name: string);
  29793. }
  29794. }
  29795. declare namespace sp.spine {
  29796. class PathConstraint implements Updatable {
  29797. static NONE: number;
  29798. static BEFORE: number;
  29799. static AFTER: number;
  29800. static epsilon: number;
  29801. data: PathConstraintData;
  29802. bones: Array<Bone>;
  29803. target: Slot;
  29804. position: number;
  29805. spacing: number;
  29806. rotateMix: number;
  29807. translateMix: number;
  29808. spaces: number[];
  29809. positions: number[];
  29810. world: number[];
  29811. curves: number[];
  29812. lengths: number[];
  29813. segments: number[];
  29814. active: boolean;
  29815. constructor(data: PathConstraintData, skeleton: Skeleton);
  29816. isActive(): boolean;
  29817. apply(): void;
  29818. update(): void;
  29819. computeWorldPositions(path: PathAttachment, spacesCount: number, tangents: boolean, percentPosition: boolean, percentSpacing: boolean): number[];
  29820. addBeforePosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
  29821. addAfterPosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
  29822. addCurvePosition(p: number, x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, out: Array<number>, o: number, tangents: boolean): void;
  29823. }
  29824. }
  29825. declare namespace sp.spine {
  29826. class PathConstraintData extends ConstraintData {
  29827. bones: BoneData[];
  29828. target: SlotData;
  29829. positionMode: PositionMode;
  29830. spacingMode: SpacingMode;
  29831. rotateMode: RotateMode;
  29832. offsetRotation: number;
  29833. position: number;
  29834. spacing: number;
  29835. rotateMix: number;
  29836. translateMix: number;
  29837. constructor(name: string);
  29838. }
  29839. enum PositionMode {
  29840. Fixed = 0,
  29841. Percent = 1
  29842. }
  29843. enum SpacingMode {
  29844. Length = 0,
  29845. Fixed = 1,
  29846. Percent = 2
  29847. }
  29848. enum RotateMode {
  29849. Tangent = 0,
  29850. Chain = 1,
  29851. ChainScale = 2
  29852. }
  29853. }
  29854. declare namespace sp.spine {
  29855. class SharedAssetManager implements Disposable {
  29856. private pathPrefix;
  29857. private clientAssets;
  29858. private queuedAssets;
  29859. private rawAssets;
  29860. private errors;
  29861. constructor(pathPrefix?: string);
  29862. private queueAsset;
  29863. loadText(clientId: string, path: string): void;
  29864. loadJson(clientId: string, path: string): void;
  29865. loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
  29866. get(clientId: string, path: string): any;
  29867. private updateClientAssets;
  29868. isLoadingComplete(clientId: string): boolean;
  29869. dispose(): void;
  29870. hasErrors(): boolean;
  29871. getErrors(): Map<string>;
  29872. }
  29873. }
  29874. declare namespace sp.spine {
  29875. class Skeleton {
  29876. data: SkeletonData;
  29877. bones: Array<Bone>;
  29878. slots: Array<Slot>;
  29879. drawOrder: Array<Slot>;
  29880. ikConstraints: Array<IkConstraint>;
  29881. transformConstraints: Array<TransformConstraint>;
  29882. pathConstraints: Array<PathConstraint>;
  29883. _updateCache: Updatable[];
  29884. updateCacheReset: Updatable[];
  29885. skin: Skin;
  29886. color: Color;
  29887. time: number;
  29888. scaleX: number;
  29889. scaleY: number;
  29890. x: number;
  29891. y: number;
  29892. constructor(data: SkeletonData);
  29893. updateCache(): void;
  29894. sortIkConstraint(constraint: IkConstraint): void;
  29895. sortPathConstraint(constraint: PathConstraint): void;
  29896. sortTransformConstraint(constraint: TransformConstraint): void;
  29897. sortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone): void;
  29898. sortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone): void;
  29899. sortBone(bone: Bone): void;
  29900. sortReset(bones: Array<Bone>): void;
  29901. updateWorldTransform(): void;
  29902. setToSetupPose(): void;
  29903. setBonesToSetupPose(): void;
  29904. setSlotsToSetupPose(): void;
  29905. getRootBone(): Bone;
  29906. findBone(boneName: string): Bone;
  29907. findBoneIndex(boneName: string): number;
  29908. findSlot(slotName: string): Slot;
  29909. findSlotIndex(slotName: string): number;
  29910. setSkinByName(skinName: string): void;
  29911. setSkin(newSkin: Skin): void;
  29912. getAttachmentByName(slotName: string, attachmentName: string): Attachment;
  29913. getAttachment(slotIndex: number, attachmentName: string): Attachment;
  29914. setAttachment(slotName: string, attachmentName: string): void;
  29915. findIkConstraint(constraintName: string): IkConstraint;
  29916. findTransformConstraint(constraintName: string): TransformConstraint;
  29917. findPathConstraint(constraintName: string): PathConstraint;
  29918. getBounds(offset: Vector2, size: Vector2, temp?: Array<number>): void;
  29919. update(delta: number): void;
  29920. }
  29921. }
  29922. declare namespace sp.spine {
  29923. class SkeletonBinary {
  29924. static AttachmentTypeValues: number[];
  29925. static TransformModeValues: TransformMode[];
  29926. static PositionModeValues: PositionMode[];
  29927. static SpacingModeValues: SpacingMode[];
  29928. static RotateModeValues: RotateMode[];
  29929. static BlendModeValues: BlendMode[];
  29930. static BONE_ROTATE: number;
  29931. static BONE_TRANSLATE: number;
  29932. static BONE_SCALE: number;
  29933. static BONE_SHEAR: number;
  29934. static SLOT_ATTACHMENT: number;
  29935. static SLOT_COLOR: number;
  29936. static SLOT_TWO_COLOR: number;
  29937. static PATH_POSITION: number;
  29938. static PATH_SPACING: number;
  29939. static PATH_MIX: number;
  29940. static CURVE_LINEAR: number;
  29941. static CURVE_STEPPED: number;
  29942. static CURVE_BEZIER: number;
  29943. scale: number;
  29944. attachmentLoader: AttachmentLoader;
  29945. private linkedMeshes;
  29946. constructor(attachmentLoader: AttachmentLoader);
  29947. readSkeletonData(binary: Uint8Array): SkeletonData;
  29948. private readSkin;
  29949. private readAttachment;
  29950. private readVertices;
  29951. private readFloatArray;
  29952. private readShortArray;
  29953. private readAnimation;
  29954. private readCurve;
  29955. setCurve(timeline: CurveTimeline, frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  29956. }
  29957. }
  29958. declare namespace sp.spine {
  29959. class SkeletonBounds {
  29960. minX: number;
  29961. minY: number;
  29962. maxX: number;
  29963. maxY: number;
  29964. boundingBoxes: BoundingBoxAttachment[];
  29965. polygons: ArrayLike<number>[];
  29966. private polygonPool;
  29967. update(skeleton: Skeleton, updateAabb: boolean): void;
  29968. aabbCompute(): void;
  29969. aabbContainsPoint(x: number, y: number): boolean;
  29970. aabbIntersectsSegment(x1: number, y1: number, x2: number, y2: number): boolean;
  29971. aabbIntersectsSkeleton(bounds: SkeletonBounds): boolean;
  29972. containsPoint(x: number, y: number): BoundingBoxAttachment;
  29973. containsPointPolygon(polygon: ArrayLike<number>, x: number, y: number): boolean;
  29974. intersectsSegment(x1: number, y1: number, x2: number, y2: number): BoundingBoxAttachment;
  29975. intersectsSegmentPolygon(polygon: ArrayLike<number>, x1: number, y1: number, x2: number, y2: number): boolean;
  29976. getPolygon(boundingBox: BoundingBoxAttachment): ArrayLike<number>;
  29977. getWidth(): number;
  29978. getHeight(): number;
  29979. }
  29980. }
  29981. declare namespace sp.spine {
  29982. class SkeletonClipping {
  29983. private triangulator;
  29984. private clippingPolygon;
  29985. private clipOutput;
  29986. clippedVertices: number[];
  29987. clippedTriangles: number[];
  29988. private scratch;
  29989. private clipAttachment;
  29990. private clippingPolygons;
  29991. clipStart(slot: Slot, clip: ClippingAttachment): number;
  29992. clipEndWithSlot(slot: Slot): void;
  29993. clipEnd(): void;
  29994. isClipping(): boolean;
  29995. clipTriangles(vertices: ArrayLike<number>, verticesLength: number, triangles: ArrayLike<number>, trianglesLength: number, uvs: ArrayLike<number>, light: Color, dark: Color, twoColor: boolean): void;
  29996. clip(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, clippingArea: Array<number>, output: Array<number>): boolean;
  29997. static makeClockwise(polygon: ArrayLike<number>): void;
  29998. }
  29999. }
  30000. declare namespace sp.spine {
  30001. class SkeletonData {
  30002. name: string;
  30003. bones: BoneData[];
  30004. slots: SlotData[];
  30005. skins: Skin[];
  30006. defaultSkin: Skin;
  30007. events: EventData[];
  30008. animations: Animation[];
  30009. ikConstraints: IkConstraintData[];
  30010. transformConstraints: TransformConstraintData[];
  30011. pathConstraints: PathConstraintData[];
  30012. x: number;
  30013. y: number;
  30014. width: number;
  30015. height: number;
  30016. version: string;
  30017. hash: string;
  30018. fps: number;
  30019. imagesPath: string;
  30020. audioPath: string;
  30021. findBone(boneName: string): BoneData;
  30022. findBoneIndex(boneName: string): number;
  30023. findSlot(slotName: string): SlotData;
  30024. findSlotIndex(slotName: string): number;
  30025. findSkin(skinName: string): Skin;
  30026. findEvent(eventDataName: string): EventData;
  30027. findAnimation(animationName: string): Animation;
  30028. findIkConstraint(constraintName: string): IkConstraintData;
  30029. findTransformConstraint(constraintName: string): TransformConstraintData;
  30030. findPathConstraint(constraintName: string): PathConstraintData;
  30031. findPathConstraintIndex(pathConstraintName: string): number;
  30032. }
  30033. }
  30034. declare namespace sp.spine {
  30035. class SkeletonJson {
  30036. attachmentLoader: AttachmentLoader;
  30037. scale: number;
  30038. private linkedMeshes;
  30039. constructor(attachmentLoader: AttachmentLoader);
  30040. readSkeletonData(json: string | any): SkeletonData;
  30041. readAttachment(map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment;
  30042. readVertices(map: any, attachment: VertexAttachment, verticesLength: number): void;
  30043. readAnimation(map: any, name: string, skeletonData: SkeletonData): void;
  30044. readCurve(map: any, timeline: CurveTimeline, frameIndex: number): void;
  30045. getValue(map: any, prop: string, defaultValue: any): any;
  30046. static blendModeFromString(str: string): BlendMode;
  30047. static positionModeFromString(str: string): PositionMode;
  30048. static spacingModeFromString(str: string): SpacingMode;
  30049. static rotateModeFromString(str: string): RotateMode;
  30050. static transformModeFromString(str: string): TransformMode;
  30051. }
  30052. }
  30053. declare namespace sp.spine {
  30054. class SkinEntry {
  30055. slotIndex: number;
  30056. name: string;
  30057. attachment: Attachment;
  30058. constructor(slotIndex: number, name: string, attachment: Attachment);
  30059. }
  30060. class Skin {
  30061. name: string;
  30062. attachments: Map<Attachment>[];
  30063. bones: BoneData[];
  30064. constraints: ConstraintData[];
  30065. constructor(name: string);
  30066. setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
  30067. addSkin(skin: Skin): void;
  30068. copySkin(skin: Skin): void;
  30069. getAttachment(slotIndex: number, name: string): Attachment;
  30070. removeAttachment(slotIndex: number, name: string): void;
  30071. getAttachments(): Array<SkinEntry>;
  30072. getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
  30073. clear(): void;
  30074. attachAll(skeleton: Skeleton, oldSkin: Skin): void;
  30075. }
  30076. }
  30077. declare namespace sp.spine {
  30078. class Slot {
  30079. data: SlotData;
  30080. bone: Bone;
  30081. color: Color;
  30082. darkColor: Color;
  30083. private attachment;
  30084. private attachmentTime;
  30085. deform: number[];
  30086. constructor(data: SlotData, bone: Bone);
  30087. getSkeleton(): Skeleton;
  30088. getAttachment(): Attachment;
  30089. setAttachment(attachment: Attachment): void;
  30090. setAttachmentTime(time: number): void;
  30091. getAttachmentTime(): number;
  30092. setToSetupPose(): void;
  30093. }
  30094. }
  30095. declare namespace sp.spine {
  30096. class SlotData {
  30097. index: number;
  30098. name: string;
  30099. boneData: BoneData;
  30100. color: Color;
  30101. darkColor: Color;
  30102. attachmentName: string;
  30103. blendMode: BlendMode;
  30104. constructor(index: number, name: string, boneData: BoneData);
  30105. }
  30106. }
  30107. declare namespace sp.spine {
  30108. abstract class Texture {
  30109. protected _image: HTMLImageElement;
  30110. constructor(image: HTMLImageElement);
  30111. getImage(): HTMLImageElement;
  30112. abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  30113. abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  30114. abstract dispose(): void;
  30115. static filterFromString(text: string): TextureFilter;
  30116. static wrapFromString(text: string): TextureWrap;
  30117. }
  30118. enum TextureFilter {
  30119. Nearest = 9728,
  30120. Linear = 9729,
  30121. MipMap = 9987,
  30122. MipMapNearestNearest = 9984,
  30123. MipMapLinearNearest = 9985,
  30124. MipMapNearestLinear = 9986,
  30125. MipMapLinearLinear = 9987
  30126. }
  30127. enum TextureWrap {
  30128. MirroredRepeat = 33648,
  30129. ClampToEdge = 33071,
  30130. Repeat = 10497
  30131. }
  30132. class TextureRegion {
  30133. renderObject: any;
  30134. u: number;
  30135. v: number;
  30136. u2: number;
  30137. v2: number;
  30138. width: number;
  30139. height: number;
  30140. rotate: boolean;
  30141. offsetX: number;
  30142. offsetY: number;
  30143. originalWidth: number;
  30144. originalHeight: number;
  30145. }
  30146. class FakeTexture extends Texture {
  30147. setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  30148. setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  30149. dispose(): void;
  30150. }
  30151. }
  30152. declare namespace sp.spine {
  30153. class TextureAtlas implements Disposable {
  30154. pages: TextureAtlasPage[];
  30155. regions: TextureAtlasRegion[];
  30156. constructor(atlasText: string, textureLoader: (path: string) => any);
  30157. private load;
  30158. findRegion(name: string): TextureAtlasRegion;
  30159. dispose(): void;
  30160. }
  30161. class TextureAtlasPage {
  30162. name: string;
  30163. minFilter: TextureFilter;
  30164. magFilter: TextureFilter;
  30165. uWrap: TextureWrap;
  30166. vWrap: TextureWrap;
  30167. texture: Texture;
  30168. width: number;
  30169. height: number;
  30170. }
  30171. class TextureAtlasRegion extends TextureRegion {
  30172. page: TextureAtlasPage;
  30173. name: string;
  30174. x: number;
  30175. y: number;
  30176. index: number;
  30177. rotate: boolean;
  30178. degrees: number;
  30179. texture: Texture;
  30180. }
  30181. }
  30182. declare namespace sp.spine {
  30183. class TransformConstraint implements Updatable {
  30184. data: TransformConstraintData;
  30185. bones: Array<Bone>;
  30186. target: Bone;
  30187. rotateMix: number;
  30188. translateMix: number;
  30189. scaleMix: number;
  30190. shearMix: number;
  30191. temp: Vector2;
  30192. active: boolean;
  30193. constructor(data: TransformConstraintData, skeleton: Skeleton);
  30194. isActive(): boolean;
  30195. apply(): void;
  30196. update(): void;
  30197. applyAbsoluteWorld(): void;
  30198. applyRelativeWorld(): void;
  30199. applyAbsoluteLocal(): void;
  30200. applyRelativeLocal(): void;
  30201. }
  30202. }
  30203. declare namespace sp.spine {
  30204. class TransformConstraintData extends ConstraintData {
  30205. bones: BoneData[];
  30206. target: BoneData;
  30207. rotateMix: number;
  30208. translateMix: number;
  30209. scaleMix: number;
  30210. shearMix: number;
  30211. offsetRotation: number;
  30212. offsetX: number;
  30213. offsetY: number;
  30214. offsetScaleX: number;
  30215. offsetScaleY: number;
  30216. offsetShearY: number;
  30217. relative: boolean;
  30218. local: boolean;
  30219. constructor(name: string);
  30220. }
  30221. }
  30222. declare namespace sp.spine {
  30223. class Triangulator {
  30224. private convexPolygons;
  30225. private convexPolygonsIndices;
  30226. private indicesArray;
  30227. private isConcaveArray;
  30228. private triangles;
  30229. private polygonPool;
  30230. private polygonIndicesPool;
  30231. triangulate(verticesArray: ArrayLike<number>): Array<number>;
  30232. decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
  30233. private static isConcave;
  30234. private static positiveArea;
  30235. private static winding;
  30236. }
  30237. }
  30238. declare namespace sp.spine {
  30239. interface Updatable {
  30240. update(): void;
  30241. isActive(): boolean;
  30242. }
  30243. }
  30244. declare namespace sp.spine {
  30245. interface Map<T> {
  30246. [key: string]: T;
  30247. }
  30248. class IntSet {
  30249. array: number[];
  30250. add(value: number): boolean;
  30251. contains(value: number): boolean;
  30252. remove(value: number): void;
  30253. clear(): void;
  30254. }
  30255. interface Disposable {
  30256. dispose(): void;
  30257. }
  30258. interface Restorable {
  30259. restore(): void;
  30260. }
  30261. class Color {
  30262. r: number;
  30263. g: number;
  30264. b: number;
  30265. a: number;
  30266. static WHITE: Color;
  30267. static RED: Color;
  30268. static GREEN: Color;
  30269. static BLUE: Color;
  30270. static MAGENTA: Color;
  30271. constructor(r?: number, g?: number, b?: number, a?: number);
  30272. set(r: number, g: number, b: number, a: number): this;
  30273. setFromColor(c: Color): this;
  30274. setFromString(hex: string): this;
  30275. add(r: number, g: number, b: number, a: number): this;
  30276. clamp(): this;
  30277. static rgba8888ToColor(color: Color, value: number): void;
  30278. static rgb888ToColor(color: Color, value: number): void;
  30279. }
  30280. class MathUtils {
  30281. static PI: number;
  30282. static PI2: number;
  30283. static radiansToDegrees: number;
  30284. static radDeg: number;
  30285. static degreesToRadians: number;
  30286. static degRad: number;
  30287. static clamp(value: number, min: number, max: number): number;
  30288. static cosDeg(degrees: number): number;
  30289. static sinDeg(degrees: number): number;
  30290. static signum(value: number): number;
  30291. static toInt(x: number): number;
  30292. static cbrt(x: number): number;
  30293. static randomTriangular(min: number, max: number): number;
  30294. static randomTriangularWith(min: number, max: number, mode: number): number;
  30295. }
  30296. abstract class Interpolation {
  30297. protected abstract applyInternal(a: number): number;
  30298. apply(start: number, end: number, a: number): number;
  30299. }
  30300. class Pow extends Interpolation {
  30301. protected power: number;
  30302. constructor(power: number);
  30303. applyInternal(a: number): number;
  30304. }
  30305. class PowOut extends Pow {
  30306. constructor(power: number);
  30307. applyInternal(a: number): number;
  30308. }
  30309. class Utils {
  30310. static SUPPORTS_TYPED_ARRAYS: boolean;
  30311. static arrayCopy<T>(source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number): void;
  30312. static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
  30313. static ensureArrayCapacity<T>(array: Array<T>, size: number, value?: any): Array<T>;
  30314. static newArray<T>(size: number, defaultValue: T): Array<T>;
  30315. static newFloatArray(size: number): ArrayLike<number>;
  30316. static newShortArray(size: number): ArrayLike<number>;
  30317. static toFloatArray(array: Array<number>): number[] | Float32Array;
  30318. static toSinglePrecision(value: number): number;
  30319. static webkit602BugfixHelper(alpha: number, blend: MixBlend): void;
  30320. static contains<T>(array: Array<T>, element: T, identity?: boolean): boolean;
  30321. }
  30322. class DebugUtils {
  30323. static logBones(skeleton: Skeleton): void;
  30324. }
  30325. class Pool<T> {
  30326. private items;
  30327. private instantiator;
  30328. constructor(instantiator: () => T);
  30329. obtain(): T;
  30330. free(item: T): void;
  30331. freeAll(items: ArrayLike<T>): void;
  30332. clear(): void;
  30333. }
  30334. class Vector2 {
  30335. x: number;
  30336. y: number;
  30337. constructor(x?: number, y?: number);
  30338. set(x: number, y: number): Vector2;
  30339. length(): number;
  30340. normalize(): this;
  30341. }
  30342. class TimeKeeper {
  30343. maxDelta: number;
  30344. framesPerSecond: number;
  30345. delta: number;
  30346. totalTime: number;
  30347. private lastTime;
  30348. private frameCount;
  30349. private frameTime;
  30350. update(): void;
  30351. }
  30352. interface ArrayLike<T> {
  30353. length: number;
  30354. [n: number]: T;
  30355. }
  30356. class WindowedMean {
  30357. values: Array<number>;
  30358. addedValues: number;
  30359. lastValue: number;
  30360. mean: number;
  30361. dirty: boolean;
  30362. constructor(windowSize?: number);
  30363. hasEnoughData(): boolean;
  30364. addValue(value: number): void;
  30365. getMean(): number;
  30366. }
  30367. }
  30368. declare namespace sp.spine {
  30369. interface VertexEffect {
  30370. begin(skeleton: Skeleton): void;
  30371. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30372. end(): void;
  30373. }
  30374. }
  30375. interface Math {
  30376. fround(n: number): number;
  30377. }
  30378. declare namespace sp.spine {
  30379. abstract class Attachment {
  30380. name: string;
  30381. constructor(name: string);
  30382. abstract copy(): Attachment;
  30383. }
  30384. abstract class VertexAttachment extends Attachment {
  30385. private static nextID;
  30386. id: number;
  30387. bones: Array<number>;
  30388. vertices: ArrayLike<number>;
  30389. worldVerticesLength: number;
  30390. deformAttachment: VertexAttachment;
  30391. constructor(name: string);
  30392. computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  30393. copyTo(attachment: VertexAttachment): void;
  30394. }
  30395. }
  30396. declare namespace sp.spine {
  30397. interface AttachmentLoader {
  30398. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  30399. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  30400. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  30401. newPathAttachment(skin: Skin, name: string): PathAttachment;
  30402. newPointAttachment(skin: Skin, name: string): PointAttachment;
  30403. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  30404. }
  30405. }
  30406. declare namespace sp.spine {
  30407. enum AttachmentType {
  30408. Region = 0,
  30409. BoundingBox = 1,
  30410. Mesh = 2,
  30411. LinkedMesh = 3,
  30412. Path = 4,
  30413. Point = 5,
  30414. Clipping = 6
  30415. }
  30416. }
  30417. declare namespace sp.spine {
  30418. class BoundingBoxAttachment extends VertexAttachment {
  30419. color: Color;
  30420. constructor(name: string);
  30421. copy(): Attachment;
  30422. }
  30423. }
  30424. declare namespace sp.spine {
  30425. class ClippingAttachment extends VertexAttachment {
  30426. endSlot: SlotData;
  30427. color: Color;
  30428. constructor(name: string);
  30429. copy(): Attachment;
  30430. }
  30431. }
  30432. declare namespace sp.spine {
  30433. class MeshAttachment extends VertexAttachment {
  30434. region: TextureRegion;
  30435. path: string;
  30436. regionUVs: ArrayLike<number>;
  30437. uvs: ArrayLike<number>;
  30438. triangles: Array<number>;
  30439. color: Color;
  30440. width: number;
  30441. height: number;
  30442. hullLength: number;
  30443. edges: Array<number>;
  30444. private parentMesh;
  30445. tempColor: Color;
  30446. constructor(name: string);
  30447. updateUVs(): void;
  30448. getParentMesh(): MeshAttachment;
  30449. setParentMesh(parentMesh: MeshAttachment): void;
  30450. copy(): Attachment;
  30451. newLinkedMesh(): MeshAttachment;
  30452. }
  30453. }
  30454. declare namespace sp.spine {
  30455. class PathAttachment extends VertexAttachment {
  30456. lengths: Array<number>;
  30457. closed: boolean;
  30458. constantSpeed: boolean;
  30459. color: Color;
  30460. constructor(name: string);
  30461. copy(): Attachment;
  30462. }
  30463. }
  30464. declare namespace sp.spine {
  30465. class PointAttachment extends VertexAttachment {
  30466. x: number;
  30467. y: number;
  30468. rotation: number;
  30469. color: Color;
  30470. constructor(name: string);
  30471. computeWorldPosition(bone: Bone, point: Vector2): Vector2;
  30472. computeWorldRotation(bone: Bone): number;
  30473. copy(): Attachment;
  30474. }
  30475. }
  30476. declare namespace sp.spine {
  30477. class RegionAttachment extends Attachment {
  30478. static OX1: number;
  30479. static OY1: number;
  30480. static OX2: number;
  30481. static OY2: number;
  30482. static OX3: number;
  30483. static OY3: number;
  30484. static OX4: number;
  30485. static OY4: number;
  30486. static X1: number;
  30487. static Y1: number;
  30488. static C1R: number;
  30489. static C1G: number;
  30490. static C1B: number;
  30491. static C1A: number;
  30492. static U1: number;
  30493. static V1: number;
  30494. static X2: number;
  30495. static Y2: number;
  30496. static C2R: number;
  30497. static C2G: number;
  30498. static C2B: number;
  30499. static C2A: number;
  30500. static U2: number;
  30501. static V2: number;
  30502. static X3: number;
  30503. static Y3: number;
  30504. static C3R: number;
  30505. static C3G: number;
  30506. static C3B: number;
  30507. static C3A: number;
  30508. static U3: number;
  30509. static V3: number;
  30510. static X4: number;
  30511. static Y4: number;
  30512. static C4R: number;
  30513. static C4G: number;
  30514. static C4B: number;
  30515. static C4A: number;
  30516. static U4: number;
  30517. static V4: number;
  30518. x: number;
  30519. y: number;
  30520. scaleX: number;
  30521. scaleY: number;
  30522. rotation: number;
  30523. width: number;
  30524. height: number;
  30525. color: Color;
  30526. path: string;
  30527. rendererObject: any;
  30528. region: TextureRegion;
  30529. offset: ArrayLike<number>;
  30530. uvs: ArrayLike<number>;
  30531. tempColor: Color;
  30532. constructor(name: string);
  30533. updateOffset(): void;
  30534. setRegion(region: TextureRegion): void;
  30535. computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  30536. copy(): Attachment;
  30537. }
  30538. }
  30539. declare namespace sp.spine {
  30540. class JitterEffect implements VertexEffect {
  30541. jitterX: number;
  30542. jitterY: number;
  30543. constructor(jitterX: number, jitterY: number);
  30544. begin(skeleton: Skeleton): void;
  30545. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30546. end(): void;
  30547. }
  30548. }
  30549. declare namespace sp.spine {
  30550. class SwirlEffect implements VertexEffect {
  30551. static interpolation: PowOut;
  30552. centerX: number;
  30553. centerY: number;
  30554. radius: number;
  30555. angle: number;
  30556. private worldX;
  30557. private worldY;
  30558. constructor(radius: number);
  30559. begin(skeleton: Skeleton): void;
  30560. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30561. end(): void;
  30562. }
  30563. }
  30564. /**
  30565. * API for jsb module
  30566. * Author: haroel
  30567. * Homepage: https://github.com/haroel/creatorexDTS
  30568. */
  30569. declare namespace jsb{
  30570. export module reflection{
  30571. /**
  30572. * https://docs.cocos.com/creator/manual/zh/advanced-topics/java-reflection.html
  30573. * call OBJC/Java static methods
  30574. *
  30575. * @param className
  30576. * @param methodName
  30577. * @param methodSignature
  30578. * @param parameters
  30579. */
  30580. export function callStaticMethod (className: string, methodName: string, methodSignature: string, ...parameters:any): any;
  30581. }
  30582. /**
  30583. * 下载任务对象
  30584. */
  30585. export type DownloaderTask = { requestURL: string, storagePath: string, identifier: string };
  30586. /**
  30587. * Http file downloader for jsb!
  30588. */
  30589. export class Downloader{
  30590. /**
  30591. * create a download task
  30592. * @param requestURL
  30593. * @param storagePath
  30594. * @param identifier
  30595. */
  30596. createDownloadFileTask (requestURL:string, storagePath:string, identifier?:string): DownloaderTask;
  30597. setOnFileTaskSuccess (onSucceed: (task: DownloaderTask) => void): void;
  30598. setOnTaskProgress (onProgress: (task: DownloaderTask, bytesReceived: number, totalBytesReceived: number, totalBytesExpected: number) => void): void;
  30599. setOnTaskError (onError: (task: DownloaderTask, errorCode: number, errorCodeInternal: number, errorStr: string) => void): void;
  30600. }
  30601. export interface ManifestAsset {
  30602. md5: string;
  30603. path: string;
  30604. compressed: boolean;
  30605. size: number;
  30606. downloadState: number;
  30607. }
  30608. export class Manifest {
  30609. constructor (manifestUrl: string);
  30610. constructor (content: string, manifestRoot: string);
  30611. parseFile (manifestUrl: string): void;
  30612. parseJSONString (content: string, manifestRoot: string): void;
  30613. getManifestRoot (): string;
  30614. getManifestFileUrl (): string;
  30615. getVersionFileUrl (): string;
  30616. getSearchPaths (): [string];
  30617. getVersion (): string;
  30618. getPackageUrl (): boolean;
  30619. setUpdating (isUpdating: boolean): void;
  30620. isUpdating (): boolean;
  30621. isVersionLoaded (): boolean;
  30622. isLoaded (): boolean;
  30623. }
  30624. export class EventAssetsManager {
  30625. // EventCode
  30626. static ERROR_NO_LOCAL_MANIFEST: number;
  30627. static ERROR_DOWNLOAD_MANIFEST: number;
  30628. static ERROR_PARSE_MANIFEST: number;
  30629. static NEW_VERSION_FOUND: number;
  30630. static ALREADY_UP_TO_DATE: number;
  30631. static UPDATE_PROGRESSION: number;
  30632. static ASSET_UPDATED: number;
  30633. static ERROR_UPDATING: number;
  30634. static UPDATE_FINISHED: number;
  30635. static UPDATE_FAILED: number;
  30636. static ERROR_DECOMPRESS: number;
  30637. constructor (eventName: string, manager: AssetsManager, eventCode: number,
  30638. assetId?: string, message?: string, curleCode?: number, curlmCode?: number);
  30639. getAssetsManagerEx (): AssetsManager;
  30640. isResuming (): boolean;
  30641. getDownloadedFiles (): number;
  30642. getDownloadedBytes (): number;
  30643. getTotalFiles (): number;
  30644. getTotalBytes (): number;
  30645. getPercent (): number;
  30646. getPercentByFile (): number;
  30647. getEventCode (): number;
  30648. getMessage (): string;
  30649. getAssetId (): string;
  30650. getCURLECode (): number;
  30651. getCURLMCode (): number;
  30652. }
  30653. export module AssetsManager {
  30654. export enum State {
  30655. UNINITED,
  30656. UNCHECKED,
  30657. PREDOWNLOAD_VERSION,
  30658. DOWNLOADING_VERSION,
  30659. VERSION_LOADED,
  30660. PREDOWNLOAD_MANIFEST,
  30661. DOWNLOADING_MANIFEST,
  30662. MANIFEST_LOADED,
  30663. NEED_UPDATE,
  30664. READY_TO_UPDATE,
  30665. UPDATING,
  30666. UNZIPPING,
  30667. UP_TO_DATE,
  30668. FAIL_TO_UPDATE,
  30669. }
  30670. }
  30671. export class AssetsManager {
  30672. constructor (manifestUrl: string, storagePath: string, versionCompareHandle?: (versionA: string, versionB: string) => number);
  30673. static create (manifestUrl: string, storagePath: string): AssetsManager;
  30674. getState (): AssetsManager.State;
  30675. getStoragePath (): string
  30676. getMaxConcurrentTask (): number;
  30677. // setMaxConcurrentTask (max: number): void; // actually not supported
  30678. checkUpdate (): void;
  30679. prepareUpdate (): void;
  30680. update (): void;
  30681. isResuming (): boolean;
  30682. getDownloadedFiles (): number;
  30683. getDownloadedBytes (): number;
  30684. getTotalFiles (): number;
  30685. getTotalBytes (): number;
  30686. downloadFailedAssets (): void;
  30687. getLocalManifest (): Manifest;
  30688. loadLocalManifest (manifestUrl: string): boolean;
  30689. loadLocalManifest (localManifest: Manifest, storagePath: string): boolean;
  30690. getRemoteManifest (): Manifest;
  30691. loadRemoteManifest (remoteManifest: Manifest): boolean;
  30692. /**
  30693. * Setup your own version compare handler, versionA and B is versions in string.
  30694. * if the return value greater than 0, versionA is greater than B,
  30695. * if the return value equals 0, versionA equals to B,
  30696. * if the return value smaller than 0, versionA is smaller than B.
  30697. */
  30698. setVersionCompareHandle (versionCompareHandle?: (versionA: string, versionB: string) => number): void;
  30699. /**
  30700. * Setup the verification callback, Return true if the verification passed, otherwise return false
  30701. */
  30702. setVerifyCallback (verifyCallback: (path: string, asset: ManifestAsset) => boolean): void;
  30703. setEventCallback (eventCallback: (event: EventAssetsManager) => void): void;
  30704. }
  30705. /**
  30706. * FileUtils Helper class to handle file operations.
  30707. */
  30708. export module fileUtils{
  30709. /**
  30710. * Checks whether the path is an absolute path.
  30711. *
  30712. * @note On Android, if the parameter passed in is relative to "@assets/", this method will treat it as an absolute path.
  30713. * Also on Blackberry, path starts with "app/native/Resources/" is treated as an absolute path.
  30714. *
  30715. * @param path The path that needs to be checked.
  30716. * @return True if it's an absolute path, false if not.
  30717. */
  30718. export function isAbsolutePath (path:string):boolean;
  30719. /** Returns the fullpath for a given filename.
  30720. First it will try to get a new filename from the "filenameLookup" dictionary.
  30721. If a new filename can't be found on the dictionary, it will use the original filename.
  30722. Then it will try to obtain the full path of the filename using the FileUtils search rules: resolutions, and search paths.
  30723. The file search is based on the array element order of search paths and resolution directories.
  30724. For instance:
  30725. We set two elements("/mnt/sdcard/", "internal_dir/") to search paths vector by setSearchPaths,
  30726. and set three elements("resources-ipadhd/", "resources-ipad/", "resources-iphonehd")
  30727. to resolutions vector by setSearchResolutionsOrder. The "internal_dir" is relative to "Resources/".
  30728. If we have a file named 'sprite.png', the mapping in fileLookup dictionary contains `key: sprite.png -> value: sprite.pvr.gz`.
  30729. Firstly, it will replace 'sprite.png' with 'sprite.pvr.gz', then searching the file sprite.pvr.gz as follows:
  30730. /mnt/sdcard/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30731. /mnt/sdcard/resources-ipad/sprite.pvr.gz (if not found, search next)
  30732. /mnt/sdcard/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30733. /mnt/sdcard/sprite.pvr.gz (if not found, search next)
  30734. internal_dir/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30735. internal_dir/resources-ipad/sprite.pvr.gz (if not found, search next)
  30736. internal_dir/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30737. internal_dir/sprite.pvr.gz (if not found, return "sprite.png")
  30738. If the filename contains relative path like "gamescene/uilayer/sprite.png",
  30739. and the mapping in fileLookup dictionary contains `key: gamescene/uilayer/sprite.png -> value: gamescene/uilayer/sprite.pvr.gz`.
  30740. The file search order will be:
  30741. /mnt/sdcard/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30742. /mnt/sdcard/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  30743. /mnt/sdcard/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30744. /mnt/sdcard/gamescene/uilayer/sprite.pvr.gz (if not found, search next)
  30745. internal_dir/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30746. internal_dir/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  30747. internal_dir/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30748. internal_dir/gamescene/uilayer/sprite.pvr.gz (if not found, return "gamescene/uilayer/sprite.png")
  30749. If the new file can't be found on the file system, it will return the parameter filename directly.
  30750. This method was added to simplify multiplatform support. Whether you are using cocos2d-js or any cross-compilation toolchain like StellaSDK or Apportable,
  30751. you might need to load different resources for a given file in the different platforms.
  30752. @since v2.1
  30753. */
  30754. export function fullPathForFilename (filename:string):string;
  30755. /**
  30756. * Gets string from a file.
  30757. */
  30758. export function getStringFromFile (filename:string):string;
  30759. /**
  30760. * Removes a file.
  30761. *
  30762. * @param filepath The full path of the file, it must be an absolute path.
  30763. * @return True if the file have been removed successfully, false if not.
  30764. */
  30765. export function removeFile (filepath:string):boolean;
  30766. /**
  30767. * Checks whether the path is a directory.
  30768. *
  30769. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30770. * @return True if the directory exists, false if not.
  30771. */
  30772. export function isDirectoryExist (dirPath:string):boolean;
  30773. /**
  30774. * Normalize: remove . and ..
  30775. * @param filepath
  30776. */
  30777. export function normalizePath (filepath:string):string;
  30778. /**
  30779. * Get default resource root path.
  30780. */
  30781. export function getDefaultResourceRootPath ():string;
  30782. /**
  30783. * Loads the filenameLookup dictionary from the contents of a filename.
  30784. *
  30785. * @note The plist file name should follow the format below:
  30786. *
  30787. * @code
  30788. * <?xml version="1.0" encoding="UTF-8"?>
  30789. * <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  30790. * <plist version="1.0">
  30791. * <dict>
  30792. * <key>filenames</key>
  30793. * <dict>
  30794. * <key>sounds/click.wav</key>
  30795. * <string>sounds/click.caf</string>
  30796. * <key>sounds/endgame.wav</key>
  30797. * <string>sounds/endgame.caf</string>
  30798. * <key>sounds/gem-0.wav</key>
  30799. * <string>sounds/gem-0.caf</string>
  30800. * </dict>
  30801. * <key>metadata</key>
  30802. * <dict>
  30803. * <key>version</key>
  30804. * <integer>1</integer>
  30805. * </dict>
  30806. * </dict>
  30807. * </plist>
  30808. * @endcode
  30809. * @param filename The plist file name.
  30810. *
  30811. @since v2.1
  30812. * @js loadFilenameLookup
  30813. * @lua loadFilenameLookup
  30814. */
  30815. export function loadFilenameLookup (filepath:string):void;
  30816. /** Checks whether to pop up a message box when failed to load an image.
  30817. * @return True if pop up a message box when failed to load an image, false if not.
  30818. */
  30819. export function isPopupNotify ():boolean;
  30820. /**
  30821. * Sets whether to pop-up a message box when failed to load an image.
  30822. */
  30823. export function setPopupNotify (notify:boolean):void;
  30824. // Converts the contents of a file to a ValueVector.
  30825. // This method is used internally.
  30826. export function getValueVectorFromFile (filepath:string):Array<any>;
  30827. /**
  30828. * Gets the array of search paths.
  30829. *
  30830. * @return The array of search paths which may contain the prefix of default resource root path.
  30831. * @note In best practise, getter function should return the value of setter function passes in.
  30832. * But since we should not break the compatibility, we keep using the old logic.
  30833. * Therefore, If you want to get the original search paths, please call 'getOriginalSearchPaths()' instead.
  30834. * @see fullPathForFilename(const char*).
  30835. * @lua NA
  30836. */
  30837. export function getSearchPaths ():Array<string>;
  30838. /**
  30839. *
  30840. * @param filepath
  30841. */
  30842. export function getFileDir (filepath:string):string;
  30843. /**
  30844. * write a ValueMap into a plist file
  30845. *
  30846. *@param dict the ValueMap want to save (key,value)
  30847. *@param fullPath The full path to the file you want to save a string
  30848. *@return bool
  30849. */
  30850. export function writeToFile ( valueMap:any ):boolean;
  30851. /**
  30852. * Gets the original search path array set by 'setSearchPaths' or 'addSearchPath'.
  30853. * @return The array of the original search paths
  30854. */
  30855. export function getOriginalSearchPaths ():Array<string>;
  30856. /**
  30857. * List all files in a directory.
  30858. *
  30859. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30860. * @return File paths in a string vector
  30861. */
  30862. export function listFiles (filepath:string):Array<string>;
  30863. /**
  30864. * Converts the contents of a file to a ValueMap.
  30865. * @param filename The filename of the file to gets content.
  30866. * @return ValueMap of the file contents.
  30867. * @note This method is used internally.
  30868. */
  30869. export function getValueMapFromFile (filepath:string):any;
  30870. /**
  30871. * Retrieve the file size.
  30872. *
  30873. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  30874. * @param filepath The path of the file, it could be a relative or absolute path.
  30875. * @return The file size.
  30876. */
  30877. export function getFileSize (filepath:string):number;
  30878. /** Converts the contents of a file to a ValueMap.
  30879. * This method is used internally.
  30880. */
  30881. export function getValueMapFromData (filedata:string,filesize:number):any;
  30882. /**
  30883. * Removes a directory.
  30884. *
  30885. * @param dirPath The full path of the directory, it must be an absolute path.
  30886. * @return True if the directory have been removed successfully, false if not.
  30887. */
  30888. export function removeDirectory (dirPath:string):boolean;
  30889. /**
  30890. * Sets the array of search paths.
  30891. *
  30892. * You can use this array to modify the search path of the resources.
  30893. * If you want to use "themes" or search resources in the "cache", you can do it easily by adding new entries in this array.
  30894. *
  30895. * @note This method could access relative path and absolute path.
  30896. * If the relative path was passed to the vector, FileUtils will add the default resource directory before the relative path.
  30897. * For instance:
  30898. * On Android, the default resource root path is "@assets/".
  30899. * If "/mnt/sdcard/" and "resources-large" were set to the search paths vector,
  30900. * "resources-large" will be converted to "@assets/resources-large" since it was a relative path.
  30901. *
  30902. * @param searchPaths The array contains search paths.
  30903. * @see fullPathForFilename(const char*)
  30904. * @since v2.1
  30905. * In js:var setSearchPaths(var jsval);
  30906. * @lua NA
  30907. */
  30908. export function setSearchPaths ( searchPath:Array<string>):void;
  30909. /**
  30910. * write a string into a file
  30911. *
  30912. * @param dataStr the string want to save
  30913. * @param fullPath The full path to the file you want to save a string
  30914. * @return bool True if write success
  30915. */
  30916. export function writeStringToFile (dataStr:string,fullPath:string):boolean;
  30917. /**
  30918. * Sets the array that contains the search order of the resources.
  30919. *
  30920. * @param searchResolutionsOrder The source array that contains the search order of the resources.
  30921. * @see getSearchResolutionsOrder(), fullPathForFilename(const char*).
  30922. * @since v2.1
  30923. * In js:var setSearchResolutionsOrder(var jsval)
  30924. * @lua NA
  30925. */
  30926. export function setSearchResolutionsOrder (searchResolutionsOrder:Array<string>):void;
  30927. /**
  30928. * Append search order of the resources.
  30929. *
  30930. * @see setSearchResolutionsOrder(), fullPathForFilename().
  30931. * @since v2.1
  30932. */
  30933. export function addSearchResolutionsOrder (order:string,front:boolean):void;
  30934. /**
  30935. * Add search path.
  30936. *
  30937. * @since v2.1
  30938. */
  30939. export function addSearchPath (path:string,front:boolean):void;
  30940. /**
  30941. * write ValueVector into a plist file
  30942. *
  30943. *@param vecData the ValueVector want to save
  30944. *@param fullPath The full path to the file you want to save a string
  30945. *@return bool
  30946. */
  30947. export function writeValueVectorToFile (vecData:Array<any>,fullPath:string):boolean;
  30948. /**
  30949. * Checks whether a file exists.
  30950. *
  30951. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  30952. * @param filename The path of the file, it could be a relative or absolute path.
  30953. * @return True if the file exists, false if not.
  30954. */
  30955. export function isFileExist (filename:string):boolean;
  30956. /**©∫
  30957. * Purges full path caches.
  30958. */
  30959. export function purgeCachedEntries ():void;
  30960. /**
  30961. * Gets full path from a file name and the path of the relative file.
  30962. * @param filename The file name.
  30963. * @param relativeFile The path of the relative file.
  30964. * @return The full path.
  30965. * e.g. filename: hello.png, pszRelativeFile: /User/path1/path2/hello.plist
  30966. * Return: /User/path1/path2/hello.pvr (If there a a key(hello.png)-value(hello.pvr) in FilenameLookup dictionary. )
  30967. *
  30968. */
  30969. export function fullPathFromRelativeFile (filename:string,relativeFile:string):string;
  30970. /**
  30971. * Windows fopen can't support UTF-8 filename
  30972. * Need convert all parameters fopen and other 3rd-party libs
  30973. *
  30974. * @param filenameUtf8 std::string name file for conversion from utf-8
  30975. * @return std::string ansi filename in current locale
  30976. */
  30977. export function getSuitableFOpen (filenameUtf8:string):string;
  30978. /**
  30979. * write ValueMap into a plist file
  30980. *
  30981. *@param dict the ValueMap want to save
  30982. *@param fullPath The full path to the file you want to save a string
  30983. *@return bool
  30984. */
  30985. export function writeValueMapToFile (dict:any,fullPath:string):string;
  30986. /**
  30987. * Gets filename extension is a suffix (separated from the base filename by a dot) in lower case.
  30988. * Examples of filename extensions are .png, .jpeg, .exe, .dmg and .txt.
  30989. * @param filePath The path of the file, it could be a relative or absolute path.
  30990. * @return suffix for filename in lower case or empty if a dot not found.
  30991. */
  30992. export function getFileExtension (filePath:string):string;
  30993. /**
  30994. * Sets writable path.
  30995. */
  30996. export function setWritablePath (writablePath:string):void;
  30997. /**
  30998. * Set default resource root path.
  30999. */
  31000. export function setDefaultResourceRootPath (filepath:string):void;
  31001. /**
  31002. * Gets the array that contains the search order of the resources.
  31003. *
  31004. * @see setSearchResolutionsOrder(const std::vector<std::string>&), fullPathForFilename(const char*).
  31005. * @since v2.1
  31006. * @lua NA
  31007. */
  31008. export function getSearchResolutionsOrder ():Array<string>;
  31009. /**
  31010. * Creates a directory.
  31011. *
  31012. * @param dirPath The path of the directory, it must be an absolute path.
  31013. * @return True if the directory have been created successfully, false if not.
  31014. */
  31015. export function createDirectory (dirPath:string):string;
  31016. /**
  31017. * List all files recursively in a directory.
  31018. *
  31019. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  31020. * @return File paths in a string vector
  31021. */
  31022. export function listFilesRecursively (dirPath:string, files:Array<string>):void;
  31023. /**
  31024. * Gets the writable path.
  31025. * @return The path that can be write/read a file in
  31026. */
  31027. export function getWritablePath ():string;
  31028. }
  31029. }
  31030. /** Running in the editor. */
  31031. declare const CC_EDITOR: boolean;
  31032. /** Preview in browser or simulator. */
  31033. declare const CC_PREVIEW: boolean;
  31034. /** Running in the editor or preview. */
  31035. declare const CC_DEV: boolean;
  31036. /** Running in the editor or preview, or build in debug mode. */
  31037. declare const CC_DEBUG: boolean;
  31038. /** Running in published project. */
  31039. declare const CC_BUILD: boolean;
  31040. /** Running in native platforms (mobile app, desktop app, or simulator). */
  31041. declare const CC_JSB: boolean;
  31042. /** Running in runtime environments. */
  31043. declare const CC_RUNTIME: boolean;
  31044. /** Running in the engine's unit test. */
  31045. declare const CC_TEST: boolean;
  31046. /** Running in the WeChat Mini Game. */
  31047. declare const CC_WECHATGAME: boolean;