creator.d.ts 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070
  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;