creator.d.ts 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073
  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. /**
  1099. !#en
  1100. Rotates a Node object to a certain angle by modifying its quternion property. <br/>
  1101. The direction will be decided by the shortest angle.
  1102. !#zh 旋转到目标角度,通过逐帧修改它的 quternion 属性,旋转方向将由最短的角度决定。
  1103. @param duration duration in seconds
  1104. @param dstAngleX dstAngleX in degrees.
  1105. @param dstAngleY dstAngleY in degrees.
  1106. @param dstAngleZ dstAngleZ in degrees.
  1107. @example
  1108. ```js
  1109. // example
  1110. var rotate3DTo = cc.rotate3DTo(2, cc.v3(0, 180, 0));
  1111. ```
  1112. */
  1113. export function rotate3DTo(duration: number, dstAngleX: number|Vec3|Quat, dstAngleY?: number, dstAngleZ?: number): ActionInterval;
  1114. /**
  1115. !#en
  1116. Rotates a Node object counter clockwise a number of degrees by modifying its quaternion property.
  1117. Relative to its properties to modify.
  1118. !#zh 旋转指定的 3D 角度。
  1119. @param duration duration in seconds
  1120. @param deltaAngleX deltaAngleX in degrees
  1121. @param deltaAngleY deltaAngleY in degrees
  1122. @param deltaAngleZ deltaAngleZ in degrees
  1123. @example
  1124. ```js
  1125. // example
  1126. var actionBy = cc.rotate3DBy(2, cc.v3(0, 360, 0));
  1127. ```
  1128. */
  1129. export function rotate3DBy(duration: number, deltaAngleX: number|Vec3, deltaAngleY?: number, deltaAngleZ?: number): ActionInterval;
  1130. export var assetManager: AssetManager;
  1131. /** !#en
  1132. cc.resources is a bundle and controls all asset under assets/resources
  1133. !#zh
  1134. cc.resources 是一个 bundle,用于管理所有在 assets/resources 下的资源 */
  1135. export var resources: AssetManager.Bundle;
  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. !#en
  1363. The convenience method to create a new {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}}
  1364. Alpha channel is optional. Default value is 255.
  1365. !#zh
  1366. 通过该方法来创建一个新的 {{#crossLink "Color/Color:method"}}cc.Color{{/crossLink}} 对象。
  1367. Alpha 通道是可选的。默认值是 255。
  1368. @param r r
  1369. @param g g
  1370. @param b b
  1371. @param a a
  1372. @example
  1373. ```js
  1374. -----------------------
  1375. // 1. All channels seperately as parameters
  1376. var color1 = new cc.Color(255, 255, 255, 255);
  1377. // 2. Convert a hex string to a color
  1378. var color2 = new cc.Color("#000000");
  1379. // 3. An color object as parameter
  1380. var color3 = new cc.Color({r: 255, g: 255, b: 255, a: 255});
  1381. ```
  1382. */
  1383. export function color(r?: number, g?: number, b?: number, a?: number): Color;
  1384. /**
  1385. !#en The convenience method to create a new {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}}.
  1386. !#zh 通过该简便的函数进行创建 {{#crossLink "Mat4"}}cc.Mat4{{/crossLink}} 对象。
  1387. @param m00 Component in column 0, row 0 position (index 0)
  1388. @param m01 Component in column 0, row 1 position (index 1)
  1389. @param m02 Component in column 0, row 2 position (index 2)
  1390. @param m03 Component in column 0, row 3 position (index 3)
  1391. @param m10 Component in column 1, row 0 position (index 4)
  1392. @param m11 Component in column 1, row 1 position (index 5)
  1393. @param m12 Component in column 1, row 2 position (index 6)
  1394. @param m13 Component in column 1, row 3 position (index 7)
  1395. @param m20 Component in column 2, row 0 position (index 8)
  1396. @param m21 Component in column 2, row 1 position (index 9)
  1397. @param m22 Component in column 2, row 2 position (index 10)
  1398. @param m23 Component in column 2, row 3 position (index 11)
  1399. @param m30 Component in column 3, row 0 position (index 12)
  1400. @param m31 Component in column 3, row 1 position (index 13)
  1401. @param m32 Component in column 3, row 2 position (index 14)
  1402. @param m33 Component in column 3, row 3 position (index 15)
  1403. */
  1404. 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;
  1405. /**
  1406. !#en The convenience method to create a new {{#crossLink "Quat"}}cc.Quat{{/crossLink}}.
  1407. !#zh 通过该简便的函数进行创建 {{#crossLink "Quat"}}cc.Quat{{/crossLink}} 对象。
  1408. @param x x
  1409. @param y y
  1410. @param z z
  1411. @param w w
  1412. */
  1413. export function quat(x?: number|any, y?: number, z?: number, w?: number): Quat;
  1414. /**
  1415. !#en
  1416. Helper function that creates a cc.Size.<br/>
  1417. Please use cc.p or cc.v2 instead, it will soon replace cc.Size.
  1418. !#zh
  1419. 创建一个 cc.Size 对象的帮助函数。<br/>
  1420. 注意:可以使用 cc.p 或者是 cc.v2 代替,它们将很快取代 cc.Size。
  1421. @param w width or a size object
  1422. @param h height
  1423. @example
  1424. ```js
  1425. var size1 = cc.size();
  1426. var size2 = cc.size(100,100);
  1427. var size3 = cc.size(size2);
  1428. var size4 = cc.size({width: 100, height: 100});
  1429. ```
  1430. */
  1431. export function size(w: number|Size, h?: number): Size;
  1432. export var EPSILON: number;
  1433. /**
  1434. Clamps a value between a minimum float and maximum float value.
  1435. @param val val
  1436. @param min min
  1437. @param max max
  1438. */
  1439. export function clamp(val: number, min: number, max: number): number;
  1440. /**
  1441. Clamps a value between 0 and 1.
  1442. @param val val
  1443. */
  1444. export function clamp01(val: number): number;
  1445. /**
  1446. @param from from
  1447. @param to to
  1448. @param ratio the interpolation coefficient
  1449. */
  1450. export function lerp(from: number, to: number, ratio: number): number;
  1451. export function random(): void;
  1452. /**
  1453. Returns a floating-point random number between min (inclusive) and max (exclusive).
  1454. @param min min
  1455. @param max max
  1456. */
  1457. export function randomRange(min: number, max: number): number;
  1458. /**
  1459. Returns a random integer between min (inclusive) and max (exclusive).
  1460. @param min min
  1461. @param max max
  1462. */
  1463. export function randomRangeInt(min: number, max: number): number;
  1464. /**
  1465. Linear congruential generator using Hull-Dobell Theorem.
  1466. @param seed the random seed
  1467. */
  1468. export function pseudoRandom(seed: number): number;
  1469. /**
  1470. Returns a floating-point pseudo-random number between min (inclusive) and max (exclusive).
  1471. @param seed seed
  1472. @param min min
  1473. @param max max
  1474. */
  1475. export function pseudoRandomRange(seed: number, min: number, max: number): number;
  1476. /**
  1477. Returns a pseudo-random integer between min (inclusive) and max (exclusive).
  1478. @param seed seed
  1479. @param min min
  1480. @param max max
  1481. */
  1482. export function pseudoRandomRangeInt(seed: number, min: number, max: number): number;
  1483. /**
  1484. Returns the next power of two for the value
  1485. @param val val
  1486. */
  1487. export function nextPow2(val: number): number;
  1488. /**
  1489. Returns float remainder for t / length
  1490. @param t time start at 0
  1491. @param length time of one cycle
  1492. */
  1493. export function repeat(t: number, length: number): number;
  1494. /**
  1495. Returns time wrapped in ping-pong mode
  1496. @param t time start at 0
  1497. @param length time of one cycle
  1498. */
  1499. export function repeat(t: number, length: number): number;
  1500. /**
  1501. Returns ratio of a value within a given range
  1502. @param from start value
  1503. @param to end value
  1504. @param value given value
  1505. */
  1506. export function repeat(from: number, to: number, value: number): number;
  1507. /**
  1508. Returns -1, 0, +1 depending on sign of x.
  1509. @param v v
  1510. */
  1511. export function sign(v: number): void;
  1512. /**
  1513. !#en The convenience method to create a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
  1514. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}} 对象。
  1515. @param x x
  1516. @param y y
  1517. @example
  1518. ```js
  1519. var v1 = cc.v2();
  1520. var v2 = cc.v2(0, 0);
  1521. var v3 = cc.v2(v2);
  1522. var v4 = cc.v2({x: 100, y: 100});
  1523. ```
  1524. */
  1525. export function v2(x?: number|any, y?: number): Vec2;
  1526. /**
  1527. !#en
  1528. The convenience method to create a new Rect.
  1529. see {{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1530. !#zh
  1531. 该方法用来快速创建一个新的矩形。{{#crossLink "Rect/Rect:method"}}cc.Rect{{/crossLink}}
  1532. @param x x
  1533. @param y y
  1534. @param w w
  1535. @param h h
  1536. @example
  1537. ```js
  1538. var a = new cc.Rect(0 , 0, 10, 0);
  1539. ```
  1540. */
  1541. export function rect(x?: number, y?: number, w?: number, h?: number): Rect;
  1542. /**
  1543. !#en The convenience method to create a new {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}}.
  1544. !#zh 通过该简便的函数进行创建 {{#crossLink "Vec3"}}cc.Vec3{{/crossLink}} 对象。
  1545. @param x x
  1546. @param y y
  1547. @param z z
  1548. @example
  1549. ```js
  1550. var v1 = cc.v3();
  1551. var v2 = cc.v3(0, 0, 0);
  1552. var v3 = cc.v3(v2);
  1553. var v4 = cc.v3({x: 100, y: 100, z: 0});
  1554. ```
  1555. */
  1556. export function v3(x?: number|any, y?: number, z?: number): Vec3;
  1557. /**
  1558. Finds a node by hierarchy path, the path is case-sensitive.
  1559. It will traverse the hierarchy by splitting the path using '/' character.
  1560. This function will still returns the node even if it is inactive.
  1561. It is recommended to not use this function every frame instead cache the result at startup.
  1562. @param path path
  1563. @param referenceNode referenceNode
  1564. */
  1565. export function find(path: string, referenceNode?: Node): Node;
  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, onUpdate: Function }>>(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, onUpdate: Function }>>(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. @param selectTarget selectTarget
  2005. */
  2006. call(callback: Function, selectTarget?: object): Tween<T>;
  2007. /**
  2008. !#en
  2009. Add an hide action
  2010. !#zh
  2011. 添加一个隐藏 action
  2012. */
  2013. hide(): Tween<T>;
  2014. /**
  2015. !#en
  2016. Add an show action
  2017. !#zh
  2018. 添加一个显示 action
  2019. */
  2020. show(): Tween<T>;
  2021. /**
  2022. !#en
  2023. Add an removeSelf action
  2024. !#zh
  2025. 添加一个移除自己 action
  2026. */
  2027. removeSelf(): Tween<T>;
  2028. /**
  2029. !#en
  2030. Add an sequence action
  2031. !#zh
  2032. 添加一个队列 action
  2033. @param action action
  2034. @param actions actions
  2035. */
  2036. sequence(action: Action|Tween<T>, ...actions: (Action|Tween<T>)[]): Tween<T>;
  2037. /**
  2038. !#en
  2039. Add an parallel action
  2040. !#zh
  2041. 添加一个并行 action
  2042. @param action action
  2043. @param actions actions
  2044. */
  2045. parallel(action: Action|Tween<T>, ...actions: (Action|Tween<T>)[]): Tween<T>;
  2046. /**
  2047. !#en
  2048. Add an repeat action. This action will integrate before actions to a sequence action as their parameters.
  2049. !#zh
  2050. 添加一个重复 action,这个 action 会将前一个动作作为他的参数。
  2051. @param repeatTimes repeatTimes
  2052. @param action action
  2053. */
  2054. repeat(repeatTimes: number, action?: Action|Tween<T>): Tween<T>;
  2055. /**
  2056. !#en
  2057. Add an repeat forever action. This action will integrate before actions to a sequence action as their parameters.
  2058. !#zh
  2059. 添加一个永久重复 action,这个 action 会将前一个动作作为他的参数。
  2060. @param action action
  2061. */
  2062. repeatForever(action?: Action|Tween<T>): Tween<T>;
  2063. /**
  2064. !#en
  2065. Add an reverse time action. This action will integrate before actions to a sequence action as their parameters.
  2066. !#zh
  2067. 添加一个倒置时间 action,这个 action 会将前一个动作作为他的参数。
  2068. @param action action
  2069. */
  2070. reverseTime(action?: Action|Tween<T>): Tween<T>;
  2071. }
  2072. /** !#en `cc.audioEngine` is the singleton object, it provide simple audio APIs.
  2073. !#zh
  2074. cc.audioengine是单例对象。<br/>
  2075. 主要用来播放音频,播放的时候会返回一个 audioID,之后都可以通过这个 audioID 来操作这个音频对象。<br/>
  2076. 不使用的时候,请使用 `cc.audioEngine.uncache(filePath);` 进行资源释放 <br/>
  2077. 注意:<br/>
  2078. 在 Android 系统浏览器上,不同浏览器,不同版本的效果不尽相同。<br/>
  2079. 比如说:大多数浏览器都需要用户物理交互才可以开始播放音效,有一些不支持 WebAudio,有一些不支持多音轨播放。总之如果对音乐依赖比较强,请做尽可能多的测试。 */
  2080. export class audioEngine {
  2081. /**
  2082. !#en Play audio.
  2083. !#zh 播放音频
  2084. @param clip The audio clip to play.
  2085. @param loop Whether the music loop or not.
  2086. @param volume Volume size.
  2087. @example
  2088. ```js
  2089. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2090. var audioID = cc.audioEngine.play(clip, false, 0.5);
  2091. });
  2092. ```
  2093. */
  2094. static play(clip: AudioClip, loop: boolean, volume: number): number;
  2095. /**
  2096. !#en Set audio loop.
  2097. !#zh 设置音频是否循环。
  2098. @param audioID audio id.
  2099. @param loop Whether cycle.
  2100. @example
  2101. ```js
  2102. cc.audioEngine.setLoop(id, true);
  2103. ```
  2104. */
  2105. static setLoop(audioID: number, loop: boolean): void;
  2106. /**
  2107. !#en Get audio cycle state.
  2108. !#zh 获取音频的循环状态。
  2109. @param audioID audio id.
  2110. @example
  2111. ```js
  2112. cc.audioEngine.isLoop(id);
  2113. ```
  2114. */
  2115. static isLoop(audioID: number): boolean;
  2116. /**
  2117. !#en Set the volume of audio.
  2118. !#zh 设置音量(0.0 ~ 1.0)。
  2119. @param audioID audio id.
  2120. @param volume Volume must be in 0.0~1.0 .
  2121. @example
  2122. ```js
  2123. cc.audioEngine.setVolume(id, 0.5);
  2124. ```
  2125. */
  2126. static setVolume(audioID: number, volume: number): void;
  2127. /**
  2128. !#en The volume of the music max value is 1.0,the min value is 0.0 .
  2129. !#zh 获取音量(0.0 ~ 1.0)。
  2130. @param audioID audio id.
  2131. @example
  2132. ```js
  2133. var volume = cc.audioEngine.getVolume(id);
  2134. ```
  2135. */
  2136. static getVolume(audioID: number): number;
  2137. /**
  2138. !#en Set current time
  2139. !#zh 设置当前的音频时间。
  2140. @param audioID audio id.
  2141. @param sec current time.
  2142. @example
  2143. ```js
  2144. cc.audioEngine.setCurrentTime(id, 2);
  2145. ```
  2146. */
  2147. static setCurrentTime(audioID: number, sec: number): boolean;
  2148. /**
  2149. !#en Get current time
  2150. !#zh 获取当前的音频播放时间。
  2151. @param audioID audio id.
  2152. @example
  2153. ```js
  2154. var time = cc.audioEngine.getCurrentTime(id);
  2155. ```
  2156. */
  2157. static getCurrentTime(audioID: number): number;
  2158. /**
  2159. !#en Get audio duration
  2160. !#zh 获取音频总时长。
  2161. @param audioID audio id.
  2162. @example
  2163. ```js
  2164. var time = cc.audioEngine.getDuration(id);
  2165. ```
  2166. */
  2167. static getDuration(audioID: number): number;
  2168. /**
  2169. !#en Get audio state
  2170. !#zh 获取音频状态。
  2171. @param audioID audio id.
  2172. @example
  2173. ```js
  2174. var state = cc.audioEngine.getState(id);
  2175. ```
  2176. */
  2177. static getState(audioID: number): audioEngine.AudioState;
  2178. /**
  2179. !#en Set Audio finish callback
  2180. !#zh 设置一个音频结束后的回调
  2181. @param audioID audio id.
  2182. @param callback loaded callback.
  2183. @example
  2184. ```js
  2185. cc.audioEngine.setFinishCallback(id, function () {});
  2186. ```
  2187. */
  2188. static setFinishCallback(audioID: number, callback: Function): void;
  2189. /**
  2190. !#en Pause playing audio.
  2191. !#zh 暂停正在播放音频。
  2192. @param audioID The return value of function play.
  2193. @example
  2194. ```js
  2195. cc.audioEngine.pause(audioID);
  2196. ```
  2197. */
  2198. static pause(audioID: number): void;
  2199. /**
  2200. !#en Pause all playing audio
  2201. !#zh 暂停现在正在播放的所有音频。
  2202. @example
  2203. ```js
  2204. cc.audioEngine.pauseAll();
  2205. ```
  2206. */
  2207. static pauseAll(): void;
  2208. /**
  2209. !#en Resume playing audio.
  2210. !#zh 恢复播放指定的音频。
  2211. @param audioID The return value of function play.
  2212. @example
  2213. ```js
  2214. cc.audioEngine.resume(audioID);
  2215. ```
  2216. */
  2217. static resume(audioID: number): void;
  2218. /**
  2219. !#en Resume all playing audio.
  2220. !#zh 恢复播放所有之前暂停的所有音频。
  2221. @example
  2222. ```js
  2223. cc.audioEngine.resumeAll();
  2224. ```
  2225. */
  2226. static resumeAll(): void;
  2227. /**
  2228. !#en Stop playing audio.
  2229. !#zh 停止播放指定音频。
  2230. @param audioID The return value of function play.
  2231. @example
  2232. ```js
  2233. cc.audioEngine.stop(audioID);
  2234. ```
  2235. */
  2236. static stop(audioID: number): void;
  2237. /**
  2238. !#en Stop all playing audio.
  2239. !#zh 停止正在播放的所有音频。
  2240. @example
  2241. ```js
  2242. cc.audioEngine.stopAll();
  2243. ```
  2244. */
  2245. static stopAll(): void;
  2246. /**
  2247. !#en Set up an audio can generate a few examples.
  2248. !#zh 设置一个音频可以设置几个实例
  2249. @param num a number of instances to be created from within an audio
  2250. @example
  2251. ```js
  2252. cc.audioEngine.setMaxAudioInstance(20);
  2253. ```
  2254. */
  2255. static setMaxAudioInstance(num: number): void;
  2256. /**
  2257. !#en Getting audio can produce several examples.
  2258. !#zh 获取一个音频可以设置几个实例
  2259. @example
  2260. ```js
  2261. cc.audioEngine.getMaxAudioInstance();
  2262. ```
  2263. */
  2264. static getMaxAudioInstance(): number;
  2265. /**
  2266. !#en Unload the preloaded audio from internal buffer.
  2267. !#zh 卸载预加载的音频。
  2268. @param clip clip
  2269. @example
  2270. ```js
  2271. cc.audioEngine.uncache(filePath);
  2272. ```
  2273. */
  2274. static uncache(clip: AudioClip): void;
  2275. /**
  2276. !#en Unload all audio from internal buffer.
  2277. !#zh 卸载所有音频。
  2278. @example
  2279. ```js
  2280. cc.audioEngine.uncacheAll();
  2281. ```
  2282. */
  2283. static uncacheAll(): void;
  2284. /**
  2285. !#en Play background music
  2286. !#zh 播放背景音乐
  2287. @param clip The audio clip to play.
  2288. @param loop Whether the music loop or not.
  2289. @example
  2290. ```js
  2291. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2292. var audioID = cc.audioEngine.playMusic(clip, false);
  2293. });
  2294. ```
  2295. */
  2296. static playMusic(clip: AudioClip, loop: boolean): number;
  2297. /**
  2298. !#en Stop background music.
  2299. !#zh 停止播放背景音乐。
  2300. @example
  2301. ```js
  2302. cc.audioEngine.stopMusic();
  2303. ```
  2304. */
  2305. static stopMusic(): void;
  2306. /**
  2307. !#en Pause the background music.
  2308. !#zh 暂停播放背景音乐。
  2309. @example
  2310. ```js
  2311. cc.audioEngine.pauseMusic();
  2312. ```
  2313. */
  2314. static pauseMusic(): void;
  2315. /**
  2316. !#en Resume playing background music.
  2317. !#zh 恢复播放背景音乐。
  2318. @example
  2319. ```js
  2320. cc.audioEngine.resumeMusic();
  2321. ```
  2322. */
  2323. static resumeMusic(): void;
  2324. /**
  2325. !#en Get the volume(0.0 ~ 1.0).
  2326. !#zh 获取音量(0.0 ~ 1.0)。
  2327. @example
  2328. ```js
  2329. var volume = cc.audioEngine.getMusicVolume();
  2330. ```
  2331. */
  2332. static getMusicVolume(): number;
  2333. /**
  2334. !#en Set the background music volume.
  2335. !#zh 设置背景音乐音量(0.0 ~ 1.0)。
  2336. @param volume Volume must be in 0.0~1.0.
  2337. @example
  2338. ```js
  2339. cc.audioEngine.setMusicVolume(0.5);
  2340. ```
  2341. */
  2342. static setMusicVolume(volume: number): void;
  2343. /**
  2344. !#en Background music playing state
  2345. !#zh 背景音乐是否正在播放
  2346. @example
  2347. ```js
  2348. cc.audioEngine.isMusicPlaying();
  2349. ```
  2350. */
  2351. static isMusicPlaying(): boolean;
  2352. /**
  2353. !#en Play effect audio.
  2354. !#zh 播放音效
  2355. @param clip The audio clip to play.
  2356. @param loop Whether the music loop or not.
  2357. @example
  2358. ```js
  2359. cc.resources.load(path, cc.AudioClip, null, function (err, clip) {
  2360. var audioID = cc.audioEngine.playEffect(clip, false);
  2361. });
  2362. ```
  2363. */
  2364. static playEffect(clip: AudioClip, loop: boolean): number;
  2365. /**
  2366. !#en Set the volume of effect audio.
  2367. !#zh 设置音效音量(0.0 ~ 1.0)。
  2368. @param volume Volume must be in 0.0~1.0.
  2369. @example
  2370. ```js
  2371. cc.audioEngine.setEffectsVolume(0.5);
  2372. ```
  2373. */
  2374. static setEffectsVolume(volume: number): void;
  2375. /**
  2376. !#en The volume of the effect audio max value is 1.0,the min value is 0.0 .
  2377. !#zh 获取音效音量(0.0 ~ 1.0)。
  2378. @example
  2379. ```js
  2380. var volume = cc.audioEngine.getEffectsVolume();
  2381. ```
  2382. */
  2383. static getEffectsVolume(): number;
  2384. /**
  2385. !#en Pause effect audio.
  2386. !#zh 暂停播放音效。
  2387. @param audioID audio id.
  2388. @example
  2389. ```js
  2390. cc.audioEngine.pauseEffect(audioID);
  2391. ```
  2392. */
  2393. static pauseEffect(audioID: number): void;
  2394. /**
  2395. !#en Stop playing all the sound effects.
  2396. !#zh 暂停播放所有音效。
  2397. @example
  2398. ```js
  2399. cc.audioEngine.pauseAllEffects();
  2400. ```
  2401. */
  2402. static pauseAllEffects(): void;
  2403. /**
  2404. !#en Resume effect audio.
  2405. !#zh 恢复播放音效音频。
  2406. @param audioID The return value of function play.
  2407. @example
  2408. ```js
  2409. cc.audioEngine.resumeEffect(audioID);
  2410. ```
  2411. */
  2412. static resumeEffect(audioID: number): void;
  2413. /**
  2414. !#en Resume all effect audio.
  2415. !#zh 恢复播放所有之前暂停的音效。
  2416. @example
  2417. ```js
  2418. cc.audioEngine.resumeAllEffects();
  2419. ```
  2420. */
  2421. static resumeAllEffects(): void;
  2422. /**
  2423. !#en Stop playing the effect audio.
  2424. !#zh 停止播放音效。
  2425. @param audioID audio id.
  2426. @example
  2427. ```js
  2428. cc.audioEngine.stopEffect(id);
  2429. ```
  2430. */
  2431. static stopEffect(audioID: number): void;
  2432. /**
  2433. !#en Stop playing all the effects.
  2434. !#zh 停止播放所有音效。
  2435. @example
  2436. ```js
  2437. cc.audioEngine.stopAllEffects();
  2438. ```
  2439. */
  2440. static stopAllEffects(): void;
  2441. }
  2442. /** !#en Class for animation data handling.
  2443. !#zh 动画剪辑,用于存储动画数据。 */
  2444. export class AnimationClip extends Asset {
  2445. /** !#en Duration of this animation.
  2446. !#zh 动画的持续时间。 */
  2447. duration: number;
  2448. /** !#en FrameRate of this animation.
  2449. !#zh 动画的帧速率。 */
  2450. sample: number;
  2451. /** !#en Speed of this animation.
  2452. !#zh 动画的播放速度。 */
  2453. speed: number;
  2454. /** !#en WrapMode of this animation.
  2455. !#zh 动画的循环模式。 */
  2456. wrapMode: WrapMode;
  2457. /** !#en Curve data.
  2458. !#zh 曲线数据。 */
  2459. curveData: any;
  2460. /** !#en Event data.
  2461. !#zh 事件数据。 */
  2462. events: {frame: number, func: string, params: string[]}[];
  2463. /**
  2464. !#en Crate clip with a set of sprite frames
  2465. !#zh 使用一组序列帧图片来创建动画剪辑
  2466. @param spriteFrames spriteFrames
  2467. @param sample sample
  2468. @example
  2469. ```js
  2470. var clip = cc.AnimationClip.createWithSpriteFrames(spriteFrames, 10);
  2471. ```
  2472. */
  2473. static createWithSpriteFrames(spriteFrames: SpriteFrame[], sample: number): AnimationClip;
  2474. }
  2475. /** !#en
  2476. The AnimationState gives full control over animation playback process.
  2477. In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
  2478. !#zh
  2479. AnimationState 完全控制动画播放过程。<br/>
  2480. 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。 */
  2481. export class AnimationState extends Playable {
  2482. /**
  2483. @param clip clip
  2484. @param name name
  2485. */
  2486. constructor(clip: AnimationClip, name?: string);
  2487. /** !#en The curves list.
  2488. !#zh 曲线列表。 */
  2489. curves: any[];
  2490. /** !#en The start delay which represents the number of seconds from an animation's start time to the start of
  2491. the active interval.
  2492. !#zh 延迟多少秒播放。 */
  2493. delay: number;
  2494. /** !#en The animation's iteration count property.
  2495. A real number greater than or equal to zero (including positive infinity) representing the number of times
  2496. to repeat the animation node.
  2497. Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
  2498. calculations.
  2499. !#zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半) */
  2500. repeatCount: number;
  2501. /** !#en The iteration duration of this animation in seconds. (length)
  2502. !#zh 单次动画的持续时间,秒。 */
  2503. duration: number;
  2504. /** !#en The animation's playback speed. 1 is normal playback speed.
  2505. !#zh 播放速率。 */
  2506. speed: number;
  2507. /** !#en
  2508. Wrapping mode of the playing animation.
  2509. Notice : dynamic change wrapMode will reset time and repeatCount property
  2510. !#zh
  2511. 动画循环方式。
  2512. 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount */
  2513. wrapMode: WrapMode;
  2514. /** !#en The current time of this animation in seconds.
  2515. !#zh 动画当前的时间,秒。 */
  2516. time: number;
  2517. /** !#en The clip that is being played by this animation state.
  2518. !#zh 此动画状态正在播放的剪辑。 */
  2519. clip: AnimationClip;
  2520. /** !#en The name of the playing animation.
  2521. !#zh 动画的名字 */
  2522. name: string;
  2523. }
  2524. /** !#en
  2525. This class provide easing methods for {{#crossLink "tween"}}{{/crossLink}} class.<br>
  2526. Demonstratio: https://easings.net/
  2527. !#zh
  2528. 缓动函数类,为 {{#crossLink "Tween"}}{{/crossLink}} 提供缓动效果函数。<br>
  2529. 函数效果演示: https://easings.net/ */
  2530. export class Easing {
  2531. /**
  2532. !#en Easing in with quadratic formula. From slow to fast.
  2533. !#zh 平方曲线缓入函数。运动由慢到快。
  2534. @param t The current time as a percentage of the total time.
  2535. */
  2536. quadIn(t: number): number;
  2537. /**
  2538. !#en Easing out with quadratic formula. From fast to slow.
  2539. !#zh 平方曲线缓出函数。运动由快到慢。
  2540. @param t The current time as a percentage of the total time.
  2541. */
  2542. quadOut(t: number): number;
  2543. /**
  2544. !#en Easing in and out with quadratic formula. From slow to fast, then back to slow.
  2545. !#zh 平方曲线缓入缓出函数。运动由慢到快再到慢。
  2546. @param t The current time as a percentage of the total time.
  2547. */
  2548. quadInOut(t: number): number;
  2549. /**
  2550. !#en Easing in with cubic formula. From slow to fast.
  2551. !#zh 立方曲线缓入函数。运动由慢到快。
  2552. @param t The current time as a percentage of the total time.
  2553. */
  2554. cubicIn(t: number): number;
  2555. /**
  2556. !#en Easing out with cubic formula. From slow to fast.
  2557. !#zh 立方曲线缓出函数。运动由快到慢。
  2558. @param t The current time as a percentage of the total time.
  2559. */
  2560. cubicOut(t: number): number;
  2561. /**
  2562. !#en Easing in and out with cubic formula. From slow to fast, then back to slow.
  2563. !#zh 立方曲线缓入缓出函数。运动由慢到快再到慢。
  2564. @param t The current time as a percentage of the total time.
  2565. */
  2566. cubicInOut(t: number): number;
  2567. /**
  2568. !#en Easing in with quartic formula. From slow to fast.
  2569. !#zh 四次方曲线缓入函数。运动由慢到快。
  2570. @param t The current time as a percentage of the total time.
  2571. */
  2572. quartIn(t: number): number;
  2573. /**
  2574. !#en Easing out with quartic formula. From fast to slow.
  2575. !#zh 四次方曲线缓出函数。运动由快到慢。
  2576. @param t The current time as a percentage of the total time.
  2577. */
  2578. quartOut(t: number): number;
  2579. /**
  2580. !#en Easing in and out with quartic formula. From slow to fast, then back to slow.
  2581. !#zh 四次方曲线缓入缓出函数。运动由慢到快再到慢。
  2582. @param t The current time as a percentage of the total time.
  2583. */
  2584. quartInOut(t: number): number;
  2585. /**
  2586. !#en Easing in with quintic formula. From slow to fast.
  2587. !#zh 五次方曲线缓入函数。运动由慢到快。
  2588. @param t The current time as a percentage of the total time.
  2589. */
  2590. quintIn(t: number): number;
  2591. /**
  2592. !#en Easing out with quintic formula. From fast to slow.
  2593. !#zh 五次方曲线缓出函数。运动由快到慢。
  2594. @param t The current time as a percentage of the total time.
  2595. */
  2596. quintOut(t: number): number;
  2597. /**
  2598. !#en Easing in and out with quintic formula. From slow to fast, then back to slow.
  2599. !#zh 五次方曲线缓入缓出函数。运动由慢到快再到慢。
  2600. @param t The current time as a percentage of the total time.
  2601. */
  2602. quintInOut(t: number): number;
  2603. /**
  2604. !#en Easing in and out with sine formula. From slow to fast.
  2605. !#zh 正弦曲线缓入函数。运动由慢到快。
  2606. @param t The current time as a percentage of the total time.
  2607. */
  2608. sineIn(t: number): number;
  2609. /**
  2610. !#en Easing in and out with sine formula. From fast to slow.
  2611. !#zh 正弦曲线缓出函数。运动由快到慢。
  2612. @param t The current time as a percentage of the total time.
  2613. */
  2614. sineOut(t: number): number;
  2615. /**
  2616. !#en Easing in and out with sine formula. From slow to fast, then back to slow.
  2617. !#zh 正弦曲线缓入缓出函数。运动由慢到快再到慢。
  2618. @param t The current time as a percentage of the total time.
  2619. */
  2620. sineInOut(t: number): number;
  2621. /**
  2622. !#en Easing in and out with exponential formula. From slow to fast.
  2623. !#zh 指数曲线缓入函数。运动由慢到快。
  2624. @param t The current time as a percentage of the total time.
  2625. */
  2626. expoIn(t: number): number;
  2627. /**
  2628. !#en Easing in and out with exponential formula. From fast to slow.
  2629. !#zh 指数曲线缓出函数。运动由快到慢。
  2630. @param t The current time as a percentage of the total time.
  2631. */
  2632. expoOut(t: number): number;
  2633. /**
  2634. !#en Easing in and out with exponential formula. From slow to fast.
  2635. !#zh 指数曲线缓入和缓出函数。运动由慢到很快再到慢。
  2636. @param t The current time as a percentage of the total time, then back to slow.
  2637. */
  2638. expoInOut(t: number): number;
  2639. /**
  2640. !#en Easing in and out with circular formula. From slow to fast.
  2641. !#zh 循环公式缓入函数。运动由慢到快。
  2642. @param t The current time as a percentage of the total time.
  2643. */
  2644. circIn(t: number): number;
  2645. /**
  2646. !#en Easing in and out with circular formula. From fast to slow.
  2647. !#zh 循环公式缓出函数。运动由快到慢。
  2648. @param t The current time as a percentage of the total time.
  2649. */
  2650. circOut(t: number): number;
  2651. /**
  2652. !#en Easing in and out with circular formula. From slow to fast.
  2653. !#zh 指数曲线缓入缓出函数。运动由慢到很快再到慢。
  2654. @param t The current time as a percentage of the total time, then back to slow.
  2655. */
  2656. circInOut(t: number): number;
  2657. /**
  2658. !#en Easing in action with a spring oscillating effect.
  2659. !#zh 弹簧回震效果的缓入函数。
  2660. @param t The current time as a percentage of the total time.
  2661. */
  2662. elasticIn(t: number): number;
  2663. /**
  2664. !#en Easing out action with a spring oscillating effect.
  2665. !#zh 弹簧回震效果的缓出函数。
  2666. @param t The current time as a percentage of the total time.
  2667. */
  2668. elasticOut(t: number): number;
  2669. /**
  2670. !#en Easing in and out action with a spring oscillating effect.
  2671. !#zh 弹簧回震效果的缓入缓出函数。
  2672. @param t The current time as a percentage of the total time.
  2673. */
  2674. elasticInOut(t: number): number;
  2675. /**
  2676. !#en Easing in action with "back up" behavior.
  2677. !#zh 回退效果的缓入函数。
  2678. @param t The current time as a percentage of the total time.
  2679. */
  2680. backIn(t: number): number;
  2681. /**
  2682. !#en Easing out action with "back up" behavior.
  2683. !#zh 回退效果的缓出函数。
  2684. @param t The current time as a percentage of the total time.
  2685. */
  2686. backOut(t: number): number;
  2687. /**
  2688. !#en Easing in and out action with "back up" behavior.
  2689. !#zh 回退效果的缓入缓出函数。
  2690. @param t The current time as a percentage of the total time.
  2691. */
  2692. backInOut(t: number): number;
  2693. /**
  2694. !#en Easing in action with bouncing effect.
  2695. !#zh 弹跳效果的缓入函数。
  2696. @param t The current time as a percentage of the total time.
  2697. */
  2698. bounceIn(t: number): number;
  2699. /**
  2700. !#en Easing out action with bouncing effect.
  2701. !#zh 弹跳效果的缓出函数。
  2702. @param t The current time as a percentage of the total time.
  2703. */
  2704. bounceOut(t: number): number;
  2705. /**
  2706. !#en Easing in and out action with bouncing effect.
  2707. !#zh 弹跳效果的缓入缓出函数。
  2708. @param t The current time as a percentage of the total time.
  2709. */
  2710. bounceInOut(t: number): number;
  2711. /**
  2712. !#en Target will run action with smooth effect.
  2713. !#zh 平滑效果函数。
  2714. @param t The current time as a percentage of the total time.
  2715. */
  2716. smooth(t: number): number;
  2717. /**
  2718. !#en Target will run action with fade effect.
  2719. !#zh 渐褪效果函数。
  2720. @param t The current time as a percentage of the total time.
  2721. */
  2722. fade(t: number): number;
  2723. }
  2724. /** !#en Specifies how time is treated when it is outside of the keyframe range of an Animation.
  2725. !#zh 动画使用的循环模式。 */
  2726. export enum WrapMode {
  2727. Default = 0,
  2728. Normal = 0,
  2729. Reverse = 0,
  2730. Loop = 0,
  2731. LoopReverse = 0,
  2732. PingPong = 0,
  2733. PingPongReverse = 0,
  2734. }
  2735. /** undefined */
  2736. export class Playable {
  2737. /** !#en Is playing or paused in play mode?
  2738. !#zh 当前是否正在播放。 */
  2739. isPlaying: boolean;
  2740. /** !#en Is currently paused? This can be true even if in edit mode(isPlaying == false).
  2741. !#zh 当前是否正在暂停 */
  2742. isPaused: boolean;
  2743. /**
  2744. !#en Play this animation.
  2745. !#zh 播放动画。
  2746. */
  2747. play(): void;
  2748. /**
  2749. !#en Stop this animation.
  2750. !#zh 停止动画播放。
  2751. */
  2752. stop(): void;
  2753. /**
  2754. !#en Pause this animation.
  2755. !#zh 暂停动画。
  2756. */
  2757. pause(): void;
  2758. /**
  2759. !#en Resume this animation.
  2760. !#zh 重新播放动画。
  2761. */
  2762. resume(): void;
  2763. /**
  2764. !#en Perform a single frame step.
  2765. !#zh 执行一帧动画。
  2766. */
  2767. step(): void;
  2768. }
  2769. /** !#en An object to boot the game.
  2770. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  2771. export class debug {
  2772. /**
  2773. !#en Gets error message with the error id and possible parameters.
  2774. !#zh 通过 error id 和必要的参数来获取错误信息。
  2775. @param errorId errorId
  2776. @param param param
  2777. */
  2778. static getError(errorId: number, param?: any): string;
  2779. /**
  2780. !#en Returns whether or not to display the FPS informations.
  2781. !#zh 是否显示 FPS 信息。
  2782. */
  2783. static isDisplayStats(): boolean;
  2784. /**
  2785. !#en Sets whether display the FPS on the bottom-left corner.
  2786. !#zh 设置是否在左下角显示 FPS。
  2787. @param displayStats displayStats
  2788. */
  2789. static setDisplayStats(displayStats: boolean): void;
  2790. }
  2791. /** !#en
  2792. <p>
  2793. ATTENTION: USE cc.director INSTEAD OF cc.Director.<br/>
  2794. cc.director is a singleton object which manage your game's logic flow.<br/>
  2795. Since the cc.director is a singleton, you don't need to call any constructor or create functions,<br/>
  2796. the standard way to use it is by calling:<br/>
  2797. - cc.director.methodName(); <br/>
  2798. It creates and handle the main Window and manages how and when to execute the Scenes.<br/>
  2799. <br/>
  2800. The cc.director is also responsible for:<br/>
  2801. - initializing the OpenGL context<br/>
  2802. - setting the OpenGL pixel format (default on is RGB565)<br/>
  2803. - setting the OpenGL buffer depth (default on is 0-bit)<br/>
  2804. - setting the color for clear screen (default one is BLACK)<br/>
  2805. - setting the projection (default one is 3D)<br/>
  2806. - setting the orientation (default one is Portrait)<br/>
  2807. <br/>
  2808. <br/>
  2809. The cc.director also sets the default OpenGL context:<br/>
  2810. - GL_TEXTURE_2D is enabled<br/>
  2811. - GL_VERTEX_ARRAY is enabled<br/>
  2812. - GL_COLOR_ARRAY is enabled<br/>
  2813. - GL_TEXTURE_COORD_ARRAY is enabled<br/>
  2814. </p>
  2815. <p>
  2816. cc.director also synchronizes timers with the refresh rate of the display.<br/>
  2817. Features and Limitations:<br/>
  2818. - Scheduled timers & drawing are synchronizes with the refresh rate of the display<br/>
  2819. - Only supports animation intervals of 1/60 1/30 & 1/15<br/>
  2820. </p>
  2821. !#zh
  2822. <p>
  2823. 注意:用 cc.director 代替 cc.Director。<br/>
  2824. cc.director 一个管理你的游戏的逻辑流程的单例对象。<br/>
  2825. 由于 cc.director 是一个单例,你不需要调用任何构造函数或创建函数,<br/>
  2826. 使用它的标准方法是通过调用:<br/>
  2827. - cc.director.methodName();
  2828. <br/>
  2829. 它创建和处理主窗口并且管理什么时候执行场景。<br/>
  2830. <br/>
  2831. cc.director 还负责:<br/>
  2832. - 初始化 OpenGL 环境。<br/>
  2833. - 设置OpenGL像素格式。(默认是 RGB565)<br/>
  2834. - 设置OpenGL缓冲区深度 (默认是 0-bit)<br/>
  2835. - 设置空白场景的颜色 (默认是 黑色)<br/>
  2836. - 设置投影 (默认是 3D)<br/>
  2837. - 设置方向 (默认是 Portrait)<br/>
  2838. <br/>
  2839. cc.director 设置了 OpenGL 默认环境 <br/>
  2840. - GL_TEXTURE_2D 启用。<br/>
  2841. - GL_VERTEX_ARRAY 启用。<br/>
  2842. - GL_COLOR_ARRAY 启用。<br/>
  2843. - GL_TEXTURE_COORD_ARRAY 启用。<br/>
  2844. </p>
  2845. <p>
  2846. cc.director 也同步定时器与显示器的刷新速率。
  2847. <br/>
  2848. 特点和局限性: <br/>
  2849. - 将计时器 & 渲染与显示器的刷新频率同步。<br/>
  2850. - 只支持动画的间隔 1/60 1/30 & 1/15。<br/>
  2851. </p> */
  2852. export class Director extends EventTarget {
  2853. /**
  2854. !#en
  2855. Converts a view coordinate to an WebGL coordinate<br/>
  2856. Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)<br/>
  2857. Implementation can be found in CCDirectorWebGL.
  2858. !#zh 将触摸点的屏幕坐标转换为 WebGL View 下的坐标。
  2859. @param uiPoint uiPoint
  2860. */
  2861. convertToGL(uiPoint: Vec2): Vec2;
  2862. /**
  2863. !#en
  2864. Converts an OpenGL coordinate to a view coordinate<br/>
  2865. Useful to convert node points to window points for calls such as glScissor<br/>
  2866. Implementation can be found in CCDirectorWebGL.
  2867. !#zh 将触摸点的 WebGL View 坐标转换为屏幕坐标。
  2868. @param glPoint glPoint
  2869. */
  2870. convertToUI(glPoint: Vec2): Vec2;
  2871. /**
  2872. End the life of director in the next frame
  2873. */
  2874. end(): void;
  2875. /**
  2876. !#en
  2877. Returns the size of the WebGL view in points.<br/>
  2878. It takes into account any possible rotation (device orientation) of the window.
  2879. !#zh 获取视图的大小,以点为单位。
  2880. */
  2881. getWinSize(): Size;
  2882. /**
  2883. !#en
  2884. Returns the size of the OpenGL view in pixels.<br/>
  2885. It takes into account any possible rotation (device orientation) of the window.<br/>
  2886. On Mac winSize and winSizeInPixels return the same value.
  2887. (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())
  2888. !#zh
  2889. 获取视图大小,以像素为单位(这里的像素指的是资源分辨率。
  2890. 如果要获取屏幕物理分辨率,需要用 cc.view.getFrameSize())
  2891. */
  2892. getWinSizeInPixels(): Size;
  2893. /**
  2894. !#en Pause the director's ticker, only involve the game logic execution.
  2895. It won't pause the rendering process nor the event manager.
  2896. If you want to pause the entier game including rendering, audio and event,
  2897. please use {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}
  2898. !#zh 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应。
  2899. 如果想要更彻底得暂停游戏,包含渲染,音频和事件,请使用 {{#crossLink "Game.pause"}}cc.game.pause{{/crossLink}}。
  2900. */
  2901. pause(): void;
  2902. /**
  2903. !#en
  2904. Run a scene. Replaces the running scene with a new one or enter the first scene.<br/>
  2905. The new scene will be launched immediately.
  2906. !#zh 立刻切换指定场景。
  2907. @param scene The need run scene.
  2908. @param onBeforeLoadScene The function invoked at the scene before loading.
  2909. @param onLaunched The function invoked at the scene after launch.
  2910. */
  2911. runSceneImmediate(scene: Scene|SceneAsset, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  2912. /**
  2913. !#en
  2914. Run a scene. Replaces the running scene with a new one or enter the first scene.
  2915. The new scene will be launched at the end of the current frame.
  2916. !#zh 运行指定场景。
  2917. @param scene The need run scene.
  2918. @param onBeforeLoadScene The function invoked at the scene before loading.
  2919. @param onLaunched The function invoked at the scene after launch.
  2920. */
  2921. runScene(scene: Scene|SceneAsset, onBeforeLoadScene?: Function, onLaunched?: Function): void;
  2922. /**
  2923. !#en Loads the scene by its name.
  2924. !#zh 通过场景名称进行加载场景。
  2925. @param sceneName The name of the scene to load.
  2926. @param onLaunched callback, will be called after scene launched.
  2927. */
  2928. loadScene(sceneName: string, onLaunched?: Function): boolean;
  2929. /**
  2930. !#en
  2931. Preloads the scene to reduces loading time. You can call this method at any time you want.
  2932. After calling this method, you still need to launch the scene by `cc.director.loadScene`.
  2933. It will be totally fine to call `cc.director.loadScene` at any time even if the preloading is not
  2934. yet finished, the scene will be launched after loaded automatically.
  2935. !#zh 预加载场景,你可以在任何时候调用这个方法。
  2936. 调用完后,你仍然需要通过 `cc.director.loadScene` 来启动场景,因为这个方法不会执行场景加载操作。
  2937. 就算预加载还没完成,你也可以直接调用 `cc.director.loadScene`,加载完成后场景就会启动。
  2938. @param sceneName The name of the scene to preload.
  2939. @param onProgress callback, will be called when the load progression change.
  2940. @param onLoaded callback, will be called after scene loaded.
  2941. */
  2942. preloadScene(sceneName: string, onProgress?: (completedCount: number, totalCount: number, item: any) => void, onLoaded?: (error: Error) => void): void;
  2943. /**
  2944. !#en Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
  2945. !#zh 恢复暂停场景的游戏逻辑,如果当前场景没有暂停将没任何事情发生。
  2946. */
  2947. resume(): void;
  2948. /**
  2949. !#en
  2950. Enables or disables WebGL depth test.<br/>
  2951. Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
  2952. !#zh 启用/禁用深度测试(在 Canvas 渲染模式下不会生效)。
  2953. @param on on
  2954. */
  2955. setDepthTest(on: boolean): void;
  2956. /**
  2957. !#en
  2958. Set color for clear screen.<br/>
  2959. (Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js)
  2960. !#zh
  2961. 设置场景的默认擦除颜色。<br/>
  2962. 支持全透明,但不支持透明度为中间值。要支持全透明需手工开启 cc.macro.ENABLE_TRANSPARENT_CANVAS。
  2963. @param clearColor clearColor
  2964. */
  2965. setClearColor(clearColor: Color): void;
  2966. /**
  2967. !#en Returns current logic Scene.
  2968. !#zh 获取当前逻辑场景。
  2969. @example
  2970. ```js
  2971. // This will help you to get the Canvas node in scene
  2972. cc.director.getScene().getChildByName('Canvas');
  2973. ```
  2974. */
  2975. getScene(): Scene;
  2976. /**
  2977. !#en Returns the FPS value. Please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} to control animation interval.
  2978. !#zh 获取单位帧执行时间。请使用 {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}} 来控制游戏帧率。
  2979. */
  2980. getAnimationInterval(): number;
  2981. /**
  2982. Sets animation interval, this doesn't control the main loop.
  2983. To control the game's frame rate overall, please use {{#crossLink "Game.setFrameRate"}}cc.game.setFrameRate{{/crossLink}}
  2984. @param value The animation interval desired.
  2985. */
  2986. setAnimationInterval(value: number): void;
  2987. /**
  2988. !#en Returns the delta time since last frame.
  2989. !#zh 获取上一帧的增量时间。
  2990. */
  2991. getDeltaTime(): number;
  2992. /**
  2993. !#en Returns the total passed time since game start, unit: ms
  2994. !#zh 获取从游戏开始到现在总共经过的时间,单位为 ms
  2995. */
  2996. getTotalTime(): number;
  2997. /**
  2998. !#en Returns how many frames were called since the director started.
  2999. !#zh 获取 director 启动以来游戏运行的总帧数。
  3000. */
  3001. getTotalFrames(): number;
  3002. /**
  3003. !#en Returns whether or not the Director is paused.
  3004. !#zh 是否处于暂停状态。
  3005. */
  3006. isPaused(): boolean;
  3007. /**
  3008. !#en Returns the cc.Scheduler associated with this director.
  3009. !#zh 获取和 director 相关联的 cc.Scheduler。
  3010. */
  3011. getScheduler(): Scheduler;
  3012. /**
  3013. !#en Sets the cc.Scheduler associated with this director.
  3014. !#zh 设置和 director 相关联的 cc.Scheduler。
  3015. @param scheduler scheduler
  3016. */
  3017. setScheduler(scheduler: Scheduler): void;
  3018. /**
  3019. !#en Returns the cc.ActionManager associated with this director.
  3020. !#zh 获取和 director 相关联的 cc.ActionManager(动作管理器)。
  3021. */
  3022. getActionManager(): ActionManager;
  3023. /**
  3024. !#en Sets the cc.ActionManager associated with this director.
  3025. !#zh 设置和 director 相关联的 cc.ActionManager(动作管理器)。
  3026. @param actionManager actionManager
  3027. */
  3028. setActionManager(actionManager: ActionManager): void;
  3029. /**
  3030. !#en Returns the cc.CollisionManager associated with this director.
  3031. !#zh 获取和 director 相关联的 cc.CollisionManager (碰撞管理器)。
  3032. */
  3033. getCollisionManager(): CollisionManager;
  3034. /**
  3035. !#en Returns the cc.PhysicsManager associated with this director.
  3036. !#zh 返回与 director 相关联的 cc.PhysicsManager (物理管理器)。
  3037. */
  3038. getPhysicsManager(): PhysicsManager;
  3039. /**
  3040. !#en Returns the cc.Physics3DManager associated with this director.
  3041. !#zh 返回与 director 相关联的 cc.Physics3DManager (物理管理器)。
  3042. */
  3043. getPhysics3DManager(): Physics3DManager;
  3044. /** !#en The event projection changed of cc.Director. This event will not get triggered since v2.0
  3045. !#zh cc.Director 投影变化的事件。从 v2.0 开始这个事件不会再被触发 */
  3046. static EVENT_PROJECTION_CHANGED: string;
  3047. /** !#en The event which will be triggered before loading a new scene.
  3048. !#zh 加载新场景之前所触发的事件。 */
  3049. static EVENT_BEFORE_SCENE_LOADING: string;
  3050. /** !#en The event which will be triggered before launching a new scene.
  3051. !#zh 运行新场景之前所触发的事件。 */
  3052. static EVENT_BEFORE_SCENE_LAUNCH: string;
  3053. /** !#en The event which will be triggered after launching a new scene.
  3054. !#zh 运行新场景之后所触发的事件。 */
  3055. static EVENT_AFTER_SCENE_LAUNCH: string;
  3056. /** !#en The event which will be triggered at the beginning of every frame.
  3057. !#zh 每个帧的开始时所触发的事件。 */
  3058. static EVENT_BEFORE_UPDATE: string;
  3059. /** !#en The event which will be triggered after engine and components update logic.
  3060. !#zh 将在引擎和组件 “update” 逻辑之后所触发的事件。 */
  3061. static EVENT_AFTER_UPDATE: string;
  3062. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  3063. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  3064. static EVENT_BEFORE_VISIT: string;
  3065. /** !#en The event is deprecated since v2.0, please use cc.Director.EVENT_BEFORE_DRAW instead
  3066. !#zh 这个事件从 v2.0 开始被废弃,请直接使用 cc.Director.EVENT_BEFORE_DRAW */
  3067. static EVENT_AFTER_VISIT: string;
  3068. /** !#en The event which will be triggered before the rendering process.
  3069. !#zh 渲染过程之前所触发的事件。 */
  3070. static EVENT_BEFORE_DRAW: string;
  3071. /** !#en The event which will be triggered after the rendering process.
  3072. !#zh 渲染过程之后所触发的事件。 */
  3073. static EVENT_AFTER_DRAW: string;
  3074. /** Constant for 2D projection (orthogonal projection) */
  3075. static PROJECTION_2D: number;
  3076. /** Constant for 3D projection with a fovy=60, znear=0.5f and zfar=1500. */
  3077. static PROJECTION_3D: number;
  3078. /** Constant for custom projection, if cc.Director's projection set to it, it calls "updateProjection" on the projection delegate. */
  3079. static PROJECTION_CUSTOM: number;
  3080. /** Constant for default projection of cc.Director, default projection is 2D projection */
  3081. static PROJECTION_DEFAULT: number;
  3082. }
  3083. /** !#en An object to boot the game.
  3084. !#zh 包含游戏主体信息并负责驱动游戏的游戏对象。 */
  3085. export class Game extends EventTarget {
  3086. /** !#en Event triggered when game hide to background.
  3087. Please note that this event is not 100% guaranteed to be fired on Web platform,
  3088. on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
  3089. !#zh 游戏进入后台时触发的事件。
  3090. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  3091. 在原生平台,它对应的是应用被切换到后台事件,下拉菜单和上拉状态栏等不一定会触发这个事件,这取决于系统行为。 */
  3092. EVENT_HIDE: string;
  3093. /** !#en Event triggered when game back to foreground
  3094. Please note that this event is not 100% guaranteed to be fired on Web platform,
  3095. on native platforms, it corresponds to enter foreground event.
  3096. !#zh 游戏进入前台运行时触发的事件。
  3097. 请注意,在 WEB 平台,这个事件不一定会 100% 触发,这完全取决于浏览器的回调行为。
  3098. 在原生平台,它对应的是应用被切换到前台事件。 */
  3099. EVENT_SHOW: string;
  3100. /** !#en Event triggered when game restart
  3101. !#zh 调用restart后,触发事件。 */
  3102. EVENT_RESTART: string;
  3103. /** Event triggered after game inited, at this point all engine objects and game scripts are loaded */
  3104. EVENT_GAME_INITED: string;
  3105. /** Event triggered after engine inited, at this point you will be able to use all engine classes.
  3106. It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0 */
  3107. EVENT_ENGINE_INITED: string;
  3108. /** Web Canvas 2d API as renderer backend */
  3109. RENDER_TYPE_CANVAS: number;
  3110. /** WebGL API as renderer backend */
  3111. RENDER_TYPE_WEBGL: number;
  3112. /** OpenGL API as renderer backend */
  3113. RENDER_TYPE_OPENGL: number;
  3114. /** !#en The outer frame of the game canvas, parent of game container.
  3115. !#zh 游戏画布的外框,container 的父容器。 */
  3116. frame: any;
  3117. /** !#en The container of game canvas.
  3118. !#zh 游戏画布的容器。 */
  3119. container: HTMLDivElement;
  3120. /** !#en The canvas of the game.
  3121. !#zh 游戏的画布。 */
  3122. canvas: HTMLCanvasElement;
  3123. /** !#en The renderer backend of the game.
  3124. !#zh 游戏的渲染器类型。 */
  3125. renderType: number;
  3126. /** !#en
  3127. The current game configuration, including:<br/>
  3128. 1. debugMode<br/>
  3129. "debugMode" possible values :<br/>
  3130. 0 - No message will be printed. <br/>
  3131. 1 - cc.error, cc.assert, cc.warn, cc.log will print in console. <br/>
  3132. 2 - cc.error, cc.assert, cc.warn will print in console. <br/>
  3133. 3 - cc.error, cc.assert will print in console. <br/>
  3134. 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.<br/>
  3135. 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web. <br/>
  3136. 6 - cc.error, cc.assert will print on canvas, available only on web. <br/>
  3137. 2. showFPS<br/>
  3138. Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.<br/>
  3139. 3. exposeClassName<br/>
  3140. Expose class name to chrome debug tools, the class intantiate performance is a little bit slower when exposed.<br/>
  3141. 4. frameRate<br/>
  3142. "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.<br/>
  3143. 5. id<br/>
  3144. "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.<br/>
  3145. 6. renderMode<br/>
  3146. "renderMode" sets the renderer type, only useful on web :<br/>
  3147. 0 - Automatically chosen by engine<br/>
  3148. 1 - Forced to use canvas renderer<br/>
  3149. 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers<br/>
  3150. <br/>
  3151. Please DO NOT modify this object directly, it won't have any effect.<br/>
  3152. !#zh
  3153. 当前的游戏配置,包括: <br/>
  3154. 1. debugMode(debug 模式,但是在浏览器中这个选项会被忽略) <br/>
  3155. "debugMode" 各种设置选项的意义。 <br/>
  3156. 0 - 没有消息被打印出来。 <br/>
  3157. 1 - cc.error,cc.assert,cc.warn,cc.log 将打印在 console 中。 <br/>
  3158. 2 - cc.error,cc.assert,cc.warn 将打印在 console 中。 <br/>
  3159. 3 - cc.error,cc.assert 将打印在 console 中。 <br/>
  3160. 4 - cc.error,cc.assert,cc.warn,cc.log 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3161. 5 - cc.error,cc.assert,cc.warn 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3162. 6 - cc.error,cc.assert 将打印在 canvas 中(仅适用于 web 端)。 <br/>
  3163. 2. showFPS(显示 FPS) <br/>
  3164. 当 showFPS 为 true 的时候界面的左下角将显示 fps 的信息,否则被隐藏。 <br/>
  3165. 3. exposeClassName <br/>
  3166. 暴露类名让 Chrome DevTools 可以识别,如果开启会稍稍降低类的创建过程的性能,但对对象构造没有影响。 <br/>
  3167. 4. frameRate (帧率) <br/>
  3168. “frameRate” 设置想要的帧率你的游戏,但真正的FPS取决于你的游戏实现和运行环境。 <br/>
  3169. 5. id <br/>
  3170. "gameCanvas" Web 页面上的 Canvas Element ID,仅适用于 web 端。 <br/>
  3171. 6. renderMode(渲染模式) <br/>
  3172. “renderMode” 设置渲染器类型,仅适用于 web 端: <br/>
  3173. 0 - 通过引擎自动选择。 <br/>
  3174. 1 - 强制使用 canvas 渲染。
  3175. 2 - 强制使用 WebGL 渲染,但是在部分 Android 浏览器中这个选项会被忽略。 <br/>
  3176. <br/>
  3177. 注意:请不要直接修改这个对象,它不会有任何效果。 */
  3178. config: any;
  3179. /**
  3180. !#en Callback when the scripts of engine have been load.
  3181. !#zh 当引擎完成启动后的回调函数。
  3182. */
  3183. onStart(): void;
  3184. /**
  3185. !#en Set frame rate of game.
  3186. !#zh 设置游戏帧率。
  3187. @param frameRate frameRate
  3188. */
  3189. setFrameRate(frameRate: number): void;
  3190. /**
  3191. !#en Get frame rate set for the game, it doesn't represent the real frame rate.
  3192. !#zh 获取设置的游戏帧率(不等同于实际帧率)。
  3193. */
  3194. getFrameRate(): number;
  3195. /**
  3196. !#en Run the game frame by frame.
  3197. !#zh 执行一帧游戏循环。
  3198. */
  3199. step(): void;
  3200. /**
  3201. !#en Pause the game main loop. This will pause:
  3202. game logic execution, rendering process, event manager, background music and all audio effects.
  3203. This is different with cc.director.pause which only pause the game logic execution.
  3204. !#zh 暂停游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。这点和只暂停游戏逻辑的 cc.director.pause 不同。
  3205. */
  3206. pause(): void;
  3207. /**
  3208. !#en Resume the game from pause. This will resume:
  3209. game logic execution, rendering process, event manager, background music and all audio effects.
  3210. !#zh 恢复游戏主循环。包含:游戏逻辑,渲染,事件处理,背景音乐和所有音效。
  3211. */
  3212. resume(): void;
  3213. /**
  3214. !#en Check whether the game is paused.
  3215. !#zh 判断游戏是否暂停。
  3216. */
  3217. isPaused(): boolean;
  3218. /**
  3219. !#en Restart game.
  3220. !#zh 重新开始游戏
  3221. */
  3222. restart(): void;
  3223. /**
  3224. !#en End game, it will close the game window
  3225. !#zh 退出游戏
  3226. */
  3227. end(): void;
  3228. /**
  3229. !#en
  3230. Register an callback of a specific event type on the game object.
  3231. This type of event should be triggered via `emit`.
  3232. !#zh
  3233. 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  3234. @param type A string representing the event type to listen for.
  3235. @param callback The callback that will be invoked when the event is dispatched.
  3236. The callback is ignored if it is a duplicate (the callbacks are unique).
  3237. @param target The target (this object) to invoke the callback, can be null
  3238. */
  3239. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3240. /**
  3241. !#en
  3242. Register an callback of a specific event type on the game object,
  3243. the callback will remove itself after the first time it is triggered.
  3244. !#zh
  3245. 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3246. @param type A string representing the event type to listen for.
  3247. @param callback The callback that will be invoked when the event is dispatched.
  3248. The callback is ignored if it is a duplicate (the callbacks are unique).
  3249. @param target The target (this object) to invoke the callback, can be null
  3250. */
  3251. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  3252. /**
  3253. !#en Prepare game.
  3254. !#zh 准备引擎,请不要直接调用这个函数。
  3255. @param cb cb
  3256. */
  3257. prepare(cb: Function): void;
  3258. /**
  3259. !#en Run game with configuration object and onStart function.
  3260. !#zh 运行游戏,并且指定引擎配置和 onStart 的回调。
  3261. @param config Pass configuration object or onStart function
  3262. @param onStart function to be executed after game initialized
  3263. */
  3264. run(config: any, onStart: Function): void;
  3265. /**
  3266. !#en
  3267. Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.<br/>
  3268. The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
  3269. !#zh
  3270. 声明常驻根节点,该节点不会被在场景切换中被销毁。<br/>
  3271. 目标节点必须位于为层级的根节点,否则无效。
  3272. @param node The node to be made persistent
  3273. */
  3274. addPersistRootNode(node: Node): void;
  3275. /**
  3276. !#en Remove a persistent root node.
  3277. !#zh 取消常驻根节点。
  3278. @param node The node to be removed from persistent node list
  3279. */
  3280. removePersistRootNode(node: Node): void;
  3281. /**
  3282. !#en Check whether the node is a persistent root node.
  3283. !#zh 检查节点是否是常驻根节点。
  3284. @param node The node to be checked
  3285. */
  3286. isPersistRootNode(node: Node): boolean;
  3287. }
  3288. /** !#en
  3289. Class of all entities in Cocos Creator scenes.<br/>
  3290. For events supported by Node, please refer to {{#crossLink "Node.EventType"}}{{/crossLink}}
  3291. !#zh
  3292. Cocos Creator 场景中的所有节点类。<br/>
  3293. 支持的节点事件,请参阅 {{#crossLink "Node.EventType"}}{{/crossLink}}。 */
  3294. export class Node extends _BaseNode {
  3295. /** !#en
  3296. Group index of node.<br/>
  3297. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  3298. !#zh
  3299. 节点的分组索引。<br/>
  3300. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  3301. groupIndex: number;
  3302. /** !#en
  3303. Group of node.<br/>
  3304. Which Group this node belongs to will resolve that this node's collision components can collide with which other collision componentns.<br/>
  3305. !#zh
  3306. 节点的分组。<br/>
  3307. 节点的分组将关系到节点的碰撞组件可以与哪些碰撞组件相碰撞。<br/> */
  3308. group: string;
  3309. /** !#en The position (x, y) of the node in its parent's coordinates.
  3310. !#zh 节点在父节点坐标系中的位置(x, y)。 */
  3311. position: Vec3;
  3312. /** !#en x axis position of node.
  3313. !#zh 节点 X 轴坐标。 */
  3314. x: number;
  3315. /** !#en y axis position of node.
  3316. !#zh 节点 Y 轴坐标。 */
  3317. y: number;
  3318. /** !#en z axis position of node.
  3319. !#zh 节点 Z 轴坐标。 */
  3320. z: number;
  3321. /** !#en Rotation of node.
  3322. !#zh 该节点旋转角度。 */
  3323. rotation: number;
  3324. /** !#en
  3325. Angle of node, the positive value is anti-clockwise direction.
  3326. !#zh
  3327. 该节点的旋转角度,正值为逆时针方向。 */
  3328. angle: number;
  3329. /** !#en The rotation as Euler angles in degrees, used in 3D node.
  3330. !#zh 该节点的欧拉角度,用于 3D 节点。 */
  3331. eulerAngles: Vec3;
  3332. /** !#en Rotation on x axis.
  3333. !#zh 该节点 X 轴旋转角度。 */
  3334. rotationX: number;
  3335. /** !#en Rotation on y axis.
  3336. !#zh 该节点 Y 轴旋转角度。 */
  3337. rotationY: number;
  3338. /** !#en The local scale relative to the parent.
  3339. !#zh 节点相对父节点的缩放。 */
  3340. scale: number;
  3341. /** !#en Scale on x axis.
  3342. !#zh 节点 X 轴缩放。 */
  3343. scaleX: number;
  3344. /** !#en Scale on y axis.
  3345. !#zh 节点 Y 轴缩放。 */
  3346. scaleY: number;
  3347. /** !#en Scale on z axis.
  3348. !#zh 节点 Z 轴缩放。 */
  3349. scaleZ: number;
  3350. /** !#en Skew x
  3351. !#zh 该节点 X 轴倾斜角度。 */
  3352. skewX: number;
  3353. /** !#en Skew y
  3354. !#zh 该节点 Y 轴倾斜角度。 */
  3355. skewY: number;
  3356. /** !#en Opacity of node, default value is 255.
  3357. !#zh 节点透明度,默认值为 255。 */
  3358. opacity: number;
  3359. /** !#en Color of node, default value is white: (255, 255, 255).
  3360. !#zh 节点颜色。默认为白色,数值为:(255,255,255)。 */
  3361. color: Color;
  3362. /** !#en Anchor point's position on x axis.
  3363. !#zh 节点 X 轴锚点位置。 */
  3364. anchorX: number;
  3365. /** !#en Anchor point's position on y axis.
  3366. !#zh 节点 Y 轴锚点位置。 */
  3367. anchorY: number;
  3368. /** !#en Width of node.
  3369. !#zh 节点宽度。 */
  3370. width: number;
  3371. /** !#en Height of node.
  3372. !#zh 节点高度。 */
  3373. height: number;
  3374. /** !#en zIndex is the 'key' used to sort the node relative to its siblings.<br/>
  3375. The value of zIndex should be in the range between cc.macro.MIN_ZINDEX and cc.macro.MAX_ZINDEX.<br/>
  3376. The Node's parent will sort all its children based on the zIndex value and the arrival order.<br/>
  3377. Nodes with greater zIndex will be sorted after nodes with smaller zIndex.<br/>
  3378. 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/>
  3379. Node's order in children list will affect its rendering order. Parent is always rendering before all children.
  3380. !#zh zIndex 是用来对节点进行排序的关键属性,它决定一个节点在兄弟节点之间的位置。<br/>
  3381. zIndex 的取值应该介于 cc.macro.MIN_ZINDEX 和 cc.macro.MAX_ZINDEX 之间
  3382. 父节点主要根据节点的 zIndex 和添加次序来排序,拥有更高 zIndex 的节点将被排在后面,如果两个节点的 zIndex 一致,先添加的节点会稳定排在另一个节点之前。<br/>
  3383. 节点在 children 中的顺序决定了其渲染顺序。父节点永远在所有子节点之前被渲染 */
  3384. zIndex: number;
  3385. /** !#en
  3386. Switch 2D/3D node. The 2D nodes will run faster.
  3387. !#zh
  3388. 切换 2D/3D 节点,2D 节点会有更高的运行效率 */
  3389. is3DNode: boolean;
  3390. /** !#en Returns a normalized vector representing the up direction (Y axis) of the node in world space.
  3391. !#zh 获取节点正上方(y 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3392. up: Vec3;
  3393. /** !#en Returns a normalized vector representing the right direction (X axis) of the node in world space.
  3394. !#zh 获取节点正右方(x 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3395. right: Vec3;
  3396. /** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
  3397. !#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
  3398. forward: Vec3;
  3399. /**
  3400. @param name name
  3401. */
  3402. constructor(name?: string);
  3403. /**
  3404. !#en
  3405. Register a callback of a specific event type on Node.<br/>
  3406. Use this method to register touch or mouse event permit propagation based on scene graph,<br/>
  3407. These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:<br/>
  3408. 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target<br/>
  3409. 2. At target phase: dispatch to the listeners of the real target<br/>
  3410. 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root<br/>
  3411. In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.<br/>
  3412. It's the recommended way to register touch/mouse event for Node,<br/>
  3413. please do not use cc.eventManager directly for Node.<br/>
  3414. You can also register custom event and use `emit` to trigger custom event on Node.<br/>
  3415. 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/>
  3416. You can also pass event callback parameters with `emit` by passing parameters after `type`.
  3417. !#zh
  3418. 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。<br/>
  3419. 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:<br/>
  3420. 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。<br/>
  3421. 2. 目标阶段:派发给目标节点的监听器。<br/>
  3422. 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发直到根节点。<br/>
  3423. 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>
  3424. 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。<br/>
  3425. 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器<br/>
  3426. 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
  3427. @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.
  3428. @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).
  3429. @param target The target (this object) to invoke the callback, can be null
  3430. @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.
  3431. @example
  3432. ```js
  3433. this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
  3434. node.on(cc.Node.EventType.TOUCH_START, callback, this);
  3435. node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
  3436. node.on(cc.Node.EventType.TOUCH_END, callback, this);
  3437. node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
  3438. node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3439. node.on(cc.Node.EventType.COLOR_CHANGED, callback);
  3440. ```
  3441. */
  3442. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3443. /**
  3444. !#en
  3445. Register an callback of a specific event type on the Node,
  3446. the callback will remove itself after the first time it is triggered.
  3447. !#zh
  3448. 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
  3449. @param type A string representing the event type to listen for.
  3450. @param callback The callback that will be invoked when the event is dispatched.
  3451. The callback is ignored if it is a duplicate (the callbacks are unique).
  3452. @param target The target (this object) to invoke the callback, can be null
  3453. @example
  3454. ```js
  3455. node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
  3456. ```
  3457. */
  3458. once<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  3459. /**
  3460. !#en
  3461. Removes the callback previously registered with the same type, callback, target and or useCapture.
  3462. This method is merely an alias to removeEventListener.
  3463. !#zh 删除之前与同类型,回调,目标或 useCapture 注册的回调。
  3464. @param type A string representing the event type being removed.
  3465. @param callback The callback to remove.
  3466. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  3467. @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.
  3468. @example
  3469. ```js
  3470. this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
  3471. node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
  3472. node.off(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
  3473. ```
  3474. */
  3475. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  3476. /**
  3477. !#en Removes all callbacks previously registered with the same target.
  3478. !#zh 移除目标上的所有注册事件。
  3479. @param target The target to be searched for all related callbacks
  3480. @example
  3481. ```js
  3482. node.targetOff(target);
  3483. ```
  3484. */
  3485. targetOff(target: any): void;
  3486. /**
  3487. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  3488. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  3489. @param type The type of event.
  3490. */
  3491. hasEventListener(type: string): boolean;
  3492. /**
  3493. !#en
  3494. Trigger an event directly with the event name and necessary arguments.
  3495. !#zh
  3496. 通过事件名发送自定义事件
  3497. @param type event type
  3498. @param arg1 First argument in callback
  3499. @param arg2 Second argument in callback
  3500. @param arg3 Third argument in callback
  3501. @param arg4 Fourth argument in callback
  3502. @param arg5 Fifth argument in callback
  3503. @example
  3504. ```js
  3505. eventTarget.emit('fire', event);
  3506. eventTarget.emit('fire', message, emitter);
  3507. ```
  3508. */
  3509. emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  3510. /**
  3511. !#en
  3512. Dispatches an event into the event flow.
  3513. The event target is the EventTarget object upon which the dispatchEvent() method is called.
  3514. !#zh 分发事件到事件流中。
  3515. @param event The Event object that is dispatched into the event flow
  3516. */
  3517. dispatchEvent(event: Event): void;
  3518. /**
  3519. !#en Pause node related system events registered with the current Node. Node system events includes touch and mouse events.
  3520. 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.
  3521. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3522. !#zh 暂停当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3523. 如果传递 recursive 为 true,那么这个 API 将暂停本节点和它的子树上所有节点的节点系统事件。
  3524. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3525. @param recursive Whether to pause node system events on the sub node tree.
  3526. @example
  3527. ```js
  3528. node.pauseSystemEvents(true);
  3529. ```
  3530. */
  3531. pauseSystemEvents(recursive: boolean): void;
  3532. /**
  3533. !#en Resume node related system events registered with the current Node. Node system events includes touch and mouse events.
  3534. 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.
  3535. Reference: http://docs.cocos2d-x.org/editors_and_tools/creator-chapters/scripting/internal-events/
  3536. !#zh 恢复当前节点上注册的所有节点系统事件,节点系统事件包含触摸和鼠标事件。
  3537. 如果传递 recursive 为 true,那么这个 API 将恢复本节点和它的子树上所有节点的节点系统事件。
  3538. 参考:https://www.cocos.com/docs/creator/scripting/internal-events.html
  3539. @param recursive Whether to resume node system events on the sub node tree.
  3540. @example
  3541. ```js
  3542. node.resumeSystemEvents(true);
  3543. ```
  3544. */
  3545. resumeSystemEvents(recursive: boolean): void;
  3546. /**
  3547. !#en
  3548. Executes an action, and returns the action that is executed.<br/>
  3549. The node becomes the action's target. Refer to cc.Action's getTarget() <br/>
  3550. Calling runAction while the node is not active won't have any effect. <br/>
  3551. Note:You shouldn't modify the action after runAction, that won't take any effect.<br/>
  3552. if you want to modify, when you define action plus.
  3553. !#zh
  3554. 执行并返回该执行的动作。该节点将会变成动作的目标。<br/>
  3555. 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/>
  3556. 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。
  3557. @param action action
  3558. @example
  3559. ```js
  3560. var action = cc.scaleTo(0.2, 1, 0.6);
  3561. node.runAction(action);
  3562. node.runAction(action).repeatForever(); // fail
  3563. node.runAction(action.repeatForever()); // right
  3564. ```
  3565. */
  3566. runAction(action: Action): Action;
  3567. /**
  3568. !#en Pause all actions running on the current node. Equals to `cc.director.getActionManager().pauseTarget(node)`.
  3569. !#zh 暂停本节点上所有正在运行的动作。和 `cc.director.getActionManager().pauseTarget(node);` 等价。
  3570. @example
  3571. ```js
  3572. node.pauseAllActions();
  3573. ```
  3574. */
  3575. pauseAllActions(): void;
  3576. /**
  3577. !#en Resume all paused actions on the current node. Equals to `cc.director.getActionManager().resumeTarget(node)`.
  3578. !#zh 恢复运行本节点上所有暂停的动作。和 `cc.director.getActionManager().resumeTarget(node);` 等价。
  3579. @example
  3580. ```js
  3581. node.resumeAllActions();
  3582. ```
  3583. */
  3584. resumeAllActions(): void;
  3585. /**
  3586. !#en Stops and removes all actions from the running action list .
  3587. !#zh 停止并且移除所有正在运行的动作列表。
  3588. @example
  3589. ```js
  3590. node.stopAllActions();
  3591. ```
  3592. */
  3593. stopAllActions(): void;
  3594. /**
  3595. !#en Stops and removes an action from the running action list.
  3596. !#zh 停止并移除指定的动作。
  3597. @param action An action object to be removed.
  3598. @example
  3599. ```js
  3600. var action = cc.scaleTo(0.2, 1, 0.6);
  3601. node.stopAction(action);
  3602. ```
  3603. */
  3604. stopAction(action: Action): void;
  3605. /**
  3606. !#en Removes an action from the running action list by its tag.
  3607. !#zh 停止并且移除指定标签的动作。
  3608. @param tag A tag that indicates the action to be removed.
  3609. @example
  3610. ```js
  3611. node.stopActionByTag(1);
  3612. ```
  3613. */
  3614. stopActionByTag(tag: number): void;
  3615. /**
  3616. !#en Returns an action from the running action list by its tag.
  3617. !#zh 通过标签获取指定动作。
  3618. @param tag tag
  3619. @example
  3620. ```js
  3621. var action = node.getActionByTag(1);
  3622. ```
  3623. */
  3624. getActionByTag(tag: number): Action;
  3625. /**
  3626. !#en
  3627. Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays).<br/>
  3628. Composable actions are counted as 1 action. Example:<br/>
  3629. If you are running 1 Sequence of 7 actions, it will return 1. <br/>
  3630. If you are running 7 Sequences of 2 actions, it will return 7.</p>
  3631. !#zh
  3632. 获取运行着的动作加上正在调度运行的动作的总数。<br/>
  3633. 例如:<br/>
  3634. - 如果你正在运行 7 个动作中的 1 个 Sequence,它将返回 1。<br/>
  3635. - 如果你正在运行 2 个动作中的 7 个 Sequence,它将返回 7。<br/>
  3636. @example
  3637. ```js
  3638. var count = node.getNumberOfRunningActions();
  3639. cc.log("Running Action Count: " + count);
  3640. ```
  3641. */
  3642. getNumberOfRunningActions(): number;
  3643. /**
  3644. !#en
  3645. Returns a copy of the position (x, y, z) of the node in its parent's coordinates.
  3646. You can pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3647. !#zh
  3648. 获取节点在父节点坐标系中的位置(x, y, z)。
  3649. 你可以传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3650. @param out The return value to receive position
  3651. @example
  3652. ```js
  3653. cc.log("Node Position: " + node.getPosition());
  3654. ```
  3655. */
  3656. getPosition(out?: Vec2|Vec3): Vec2;
  3657. /**
  3658. !#en
  3659. Sets the position (x, y, z) of the node in its parent's coordinates.<br/>
  3660. Usually we use cc.v2(x, y) to compose cc.Vec2 object, in this case, position.z will become 0.<br/>
  3661. and passing two numbers (x, y) is more efficient than passing cc.Vec2 object, in this case, position.z will remain unchanged.
  3662. For 3D node we can use cc.v3(x, y, z) to compose cc.Vec3 object,<br/>
  3663. and passing three numbers (x, y, z) is more efficient than passing cc.Vec3 object.
  3664. !#zh
  3665. 设置节点在父节点坐标系中的位置。<br/>
  3666. 可以通过下面的方式设置坐标点:<br/>
  3667. 1. 传入 2 个数值 x, y (此时不会改变 position.z 的值)。<br/>
  3668. 2. 传入 cc.v2(x, y) 类型为 cc.Vec2 的对象 (此时 position.z 的值将被设置为0)。
  3669. 3. 对于 3D 节点可以传入 3 个数值 x, y, z。<br/>
  3670. 4. 对于 3D 节点可以传入 cc.v3(x, y, z) 类型为 cc.Vec3 的对象。
  3671. @param x X coordinate for position or the position object
  3672. @param y Y coordinate for position
  3673. @param z Z coordinate for position
  3674. */
  3675. setPosition(x: Vec2|Vec3|number, y?: number, z?: number): void;
  3676. /**
  3677. !#en
  3678. Returns the scale factor of the node.
  3679. Need pass a cc.Vec2 or cc.Vec3 as the argument to receive the return values.
  3680. !#zh 获取节点的缩放,需要传一个 cc.Vec2 或者 cc.Vec3 作为参数来接收返回值。
  3681. @param out out
  3682. @example
  3683. ```js
  3684. cc.log("Node Scale: " + node.getScale(cc.v3()));
  3685. ```
  3686. */
  3687. getScale(out: Vec2|Vec3): Vec2;
  3688. /**
  3689. !#en
  3690. Sets the scale of axis in local coordinates of the node.
  3691. You can operate 2 axis in 2D node, and 3 axis in 3D node.
  3692. When only (x, y) is passed, the value of scale.z will not be changed.
  3693. When a Vec2 is passed in, the value of scale.z will be set to 0.
  3694. !#zh
  3695. 设置节点在本地坐标系中坐标轴上的缩放比例。
  3696. 2D 节点可以操作两个坐标轴,而 3D 节点可以操作三个坐标轴。
  3697. 当只传入 (x, y) 时,scale.z 的值不会被改变。
  3698. 当只传入 Vec2 对象时,scale.z 的值将被设置为0。
  3699. @param x scaleX or scale object
  3700. @param y y
  3701. @param z z
  3702. @example
  3703. ```js
  3704. node.setScale(cc.v2(2, 2)); // Notice: scaleZ will be 0
  3705. node.setScale(cc.v3(2, 2, 2)); // for 3D node
  3706. node.setScale(2);
  3707. ```
  3708. */
  3709. setScale(x: number|Vec2|Vec3, y?: number, z?: number): void;
  3710. /**
  3711. !#en
  3712. Get rotation of node (in quaternion).
  3713. Need pass a cc.Quat as the argument to receive the return values.
  3714. !#zh
  3715. 获取该节点的 quaternion 旋转角度,需要传一个 cc.Quat 作为参数来接收返回值。
  3716. @param out out
  3717. */
  3718. getRotation(out: Quat): Quat;
  3719. /**
  3720. !#en Set rotation of node (in quaternion).
  3721. !#zh 设置该节点的 quaternion 旋转角度。
  3722. @param quat Quaternion object represents the rotation or the x value of quaternion
  3723. @param y y value of quternion
  3724. @param z z value of quternion
  3725. @param w w value of quternion
  3726. */
  3727. setRotation(quat: Quat|number, y?: number, z?: number, w?: number): void;
  3728. /**
  3729. !#en
  3730. Returns a copy the untransformed size of the node. <br/>
  3731. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3732. All nodes has a size. Layer and Scene has the same size of the screen by default. <br/>
  3733. !#zh 获取节点自身大小,不受该节点是否被缩放或者旋转的影响。
  3734. @example
  3735. ```js
  3736. cc.log("Content Size: " + node.getContentSize());
  3737. ```
  3738. */
  3739. getContentSize(): Size;
  3740. /**
  3741. !#en
  3742. Sets the untransformed size of the node.<br/>
  3743. The contentSize remains the same no matter the node is scaled or rotated.<br/>
  3744. All nodes has a size. Layer and Scene has the same size of the screen.
  3745. !#zh 设置节点原始大小,不受该节点是否被缩放或者旋转的影响。
  3746. @param size The untransformed size of the node or The untransformed size's width of the node.
  3747. @param height The untransformed size's height of the node.
  3748. @example
  3749. ```js
  3750. node.setContentSize(cc.size(100, 100));
  3751. node.setContentSize(100, 100);
  3752. ```
  3753. */
  3754. setContentSize(size: Size|number, height?: number): void;
  3755. /**
  3756. !#en
  3757. Returns a copy of the anchor point.<br/>
  3758. Anchor point is the point around which all transformations and positioning manipulations take place.<br/>
  3759. It's like a pin in the node where it is "attached" to its parent. <br/>
  3760. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. <br/>
  3761. But you can use values higher than (1,1) and lower than (0,0) too. <br/>
  3762. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3763. !#zh
  3764. 获取节点锚点,用百分比表示。<br/>
  3765. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3766. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3767. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3768. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3769. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3770. @example
  3771. ```js
  3772. cc.log("Node AnchorPoint: " + node.getAnchorPoint());
  3773. ```
  3774. */
  3775. getAnchorPoint(): Vec2;
  3776. /**
  3777. !#en
  3778. Sets the anchor point in percent. <br/>
  3779. anchor point is the point around which all transformations and positioning manipulations take place. <br/>
  3780. It's like a pin in the node where it is "attached" to its parent. <br/>
  3781. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner.<br/>
  3782. But you can use values higher than (1,1) and lower than (0,0) too.<br/>
  3783. The default anchor point is (0.5,0.5), so it starts at the center of the node.
  3784. !#zh
  3785. 设置锚点的百分比。<br/>
  3786. 锚点应用于所有变换和坐标点的操作,它就像在节点上连接其父节点的大头针。<br/>
  3787. 锚点是标准化的,就像百分比一样。(0,0) 表示左下角,(1,1) 表示右上角。<br/>
  3788. 但是你可以使用比(1,1)更高的值或者比(0,0)更低的值。<br/>
  3789. 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。<br/>
  3790. 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
  3791. @param point The anchor point of node or The x axis anchor of node.
  3792. @param y The y axis anchor of node.
  3793. @example
  3794. ```js
  3795. node.setAnchorPoint(cc.v2(1, 1));
  3796. node.setAnchorPoint(1, 1);
  3797. ```
  3798. */
  3799. setAnchorPoint(point: Vec2|number, y?: number): void;
  3800. /**
  3801. !#en Set rotation by lookAt target point, normally used by Camera Node
  3802. !#zh 通过观察目标来设置 rotation,一般用于 Camera Node 上
  3803. @param pos pos
  3804. @param up default is (0,1,0)
  3805. */
  3806. lookAt(pos: Vec3, up?: Vec3): void;
  3807. /**
  3808. !#en
  3809. Get the local transform matrix (4x4), based on parent node coordinates
  3810. !#zh 返回局部空间坐标系的矩阵,基于父节点坐标系。
  3811. @param out The matrix object to be filled with data
  3812. @example
  3813. ```js
  3814. let mat4 = cc.mat4();
  3815. node.getLocalMatrix(mat4);
  3816. ```
  3817. */
  3818. getLocalMatrix(out: Mat4): Mat4;
  3819. /**
  3820. !#en
  3821. Get the world transform matrix (4x4)
  3822. !#zh 返回世界空间坐标系的矩阵。
  3823. @param out The matrix object to be filled with data
  3824. @example
  3825. ```js
  3826. let mat4 = cc.mat4();
  3827. node.getWorldMatrix(mat4);
  3828. ```
  3829. */
  3830. getWorldMatrix(out: Mat4): Mat4;
  3831. /**
  3832. !#en
  3833. Converts a Point to node (local) space coordinates.
  3834. !#zh
  3835. 将一个点转换到节点 (局部) 空间坐标系。
  3836. @param worldPoint worldPoint
  3837. @param out out
  3838. @example
  3839. ```js
  3840. var newVec2 = node.convertToNodeSpaceAR(cc.v2(100, 100));
  3841. var newVec3 = node.convertToNodeSpaceAR(cc.v3(100, 100, 100));
  3842. ```
  3843. */
  3844. convertToNodeSpaceAR<T extends cc.Vec2 | cc.Vec3>(worldPoint: T, out?: T): T;
  3845. /**
  3846. !#en
  3847. Converts a Point in node coordinates to world space coordinates.
  3848. !#zh
  3849. 将节点坐标系下的一个点转换到世界空间坐标系。
  3850. @param nodePoint nodePoint
  3851. @param out out
  3852. @example
  3853. ```js
  3854. var newVec2 = node.convertToWorldSpaceAR(cc.v2(100, 100));
  3855. var newVec3 = node.convertToWorldSpaceAR(cc.v3(100, 100, 100));
  3856. ```
  3857. */
  3858. convertToWorldSpaceAR<T extends cc.Vec2 | cc.Vec3>(nodePoint: T, out?: T): T;
  3859. /**
  3860. !#en Converts a Point to node (local) space coordinates then add the anchor point position.
  3861. So the return position will be related to the left bottom corner of the node's bounding box.
  3862. This equals to the API behavior of cocos2d-x, you probably want to use convertToNodeSpaceAR instead
  3863. !#zh 将一个点转换到节点 (局部) 坐标系,并加上锚点的坐标。<br/>
  3864. 也就是说返回的坐标是相对于节点包围盒左下角的坐标。<br/>
  3865. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToNodeSpaceAR。
  3866. @param worldPoint worldPoint
  3867. @example
  3868. ```js
  3869. var newVec2 = node.convertToNodeSpace(cc.v2(100, 100));
  3870. ```
  3871. */
  3872. convertToNodeSpace(worldPoint: Vec2): Vec2;
  3873. /**
  3874. !#en Converts a Point related to the left bottom corner of the node's bounding box to world space coordinates.
  3875. This equals to the API behavior of cocos2d-x, you probably want to use convertToWorldSpaceAR instead
  3876. !#zh 将一个相对于节点左下角的坐标位置转换到世界空间坐标系。
  3877. 这个 API 的设计是为了和 cocos2d-x 中行为一致,更多情况下你可能需要使用 convertToWorldSpaceAR
  3878. @param nodePoint nodePoint
  3879. @example
  3880. ```js
  3881. var newVec2 = node.convertToWorldSpace(cc.v2(100, 100));
  3882. ```
  3883. */
  3884. convertToWorldSpace(nodePoint: Vec2): Vec2;
  3885. /**
  3886. !#en
  3887. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  3888. The matrix is in Pixels.
  3889. !#zh 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。这个矩阵以像素为单位。
  3890. @param out The affine transform object to be filled with data
  3891. @example
  3892. ```js
  3893. let affineTransform = cc.AffineTransform.create();
  3894. node.getNodeToParentTransform(affineTransform);
  3895. ```
  3896. */
  3897. getNodeToParentTransform(out?: AffineTransform): AffineTransform;
  3898. /**
  3899. !#en
  3900. Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.<br/>
  3901. The matrix is in Pixels.<br/>
  3902. This method is AR (Anchor Relative).
  3903. !#zh
  3904. 返回这个将节点(局部)的空间坐标系转换成父节点的空间坐标系的矩阵。<br/>
  3905. 这个矩阵以像素为单位。<br/>
  3906. 该方法基于节点坐标。
  3907. @param out The affine transform object to be filled with data
  3908. @example
  3909. ```js
  3910. let affineTransform = cc.AffineTransform.create();
  3911. node.getNodeToParentTransformAR(affineTransform);
  3912. ```
  3913. */
  3914. getNodeToParentTransformAR(out?: AffineTransform): AffineTransform;
  3915. /**
  3916. !#en Returns the world affine transform matrix. The matrix is in Pixels.
  3917. !#zh 返回节点到世界坐标系的仿射变换矩阵。矩阵单位是像素。
  3918. @param out The affine transform object to be filled with data
  3919. @example
  3920. ```js
  3921. let affineTransform = cc.AffineTransform.create();
  3922. node.getNodeToWorldTransform(affineTransform);
  3923. ```
  3924. */
  3925. getNodeToWorldTransform(out?: AffineTransform): AffineTransform;
  3926. /**
  3927. !#en
  3928. Returns the world affine transform matrix. The matrix is in Pixels.<br/>
  3929. This method is AR (Anchor Relative).
  3930. !#zh
  3931. 返回节点到世界坐标仿射变换矩阵。矩阵单位是像素。<br/>
  3932. 该方法基于节点坐标。
  3933. @param out The affine transform object to be filled with data
  3934. @example
  3935. ```js
  3936. let affineTransform = cc.AffineTransform.create();
  3937. node.getNodeToWorldTransformAR(affineTransform);
  3938. ```
  3939. */
  3940. getNodeToWorldTransformAR(out?: AffineTransform): AffineTransform;
  3941. /**
  3942. !#en
  3943. Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.<br/>
  3944. The matrix is in Pixels. The returned transform is readonly and cannot be changed.
  3945. !#zh
  3946. 返回将父节点的坐标系转换成节点(局部)的空间坐标系的矩阵。<br/>
  3947. 该矩阵以像素为单位。返回的矩阵是只读的,不能更改。
  3948. @param out The affine transform object to be filled with data
  3949. @example
  3950. ```js
  3951. let affineTransform = cc.AffineTransform.create();
  3952. node.getParentToNodeTransform(affineTransform);
  3953. ```
  3954. */
  3955. getParentToNodeTransform(out?: AffineTransform): AffineTransform;
  3956. /**
  3957. !#en Returns the inverse world affine transform matrix. The matrix is in Pixels.
  3958. !#en 返回世界坐标系到节点坐标系的逆矩阵。
  3959. @param out The affine transform object to be filled with data
  3960. @example
  3961. ```js
  3962. let affineTransform = cc.AffineTransform.create();
  3963. node.getWorldToNodeTransform(affineTransform);
  3964. ```
  3965. */
  3966. getWorldToNodeTransform(out?: AffineTransform): AffineTransform;
  3967. /**
  3968. !#en convenience methods which take a cc.Touch instead of cc.Vec2.
  3969. !#zh 将触摸点转换成本地坐标系中位置。
  3970. @param touch The touch object
  3971. @example
  3972. ```js
  3973. var newVec2 = node.convertTouchToNodeSpace(touch);
  3974. ```
  3975. */
  3976. convertTouchToNodeSpace(touch: Touch): Vec2;
  3977. /**
  3978. !#en converts a cc.Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
  3979. !#zh 转换一个 cc.Touch(世界坐标)到一个局部坐标,该方法基于节点坐标。
  3980. @param touch The touch object
  3981. @example
  3982. ```js
  3983. var newVec2 = node.convertTouchToNodeSpaceAR(touch);
  3984. ```
  3985. */
  3986. convertTouchToNodeSpaceAR(touch: Touch): Vec2;
  3987. /**
  3988. !#en
  3989. Returns a "local" axis aligned bounding box of the node. <br/>
  3990. The returned box is relative only to its parent.
  3991. !#zh 返回父节坐标系下的轴向对齐的包围盒。
  3992. @example
  3993. ```js
  3994. var boundingBox = node.getBoundingBox();
  3995. ```
  3996. */
  3997. getBoundingBox(): Rect;
  3998. /**
  3999. !#en
  4000. Returns a "world" axis aligned bounding box of the node.<br/>
  4001. The bounding box contains self and active children's world bounding box.
  4002. !#zh
  4003. 返回节点在世界坐标系下的对齐轴向的包围盒(AABB)。<br/>
  4004. 该边框包含自身和已激活的子节点的世界边框。
  4005. @example
  4006. ```js
  4007. var newRect = node.getBoundingBoxToWorld();
  4008. ```
  4009. */
  4010. getBoundingBoxToWorld(): Rect;
  4011. /**
  4012. !#en
  4013. Adds a child to the node with z order and name.
  4014. !#zh
  4015. 添加子节点,并且可以修改该节点的 局部 Z 顺序和名字。
  4016. @param child A child node
  4017. @param zIndex Z order for drawing priority. Please refer to zIndex property
  4018. @param name A name to identify the node easily. Please refer to name property
  4019. @example
  4020. ```js
  4021. node.addChild(newNode, 1, "node");
  4022. ```
  4023. */
  4024. addChild(child: Node, zIndex?: number, name?: string): void;
  4025. /**
  4026. !#en Stops all running actions and schedulers.
  4027. !#zh 停止所有正在播放的动作和计时器。
  4028. @example
  4029. ```js
  4030. node.cleanup();
  4031. ```
  4032. */
  4033. cleanup(): void;
  4034. /**
  4035. !#en Sorts the children array depends on children's zIndex and arrivalOrder,
  4036. normally you won't need to invoke this function.
  4037. !#zh 根据子节点的 zIndex 和 arrivalOrder 进行排序,正常情况下开发者不需要手动调用这个函数。
  4038. */
  4039. sortAllChildren(): void;
  4040. /**
  4041. !#en
  4042. Returns the displayed opacity of Node,
  4043. 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.
  4044. !#zh
  4045. 获取节点显示透明度,
  4046. 显示透明度和透明度之间的不同之处在于当启用级连透明度时,
  4047. 显示透明度是基于自身透明度和父节点透明度计算的。
  4048. */
  4049. getDisplayedOpacity(): number;
  4050. /**
  4051. !#en
  4052. Returns the displayed color of Node,
  4053. 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.
  4054. !#zh
  4055. 获取节点的显示颜色,
  4056. 显示颜色和颜色之间的不同之处在于当启用级连颜色时,
  4057. 显示颜色是基于自身颜色和父节点颜色计算的。
  4058. */
  4059. getDisplayedColor(): Color;
  4060. /** !#en Cascade opacity is removed from v2.0
  4061. Indicate whether node's opacity value affect its child nodes, default value is true.
  4062. !#zh 透明度级联功能从 v2.0 开始已移除
  4063. 节点的不透明度值是否影响其子节点,默认值为 true。 */
  4064. cascadeOpacity: boolean;
  4065. /**
  4066. !#en Cascade opacity is removed from v2.0
  4067. Returns whether node's opacity value affect its child nodes.
  4068. !#zh 透明度级联功能从 v2.0 开始已移除
  4069. 返回节点的不透明度值是否影响其子节点。
  4070. */
  4071. isCascadeOpacityEnabled(): boolean;
  4072. /**
  4073. !#en Cascade opacity is removed from v2.0
  4074. Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity.
  4075. !#zh 透明度级联功能从 v2.0 开始已移除
  4076. 启用或禁用级连不透明度,如果级连启用,子节点的不透明度将是父不透明度乘上它自己的不透明度。
  4077. @param cascadeOpacityEnabled cascadeOpacityEnabled
  4078. */
  4079. setCascadeOpacityEnabled(cascadeOpacityEnabled: boolean): void;
  4080. /**
  4081. !#en Opacity modify RGB have been removed since v2.0
  4082. Set whether color should be changed with the opacity value,
  4083. useless in ccsg.Node, but this function is override in some class to have such behavior.
  4084. !#zh 透明度影响颜色配置已经被废弃
  4085. 设置更改透明度时是否修改RGB值,
  4086. @param opacityValue opacityValue
  4087. */
  4088. setOpacityModifyRGB(opacityValue: boolean): void;
  4089. /**
  4090. !#en Opacity modify RGB have been removed since v2.0
  4091. Get whether color should be changed with the opacity value.
  4092. !#zh 透明度影响颜色配置已经被废弃
  4093. 获取更改透明度时是否修改RGB值。
  4094. */
  4095. isOpacityModifyRGB(): boolean;
  4096. }
  4097. /** !#en
  4098. Class of private entities in Cocos Creator scenes.<br/>
  4099. The PrivateNode is hidden in editor, and completely transparent to users.<br/>
  4100. It's normally used as Node's private content created by components in parent node.<br/>
  4101. So in theory private nodes are not children, they are part of the parent node.<br/>
  4102. Private node have two important characteristics:<br/>
  4103. 1. It has the minimum z index and cannot be modified, because they can't be displayed over real children.<br/>
  4104. 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/>
  4105. In this way, they can be easily kept inside the bounding box.<br/>
  4106. Currently, it's used by RichText component and TileMap component.
  4107. !#zh
  4108. Cocos Creator 场景中的私有节点类。<br/>
  4109. 私有节点在编辑器中不可见,对用户透明。<br/>
  4110. 通常私有节点是被一些特殊的组件创建出来作为父节点的一部分而存在的,理论上来说,它们不是子节点,而是父节点的组成部分。<br/>
  4111. 私有节点有两个非常重要的特性:<br/>
  4112. 1. 它有着最小的渲染排序的 Z 轴深度,并且无法被更改,因为它们不能被显示在其他正常子节点之上。<br/>
  4113. 2. 它的定位也是特殊的,对于私有节点来说,父节点包围盒的左下角是它的局部坐标系原点,这个原点相当于父节点的位置减去它锚点的偏移。这样私有节点可以比较容易被控制在包围盒之中。<br/>
  4114. 目前在引擎中,RichText 和 TileMap 都有可能生成私有节点。 */
  4115. export class PrivateNode extends Node {
  4116. /**
  4117. @param name name
  4118. */
  4119. constructor(name?: string);
  4120. }
  4121. /** !#en
  4122. cc.Scene is a subclass of cc.Node that is used only as an abstract concept.<br/>
  4123. cc.Scene and cc.Node are almost identical with the difference that users can not modify cc.Scene manually.
  4124. !#zh
  4125. cc.Scene 是 cc.Node 的子类,仅作为一个抽象的概念。<br/>
  4126. cc.Scene 和 cc.Node 有点不同,用户不应直接修改 cc.Scene。 */
  4127. export class Scene extends Node {
  4128. /** !#en Indicates whether all (directly or indirectly) static referenced assets of this scene are releasable by default after scene unloading.
  4129. !#zh 指示该场景中直接或间接静态引用到的所有资源是否默认在场景切换后自动释放。 */
  4130. autoReleaseAssets: boolean;
  4131. }
  4132. /** !#en
  4133. Scheduler is responsible of triggering the scheduled callbacks.<br/>
  4134. You should not use NSTimer. Instead use this class.<br/>
  4135. <br/>
  4136. There are 2 different types of callbacks (selectors):<br/>
  4137. - update callback: the 'update' callback will be called every frame. You can customize the priority.<br/>
  4138. - custom callback: A custom callback will be called every frame, or with a custom interval of time<br/>
  4139. <br/>
  4140. The 'custom selectors' should be avoided when possible. It is faster,
  4141. and consumes less memory to use the 'update callback'. *
  4142. !#zh
  4143. Scheduler 是负责触发回调函数的类。<br/>
  4144. 通常情况下,建议使用 cc.director.getScheduler() 来获取系统定时器。<br/>
  4145. 有两种不同类型的定时器:<br/>
  4146. - update 定时器:每一帧都会触发。您可以自定义优先级。<br/>
  4147. - 自定义定时器:自定义定时器可以每一帧或者自定义的时间间隔触发。<br/>
  4148. 如果希望每帧都触发,应该使用 update 定时器,使用 update 定时器更快,而且消耗更少的内存。 */
  4149. export class Scheduler {
  4150. /**
  4151. !#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.
  4152. This method will add a `_id` property if it doesn't exist.
  4153. !#zh 任何需要用 Scheduler 管理任务的对象主体都应该调用这个方法,并且应该在调用任何 Scheduler API 之前调用这个方法。
  4154. 这个方法会给对象添加一个 `_id` 属性,如果这个属性不存在的话。
  4155. @param target target
  4156. */
  4157. enableForTarget(target: any): void;
  4158. /**
  4159. !#en
  4160. Modifies the time of all scheduled callbacks.<br/>
  4161. You can use this property to create a 'slow motion' or 'fast forward' effect.<br/>
  4162. Default is 1.0. To create a 'slow motion' effect, use values below 1.0.<br/>
  4163. To create a 'fast forward' effect, use values higher than 1.0.<br/>
  4164. Note:It will affect EVERY scheduled selector / action.
  4165. !#zh
  4166. 设置时间间隔的缩放比例。<br/>
  4167. 您可以使用这个方法来创建一个 “slow motion(慢动作)” 或 “fast forward(快进)” 的效果。<br/>
  4168. 默认是 1.0。要创建一个 “slow motion(慢动作)” 效果,使用值低于 1.0。<br/>
  4169. 要使用 “fast forward(快进)” 效果,使用值大于 1.0。<br/>
  4170. 注意:它影响该 Scheduler 下管理的所有定时器。
  4171. @param timeScale timeScale
  4172. */
  4173. setTimeScale(timeScale: number): void;
  4174. /**
  4175. !#en Returns time scale of scheduler.
  4176. !#zh 获取时间间隔的缩放比例。
  4177. */
  4178. getTimeScale(): number;
  4179. /**
  4180. !#en 'update' the scheduler. (You should NEVER call this method, unless you know what you are doing.)
  4181. !#zh update 调度函数。(不应该直接调用这个方法,除非完全了解这么做的结果)
  4182. @param dt delta time
  4183. */
  4184. update(dt: number): void;
  4185. /**
  4186. !#en
  4187. <p>
  4188. The scheduled method will be called every 'interval' seconds.<br/>
  4189. If paused is YES, then it won't be called until it is resumed.<br/>
  4190. If 'interval' is 0, it will be called every frame, but if so, it recommended to use 'scheduleUpdateForTarget:' instead.<br/>
  4191. If the callback function is already scheduled, then only the interval parameter will be updated without re-scheduling it again.<br/>
  4192. repeat let the action be repeated repeat + 1 times, use cc.macro.REPEAT_FOREVER to let the action run continuously<br/>
  4193. delay is the amount of time the action will wait before it'll start<br/>
  4194. </p>
  4195. !#zh
  4196. 指定回调函数,调用对象等信息来添加一个新的定时器。<br/>
  4197. 如果 paused 值为 true,那么直到 resume 被调用才开始计时。<br/>
  4198. 当时间间隔达到指定值时,设置的回调函数将会被调用。<br/>
  4199. 如果 interval 值为 0,那么回调函数每一帧都会被调用,但如果是这样,
  4200. 建议使用 scheduleUpdateForTarget 代替。<br/>
  4201. 如果回调函数已经被定时器使用,那么只会更新之前定时器的时间间隔参数,不会设置新的定时器。<br/>
  4202. repeat 值可以让定时器触发 repeat + 1 次,使用 cc.macro.REPEAT_FOREVER
  4203. 可以让定时器一直循环触发。<br/>
  4204. delay 值指定延迟时间,定时器会在延迟指定的时间之后开始计时。
  4205. @param callback callback
  4206. @param target target
  4207. @param interval interval
  4208. @param repeat repeat
  4209. @param delay delay
  4210. @param paused paused
  4211. @example
  4212. ```js
  4213. //register a schedule to scheduler
  4214. cc.director.getScheduler().schedule(callback, this, interval, !this._isRunning);
  4215. ```
  4216. */
  4217. schedule(callback: Function, target: any, interval: number, repeat: number, delay: number, paused?: boolean): void;
  4218. schedule(callback: Function, target: any, interval: number, paused?: boolean): void;
  4219. /**
  4220. !#en
  4221. Schedules the update callback for a given target,
  4222. During every frame after schedule started, the "update" function of target will be invoked.
  4223. !#zh
  4224. 使用指定的优先级为指定的对象设置 update 定时器。
  4225. update 定时器每一帧都会被触发,触发时自动调用指定对象的 "update" 函数。
  4226. 优先级的值越低,定时器被触发的越早。
  4227. @param target target
  4228. @param priority priority
  4229. @param paused paused
  4230. */
  4231. scheduleUpdate(target: any, priority: number, paused: boolean): void;
  4232. /**
  4233. !#en
  4234. Unschedules a callback for a callback and a given target.
  4235. If you want to unschedule the "update", use `unscheduleUpdate()`
  4236. !#zh
  4237. 取消指定对象定时器。
  4238. 如果需要取消 update 定时器,请使用 unscheduleUpdate()。
  4239. @param callback The callback to be unscheduled
  4240. @param target The target bound to the callback.
  4241. */
  4242. unschedule(callback: Function, target: any): void;
  4243. /**
  4244. !#en Unschedules the update callback for a given target.
  4245. !#zh 取消指定对象的 update 定时器。
  4246. @param target The target to be unscheduled.
  4247. */
  4248. unscheduleUpdate(target: any): void;
  4249. /**
  4250. !#en
  4251. Unschedules all scheduled callbacks for a given target.
  4252. This also includes the "update" callback.
  4253. !#zh 取消指定对象的所有定时器,包括 update 定时器。
  4254. @param target The target to be unscheduled.
  4255. */
  4256. unscheduleAllForTarget(target: any): void;
  4257. /**
  4258. !#en
  4259. Unschedules all scheduled callbacks from all targets including the system callbacks.<br/>
  4260. You should NEVER call this method, unless you know what you are doing.
  4261. !#zh
  4262. 取消所有对象的所有定时器,包括系统定时器。<br/>
  4263. 不要调用此函数,除非你确定你在做什么。
  4264. */
  4265. unscheduleAll(): void;
  4266. /**
  4267. !#en
  4268. Unschedules all callbacks from all targets with a minimum priority.<br/>
  4269. You should only call this with `PRIORITY_NON_SYSTEM_MIN` or higher.
  4270. !#zh
  4271. 取消所有优先级的值大于指定优先级的定时器。<br/>
  4272. 你应该只取消优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  4273. @param minPriority The minimum priority of selector to be unscheduled. Which means, all selectors which
  4274. priority is higher than minPriority will be unscheduled.
  4275. */
  4276. unscheduleAllWithMinPriority(minPriority: number): void;
  4277. /**
  4278. !#en Checks whether a callback for a given target is scheduled.
  4279. !#zh 检查指定的回调函数和回调对象组合是否存在定时器。
  4280. @param callback The callback to check.
  4281. @param target The target of the callback.
  4282. */
  4283. isScheduled(callback: Function, target: any): boolean;
  4284. /**
  4285. !#en
  4286. Pause all selectors from all targets.<br/>
  4287. You should NEVER call this method, unless you know what you are doing.
  4288. !#zh
  4289. 暂停所有对象的所有定时器。<br/>
  4290. 不要调用这个方法,除非你知道你正在做什么。
  4291. */
  4292. pauseAllTargets(): void;
  4293. /**
  4294. !#en
  4295. Pause all selectors from all targets with a minimum priority. <br/>
  4296. You should only call this with kCCPriorityNonSystemMin or higher.
  4297. !#zh
  4298. 暂停所有优先级的值大于指定优先级的定时器。<br/>
  4299. 你应该只暂停优先级的值大于 PRIORITY_NON_SYSTEM_MIN 的定时器。
  4300. @param minPriority minPriority
  4301. */
  4302. pauseAllTargetsWithMinPriority(minPriority: number): void;
  4303. /**
  4304. !#en
  4305. Resume selectors on a set of targets.<br/>
  4306. This can be useful for undoing a call to pauseAllCallbacks.
  4307. !#zh
  4308. 恢复指定数组中所有对象的定时器。<br/>
  4309. 这个函数是 pauseAllCallbacks 的逆操作。
  4310. @param targetsToResume targetsToResume
  4311. */
  4312. resumeTargets(targetsToResume: any[]): void;
  4313. /**
  4314. !#en
  4315. Pauses the target.<br/>
  4316. All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed.<br/>
  4317. If the target is not present, nothing happens.
  4318. !#zh
  4319. 暂停指定对象的定时器。<br/>
  4320. 指定对象的所有定时器都会被暂停。<br/>
  4321. 如果指定的对象没有定时器,什么也不会发生。
  4322. @param target target
  4323. */
  4324. pauseTarget(target: any): void;
  4325. /**
  4326. !#en
  4327. Resumes the target.<br/>
  4328. The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again.<br/>
  4329. If the target is not present, nothing happens.
  4330. !#zh
  4331. 恢复指定对象的所有定时器。<br/>
  4332. 指定对象的所有定时器将继续工作。<br/>
  4333. 如果指定的对象没有定时器,什么也不会发生。
  4334. @param target target
  4335. */
  4336. resumeTarget(target: any): void;
  4337. /**
  4338. !#en Returns whether or not the target is paused.
  4339. !#zh 返回指定对象的定时器是否暂停了。
  4340. @param target target
  4341. */
  4342. isTargetPaused(target: any): boolean;
  4343. /** !#en Priority level reserved for system services.
  4344. !#zh 系统服务的优先级。 */
  4345. static PRIORITY_SYSTEM: number;
  4346. /** !#en Minimum priority level for user scheduling.
  4347. !#zh 用户调度最低优先级。 */
  4348. static PRIORITY_NON_SYSTEM: number;
  4349. }
  4350. /** Class for particle asset handling. */
  4351. export class ParticleAsset extends Asset {
  4352. }
  4353. /** Particle System base class. <br/>
  4354. Attributes of a Particle System:<br/>
  4355. - emmision rate of the particles<br/>
  4356. - Gravity Mode (Mode A): <br/>
  4357. - gravity <br/>
  4358. - direction <br/>
  4359. - speed +- variance <br/>
  4360. - tangential acceleration +- variance<br/>
  4361. - radial acceleration +- variance<br/>
  4362. - Radius Mode (Mode B): <br/>
  4363. - startRadius +- variance <br/>
  4364. - endRadius +- variance <br/>
  4365. - rotate +- variance <br/>
  4366. - Properties common to all modes: <br/>
  4367. - life +- life variance <br/>
  4368. - start spin +- variance <br/>
  4369. - end spin +- variance <br/>
  4370. - start size +- variance <br/>
  4371. - end size +- variance <br/>
  4372. - start color +- variance <br/>
  4373. - end color +- variance <br/>
  4374. - life +- variance <br/>
  4375. - blending function <br/>
  4376. - texture <br/>
  4377. <br/>
  4378. cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>
  4379. 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d, <br/>
  4380. cocos2d uses a another approach, but the results are almost identical.<br/>
  4381. cocos2d supports all the variables used by Particle Designer plus a bit more: <br/>
  4382. - spinning particles (supported when using ParticleSystem) <br/>
  4383. - tangential acceleration (Gravity mode) <br/>
  4384. - radial acceleration (Gravity mode) <br/>
  4385. - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>
  4386. It is possible to customize any of the above mentioned properties in runtime. Example: <br/> */
  4387. export class ParticleSystem extends RenderComponent implements BlendFunc {
  4388. /** !#en Play particle in edit mode.
  4389. !#zh 在编辑器模式下预览粒子,启用后选中粒子时,粒子将自动播放。 */
  4390. preview: boolean;
  4391. /** !#en
  4392. If set custom to true, then use custom properties insteadof read particle file.
  4393. !#zh 是否自定义粒子属性。 */
  4394. custom: boolean;
  4395. /** !#en The plist file.
  4396. !#zh plist 格式的粒子配置文件。 */
  4397. file: ParticleAsset;
  4398. /** !#en SpriteFrame used for particles display
  4399. !#zh 用于粒子呈现的 SpriteFrame */
  4400. spriteFrame: SpriteFrame;
  4401. /** !#en Texture of Particle System, readonly, please use spriteFrame to setup new texture。
  4402. !#zh 粒子贴图,只读属性,请使用 spriteFrame 属性来替换贴图。 */
  4403. texture: string;
  4404. /** !#en Current quantity of particles that are being simulated.
  4405. !#zh 当前播放的粒子数量。 */
  4406. particleCount: number;
  4407. /** !#en Indicate whether the system simulation have stopped.
  4408. !#zh 指示粒子播放是否完毕。 */
  4409. stopped: boolean;
  4410. /** !#en If set to true, the particle system will automatically start playing on onLoad.
  4411. !#zh 如果设置为 true 运行时会自动发射粒子。 */
  4412. playOnLoad: boolean;
  4413. /** !#en Indicate whether the owner node will be auto-removed when it has no particles left.
  4414. !#zh 粒子播放完毕后自动销毁所在的节点。 */
  4415. autoRemoveOnFinish: boolean;
  4416. /** !#en Indicate whether the particle system is activated.
  4417. !#zh 是否激活粒子。 */
  4418. active: boolean;
  4419. /** !#en Maximum particles of the system.
  4420. !#zh 粒子最大数量。 */
  4421. totalParticles: number;
  4422. /** !#en How many seconds the emitter wil run. -1 means 'forever'.
  4423. !#zh 发射器生存时间,单位秒,-1表示持续发射。 */
  4424. duration: number;
  4425. /** !#en Emission rate of the particles.
  4426. !#zh 每秒发射的粒子数目。 */
  4427. emissionRate: number;
  4428. /** !#en Life of each particle setter.
  4429. !#zh 粒子的运行时间。 */
  4430. life: number;
  4431. /** !#en Variation of life.
  4432. !#zh 粒子的运行时间变化范围。 */
  4433. lifeVar: number;
  4434. /** !#en Start color of each particle.
  4435. !#zh 粒子初始颜色。 */
  4436. startColor: Color;
  4437. /** !#en Variation of the start color.
  4438. !#zh 粒子初始颜色变化范围。 */
  4439. startColorVar: Color;
  4440. /** !#en Ending color of each particle.
  4441. !#zh 粒子结束颜色。 */
  4442. endColor: Color;
  4443. /** !#en Variation of the end color.
  4444. !#zh 粒子结束颜色变化范围。 */
  4445. endColorVar: Color;
  4446. /** !#en Angle of each particle setter.
  4447. !#zh 粒子角度。 */
  4448. angle: number;
  4449. /** !#en Variation of angle of each particle setter.
  4450. !#zh 粒子角度变化范围。 */
  4451. angleVar: number;
  4452. /** !#en Start size in pixels of each particle.
  4453. !#zh 粒子的初始大小。 */
  4454. startSize: number;
  4455. /** !#en Variation of start size in pixels.
  4456. !#zh 粒子初始大小的变化范围。 */
  4457. startSizeVar: number;
  4458. /** !#en End size in pixels of each particle.
  4459. !#zh 粒子结束时的大小。 */
  4460. endSize: number;
  4461. /** !#en Variation of end size in pixels.
  4462. !#zh 粒子结束大小的变化范围。 */
  4463. endSizeVar: number;
  4464. /** !#en Start angle of each particle.
  4465. !#zh 粒子开始自旋角度。 */
  4466. startSpin: number;
  4467. /** !#en Variation of start angle.
  4468. !#zh 粒子开始自旋角度变化范围。 */
  4469. startSpinVar: number;
  4470. /** !#en End angle of each particle.
  4471. !#zh 粒子结束自旋角度。 */
  4472. endSpin: number;
  4473. /** !#en Variation of end angle.
  4474. !#zh 粒子结束自旋角度变化范围。 */
  4475. endSpinVar: number;
  4476. /** !#en Source position of the emitter.
  4477. !#zh 发射器位置。 */
  4478. sourcePos: Vec2;
  4479. /** !#en Variation of source position.
  4480. !#zh 发射器位置的变化范围。(横向和纵向) */
  4481. posVar: Vec2;
  4482. /** !#en Particles movement type.
  4483. !#zh 粒子位置类型。 */
  4484. positionType: ParticleSystem.PositionType;
  4485. /** !#en Particles emitter modes.
  4486. !#zh 发射器类型。 */
  4487. emitterMode: ParticleSystem.EmitterMode;
  4488. /** !#en Gravity of the emitter.
  4489. !#zh 重力。 */
  4490. gravity: Vec2;
  4491. /** !#en Speed of the emitter.
  4492. !#zh 速度。 */
  4493. speed: number;
  4494. /** !#en Variation of the speed.
  4495. !#zh 速度变化范围。 */
  4496. speedVar: number;
  4497. /** !#en Tangential acceleration of each particle. Only available in 'Gravity' mode.
  4498. !#zh 每个粒子的切向加速度,即垂直于重力方向的加速度,只有在重力模式下可用。 */
  4499. tangentialAccel: number;
  4500. /** !#en Variation of the tangential acceleration.
  4501. !#zh 每个粒子的切向加速度变化范围。 */
  4502. tangentialAccelVar: number;
  4503. /** !#en Acceleration of each particle. Only available in 'Gravity' mode.
  4504. !#zh 粒子径向加速度,即平行于重力方向的加速度,只有在重力模式下可用。 */
  4505. radialAccel: number;
  4506. /** !#en Variation of the radial acceleration.
  4507. !#zh 粒子径向加速度变化范围。 */
  4508. radialAccelVar: number;
  4509. /** !#en Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
  4510. !#zh 每个粒子的旋转是否等于其方向,只有在重力模式下可用。 */
  4511. rotationIsDir: boolean;
  4512. /** !#en Starting radius of the particles. Only available in 'Radius' mode.
  4513. !#zh 初始半径,表示粒子出生时相对发射器的距离,只有在半径模式下可用。 */
  4514. startRadius: number;
  4515. /** !#en Variation of the starting radius.
  4516. !#zh 初始半径变化范围。 */
  4517. startRadiusVar: number;
  4518. /** !#en Ending radius of the particles. Only available in 'Radius' mode.
  4519. !#zh 结束半径,只有在半径模式下可用。 */
  4520. endRadius: number;
  4521. /** !#en Variation of the ending radius.
  4522. !#zh 结束半径变化范围。 */
  4523. endRadiusVar: number;
  4524. /** !#en Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
  4525. !#zh 粒子每秒围绕起始点的旋转角度,只有在半径模式下可用。 */
  4526. rotatePerS: number;
  4527. /** !#en Variation of the degress to rotate a particle around the source pos per second.
  4528. !#zh 粒子每秒围绕起始点的旋转角度变化范围。 */
  4529. rotatePerSVar: number;
  4530. /** !#en The Particle emitter lives forever.
  4531. !#zh 表示发射器永久存在 */
  4532. static DURATION_INFINITY: number;
  4533. /** !#en The starting size of the particle is equal to the ending size.
  4534. !#zh 表示粒子的起始大小等于结束大小。 */
  4535. static START_SIZE_EQUAL_TO_END_SIZE: number;
  4536. /** !#en The starting radius of the particle is equal to the ending radius.
  4537. !#zh 表示粒子的起始半径等于结束半径。 */
  4538. static START_RADIUS_EQUAL_TO_END_RADIUS: number;
  4539. /**
  4540. !#en Stop emitting particles. Running particles will continue to run until they die.
  4541. !#zh 停止发射器发射粒子,发射出去的粒子将继续运行,直至粒子生命结束。
  4542. @example
  4543. ```js
  4544. // stop particle system.
  4545. myParticleSystem.stopSystem();
  4546. ```
  4547. */
  4548. stopSystem(): void;
  4549. /**
  4550. !#en Kill all living particles.
  4551. !#zh 杀死所有存在的粒子,然后重新启动粒子发射器。
  4552. @example
  4553. ```js
  4554. // play particle system.
  4555. myParticleSystem.resetSystem();
  4556. ```
  4557. */
  4558. resetSystem(): void;
  4559. /**
  4560. !#en Whether or not the system is full.
  4561. !#zh 发射器中粒子是否大于等于设置的总粒子数量。
  4562. */
  4563. isFull(): boolean;
  4564. /**
  4565. !#en Sets a new texture with a rect. The rect is in texture position and size.
  4566. Please use spriteFrame property instead, this function is deprecated since v1.9
  4567. !#zh 设置一张新贴图和关联的矩形。
  4568. 请直接设置 spriteFrame 属性,这个函数从 v1.9 版本开始已经被废弃
  4569. @param texture texture
  4570. @param rect rect
  4571. */
  4572. setTextureWithRect(texture: Texture2D, rect: Rect): void;
  4573. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  4574. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  4575. srcBlendFactor: macro.BlendFactor;
  4576. /** !#en specify the destination Blend Factor.
  4577. !#zh 指定目标的混合模式 */
  4578. dstBlendFactor: macro.BlendFactor;
  4579. }
  4580. /** !#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.
  4581. !#zh WebView 组件,用于在游戏中显示网页。由于不同平台对于 WebView 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。 */
  4582. export class WebView extends Component {
  4583. /** !#en A given URL to be loaded by the WebView, it should have a http or https prefix.
  4584. !#zh 指定 WebView 加载的网址,它应该是一个 http 或者 https 开头的字符串 */
  4585. url: string;
  4586. /** !#en The webview's event callback , it will be triggered when certain webview event occurs.
  4587. !#zh WebView 的回调事件,当网页加载过程中,加载完成后或者加载出错时都会回调此函数 */
  4588. webviewLoadedEvents: Component.EventHandler[];
  4589. /**
  4590. !#en
  4591. Set javascript interface scheme (see also setOnJSCallback). <br/>
  4592. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  4593. Please refer to the official documentation for more details.
  4594. !#zh
  4595. 设置 JavaScript 接口方案(与 'setOnJSCallback' 配套使用)。<br/>
  4596. 注意:只支持 Android 和 iOS ,Web 端用法请前往官方文档查看。<br/>
  4597. 详情请参阅官方文档
  4598. @param scheme scheme
  4599. */
  4600. setJavascriptInterfaceScheme(scheme: string): void;
  4601. /**
  4602. !#en
  4603. This callback called when load URL that start with javascript
  4604. interface scheme (see also setJavascriptInterfaceScheme). <br/>
  4605. Note: Supports only on the Android and iOS. For HTML5, please refer to the official documentation.<br/>
  4606. Please refer to the official documentation for more details.
  4607. !#zh
  4608. 当加载 URL 以 JavaScript 接口方案开始时调用这个回调函数。<br/>
  4609. 注意:只支持 Android 和 iOS,Web 端用法请前往官方文档查看。
  4610. 详情请参阅官方文档
  4611. @param callback callback
  4612. */
  4613. setOnJSCallback(callback: Function): void;
  4614. /**
  4615. !#en
  4616. Evaluates JavaScript in the context of the currently displayed page. <br/>
  4617. Please refer to the official document for more details <br/>
  4618. Note: Cross domain issues need to be resolved by yourself <br/>
  4619. !#zh
  4620. 执行 WebView 内部页面脚本(详情请参阅官方文档) <br/>
  4621. 注意:需要自行解决跨域问题
  4622. @param str str
  4623. */
  4624. evaluateJS(str: string): void;
  4625. /**
  4626. !#en if you don't need the WebView and it isn't in any running Scene, you should
  4627. call the destroy method on this component or the associated node explicitly.
  4628. Otherwise, the created DOM element won't be removed from web page.
  4629. !#zh
  4630. 如果你不再使用 WebView,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  4631. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  4632. @example
  4633. ```js
  4634. webview.node.parent = null; // or webview.node.removeFromParent(false);
  4635. // when you don't need webview anymore
  4636. webview.node.destroy();
  4637. ```
  4638. */
  4639. destroy(): boolean;
  4640. }
  4641. /** cc.TMXLayerInfo contains the information about the layers like:
  4642. - Layer name
  4643. - Layer size
  4644. - Layer opacity at creation time (it can be modified at runtime)
  4645. - Whether the layer is visible (if it's not visible, then the CocosNode won't be created)
  4646. This information is obtained from the TMX file. */
  4647. export class TMXLayerInfo {
  4648. /** Properties of the layer info. */
  4649. properties: any;
  4650. }
  4651. /** cc.TMXImageLayerInfo contains the information about the image layers.
  4652. This information is obtained from the TMX file. */
  4653. export class TMXImageLayerInfo {
  4654. }
  4655. /** <p>cc.TMXObjectGroupInfo contains the information about the object group like:
  4656. - group name
  4657. - group size
  4658. - group opacity at creation time (it can be modified at runtime)
  4659. - Whether the group is visible
  4660. This information is obtained from the TMX file.</p> */
  4661. export class TMXObjectGroupInfo {
  4662. /** Properties of the ObjectGroup info. */
  4663. properties: any[];
  4664. }
  4665. /** <p>cc.TMXTilesetInfo contains the information about the tilesets like: <br />
  4666. - Tileset name<br />
  4667. - Tileset spacing<br />
  4668. - Tileset margin<br />
  4669. - size of the tiles<br />
  4670. - Image used for the tiles<br />
  4671. - Image size<br />
  4672. This information is obtained from the TMX file. </p> */
  4673. export class TMXTilesetInfo {
  4674. /** Tileset name */
  4675. name: string;
  4676. /** First grid */
  4677. firstGid: number;
  4678. /** Spacing */
  4679. spacing: number;
  4680. /** Margin */
  4681. margin: number;
  4682. /** Texture containing the tiles (should be sprite sheet / texture atlas) */
  4683. sourceImage: any;
  4684. /** Size in pixels of the image */
  4685. imageSize: Size;
  4686. }
  4687. /** <p>cc.TMXMapInfo contains the information about the map like: <br/>
  4688. - Map orientation (hexagonal, isometric or orthogonal)<br/>
  4689. - Tile size<br/>
  4690. - Map size</p>
  4691. <p>And it also contains: <br/>
  4692. - Layers (an array of TMXLayerInfo objects)<br/>
  4693. - Tilesets (an array of TMXTilesetInfo objects) <br/>
  4694. - ObjectGroups (an array of TMXObjectGroupInfo objects) </p>
  4695. <p>This information is obtained from the TMX file. </p> */
  4696. export class TMXMapInfo {
  4697. /** Properties of the map info. */
  4698. properties: any[];
  4699. /** Map orientation. */
  4700. orientation: number;
  4701. /** Parent element. */
  4702. parentElement: any;
  4703. /** Parent GID. */
  4704. parentGID: number;
  4705. /** Layer attributes. */
  4706. layerAttrs: any;
  4707. /** Is reading storing characters stream. */
  4708. storingCharacters: boolean;
  4709. /** Current string stored from characters stream. */
  4710. currentString: string;
  4711. /** Width of the map */
  4712. mapWidth: number;
  4713. /** Height of the map */
  4714. mapHeight: number;
  4715. /** Width of a tile */
  4716. tileWidth: number;
  4717. /** Height of a tile */
  4718. tileHeight: number;
  4719. static ATTRIB_NONE: number;
  4720. static ATTRIB_BASE64: number;
  4721. static ATTRIB_GZIP: number;
  4722. static ATTRIB_ZLIB: number;
  4723. }
  4724. /** !#en Render the TMX layer.
  4725. !#zh 渲染 TMX layer。 */
  4726. export class TiledLayer extends Component {
  4727. /**
  4728. !#en enable or disable culling
  4729. !#zh 开启或关闭裁剪。
  4730. @param value value
  4731. */
  4732. enableCulling(value: any): void;
  4733. /**
  4734. !#en Adds user's node into layer.
  4735. !#zh 添加用户节点。
  4736. @param node node
  4737. */
  4738. addUserNode(node: Node): boolean;
  4739. /**
  4740. !#en Removes user's node.
  4741. !#zh 移除用户节点。
  4742. @param node node
  4743. */
  4744. removeUserNode(node: Node): boolean;
  4745. /**
  4746. !#en Destroy user's node.
  4747. !#zh 销毁用户节点。
  4748. @param node node
  4749. */
  4750. destroyUserNode(node: Node): void;
  4751. /**
  4752. !#en Gets the layer name.
  4753. !#zh 获取层的名称。
  4754. @example
  4755. ```js
  4756. let layerName = tiledLayer.getLayerName();
  4757. cc.log(layerName);
  4758. ```
  4759. */
  4760. getLayerName(): string;
  4761. /**
  4762. !#en Set the layer name.
  4763. !#zh 设置层的名称
  4764. @param layerName layerName
  4765. @example
  4766. ```js
  4767. tiledLayer.setLayerName("New Layer");
  4768. ```
  4769. */
  4770. SetLayerName(layerName: string): void;
  4771. /**
  4772. !#en Return the value for the specific property name.
  4773. !#zh 获取指定属性名的值。
  4774. @param propertyName propertyName
  4775. @example
  4776. ```js
  4777. let property = tiledLayer.getProperty("info");
  4778. cc.log(property);
  4779. ```
  4780. */
  4781. getProperty(propertyName: string): any;
  4782. /**
  4783. !#en Returns the position in pixels of a given tile coordinate.
  4784. !#zh 获取指定 tile 的像素坐标。
  4785. @param pos position or x
  4786. @param y y
  4787. @example
  4788. ```js
  4789. let pos = tiledLayer.getPositionAt(cc.v2(0, 0));
  4790. cc.log("Pos: " + pos);
  4791. let pos = tiledLayer.getPositionAt(0, 0);
  4792. cc.log("Pos: " + pos);
  4793. ```
  4794. */
  4795. getPositionAt(pos: Vec2|number, y?: number): Vec2;
  4796. /**
  4797. !#en
  4798. Sets the tiles gid (gid = tile global id) at a given tiles rect.
  4799. !#zh
  4800. 设置给定区域的 tile 的 gid (gid = tile 全局 id),
  4801. @param gids an array contains gid
  4802. @param beginCol begin col number
  4803. @param beginRow begin row number
  4804. @param totalCols count of column
  4805. @example
  4806. ```js
  4807. tiledLayer.setTilesGIDAt([1, 1, 1, 1], 10, 10, 2)
  4808. ```
  4809. */
  4810. setTilesGIDAt(gids: any[], beginCol: number, beginRow: number, totalCols: number): void;
  4811. /**
  4812. !#en
  4813. Sets the tile gid (gid = tile global id) at a given tile coordinate.<br />
  4814. The Tile GID can be obtained by using the method "tileGIDAt" or by using the TMX editor . Tileset Mgr +1.<br />
  4815. If a tile is already placed at that position, then it will be removed.
  4816. !#zh
  4817. 设置给定坐标的 tile 的 gid (gid = tile 全局 id),
  4818. tile 的 GID 可以使用方法 “tileGIDAt” 来获得。<br />
  4819. 如果一个 tile 已经放在那个位置,那么它将被删除。
  4820. @param gid gid
  4821. @param posOrX position or x
  4822. @param flagsOrY flags or y
  4823. @param flags flags
  4824. @example
  4825. ```js
  4826. tiledLayer.setTileGIDAt(1001, 10, 10, 1)
  4827. ```
  4828. */
  4829. setTileGIDAt(gid: number, posOrX: Vec2|number, flagsOrY: number, flags?: number): void;
  4830. /**
  4831. !#en
  4832. Returns the tiles data.An array fill with GIDs. <br />
  4833. !#zh
  4834. 返回 tiles 数据. 由GID构成的一个数组. <br />
  4835. */
  4836. getTiles(): number[];
  4837. /**
  4838. !#en
  4839. Returns the tile gid at a given tile coordinate. <br />
  4840. if it returns 0, it means that the tile is empty. <br />
  4841. !#zh
  4842. 通过给定的 tile 坐标、flags(可选)返回 tile 的 GID. <br />
  4843. 如果它返回 0,则表示该 tile 为空。<br />
  4844. @param pos or x
  4845. @param y y
  4846. @example
  4847. ```js
  4848. let tileGid = tiledLayer.getTileGIDAt(0, 0);
  4849. ```
  4850. */
  4851. getTileGIDAt(pos: Vec2|number, y?: number): number;
  4852. /**
  4853. !#en Layer orientation, which is the same as the map orientation.
  4854. !#zh 获取 Layer 方向(同地图方向)。
  4855. @example
  4856. ```js
  4857. let orientation = tiledLayer.getLayerOrientation();
  4858. cc.log("Layer Orientation: " + orientation);
  4859. ```
  4860. */
  4861. getLayerOrientation(): number;
  4862. /**
  4863. !#en properties from the layer. They can be added using Tiled.
  4864. !#zh 获取 layer 的属性,可以使用 Tiled 编辑器添加属性。
  4865. @example
  4866. ```js
  4867. let properties = tiledLayer.getProperties();
  4868. cc.log("Properties: " + properties);
  4869. ```
  4870. */
  4871. getProperties(): any;
  4872. /**
  4873. !#en
  4874. Get the TiledTile with the tile coordinate.<br/>
  4875. If there is no tile in the specified coordinate and forceCreate parameter is true, <br/>
  4876. then will create a new TiledTile at the coordinate.
  4877. The renderer will render the tile with the rotation, scale, position and color property of the TiledTile.
  4878. !#zh
  4879. 通过指定的 tile 坐标获取对应的 TiledTile。 <br/>
  4880. 如果指定的坐标没有 tile,并且设置了 forceCreate 那么将会在指定的坐标创建一个新的 TiledTile 。<br/>
  4881. 在渲染这个 tile 的时候,将会使用 TiledTile 的节点的旋转、缩放、位移、颜色属性。<br/>
  4882. @param x x
  4883. @param y y
  4884. @param forceCreate forceCreate
  4885. @example
  4886. ```js
  4887. let tile = tiledLayer.getTiledTileAt(100, 100, true);
  4888. cc.log(tile);
  4889. ```
  4890. */
  4891. getTiledTileAt(x: number, y: number, forceCreate: boolean): TiledTile;
  4892. /**
  4893. !#en
  4894. Change tile to TiledTile at the specified coordinate.
  4895. !#zh
  4896. 将指定的 tile 坐标替换为指定的 TiledTile。
  4897. @param x x
  4898. @param y y
  4899. @param tiledTile tiledTile
  4900. */
  4901. setTiledTileAt(x: number, y: number, tiledTile: TiledTile): TiledTile;
  4902. /**
  4903. !#en Return texture.
  4904. !#zh 获取纹理。
  4905. @param index The index of textures
  4906. */
  4907. getTexture(index: any): Texture2D;
  4908. /**
  4909. !#en Return texture.
  4910. !#zh 获取纹理。
  4911. */
  4912. getTextures(): Texture2D;
  4913. /**
  4914. !#en Set the texture.
  4915. !#zh 设置纹理。
  4916. @param texture texture
  4917. */
  4918. setTexture(texture: Texture2D): void;
  4919. /**
  4920. !#en Set the texture.
  4921. !#zh 设置纹理。
  4922. @param textures textures
  4923. */
  4924. setTexture(textures: Texture2D): void;
  4925. /**
  4926. !#en Gets layer size.
  4927. !#zh 获得层大小。
  4928. @example
  4929. ```js
  4930. let size = tiledLayer.getLayerSize();
  4931. cc.log("layer size: " + size);
  4932. ```
  4933. */
  4934. getLayerSize(): Size;
  4935. /**
  4936. !#en Size of the map's tile (could be different from the tile's size).
  4937. !#zh 获取 tile 的大小( tile 的大小可能会有所不同)。
  4938. @example
  4939. ```js
  4940. let mapTileSize = tiledLayer.getMapTileSize();
  4941. cc.log("MapTile size: " + mapTileSize);
  4942. ```
  4943. */
  4944. getMapTileSize(): Size;
  4945. /**
  4946. !#en Gets Tile set first information for the layer.
  4947. !#zh 获取 layer 索引位置为0的 Tileset 信息。
  4948. @param index The index of tilesets
  4949. */
  4950. getTileSet(index: any): TMXTilesetInfo;
  4951. /**
  4952. !#en Gets tile set all information for the layer.
  4953. !#zh 获取 layer 所有的 Tileset 信息。
  4954. */
  4955. getTileSet(): TMXTilesetInfo;
  4956. /**
  4957. !#en Sets tile set information for the layer.
  4958. !#zh 设置 layer 的 tileset 信息。
  4959. @param tileset tileset
  4960. */
  4961. setTileSet(tileset: TMXTilesetInfo): void;
  4962. /**
  4963. !#en Sets Tile set information for the layer.
  4964. !#zh 设置 layer 的 Tileset 信息。
  4965. @param tilesets tilesets
  4966. */
  4967. setTileSets(tilesets: TMXTilesetInfo): void;
  4968. }
  4969. /** !#en Renders a TMX Tile Map in the scene.
  4970. !#zh 在场景中渲染一个 tmx 格式的 Tile Map。 */
  4971. export class TiledMap extends Component {
  4972. /** !#en The TiledMap Asset.
  4973. !#zh TiledMap 资源。 */
  4974. tmxAsset: TiledMapAsset;
  4975. /**
  4976. !#en Gets the map size.
  4977. !#zh 获取地图大小。
  4978. @example
  4979. ```js
  4980. let mapSize = tiledMap.getMapSize();
  4981. cc.log("Map Size: " + mapSize);
  4982. ```
  4983. */
  4984. getMapSize(): Size;
  4985. /**
  4986. !#en Gets the tile size.
  4987. !#zh 获取地图背景中 tile 元素的大小。
  4988. @example
  4989. ```js
  4990. let tileSize = tiledMap.getTileSize();
  4991. cc.log("Tile Size: " + tileSize);
  4992. ```
  4993. */
  4994. getTileSize(): Size;
  4995. /**
  4996. !#en map orientation.
  4997. !#zh 获取地图方向。
  4998. @example
  4999. ```js
  5000. let mapOrientation = tiledMap.getMapOrientation();
  5001. cc.log("Map Orientation: " + mapOrientation);
  5002. ```
  5003. */
  5004. getMapOrientation(): number;
  5005. /**
  5006. !#en object groups.
  5007. !#zh 获取所有的对象层。
  5008. @example
  5009. ```js
  5010. let objGroups = titledMap.getObjectGroups();
  5011. for (let i = 0; i < objGroups.length; ++i) {
  5012. cc.log("obj: " + objGroups[i]);
  5013. }
  5014. ```
  5015. */
  5016. getObjectGroups(): TiledObjectGroup[];
  5017. /**
  5018. !#en Return the TMXObjectGroup for the specific group.
  5019. !#zh 获取指定的 TMXObjectGroup。
  5020. @param groupName groupName
  5021. @example
  5022. ```js
  5023. let group = titledMap.getObjectGroup("Players");
  5024. cc.log("ObjectGroup: " + group);
  5025. ```
  5026. */
  5027. getObjectGroup(groupName: string): TiledObjectGroup;
  5028. /**
  5029. !#en enable or disable culling
  5030. !#zh 开启或关闭裁剪。
  5031. @param value value
  5032. */
  5033. enableCulling(value: any): void;
  5034. /**
  5035. !#en Gets the map properties.
  5036. !#zh 获取地图的属性。
  5037. @example
  5038. ```js
  5039. let properties = titledMap.getProperties();
  5040. for (let i = 0; i < properties.length; ++i) {
  5041. cc.log("Properties: " + properties[i]);
  5042. }
  5043. ```
  5044. */
  5045. getProperties(): any[];
  5046. /**
  5047. !#en Return All layers array.
  5048. !#zh 返回包含所有 layer 的数组。
  5049. @example
  5050. ```js
  5051. let layers = titledMap.getLayers();
  5052. for (let i = 0; i < layers.length; ++i) {
  5053. cc.log("Layers: " + layers[i]);
  5054. }
  5055. ```
  5056. */
  5057. getLayers(): TiledLayer[];
  5058. /**
  5059. !#en return the cc.TiledLayer for the specific layer.
  5060. !#zh 获取指定名称的 layer。
  5061. @param layerName layerName
  5062. @example
  5063. ```js
  5064. let layer = titledMap.getLayer("Player");
  5065. cc.log(layer);
  5066. ```
  5067. */
  5068. getLayer(layerName: string): TiledLayer;
  5069. /**
  5070. !#en Return the value for the specific property name.
  5071. !#zh 通过属性名称,获取指定的属性。
  5072. @param propertyName propertyName
  5073. @example
  5074. ```js
  5075. let property = titledMap.getProperty("info");
  5076. cc.log("Property: " + property);
  5077. ```
  5078. */
  5079. getProperty(propertyName: string): string;
  5080. /**
  5081. !#en Return properties dictionary for tile GID.
  5082. !#zh 通过 GID ,获取指定的属性。
  5083. @param GID GID
  5084. @example
  5085. ```js
  5086. let properties = titledMap.getPropertiesForGID(GID);
  5087. cc.log("Properties: " + properties);
  5088. ```
  5089. */
  5090. getPropertiesForGID(GID: number): any;
  5091. }
  5092. /** Class for tiled map asset handling. */
  5093. export class TiledMapAsset extends Asset {
  5094. textures: Texture2D[];
  5095. textureNames: string[];
  5096. textureSizes: Size[];
  5097. imageLayerTextures: Texture2D[];
  5098. imageLayerTextureNames: string[];
  5099. }
  5100. /** !#en Renders the TMX object group.
  5101. !#zh 渲染 tmx object group。 */
  5102. export class TiledObjectGroup extends Component {
  5103. /**
  5104. !#en Offset position of child objects.
  5105. !#zh 获取子对象的偏移位置。
  5106. @example
  5107. ```js
  5108. let offset = tMXObjectGroup.getPositionOffset();
  5109. ```
  5110. */
  5111. getPositionOffset(): Vec2;
  5112. /**
  5113. !#en List of properties stored in a dictionary.
  5114. !#zh 以映射的形式获取属性列表。
  5115. @example
  5116. ```js
  5117. let offset = tMXObjectGroup.getProperties();
  5118. ```
  5119. */
  5120. getProperties(): any;
  5121. /**
  5122. !#en Gets the Group name.
  5123. !#zh 获取组名称。
  5124. @example
  5125. ```js
  5126. let groupName = tMXObjectGroup.getGroupName;
  5127. ```
  5128. */
  5129. getGroupName(): string;
  5130. /**
  5131. !#en
  5132. Return the object for the specific object name. <br />
  5133. It will return the 1st object found on the array for the given name.
  5134. !#zh 获取指定的对象。
  5135. @param objectName objectName
  5136. @example
  5137. ```js
  5138. let object = tMXObjectGroup.getObject("Group");
  5139. ```
  5140. */
  5141. getObject(objectName: string): any;
  5142. /**
  5143. !#en Gets the objects.
  5144. !#zh 获取对象数组。
  5145. @example
  5146. ```js
  5147. let objects = tMXObjectGroup.getObjects();
  5148. ```
  5149. */
  5150. getObjects(): any[];
  5151. }
  5152. /** !#en TiledTile can control the specified map tile.
  5153. It will apply the node rotation, scale, translate to the map tile.
  5154. You can change the TiledTile's gid to change the map tile's style.
  5155. !#zh TiledTile 可以单独对某一个地图块进行操作。
  5156. 他会将节点的旋转,缩放,平移操作应用在这个地图块上,并可以通过更换当前地图块的 gid 来更换地图块的显示样式。 */
  5157. export class TiledTile extends Component {
  5158. /** !#en Specify the TiledTile horizontal coordinate,use map tile as the unit.
  5159. !#zh 指定 TiledTile 的横向坐标,以地图块为单位 */
  5160. x: number;
  5161. /** !#en Specify the TiledTile vertical coordinate,use map tile as the unit.
  5162. !#zh 指定 TiledTile 的纵向坐标,以地图块为单位 */
  5163. y: number;
  5164. /** !#en Specify the TiledTile gid.
  5165. !#zh 指定 TiledTile 的 gid 值 */
  5166. gid: number;
  5167. }
  5168. /** !#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.
  5169. !#zh Video 组件,用于在游戏中播放视频。由于不同平台对于 VideoPlayer 组件的授权、API、控制方式都不同,还没有形成统一的标准,所以目前只支持 Web、iOS 和 Android 平台。 */
  5170. export class VideoPlayer extends Component {
  5171. /** !#en The resource type of videoplayer, REMOTE for remote url and LOCAL for local file path.
  5172. !#zh 视频来源:REMOTE 表示远程视频 URL,LOCAL 表示本地视频地址。 */
  5173. resourceType: VideoPlayer.ResourceType;
  5174. /** !#en The remote URL of video.
  5175. !#zh 远程视频的 URL */
  5176. remoteURL: string;
  5177. /** !#en The local video full path.
  5178. !#zh 本地视频的 URL */
  5179. clip: string;
  5180. /** !#en The current playback time of the now playing item in seconds, you could also change the start playback time.
  5181. !#zh 指定视频从什么时间点开始播放,单位是秒,也可以用来获取当前视频播放的时间进度。 */
  5182. currentTime: number;
  5183. /** !#en The volume of the video.
  5184. !#zh 视频的音量(0.0 ~ 1.0) */
  5185. volume: number;
  5186. /** !#en Mutes the VideoPlayer. Mute sets the volume=0, Un-Mute restore the original volume.
  5187. !#zh 是否静音视频。静音时设置音量为 0,取消静音是恢复原来的音量。 */
  5188. mute: boolean;
  5189. /** !#en Whether keep the aspect ration of the original video.
  5190. !#zh 是否保持视频原来的宽高比 */
  5191. keepAspectRatio: boolean;
  5192. /** !#en Whether play video in fullscreen mode.
  5193. !#zh 是否全屏播放视频 */
  5194. isFullscreen: boolean;
  5195. /** !#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).
  5196. !#zh 永远在游戏视图最底层(这个属性只有在 Web 平台上有效果。注意:具体效果无法保证一致,跟各个浏览器是否支持与限制有关) */
  5197. stayOnBottom: boolean;
  5198. /** !#en the video player's callback, it will be triggered when certain event occurs, like: playing, paused, stopped and completed.
  5199. !#zh 视频播放回调函数,该回调函数会在特定情况被触发,比如播放中,暂时,停止和完成播放。 */
  5200. videoPlayerEvent: Component.EventHandler[];
  5201. /**
  5202. !#en If a video is paused, call this method could resume playing. If a video is stopped, call this method to play from scratch.
  5203. !#zh 如果视频被暂停播放了,调用这个接口可以继续播放。如果视频被停止播放了,调用这个接口可以从头开始播放。
  5204. */
  5205. play(): void;
  5206. /**
  5207. !#en If a video is paused, call this method to resume playing.
  5208. !#zh 如果一个视频播放被暂停播放了,调用这个接口可以继续播放。
  5209. */
  5210. resume(): void;
  5211. /**
  5212. !#en If a video is playing, call this method to pause playing.
  5213. !#zh 如果一个视频正在播放,调用这个接口可以暂停播放。
  5214. */
  5215. pause(): void;
  5216. /**
  5217. !#en If a video is playing, call this method to stop playing immediately.
  5218. !#zh 如果一个视频正在播放,调用这个接口可以立马停止播放。
  5219. */
  5220. stop(): void;
  5221. /**
  5222. !#en Gets the duration of the video
  5223. !#zh 获取视频文件的播放总时长
  5224. */
  5225. getDuration(): number;
  5226. /**
  5227. !#en Determine whether video is playing or not.
  5228. !#zh 判断当前视频是否处于播放状态
  5229. */
  5230. isPlaying(): boolean;
  5231. /**
  5232. !#en if you don't need the VideoPlayer and it isn't in any running Scene, you should
  5233. call the destroy method on this component or the associated node explicitly.
  5234. Otherwise, the created DOM element won't be removed from web page.
  5235. !#zh
  5236. 如果你不再使用 VideoPlayer,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  5237. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  5238. @example
  5239. ```js
  5240. videoplayer.node.parent = null; // or videoplayer.node.removeFromParent(false);
  5241. // when you don't need videoplayer anymore
  5242. videoplayer.node.destroy();
  5243. ```
  5244. */
  5245. destroy(): boolean;
  5246. }
  5247. /** !#en
  5248. cc.NodePool is the cache pool designed for node type.<br/>
  5249. It can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  5250. It's recommended to create cc.NodePool instances by node type, the type corresponds to node type in game design, not the class,
  5251. for example, a prefab is a specific node type. <br/>
  5252. When you create a node pool, you can pass a Component which contains `unuse`, `reuse` functions to control the content of node.<br/>
  5253. Some common use case is :<br/>
  5254. 1. Bullets in game (die very soon, massive creation and recreation, no side effect on other objects)<br/>
  5255. 2. Blocks in candy crash (massive creation and recreation)<br/>
  5256. etc...
  5257. !#zh
  5258. cc.NodePool 是用于管理节点对象的对象缓存池。<br/>
  5259. 它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁<br/>
  5260. 以前 cocos2d-x 中的 cc.pool 和新的节点事件注册系统不兼容,因此请使用 cc.NodePool 来代替。
  5261. 新的 NodePool 需要实例化之后才能使用,每种不同的节点对象池需要一个不同的对象池实例,这里的种类对应于游戏中的节点设计,一个 prefab 相当于一个种类的节点。<br/>
  5262. 在创建缓冲池时,可以传入一个包含 unuse, reuse 函数的组件类型用于节点的回收和复用逻辑。<br/>
  5263. 一些常见的用例是:<br/>
  5264. 1.在游戏中的子弹(死亡很快,频繁创建,对其他对象无副作用)<br/>
  5265. 2.糖果粉碎传奇中的木块(频繁创建)。
  5266. 等等.... */
  5267. export class NodePool {
  5268. /**
  5269. !#en
  5270. 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.
  5271. !#zh
  5272. 使用构造函数来创建一个节点专用的对象池,您可以传递一个组件类型或名称,用于处理节点回收和复用时的事件逻辑。
  5273. @param poolHandlerComp !#en The constructor or the class name of the component to control the unuse/reuse logic. !#zh 处理节点回收和复用事件逻辑的组件类型或名称。
  5274. @example
  5275. ```js
  5276. properties: {
  5277. template: cc.Prefab
  5278. },
  5279. onLoad () {
  5280. // MyTemplateHandler is a component with 'unuse' and 'reuse' to handle events when node is reused or recycled.
  5281. this.myPool = new cc.NodePool('MyTemplateHandler');
  5282. }
  5283. ```
  5284. */
  5285. constructor(poolHandlerComp?: {prototype: Component}|string);
  5286. /** !#en The pool handler component, it could be the class name or the constructor.
  5287. !#zh 缓冲池处理组件,用于节点的回收和复用逻辑,这个属性可以是组件类名或组件的构造函数。 */
  5288. poolHandlerComp: Function|string;
  5289. /**
  5290. !#en The current available size in the pool
  5291. !#zh 获取当前缓冲池的可用对象数量
  5292. */
  5293. size(): number;
  5294. /**
  5295. !#en Destroy all cached nodes in the pool
  5296. !#zh 销毁对象池中缓存的所有节点
  5297. */
  5298. clear(): void;
  5299. /**
  5300. !#en Put a new Node into the pool.
  5301. It will automatically remove the node from its parent without cleanup.
  5302. It will also invoke unuse method of the poolHandlerComp if exist.
  5303. !#zh 向缓冲池中存入一个不再需要的节点对象。
  5304. 这个函数会自动将目标节点从父节点上移除,但是不会进行 cleanup 操作。
  5305. 这个函数会调用 poolHandlerComp 的 unuse 函数,如果组件和函数都存在的话。
  5306. @param obj obj
  5307. @example
  5308. ```js
  5309. let myNode = cc.instantiate(this.template);
  5310. this.myPool.put(myNode);
  5311. ```
  5312. */
  5313. put(obj: Node): void;
  5314. /**
  5315. !#en Get a obj from pool, if no available object in pool, null will be returned.
  5316. This function will invoke the reuse function of poolHandlerComp if exist.
  5317. !#zh 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  5318. 这个函数会调用 poolHandlerComp 的 reuse 函数,如果组件和函数都存在的话。
  5319. @param params !#en Params to pass to 'reuse' method in poolHandlerComp !#zh 向 poolHandlerComp 中的 'reuse' 函数传递的参数
  5320. @example
  5321. ```js
  5322. let newNode = this.myPool.get();
  5323. ```
  5324. */
  5325. get(...params: any[]): Node;
  5326. }
  5327. /** !#en Box Collider.
  5328. !#zh 包围盒碰撞组件 */
  5329. export class BoxCollider extends Collider implements Collider.Box {
  5330. /** !#en
  5331. Collider info in world coordinate.
  5332. !#zh
  5333. 碰撞体的世界坐标系下的信息。 */
  5334. world: ColliderInfo;
  5335. /** !#en Position offset
  5336. !#zh 位置偏移量 */
  5337. offset: Vec2;
  5338. /** !#en Box size
  5339. !#zh 包围盒大小 */
  5340. size: Size;
  5341. }
  5342. /** !#en Collider component base class.
  5343. !#zh 碰撞组件基类 */
  5344. export class Collider extends Component {
  5345. /** !#en Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
  5346. !#zh 标签。当一个节点上有多个碰撞组件时,在发生碰撞后,可以使用此标签来判断是节点上的哪个碰撞组件被碰撞了。 */
  5347. tag: number;
  5348. }
  5349. /** !#en Circle Collider.
  5350. !#zh 圆形碰撞组件 */
  5351. export class CircleCollider extends Collider implements Collider.Circle {
  5352. /** !#en
  5353. Collider info in world coordinate.
  5354. !#zh
  5355. 碰撞体的世界坐标系下的信息。 */
  5356. world: ColliderInfo;
  5357. /** !#en Position offset
  5358. !#zh 位置偏移量 */
  5359. offset: Vec2;
  5360. /** !#en Circle radius
  5361. !#zh 圆形半径 */
  5362. radius: number;
  5363. }
  5364. /** !#en
  5365. Collider Info.
  5366. !#zh
  5367. 碰撞体信息。 */
  5368. export class ColliderInfo {
  5369. /** !#en
  5370. Collider aabb information of last frame
  5371. !#zh
  5372. 碰撞体上一帧的 aabb 信息 */
  5373. preAabb: Rect;
  5374. /** !#en
  5375. Collider aabb information of current frame
  5376. !#zh
  5377. 碰撞体当前帧的 aabb 信息 */
  5378. aabb: Rect;
  5379. /** !#en
  5380. Collider matrix
  5381. !#zh
  5382. 碰撞体的矩阵信息 */
  5383. matrix: Mat4;
  5384. /** !#en
  5385. Collider radius (for CircleCollider)
  5386. !#zh
  5387. 碰撞体的半径(只对 CircleCollider 有效) */
  5388. radius: number;
  5389. /** !#en
  5390. Collider position (for CircleCollider)
  5391. !#zh
  5392. 碰撞体的位置(只对 CircleCollider 有效) */
  5393. position: Vec2;
  5394. /** !#en
  5395. Collider points (for BoxCollider and PolygonCollider)
  5396. !#zh
  5397. 碰撞体的顶点信息(只对 BoxCollider 和 PolygonCollider 有效) */
  5398. points: Vec2[];
  5399. }
  5400. /** !#en
  5401. A simple collision manager class.
  5402. It will calculate whether the collider collides other colliders, if collides then call the callbacks.
  5403. !#zh
  5404. 一个简单的碰撞组件管理类,用于处理节点之间的碰撞组件是否产生了碰撞,并调用相应回调函数。 */
  5405. export class CollisionManager implements EventTarget {
  5406. /** !#en
  5407. !#zh
  5408. 是否开启碰撞管理,默认为不开启 */
  5409. enabled: boolean;
  5410. /** !#en
  5411. !#zh
  5412. 是否绘制碰撞组件的包围盒,默认为不绘制 */
  5413. enabledDrawBoundingBox: boolean;
  5414. /** !#en
  5415. !#zh
  5416. 是否绘制碰撞组件的形状,默认为不绘制 */
  5417. enabledDebugDraw: boolean;
  5418. /**
  5419. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  5420. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  5421. @param type The type of event.
  5422. */
  5423. hasEventListener(type: string): boolean;
  5424. /**
  5425. !#en
  5426. Register an callback of a specific event type on the EventTarget.
  5427. This type of event should be triggered via `emit`.
  5428. !#zh
  5429. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  5430. @param type A string representing the event type to listen for.
  5431. @param callback The callback that will be invoked when the event is dispatched.
  5432. The callback is ignored if it is a duplicate (the callbacks are unique).
  5433. @param target The target (this object) to invoke the callback, can be null
  5434. @example
  5435. ```js
  5436. eventTarget.on('fire', function () {
  5437. cc.log("fire in the hole");
  5438. }, node);
  5439. ```
  5440. */
  5441. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  5442. /**
  5443. !#en
  5444. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  5445. if only type is passed as parameter, all listeners registered with that type will be removed.
  5446. !#zh
  5447. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  5448. @param type A string representing the event type being removed.
  5449. @param callback The callback to remove.
  5450. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  5451. @example
  5452. ```js
  5453. // register fire eventListener
  5454. var callback = eventTarget.on('fire', function () {
  5455. cc.log("fire in the hole");
  5456. }, target);
  5457. // remove fire event listener
  5458. eventTarget.off('fire', callback, target);
  5459. // remove all fire event listeners
  5460. eventTarget.off('fire');
  5461. ```
  5462. */
  5463. off(type: string, callback?: Function, target?: any): void;
  5464. /**
  5465. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  5466. This is not for removing all listeners in the current event target,
  5467. and this is not for removing all listeners the target parameter have registered.
  5468. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  5469. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  5470. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  5471. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  5472. @param target The target to be searched for all related listeners
  5473. */
  5474. targetOff(target: any): void;
  5475. /**
  5476. !#en
  5477. Register an callback of a specific event type on the EventTarget,
  5478. the callback will remove itself after the first time it is triggered.
  5479. !#zh
  5480. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  5481. @param type A string representing the event type to listen for.
  5482. @param callback The callback that will be invoked when the event is dispatched.
  5483. The callback is ignored if it is a duplicate (the callbacks are unique).
  5484. @param target The target (this object) to invoke the callback, can be null
  5485. @example
  5486. ```js
  5487. eventTarget.once('fire', function () {
  5488. cc.log("this is the callback and will be invoked only once");
  5489. }, node);
  5490. ```
  5491. */
  5492. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  5493. /**
  5494. !#en
  5495. Send an event with the event object.
  5496. !#zh
  5497. 通过事件对象派发事件
  5498. @param event event
  5499. */
  5500. dispatchEvent(event: Event): void;
  5501. /**
  5502. !#en
  5503. Destroy all callbackInfos.
  5504. !#zh
  5505. 销毁记录的事件
  5506. */
  5507. clear(): void;
  5508. }
  5509. /** !#en Intersection helper class
  5510. !#zh 辅助类,用于测试形状与形状是否相交 */
  5511. export class Intersection {
  5512. /**
  5513. !#en Test line and line
  5514. !#zh 测试线段与线段是否相交
  5515. @param a1 The start point of the first line
  5516. @param a2 The end point of the first line
  5517. @param b1 The start point of the second line
  5518. @param b2 The end point of the second line
  5519. */
  5520. static lineLine(a1: Vec2, a2: Vec2, b1: Vec2, b2: Vec2): boolean;
  5521. /**
  5522. !#en Test line and rect
  5523. !#zh 测试线段与矩形是否相交
  5524. @param a1 The start point of the line
  5525. @param a2 The end point of the line
  5526. @param b The rect
  5527. */
  5528. static lineRect(a1: Vec2, a2: Vec2, b: Rect): boolean;
  5529. /**
  5530. !#en Test line and polygon
  5531. !#zh 测试线段与多边形是否相交
  5532. @param a1 The start point of the line
  5533. @param a2 The end point of the line
  5534. @param b The polygon, a set of points
  5535. */
  5536. static linePolygon(a1: Vec2, a2: Vec2, b: Vec2[]): boolean;
  5537. /**
  5538. !#en Test rect and rect
  5539. !#zh 测试矩形与矩形是否相交
  5540. @param a The first rect
  5541. @param b The second rect
  5542. */
  5543. static rectRect(a: Rect, b: Rect): boolean;
  5544. /**
  5545. !#en Test rect and polygon
  5546. !#zh 测试矩形与多边形是否相交
  5547. @param a The rect
  5548. @param b The polygon, a set of points
  5549. */
  5550. static rectPolygon(a: Rect, b: Vec2[]): boolean;
  5551. /**
  5552. !#en Test polygon and polygon
  5553. !#zh 测试多边形与多边形是否相交
  5554. @param a The first polygon, a set of points
  5555. @param b The second polygon, a set of points
  5556. */
  5557. static polygonPolygon(a: Vec2[], b: Vec2[]): boolean;
  5558. /**
  5559. !#en Test circle and circle
  5560. !#zh 测试圆形与圆形是否相交
  5561. @param a Object contains position and radius
  5562. @param b Object contains position and radius
  5563. */
  5564. static circleCircle(a: {position: Vec2, radius: number}, b: {position: Vec2, radius: number}): boolean;
  5565. /**
  5566. !#en Test polygon and circle
  5567. !#zh 测试矩形与圆形是否相交
  5568. @param polygon The Polygon, a set of points
  5569. @param circle Object contains position and radius
  5570. */
  5571. static polygonCircle(polygon: Vec2[], circle: {position: Vec2, radius: number}): boolean;
  5572. /**
  5573. !#en Test whether the point is in the polygon
  5574. !#zh 测试一个点是否在一个多边形中
  5575. @param point The point
  5576. @param polygon The polygon, a set of points
  5577. */
  5578. static pointInPolygon(point: Vec2, polygon: Vec2[]): boolean;
  5579. /**
  5580. !#en Calculate the distance of point to line.
  5581. !#zh 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。
  5582. @param point The point
  5583. @param start The start point of line
  5584. @param end The end point of line
  5585. @param isSegment whether this line is a segment
  5586. */
  5587. static pointLineDistance(point: Vec2, start: Vec2, end: Vec2, isSegment: boolean): number;
  5588. }
  5589. /** !#en Polygon Collider.
  5590. !#zh 多边形碰撞组件 */
  5591. export class PolygonCollider extends Collider implements Collider.Polygon {
  5592. /** !#en
  5593. Collider info in world coordinate.
  5594. !#zh
  5595. 碰撞体的世界坐标系下的信息。 */
  5596. world: ColliderInfo;
  5597. /** !#en Position offset
  5598. !#zh 位置偏移量 */
  5599. offset: Vec2;
  5600. /** !#en Polygon points
  5601. !#zh 多边形顶点数组 */
  5602. points: Vec2[];
  5603. }
  5604. /** !#en The Light Component
  5605. !#zh 光源组件 */
  5606. export class Light extends Component {
  5607. }
  5608. /** !#en
  5609. This module controls asset's behaviors and information, include loading, releasing etc. it is a singleton
  5610. All member can be accessed with `cc.assetManager`.
  5611. !#zh
  5612. 此模块管理资源的行为和信息,包括加载,释放等,这是一个单例,所有成员能够通过 `cc.assetManager` 调用 */
  5613. export class AssetManager {
  5614. /** !#en
  5615. Normal loading pipeline
  5616. !#zh
  5617. 正常加载管线 */
  5618. pipeline: cc.AssetManager.Pipeline;
  5619. /** !#en
  5620. Fetching pipeline
  5621. !#zh
  5622. 下载管线 */
  5623. fetchPipeline: cc.AssetManager.Pipeline;
  5624. /** !#en
  5625. Url transformer
  5626. !#zh
  5627. Url 转换器 */
  5628. transformPipeline: cc.AssetManager.Pipeline;
  5629. /** !#en
  5630. The collection of bundle which is already loaded, you can remove cache with {{#crossLink "AssetManager/removeBundle:method"}}{{/crossLink}}
  5631. !#zh
  5632. 已加载 bundle 的集合, 你能通过 {{#crossLink "AssetManager/removeBundle:method"}}{{/crossLink}} 来移除缓存 */
  5633. bundles: AssetManager.Cache<AssetManager.Bundle>;
  5634. /** !#en
  5635. The collection of asset which is already loaded, you can remove cache with {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  5636. !#zh
  5637. 已加载资源的集合, 你能通过 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} 来移除缓存 */
  5638. assets: AssetManager.Cache<cc.Asset>;
  5639. /** !#en
  5640. Manage relationship between asset and its dependencies
  5641. !#zh
  5642. 管理资源依赖关系 */
  5643. dependUtil: cc.AssetManager.DependUtil;
  5644. /** !#en
  5645. Whether or not cache the loaded asset
  5646. !#zh
  5647. 是否缓存已加载的资源 */
  5648. cacheAsset: boolean;
  5649. /** !#en
  5650. Whether or not load asset forcely, if it is true, asset will be loaded regardless of error
  5651. !#zh
  5652. 是否强制加载资源, 如果为 true ,加载资源将会忽略报错 */
  5653. force: boolean;
  5654. /** !#en
  5655. Some useful function
  5656. !#zh
  5657. 一些有用的方法 */
  5658. utils: cc.AssetManager.Helper;
  5659. /** !#en
  5660. Manage all downloading task
  5661. !#zh
  5662. 管理所有下载任务 */
  5663. downloader: cc.AssetManager.Downloader;
  5664. /** !#en
  5665. Manage all parsing task
  5666. !#zh
  5667. 管理所有解析任务 */
  5668. parser: cc.AssetManager.Parser;
  5669. /** !#en
  5670. Manage internal asset
  5671. !#zh
  5672. 管理内置资源 */
  5673. builtins: cc.AssetManager.Builtins;
  5674. /** !#en
  5675. Manage all packed asset
  5676. !#zh
  5677. 管理所有合并后的资源 */
  5678. packManager: cc.AssetManager.PackManager;
  5679. /** !#en
  5680. Cache manager is a module which controls all caches downloaded from server in non-web platform.
  5681. !#zh
  5682. 缓存管理器是一个模块,在非 WEB 平台上,用于管理所有从服务器上下载下来的缓存 */
  5683. cacheManager: cc.AssetManager.CacheManager|null;
  5684. /** !#en
  5685. The preset of options
  5686. !#zh
  5687. 可选参数的预设集 */
  5688. presets: Record<string, Record<string, any>>;
  5689. /** !#en
  5690. The builtin 'main' bundle
  5691. !#zh
  5692. 内置 main 包 */
  5693. main: cc.AssetManager.Bundle;
  5694. /** !#en
  5695. The builtin 'resources' bundle
  5696. !#zh
  5697. 内置 resources 包 */
  5698. resources: cc.AssetManager.Bundle;
  5699. /** !#en
  5700. The builtin 'internal' bundle
  5701. !#zh
  5702. 内置 internal 包 */
  5703. internal: cc.AssetManager.Bundle;
  5704. /**
  5705. !#en
  5706. Initialize assetManager with options
  5707. !#zh
  5708. 初始化资源管理器
  5709. @param options options
  5710. */
  5711. init(options: Record<string, any>): void;
  5712. /**
  5713. !#en
  5714. Get the bundle which has been loaded
  5715. !#zh
  5716. 获取已加载的分包
  5717. @param name The name of bundle
  5718. @example
  5719. ```js
  5720. // ${project}/assets/test1
  5721. cc.assetManager.getBundle('test1');
  5722. cc.assetManager.getBundle('resources');
  5723. ```
  5724. */
  5725. getBundle (name: string): cc.AssetManager.Bundle;
  5726. /**
  5727. !#en
  5728. 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
  5729. !#zh
  5730. 移除此包, 注意:这个包内的资源不会自动释放, 如果需要的话你可以在摧毁之前手动调用 {{#crossLink "Bundle/releaseAll:method"}}{{/crossLink}} 进行释放
  5731. @param bundle The bundle to be removed
  5732. */
  5733. removeBundle(bundle: cc.AssetManager.Bundle): void;
  5734. /**
  5735. !#en
  5736. 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`.
  5737. 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`.
  5738. 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.
  5739. Every custom parameter in `requests` will be tranfered to handler of `downloader` and `parser` as `options`.
  5740. You can register you own handler downloader or parser to collect these custom parameters for some effect.
  5741. Reserved Keyword: `uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`, `maxConcurrency`, `maxRequestsPerFrame`
  5742. `maxRetryCount`, `version`, `responseType`, `withCredentials`, `mimeType`, `timeout`, `header`, `reload`, `cacheAsset`, `cacheEnabled`,
  5743. Please DO NOT use these words as custom options!
  5744. !#zh
  5745. 通用加载资源接口,可传入进度回调以及完成回调,通过组合 `request` 和 `options` 参数,几乎可以实现和扩展所有想要的加载效果。非常建议你使用更简单的API,例如 `load`、`loadDir` 等。
  5746. `options` 中的自定义参数将会分发到 `requests` 的每一项中,如果request中已存在同名的参数则以 `requests` 中为准,同时如果有其他
  5747. 依赖资源,则 `options` 中的参数会继续向依赖项中分发。request中的自定义参数都会以 `options` 形式传入加载流程中的 `downloader`, `parser` 的方法中, 你可以
  5748. 扩展 `downloader`, `parser` 收集参数完成想实现的效果。
  5749. 保留关键字: `uuid`, `url`, `path`, `dir`, `scene`, `type`, `priority`, `preset`, `audioLoadMode`, `ext`, `bundle`, `onFileProgress`, `maxConcurrency`, `maxRequestsPerFrame`
  5750. `maxRetryCount`, `version`, `responseType`, `withCredentials`, `mimeType`, `timeout`, `header`, `reload`, `cacheAsset`, `cacheEnabled`,
  5751. 请不要使用这些字段为自定义参数!
  5752. @param requests The request you want to load
  5753. @param options Optional parameters
  5754. @param onProgress Callback invoked when progression change
  5755. @param onComplete Callback invoked when finish loading
  5756. @example
  5757. ```js
  5758. cc.assetManager.loadAny({url: 'http://example.com/a.png'}, (err, img) => cc.log(img));
  5759. cc.assetManager.loadAny(['60sVXiTH1D/6Aft4MRt9VC'], (err, assets) => cc.log(assets));
  5760. cc.assetManager.loadAny([{ uuid: '0cbZa5Y71CTZAccaIFluuZ'}, {url: 'http://example.com/a.png'}], (err, assets) => cc.log(assets));
  5761. cc.assetManager.downloader.register('.asset', (url, options, onComplete) => {
  5762. url += '?userName=' + options.userName + "&password=" + options.password;
  5763. cc.assetManager.downloader.downloadFile(url, null, onComplete);
  5764. });
  5765. cc.assetManager.parser.register('.asset', (file, options, onComplete) => {
  5766. var json = JSON.parse(file);
  5767. var skin = json[options.skin];
  5768. var model = json[options.model];
  5769. onComplete(null, {skin, model});
  5770. });
  5771. cc.assetManager.loadAny({ url: 'http://example.com/my.asset', skin: 'xxx', model: 'xxx', userName: 'xxx', password: 'xxx' });
  5772. ```
  5773. */
  5774. 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;
  5775. 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;
  5776. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>, onComplete: (err: Error, data: any) => void): void;
  5777. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onComplete: (err: Error, data: any) => void): void;
  5778. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>): void;
  5779. loadAny(requests: string | string[] | Record<string, any> | Record<string, any>[]): void;
  5780. /**
  5781. !#en
  5782. 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.
  5783. 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)`
  5784. to finish loading asset
  5785. !#zh
  5786. 通用预加载资源接口,可传入进度回调以及完成回调,非常建议你使用更简单的 API ,例如 `preloadRes`, `preloadResDir` 等。`preloadAny` 和 `loadAny` 几乎一样,区别在于 `preloadAny` 只会下载资源,不会去解析资源,你需要调用 `cc.assetManager.loadAny(preloadTask)`
  5787. 来完成资源加载。
  5788. @param requests The request you want to preload
  5789. @param options Optional parameters
  5790. @param onProgress Callback invoked when progression change
  5791. @param onComplete Callback invoked when finish preloading
  5792. @example
  5793. ```js
  5794. cc.assetManager.preloadAny('0cbZa5Y71CTZAccaIFluuZ', (err) => cc.assetManager.loadAny('0cbZa5Y71CTZAccaIFluuZ'));
  5795. ```
  5796. */
  5797. 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;
  5798. 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;
  5799. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>, onComplete: (err: Error, items: cc.AssetManager.RequestItem[]) => void): void;
  5800. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], onComplete: (err: Error, items: cc.AssetManager.RequestItem[]) => void): void;
  5801. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[], options: Record<string, any>): void;
  5802. preloadAny(requests: string | string[] | Record<string, any> | Record<string, any>[]): void;
  5803. /**
  5804. !#en
  5805. 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
  5806. !#zh
  5807. 加载资源的原生文件,如果你勾选了'延迟加载资源'选项,你可能需要在使用资源之前调用此方法来加载原生文件
  5808. @param asset The asset
  5809. @param options Some optional parameters
  5810. @param onComplete Callback invoked when finish loading
  5811. @example
  5812. ```js
  5813. cc.assetManager.postLoadNative(texture, (err) => console.log(err));
  5814. ```
  5815. */
  5816. postLoadNative(asset: cc.Asset, options: Record<string, any>, onComplete: (err: Error) => void): void;
  5817. postLoadNative(asset: cc.Asset, onComplete: (err: Error) => void): void;
  5818. postLoadNative(asset: cc.Asset, options: Record<string, any>): void;
  5819. postLoadNative(asset: cc.Asset): void;
  5820. /**
  5821. !#en
  5822. Load remote asset with url, such as audio, image, text and so on.
  5823. !#zh
  5824. 使用 url 加载远程资源,例如音频,图片,文本等等。
  5825. @param url The url of asset
  5826. @param options Some optional parameters
  5827. @param onComplete Callback invoked when finish loading
  5828. @example
  5829. ```js
  5830. cc.assetManager.loadRemote('http://www.cloud.com/test1.jpg', (err, texture) => console.log(err));
  5831. cc.assetManager.loadRemote('http://www.cloud.com/test2.mp3', (err, audioClip) => console.log(err));
  5832. cc.assetManager.loadRemote('http://www.cloud.com/test3', { ext: '.png' }, (err, texture) => console.log(err));
  5833. ```
  5834. */
  5835. loadRemote<T extends cc.Asset>(url: string, options: Record<string, any>, onComplete: (err: Error, asset: T) => void): void;
  5836. loadRemote<T extends cc.Asset>(url: string, onComplete: (err: Error, asset: T) => void): void;
  5837. loadRemote<T extends cc.Asset>(url: string, options: Record<string, any>): void;
  5838. loadRemote<T extends cc.Asset>(url: string): void;
  5839. /**
  5840. !#en
  5841. Load script
  5842. !#zh
  5843. 加载脚本
  5844. @param url Url of the script
  5845. @param options Some optional paramters
  5846. @param onComplete Callback when script loaded or failed
  5847. @example
  5848. ```js
  5849. loadScript('http://localhost:8080/index.js', null, (err) => console.log(err));
  5850. ```
  5851. */
  5852. loadScript(url: string|string[], options: Record<string, any>, onComplete: (err: Error) => void): void;
  5853. loadScript(url: string|string[], onComplete: (err: Error) => void): void;
  5854. loadScript(url: string|string[], options: Record<string, any>): void;
  5855. loadScript(url: string|string[]): void;
  5856. /**
  5857. !#en
  5858. load bundle
  5859. !#zh
  5860. 加载资源包
  5861. @param nameOrUrl The name or root path of bundle
  5862. @param options Some optional paramter, same like downloader.downloadFile
  5863. @param onComplete Callback when bundle loaded or failed
  5864. @example
  5865. ```js
  5866. loadBundle('http://localhost:8080/test', null, (err, bundle) => console.log(err));
  5867. ```
  5868. */
  5869. loadBundle(nameOrUrl: string, options: Record<string, any>, onComplete: (err: Error, bundle: cc.AssetManager.Bundle) => void): void;
  5870. loadBundle(nameOrUrl: string, onComplete: (err: Error, bundle: cc.AssetManager.Bundle) => void): void;
  5871. loadBundle(nameOrUrl: string, options: Record<string, any>): void;
  5872. loadBundle(nameOrUrl: string): void;
  5873. /**
  5874. !#en
  5875. Release asset and it's dependencies.
  5876. This method will not only remove the cache of the asset in assetManager, but also clean up its content.
  5877. For example, if you release a texture, the texture asset and its gl texture data will be freed up.
  5878. 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.
  5879. !#zh
  5880. 释放资源以及其依赖资源, 这个方法不仅会从 assetManager 中删除资源的缓存引用,还会清理它的资源内容。
  5881. 比如说,当你释放一个 texture 资源,这个 texture 和它的 gl 贴图数据都会被释放。
  5882. 注意,这个函数可能会导致资源贴图或资源所依赖的贴图不可用,如果场景中存在节点仍然依赖同样的贴图,它们可能会变黑并报 GL 错误。
  5883. @param asset The asset to be released
  5884. @example
  5885. ```js
  5886. // release a texture which is no longer need
  5887. cc.assetManager.releaseAsset(texture);
  5888. ```
  5889. */
  5890. releaseAsset(asset: cc.Asset): void;
  5891. /**
  5892. !#en
  5893. Release all assets. Refer to {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} for detailed informations.
  5894. !#zh
  5895. 释放所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  5896. */
  5897. releaseAll(): void;
  5898. }
  5899. /** `cc.loader` is deprecated, please backup your project and upgrade to {{#crossLink "AssetManager"}}{{/crossLink}} */
  5900. export class loader {
  5901. /** `cc.loader.onProgress` is deprecated, please transfer onProgress to API as a parameter */
  5902. static onProgress: any;
  5903. /**
  5904. `cc.loader.load` is deprecated, please use {{#crossLink "AssetManager/loadAny:method"}}{{/crossLink}} instead
  5905. @param resources Url list in an array
  5906. @param progressCallback Callback invoked when progression change
  5907. @param completeCallback Callback invoked when all resources loaded
  5908. */
  5909. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, completeCallback?: Function): void;
  5910. static load(resources: string|string[]|{uuid?: string, url?: string, type?: string}, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: Function|null): void;
  5911. /**
  5912. `cc.loader.getXMLHttpRequest` is deprecated, please use `XMLHttpRequest` directly
  5913. */
  5914. static getXMLHttpRequest(): XMLHttpRequest;
  5915. /**
  5916. `cc.loader.getItem` is deprecated, please use `cc.assetManager.asset.get` instead
  5917. @param id The id of the item
  5918. */
  5919. static getItem(id: any): any;
  5920. /**
  5921. `cc.loader.loadRes` is deprecated, please use {{#crossLink "Bundle/load:method"}}{{/crossLink}} instead
  5922. @param url Url of the target resource.
  5923. The url is relative to the "resources" folder, extensions must be omitted.
  5924. @param type Only asset of type will be loaded if this argument is supplied.
  5925. @param progressCallback Callback invoked when progression change.
  5926. @param completeCallback Callback invoked when the resource loaded.
  5927. */
  5928. static loadRes(url: string, type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  5929. static loadRes(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any) => void): void;
  5930. static loadRes(url: string, type: typeof cc.Asset): void;
  5931. static loadRes(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any) => void)|null): void;
  5932. static loadRes(url: string, completeCallback: (error: Error, resource: any) => void): void;
  5933. static loadRes(url: string): void;
  5934. /**
  5935. `cc.loader.loadResArray` is deprecated, please use {{#crossLink "Bundle/load:method"}}{{/crossLink}} instead
  5936. @param urls Array of URLs of the target resource.
  5937. The url is relative to the "resources" folder, extensions must be omitted.
  5938. @param type Only asset of type will be loaded if this argument is supplied.
  5939. @param progressCallback Callback invoked when progression change.
  5940. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  5941. */
  5942. static loadResArray(url: string[], type: typeof cc.Asset, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  5943. static loadResArray(url: string[], type: typeof cc.Asset, completeCallback: (error: Error, resource: any[]) => void): void;
  5944. static loadResArray(url: string[], type: typeof cc.Asset): void;
  5945. static loadResArray(url: string[], progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[]) => void)|null): void;
  5946. static loadResArray(url: string[], completeCallback: (error: Error, resource: any[]) => void): void;
  5947. static loadResArray(url: string[]): void;
  5948. static loadResArray(url: string[], type: typeof cc.Asset[]): void;
  5949. /**
  5950. `cc.loader.loadResDir` is deprecated, please use {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} instead
  5951. @param url Url of the target folder.
  5952. The url is relative to the "resources" folder, extensions must be omitted.
  5953. @param type Only asset of type will be loaded if this argument is supplied.
  5954. @param progressCallback Callback invoked when progression change.
  5955. @param completeCallback A callback which is called when all assets have been loaded, or an error occurs.
  5956. */
  5957. 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;
  5958. static loadResDir(url: string, type: typeof cc.Asset, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  5959. static loadResDir(url: string, type: typeof cc.Asset): void;
  5960. static loadResDir(url: string, progressCallback: (completedCount: number, totalCount: number, item: any) => void, completeCallback: ((error: Error, resource: any[], urls: string[]) => void)|null): void;
  5961. static loadResDir(url: string, completeCallback: (error: Error, resource: any[], urls: string[]) => void): void;
  5962. static loadResDir(url: string): void;
  5963. /**
  5964. `cc.loader.getRes` is deprecated, please use {{#crossLink "Bundle/get:method"}}{{/crossLink}} instead
  5965. @param url url
  5966. @param type Only asset of type will be returned if this argument is supplied.
  5967. */
  5968. static getRes(url: string, type?: Function): any;
  5969. /**
  5970. `cc.loader.getDependsRecursively` is deprecated, please use use {{#crossLink "DependUtil/getDepsRecursively:method"}}{{/crossLink}} instead
  5971. @param owner The owner asset or the resource url or the asset's uuid
  5972. */
  5973. static getDependsRecursively(owner: Asset|string): any[];
  5974. /** `cc.loader.assetLoader` was removed, assetLoader and md5Pipe were merged into {{#crossLink "AssetManager/transformPipeline:property"}}{{/crossLink}} */
  5975. static assetLoader: any;
  5976. /** `cc.loader.md5Pipe` is deprecated, assetLoader and md5Pipe were merged into {{#crossLink "AssetManager/transformPipeline:property"}}{{/crossLink}} */
  5977. static md5Pipe: any;
  5978. /** `cc.loader.downloader` is deprecated, please use {{#crossLink "AssetManager/downloader:property"}}{{/crossLink}} instead */
  5979. static downloader: any;
  5980. /** `cc.loader.loader` is deprecated, please use {{#crossLink "AssetManager/parser:property"}}{{/crossLink}} instead */
  5981. static loader: any;
  5982. /**
  5983. `cc.loader.addDownloadHandlers` is deprecated, please use `cc.assetManager.downloader.register` instead
  5984. @param extMap Custom supported types with corresponded handler
  5985. */
  5986. static addDownloadHandlers(extMap: any): void;
  5987. /**
  5988. `cc.loader.addLoadHandlers` is deprecated, please use `cc.assetManager.parser.register` instead
  5989. @param extMap Custom supported types with corresponded handler
  5990. */
  5991. static addLoadHandlers(extMap: any): void;
  5992. /**
  5993. `cc.loader.release` is deprecated, please use {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} instead
  5994. @param asset asset
  5995. */
  5996. static release(asset: Asset|string|any[]): void;
  5997. /**
  5998. `cc.loader.releaseAsset` is deprecated, please use {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} instead
  5999. @param asset asset
  6000. */
  6001. static releaseAsset(asset: Asset): void;
  6002. /**
  6003. `cc.loader.releaseRes` is deprecated, please use {{#crossLink "AssetManager/releaseRes:method"}}{{/crossLink}} instead
  6004. @param url url
  6005. @param type Only asset of type will be released if this argument is supplied.
  6006. */
  6007. static releaseRes(url: string, type?: Function): void;
  6008. /**
  6009. `cc.loader.releaseResDir` was removed, please use {{#crossLink "AssetManager/releaseRes:method"}}{{/crossLink}} instead
  6010. */
  6011. static releaseResDir(): void;
  6012. /**
  6013. `cc.loader.releaseAll` is deprecated, please use {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}} instead
  6014. */
  6015. static releaseAll(): void;
  6016. /**
  6017. `cc.loader.removeItem` is deprecated, please use `cc.assetManager.assets.remove` instead
  6018. @param id The id of the item
  6019. */
  6020. static removeItem(id: any): boolean;
  6021. /**
  6022. `cc.loader.setAutoRelease` is deprecated, if you want to prevent some asset from auto releasing, please use {{#crossLink "Asset/addRef:method"}}{{/crossLink}} instead
  6023. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  6024. @param autoRelease indicates whether should release automatically
  6025. */
  6026. static setAutoRelease(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  6027. /**
  6028. `cc.loader.setAutoReleaseRecursively` is deprecated, if you want to prevent some asset from auto releasing, please use {{#crossLink "Asset/addRef:method"}}{{/crossLink}} instead
  6029. @param assetOrUrlOrUuid asset object or the raw asset's url or uuid
  6030. @param autoRelease indicates whether should release automatically
  6031. */
  6032. static setAutoReleaseRecursively(assetOrUrlOrUuid: Asset|string, autoRelease: boolean): void;
  6033. /**
  6034. `cc.loader.isAutoRelease` is deprecated
  6035. @param assetOrUrl asset object or the raw asset's url
  6036. */
  6037. static isAutoRelease(assetOrUrl: Asset|string): boolean;
  6038. }
  6039. /** `cc.url` is deprecated */
  6040. export class url {
  6041. /**
  6042. `cc.url.raw` is deprecated, please use `cc.resources.load` directly, or use `Asset.nativeUrl` instead.
  6043. @param url url
  6044. */
  6045. static raw(url: string): string;
  6046. }
  6047. /** `cc.LoadingItems` was removed, please use {{#crossLink "Task"}}{{/crossLink}} instead */
  6048. export class LoadingItems {
  6049. }
  6050. /** !#en
  6051. Base class for handling assets used in Creator.<br/>
  6052. You may want to override:<br/>
  6053. - createNode<br/>
  6054. - getset functions of _nativeAsset<br/>
  6055. - cc.Object._serialize<br/>
  6056. - cc.Object._deserialize<br/>
  6057. !#zh
  6058. Creator 中的资源基类。<br/>
  6059. 您可能需要重写:<br/>
  6060. - createNode <br/>
  6061. - _nativeAsset 的 getset 方法<br/>
  6062. - cc.Object._serialize<br/>
  6063. - cc.Object._deserialize<br/> */
  6064. export class Asset extends Object {
  6065. /** `cc.Asset.url` is deprecated, please use {{#crossLink "Asset/nativeUrl:property"}}{{/crossLink}} instead */
  6066. url: string;
  6067. /** !#en
  6068. Whether the asset is loaded or not.
  6069. !#zh
  6070. 该资源是否已经成功加载。 */
  6071. loaded: boolean;
  6072. /** !#en
  6073. Returns the url of this asset's native object, if none it will returns an empty string.
  6074. !#zh
  6075. 返回该资源对应的目标平台资源的 URL,如果没有将返回一个空字符串。 */
  6076. nativeUrl: string;
  6077. /** !#en
  6078. The number of reference
  6079. !#zh
  6080. 引用的数量 */
  6081. refCount: number;
  6082. /** !#en Indicates whether its dependent raw assets can support deferred load if the owner scene (or prefab) is marked as `asyncLoadAssets`.
  6083. !#zh 当场景或 Prefab 被标记为 `asyncLoadAssets`,禁止延迟加载该资源所依赖的其它原始资源。 */
  6084. static preventDeferredLoadDependents: boolean;
  6085. /** !#en Indicates whether its native object should be preloaded from native url.
  6086. !#zh 禁止预加载原生对象。 */
  6087. static preventPreloadNativeObject: boolean;
  6088. /**
  6089. !#en
  6090. Returns the asset's url.
  6091. The `Asset` object overrides the `toString()` method of the `Object` object.
  6092. For `Asset` objects, the `toString()` method returns a string representation of the object.
  6093. 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.
  6094. !#zh
  6095. 返回资源的 URL。
  6096. Asset 对象将会重写 Object 对象的 `toString()` 方法。
  6097. 对于 Asset 对象,`toString()` 方法返回该对象的字符串表示形式。
  6098. 当资源要表示为文本值时或在字符串连接时引用时,JavaScript 会自动调用 `toString()` 方法。
  6099. */
  6100. toString(): string;
  6101. /**
  6102. !#en
  6103. Create a new node using this asset in the scene.<br/>
  6104. If this type of asset dont have its corresponding node type, this method should be null.
  6105. !#zh
  6106. 使用该资源在场景中创建一个新节点。<br/>
  6107. 如果这类资源没有相应的节点类型,该方法应该是空的。
  6108. @param callback callback
  6109. */
  6110. createNode(callback: (error: string, node: any) => void): void;
  6111. /**
  6112. !#en
  6113. Add references of asset
  6114. !#zh
  6115. 增加资源的引用
  6116. */
  6117. addRef(): cc.Asset;
  6118. /**
  6119. !#en
  6120. Reduce references of asset and it will be auto released when refCount equals 0.
  6121. !#zh
  6122. 减少资源的引用并尝试进行自动释放。
  6123. */
  6124. decRef(): cc.Asset;
  6125. }
  6126. /** Predefined constants */
  6127. export class macro {
  6128. /** `cc.macro.DOWNLOAD_MAX_CONCURRENT` is deprecated now, please use {{#crossLink "Downloader/maxConcurrency:property"}}{{/crossLink}} instead */
  6129. static DOWNLOAD_MAX_CONCURRENT: number;
  6130. /** PI / 180 */
  6131. static RAD: number;
  6132. /** One degree */
  6133. static DEG: number;
  6134. static REPEAT_FOREVER: number;
  6135. static FLT_EPSILON: number;
  6136. /** Minimum z index value for node */
  6137. static MIN_ZINDEX: number;
  6138. /** Maximum z index value for node */
  6139. static MAX_ZINDEX: number;
  6140. static ONE: number;
  6141. static ZERO: number;
  6142. static SRC_ALPHA: number;
  6143. static SRC_ALPHA_SATURATE: number;
  6144. static SRC_COLOR: number;
  6145. static DST_ALPHA: number;
  6146. static DST_COLOR: number;
  6147. static ONE_MINUS_SRC_ALPHA: number;
  6148. static ONE_MINUS_SRC_COLOR: number;
  6149. static ONE_MINUS_DST_ALPHA: number;
  6150. static ONE_MINUS_DST_COLOR: number;
  6151. static ONE_MINUS_CONSTANT_ALPHA: number;
  6152. static ONE_MINUS_CONSTANT_COLOR: number;
  6153. /** Oriented vertically */
  6154. static ORIENTATION_PORTRAIT: number;
  6155. /** Oriented horizontally */
  6156. static ORIENTATION_LANDSCAPE: number;
  6157. /** Oriented automatically */
  6158. static ORIENTATION_AUTO: number;
  6159. /** <p>
  6160. If enabled, the texture coordinates will be calculated by using this formula: <br/>
  6161. - texCoord.left = (rect.x*2+1) / (texture.wide*2); <br/>
  6162. - texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2); <br/>
  6163. <br/>
  6164. The same for bottom and top. <br/>
  6165. <br/>
  6166. This formula prevents artifacts by using 99% of the texture. <br/>
  6167. The "correct" way to prevent artifacts is by expand the texture's border with the same color by 1 pixel<br/>
  6168. <br/>
  6169. Affected component: <br/>
  6170. - cc.TMXLayer <br/>
  6171. <br/>
  6172. Enabled by default. To disabled set it to 0. <br/>
  6173. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h
  6174. </p> */
  6175. static FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: number;
  6176. /** Position of the FPS (Default: 0,0 (bottom-left corner))<br/>
  6177. To modify it, in Web engine please refer to CCMacro.js, in JSB please refer to CCConfig.h */
  6178. static DIRECTOR_STATS_POSITION: Vec2;
  6179. /** <p>
  6180. If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked. <br/>
  6181. 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/>
  6182. If disabled, only the last run action will take effect.
  6183. </p> */
  6184. static ENABLE_STACKABLE_ACTIONS: number;
  6185. /** !#en
  6186. The timeout to determine whether a touch is no longer active and should be removed.
  6187. The reason to add this timeout is due to an issue in X5 browser core,
  6188. when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
  6189. no touch cancel event is triggered, and the touch will be considered active forever.
  6190. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
  6191. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
  6192. 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.
  6193. You can modify this value to have a better behavior if you find it's not enough.
  6194. !#zh
  6195. 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
  6196. 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
  6197. 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
  6198. 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
  6199. 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
  6200. 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
  6201. 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。 */
  6202. static TOUCH_TIMEOUT: number;
  6203. /** !#en
  6204. The maximum vertex count for a single batched draw call.
  6205. !#zh
  6206. 最大可以被单次批处理渲染的顶点数量。 */
  6207. static BATCH_VERTEX_COUNT: number;
  6208. /** !#en
  6209. 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.
  6210. !#zh
  6211. 是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 或者采用了摄像机的话,需要手动关闭,否则渲染会出错。 */
  6212. static ENABLE_TILEDMAP_CULLING: boolean;
  6213. /** !#en
  6214. Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance.
  6215. Though if you want to make your canvas background transparent and show other dom elements at the background,
  6216. you can set it to true before `cc.game.run`.
  6217. Web only.
  6218. !#zh
  6219. 用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。
  6220. 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 `cc.game.run` 之前将这个值设为 true。
  6221. 仅支持 Web */
  6222. static ENABLE_TRANSPARENT_CANVAS: boolean;
  6223. /** !#en
  6224. Boolean that indicates if the WebGL context is created with `antialias` option turned on, default value is false.
  6225. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated.
  6226. Whether to use this really depend on your game design and targeted platform,
  6227. device with retina display usually have good detail on graphics with or without this option,
  6228. you probably don't want antialias if your game style is pixel art based.
  6229. Also, it could have great performance impact with some browser / device using software MSAA.
  6230. You can set it to true before `cc.game.run`.
  6231. Web only.
  6232. !#zh
  6233. 用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。
  6234. 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。
  6235. 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。
  6236. 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。
  6237. 你可以在 `cc.game.run` 之前设置这个值,否则它不会生效。
  6238. 仅支持 Web */
  6239. static ENABLE_WEBGL_ANTIALIAS: boolean;
  6240. /** !#en
  6241. Whether or not enable auto culling.
  6242. This feature have been removed in v2.0 new renderer due to overall performance consumption.
  6243. We have no plan currently to re-enable auto culling.
  6244. If your game have more dynamic objects, we suggest to disable auto culling.
  6245. If your game have more static objects, we suggest to enable auto culling.
  6246. !#zh
  6247. 是否开启自动裁减功能,开启裁减功能将会把在屏幕外的物体从渲染队列中去除掉。
  6248. 这个功能在 v2.0 的新渲染器中被移除了,因为它在大多数游戏中所带来的损耗要高于性能的提升,目前我们没有计划重新支持自动裁剪。
  6249. 如果游戏中的动态物体比较多的话,建议将此选项关闭。
  6250. 如果游戏中的静态物体比较多的话,建议将此选项打开。 */
  6251. static ENABLE_CULLING: boolean;
  6252. /** !#en
  6253. 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.
  6254. Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory.
  6255. But on WeChat Game platform, the current version cache decoded data in Image object, which has high memory usage.
  6256. So we enabled this option by default on WeChat, so that we can release Image cache immediately after uploaded to GPU.
  6257. !#zh
  6258. 是否在将贴图上传至 GPU 之后删除原始图片缓存,删除之后图片将无法进行 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。
  6259. 在 Web 平台,你通常不需要开启这个选项,因为在 Web 平台 Image 对象所占用的内存很小。
  6260. 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。
  6261. 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 */
  6262. static CLEANUP_IMAGE_CACHE: boolean;
  6263. /** !#en
  6264. Whether or not show mesh wire frame.
  6265. !#zh
  6266. 是否显示网格的线框。 */
  6267. static SHOW_MESH_WIREFRAME: boolean;
  6268. /** !#en
  6269. Whether or not show mesh normal.
  6270. !#zh
  6271. 是否显示网格的法线。 */
  6272. static SHOW_MESH_NORMAL: boolean;
  6273. /** !#en
  6274. Whether to enable multi-touch.
  6275. !#zh
  6276. 是否开启多点触摸 */
  6277. static ENABLE_MULTI_TOUCH: boolean;
  6278. /** References:
  6279. https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap
  6280. https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
  6281. !#en
  6282. Whether to use image bitmap first. If enabled, memory usage will increase.
  6283. !#zh
  6284. 是否优先使用 image bitmap,启用之后,内存占用会变高 */
  6285. static ALLOW_IMAGE_BITMAP: boolean;
  6286. /** !#en
  6287. Whether to use native TTF renderer which is faster but layout slightly different.
  6288. !#zh
  6289. 是否使用原生的文本渲染机制, 布局和编辑器有差异. */
  6290. static ENABLE_NATIVE_TTF_RENDERER: boolean;
  6291. /** !#en
  6292. The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types.
  6293. Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], The iOS mobile platform also supports the PVR format。
  6294. !#zh
  6295. 引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。
  6296. 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. 另外 Ios 手机平台还额外支持了 PVR 格式。 */
  6297. static SUPPORT_TEXTURE_FORMATS: string[];
  6298. }
  6299. /** !#en Class for BitmapFont handling.
  6300. !#zh 位图字体资源类。 */
  6301. export class BitmapFont extends Font {
  6302. }
  6303. /** !#en Class for audio data handling.
  6304. !#zh 音频资源类。 */
  6305. export class AudioClip extends Asset implements EventTarget {
  6306. /** !#en Get the audio clip duration
  6307. !#zh 获取音频剪辑的长度 */
  6308. duration: number;
  6309. /**
  6310. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6311. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6312. @param type The type of event.
  6313. */
  6314. hasEventListener(type: string): boolean;
  6315. /**
  6316. !#en
  6317. Register an callback of a specific event type on the EventTarget.
  6318. This type of event should be triggered via `emit`.
  6319. !#zh
  6320. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6321. @param type A string representing the event type to listen for.
  6322. @param callback The callback that will be invoked when the event is dispatched.
  6323. The callback is ignored if it is a duplicate (the callbacks are unique).
  6324. @param target The target (this object) to invoke the callback, can be null
  6325. @example
  6326. ```js
  6327. eventTarget.on('fire', function () {
  6328. cc.log("fire in the hole");
  6329. }, node);
  6330. ```
  6331. */
  6332. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6333. /**
  6334. !#en
  6335. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6336. if only type is passed as parameter, all listeners registered with that type will be removed.
  6337. !#zh
  6338. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6339. @param type A string representing the event type being removed.
  6340. @param callback The callback to remove.
  6341. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6342. @example
  6343. ```js
  6344. // register fire eventListener
  6345. var callback = eventTarget.on('fire', function () {
  6346. cc.log("fire in the hole");
  6347. }, target);
  6348. // remove fire event listener
  6349. eventTarget.off('fire', callback, target);
  6350. // remove all fire event listeners
  6351. eventTarget.off('fire');
  6352. ```
  6353. */
  6354. off(type: string, callback?: Function, target?: any): void;
  6355. /**
  6356. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6357. This is not for removing all listeners in the current event target,
  6358. and this is not for removing all listeners the target parameter have registered.
  6359. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6360. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6361. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6362. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6363. @param target The target to be searched for all related listeners
  6364. */
  6365. targetOff(target: any): void;
  6366. /**
  6367. !#en
  6368. Register an callback of a specific event type on the EventTarget,
  6369. the callback will remove itself after the first time it is triggered.
  6370. !#zh
  6371. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6372. @param type A string representing the event type to listen for.
  6373. @param callback The callback that will be invoked when the event is dispatched.
  6374. The callback is ignored if it is a duplicate (the callbacks are unique).
  6375. @param target The target (this object) to invoke the callback, can be null
  6376. @example
  6377. ```js
  6378. eventTarget.once('fire', function () {
  6379. cc.log("this is the callback and will be invoked only once");
  6380. }, node);
  6381. ```
  6382. */
  6383. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6384. /**
  6385. !#en
  6386. Send an event with the event object.
  6387. !#zh
  6388. 通过事件对象派发事件
  6389. @param event event
  6390. */
  6391. dispatchEvent(event: Event): void;
  6392. /**
  6393. !#en
  6394. Destroy all callbackInfos.
  6395. !#zh
  6396. 销毁记录的事件
  6397. */
  6398. clear(): void;
  6399. }
  6400. /** undefined */
  6401. export class BufferAsset extends Asset {
  6402. }
  6403. /** !#en Class for Font handling.
  6404. !#zh 字体资源类。 */
  6405. export class Font extends Asset {
  6406. }
  6407. /** !#en Class for LabelAtlas handling.
  6408. !#zh 艺术数字字体资源类。 */
  6409. export class LabelAtlas extends BitmapFont {
  6410. }
  6411. /** !#en
  6412. Class for JSON file. When the JSON file is loaded, this object is returned.
  6413. The parsed JSON object can be accessed through the `json` attribute in it.<br>
  6414. If you want to get the original JSON text, you should modify the extname to `.txt`
  6415. so that it is loaded as a `TextAsset` instead of a `JsonAsset`.
  6416. !#zh
  6417. JSON 资源类。JSON 文件加载后,将会返回该对象。可以通过其中的 `json` 属性访问解析后的 JSON 对象。<br>
  6418. 如果你想要获得 JSON 的原始文本,那么应该修改源文件的后缀为 `.txt`,这样就会加载为一个 `TextAsset` 而不是 `JsonAsset`。 */
  6419. export class JsonAsset extends Asset {
  6420. /** The loaded JSON object. */
  6421. json: any;
  6422. }
  6423. /** !#en Class for prefab handling.
  6424. !#zh 预制资源类。 */
  6425. export class Prefab extends Asset {
  6426. /** the main cc.Node in the prefab */
  6427. data: Node;
  6428. /** !#zh
  6429. 设置实例化这个 prefab 时所用的优化策略。根据使用情况设置为合适的值,能优化该 prefab 实例化所用的时间。
  6430. !#en
  6431. Indicates the optimization policy for instantiating this prefab.
  6432. Set to a suitable value based on usage, can optimize the time it takes to instantiate this prefab. */
  6433. optimizationPolicy: Prefab.OptimizationPolicy;
  6434. /** !#en Indicates the raw assets of this prefab can be load after prefab loaded.
  6435. !#zh 指示该 Prefab 依赖的资源可否在 Prefab 加载后再延迟加载。 */
  6436. asyncLoadAssets: boolean;
  6437. readonly: boolean;
  6438. /**
  6439. Dynamically translation prefab data into minimized code.<br/>
  6440. This method will be called automatically before the first time the prefab being instantiated,
  6441. but you can re-call to refresh the create function once you modified the original prefab data in script.
  6442. */
  6443. compileCreateFunction(): void;
  6444. }
  6445. /** Render textures are textures that can be rendered to. */
  6446. export class RenderTexture extends Texture2D {
  6447. /**
  6448. !#en
  6449. Init the render texture with size.
  6450. !#zh
  6451. 初始化 render texture
  6452. @param width width
  6453. @param height height
  6454. @param depthStencilFormat depthStencilFormat
  6455. */
  6456. initWithSize(width?: number, height?: number, depthStencilFormat?: number): void;
  6457. /**
  6458. !#en
  6459. Get pixels from render texture, the pixels data stores in a RGBA Uint8Array.
  6460. It will return a new (width * height * 4) length Uint8Array by default。
  6461. You can specify a data to store the pixels to reuse the data,
  6462. you and can specify other params to specify the texture region to read.
  6463. !#zh
  6464. 从 render texture 读取像素数据,数据类型为 RGBA 格式的 Uint8Array 数组。
  6465. 默认每次调用此函数会生成一个大小为 (长 x 高 x 4) 的 Uint8Array。
  6466. 你可以通过传入 data 来接收像素数据,也可以通过传参来指定需要读取的区域的像素。
  6467. @param data data
  6468. @param x x
  6469. @param y y
  6470. @param w w
  6471. @param h h
  6472. */
  6473. readPixels(data?: Uint8Array, x?: number, y?: number, w?: number, h?: number): Uint8Array;
  6474. }
  6475. /** !#en Class for scene handling.
  6476. !#zh 场景资源类。 */
  6477. export class SceneAsset extends Asset {
  6478. scene: Scene;
  6479. /** !#en Indicates the raw assets of this scene can be load after scene launched.
  6480. !#zh 指示该场景依赖的资源可否在场景切换后再延迟加载。 */
  6481. asyncLoadAssets: boolean;
  6482. }
  6483. /** !#en Class for script handling.
  6484. !#zh Script 资源类。 */
  6485. export class _Script extends Asset {
  6486. }
  6487. /** !#en Class for JavaScript handling.
  6488. !#zh JavaScript 资源类。 */
  6489. export class _JavaScript extends Asset {
  6490. }
  6491. /** !#en Class for TypeScript handling.
  6492. !#zh TypeScript 资源类。 */
  6493. export class TypeScript extends Asset {
  6494. }
  6495. /** !#en Class for sprite atlas handling.
  6496. !#zh 精灵图集资源类。 */
  6497. export class SpriteAtlas extends Asset {
  6498. /**
  6499. Returns the texture of the sprite atlas
  6500. */
  6501. getTexture(): Texture2D;
  6502. /**
  6503. Returns the sprite frame correspond to the given key in sprite atlas.
  6504. @param key key
  6505. */
  6506. getSpriteFrame(key: string): SpriteFrame;
  6507. /**
  6508. Returns the sprite frames in sprite atlas.
  6509. */
  6510. getSpriteFrames(): SpriteFrame[];
  6511. }
  6512. /** !#en
  6513. A cc.SpriteFrame has:<br/>
  6514. - texture: A cc.Texture2D that will be used by render components<br/>
  6515. - rectangle: A rectangle of the texture
  6516. !#zh
  6517. 一个 SpriteFrame 包含:<br/>
  6518. - 纹理:会被渲染组件使用的 Texture2D 对象。<br/>
  6519. - 矩形:在纹理中的矩形区域。 */
  6520. export class SpriteFrame extends Asset implements EventTarget {
  6521. /** !#en Top border of the sprite
  6522. !#zh sprite 的顶部边框 */
  6523. insetTop: number;
  6524. /** !#en Bottom border of the sprite
  6525. !#zh sprite 的底部边框 */
  6526. insetBottom: number;
  6527. /** !#en Left border of the sprite
  6528. !#zh sprite 的左边边框 */
  6529. insetLeft: number;
  6530. /** !#en Right border of the sprite
  6531. !#zh sprite 的左边边框 */
  6532. insetRight: number;
  6533. /**
  6534. !#en
  6535. Constructor of SpriteFrame class.
  6536. !#zh
  6537. SpriteFrame 类的构造函数。
  6538. @param filename filename
  6539. @param rect rect
  6540. @param rotated Whether the frame is rotated in the texture
  6541. @param offset The offset of the frame in the texture
  6542. @param originalSize The size of the frame in the texture
  6543. */
  6544. constructor(filename?: string|Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size);
  6545. /**
  6546. !#en Returns whether the texture have been loaded
  6547. !#zh 返回是否已加载纹理
  6548. */
  6549. textureLoaded(): boolean;
  6550. /**
  6551. !#en Returns whether the sprite frame is rotated in the texture.
  6552. !#zh 获取 SpriteFrame 是否旋转
  6553. */
  6554. isRotated(): boolean;
  6555. /**
  6556. !#en Set whether the sprite frame is rotated in the texture.
  6557. !#zh 设置 SpriteFrame 是否旋转
  6558. @param bRotated bRotated
  6559. */
  6560. setRotated(bRotated: boolean): void;
  6561. /**
  6562. !#en Returns whether the sprite frame is flip x axis in the texture.
  6563. !#zh 获取 SpriteFrame 是否反转 x 轴
  6564. */
  6565. isFlipX(): boolean;
  6566. /**
  6567. !#en Returns whether the sprite frame is flip y axis in the texture.
  6568. !#zh 获取 SpriteFrame 是否反转 y 轴
  6569. */
  6570. isFlipY(): boolean;
  6571. /**
  6572. !#en Set whether the sprite frame is flip x axis in the texture.
  6573. !#zh 设置 SpriteFrame 是否翻转 x 轴
  6574. @param flipX flipX
  6575. */
  6576. setFlipX(flipX: boolean): void;
  6577. /**
  6578. !#en Set whether the sprite frame is flip y axis in the texture.
  6579. !#zh 设置 SpriteFrame 是否翻转 y 轴
  6580. @param flipY flipY
  6581. */
  6582. setFlipY(flipY: boolean): void;
  6583. /**
  6584. !#en Returns the rect of the sprite frame in the texture.
  6585. !#zh 获取 SpriteFrame 的纹理矩形区域
  6586. */
  6587. getRect(): Rect;
  6588. /**
  6589. !#en Sets the rect of the sprite frame in the texture.
  6590. !#zh 设置 SpriteFrame 的纹理矩形区域
  6591. @param rect rect
  6592. */
  6593. setRect(rect: Rect): void;
  6594. /**
  6595. !#en Returns the original size of the trimmed image.
  6596. !#zh 获取修剪前的原始大小
  6597. */
  6598. getOriginalSize(): Size;
  6599. /**
  6600. !#en Sets the original size of the trimmed image.
  6601. !#zh 设置修剪前的原始大小
  6602. @param size size
  6603. */
  6604. setOriginalSize(size: Size): void;
  6605. /**
  6606. !#en Returns the texture of the frame.
  6607. !#zh 获取使用的纹理实例
  6608. */
  6609. getTexture(): Texture2D;
  6610. /**
  6611. !#en Returns the offset of the frame in the texture.
  6612. !#zh 获取偏移量
  6613. */
  6614. getOffset(): Vec2;
  6615. /**
  6616. !#en Sets the offset of the frame in the texture.
  6617. !#zh 设置偏移量
  6618. @param offsets offsets
  6619. */
  6620. setOffset(offsets: Vec2): void;
  6621. /**
  6622. !#en Clone the sprite frame.
  6623. !#zh 克隆 SpriteFrame
  6624. */
  6625. clone(): SpriteFrame;
  6626. /**
  6627. !#en Set SpriteFrame with Texture, rect, rotated, offset and originalSize.<br/>
  6628. !#zh 通过 Texture,rect,rotated,offset 和 originalSize 设置 SpriteFrame。
  6629. @param texture texture
  6630. @param rect rect
  6631. @param rotated rotated
  6632. @param offset offset
  6633. @param originalSize originalSize
  6634. */
  6635. setTexture(texture: Texture2D, rect?: Rect, rotated?: boolean, offset?: Vec2, originalSize?: Size): boolean;
  6636. /**
  6637. !#en If a loading scene (or prefab) is marked as `asyncLoadAssets`, all the textures of the SpriteFrame which
  6638. associated by user's custom Components in the scene, will not preload automatically.
  6639. These textures will be load when Sprite component is going to render the SpriteFrames.
  6640. You can call this method if you want to load the texture early.
  6641. !#zh 当加载中的场景或 Prefab 被标记为 `asyncLoadAssets` 时,用户在场景中由自定义组件关联到的所有 SpriteFrame 的贴图都不会被提前加载。
  6642. 只有当 Sprite 组件要渲染这些 SpriteFrame 时,才会检查贴图是否加载。如果你希望加载过程提前,你可以手工调用这个方法。
  6643. @example
  6644. ```js
  6645. if (spriteFrame.textureLoaded()) {
  6646. this._onSpriteFrameLoaded();
  6647. }
  6648. else {
  6649. spriteFrame.once('load', this._onSpriteFrameLoaded, this);
  6650. spriteFrame.ensureLoadTexture();
  6651. }
  6652. ```
  6653. */
  6654. ensureLoadTexture(): void;
  6655. /**
  6656. !#en
  6657. 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.
  6658. !#zh
  6659. 当你暂时不再使用这个 SpriteFrame 时,可以调用这个方法来保证引用的贴图对象能被 GC。然后当你要渲染 SpriteFrame 时,你需要手动调用 `ensureLoadTexture` 来重新加载贴图。
  6660. */
  6661. clearTexture(): void;
  6662. /**
  6663. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6664. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6665. @param type The type of event.
  6666. */
  6667. hasEventListener(type: string): boolean;
  6668. /**
  6669. !#en
  6670. Register an callback of a specific event type on the EventTarget.
  6671. This type of event should be triggered via `emit`.
  6672. !#zh
  6673. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6674. @param type A string representing the event type to listen for.
  6675. @param callback The callback that will be invoked when the event is dispatched.
  6676. The callback is ignored if it is a duplicate (the callbacks are unique).
  6677. @param target The target (this object) to invoke the callback, can be null
  6678. @example
  6679. ```js
  6680. eventTarget.on('fire', function () {
  6681. cc.log("fire in the hole");
  6682. }, node);
  6683. ```
  6684. */
  6685. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6686. /**
  6687. !#en
  6688. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6689. if only type is passed as parameter, all listeners registered with that type will be removed.
  6690. !#zh
  6691. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6692. @param type A string representing the event type being removed.
  6693. @param callback The callback to remove.
  6694. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6695. @example
  6696. ```js
  6697. // register fire eventListener
  6698. var callback = eventTarget.on('fire', function () {
  6699. cc.log("fire in the hole");
  6700. }, target);
  6701. // remove fire event listener
  6702. eventTarget.off('fire', callback, target);
  6703. // remove all fire event listeners
  6704. eventTarget.off('fire');
  6705. ```
  6706. */
  6707. off(type: string, callback?: Function, target?: any): void;
  6708. /**
  6709. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6710. This is not for removing all listeners in the current event target,
  6711. and this is not for removing all listeners the target parameter have registered.
  6712. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6713. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6714. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6715. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6716. @param target The target to be searched for all related listeners
  6717. */
  6718. targetOff(target: any): void;
  6719. /**
  6720. !#en
  6721. Register an callback of a specific event type on the EventTarget,
  6722. the callback will remove itself after the first time it is triggered.
  6723. !#zh
  6724. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6725. @param type A string representing the event type to listen for.
  6726. @param callback The callback that will be invoked when the event is dispatched.
  6727. The callback is ignored if it is a duplicate (the callbacks are unique).
  6728. @param target The target (this object) to invoke the callback, can be null
  6729. @example
  6730. ```js
  6731. eventTarget.once('fire', function () {
  6732. cc.log("this is the callback and will be invoked only once");
  6733. }, node);
  6734. ```
  6735. */
  6736. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6737. /**
  6738. !#en
  6739. Send an event with the event object.
  6740. !#zh
  6741. 通过事件对象派发事件
  6742. @param event event
  6743. */
  6744. dispatchEvent(event: Event): void;
  6745. /**
  6746. !#en
  6747. Destroy all callbackInfos.
  6748. !#zh
  6749. 销毁记录的事件
  6750. */
  6751. clear(): void;
  6752. }
  6753. /** !#en Class for TTFFont handling.
  6754. !#zh TTF 字体资源类。 */
  6755. export class TTFFont extends Font {
  6756. }
  6757. /** !#en Class for text file.
  6758. !#zh 文本资源类。 */
  6759. export class TextAsset extends Asset {
  6760. /** The text contents of the resource. */
  6761. text: string;
  6762. }
  6763. /** This class allows to easily create OpenGL or Canvas 2D textures from images or raw data. */
  6764. export class Texture2D extends Asset implements EventTarget {
  6765. /** !#en Sets whether generate mipmaps for the texture
  6766. !#zh 是否为纹理设置生成 mipmaps。 */
  6767. genMipmaps: boolean;
  6768. /** !#en
  6769. Sets whether texture can be packed into texture atlas.
  6770. If need use texture uv in custom Effect, please sets packable to false.
  6771. !#zh
  6772. 设置纹理是否允许参与合图。
  6773. 如果需要在自定义 Effect 中使用纹理 UV,需要禁止该选项。 */
  6774. packable: boolean;
  6775. /** !#en
  6776. Whether the texture is loaded or not
  6777. !#zh
  6778. 贴图是否已经成功加载 */
  6779. loaded: boolean;
  6780. /** !#en
  6781. Texture width in pixel
  6782. !#zh
  6783. 贴图像素宽度 */
  6784. width: number;
  6785. /** !#en
  6786. Texture height in pixel
  6787. !#zh
  6788. 贴图像素高度 */
  6789. height: number;
  6790. /**
  6791. !#en
  6792. Get renderer texture implementation object
  6793. extended from render.Texture2D
  6794. !#zh 返回渲染器内部贴图对象
  6795. */
  6796. getImpl(): void;
  6797. /**
  6798. Update texture options, not available in Canvas render mode.
  6799. image, format, premultiplyAlpha can not be updated in native.
  6800. @param options options
  6801. */
  6802. update(options: {image: DOMImageElement; genMipmaps: boolean; format: Texture2D.PixelFormat; minFilter: Texture2D.Filter; magFilter: Texture2D.Filter; wrapS: WrapMode; wrapT: WrapMode; premultiplyAlpha: boolean; }): void;
  6803. /**
  6804. !#en
  6805. Init with HTML element.
  6806. !#zh 用 HTML Image 或 Canvas 对象初始化贴图。
  6807. @param element element
  6808. @example
  6809. ```js
  6810. var img = new Image();
  6811. img.src = dataURL;
  6812. texture.initWithElement(img);
  6813. ```
  6814. */
  6815. initWithElement(element: HTMLImageElement|HTMLCanvasElement): void;
  6816. /**
  6817. !#en
  6818. Intializes with texture data in ArrayBufferView.
  6819. !#zh 使用一个存储在 ArrayBufferView 中的图像数据(raw data)初始化数据。
  6820. @param data data
  6821. @param pixelFormat pixelFormat
  6822. @param pixelsWidth pixelsWidth
  6823. @param pixelsHeight pixelsHeight
  6824. */
  6825. initWithData(data: ArrayBufferView, pixelFormat: number, pixelsWidth: number, pixelsHeight: number): boolean;
  6826. /**
  6827. !#en
  6828. HTMLElement Object getter, available only on web.<br/>
  6829. Note: texture is packed into texture atlas by default<br/>
  6830. you should set texture.packable as false before getting Html element object.
  6831. !#zh 获取当前贴图对应的 HTML Image 或 Canvas 对象,只在 Web 平台下有效。<br/>
  6832. 注意:<br/>
  6833. texture 默认参与动态合图,如果需要获取到正确的 Html 元素对象,需要先设置 texture.packable 为 false
  6834. */
  6835. getHtmlElementObj(): HTMLImageElement;
  6836. /**
  6837. !#en
  6838. Destory this texture and immediately release its video memory. (Inherit from cc.Object.destroy)<br>
  6839. After destroy, this object is not usable anymore.
  6840. You can use cc.isValid(obj) to check whether the object is destroyed before accessing it.
  6841. !#zh
  6842. 销毁该贴图,并立即释放它对应的显存。(继承自 cc.Object.destroy)<br/>
  6843. 销毁后,该对象不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
  6844. */
  6845. destroy(): boolean;
  6846. /**
  6847. !#en
  6848. Pixel format of the texture.
  6849. !#zh 获取纹理的像素格式。
  6850. */
  6851. getPixelFormat(): number;
  6852. /**
  6853. !#en
  6854. Whether or not the texture has their Alpha premultiplied.
  6855. !#zh 检查纹理在上传 GPU 时预乘选项是否开启。
  6856. */
  6857. hasPremultipliedAlpha(): boolean;
  6858. /**
  6859. !#en
  6860. Handler of texture loaded event.
  6861. Since v2.0, you don't need to invoke this function, it will be invoked automatically after texture loaded.
  6862. !#zh 贴图加载事件处理器。v2.0 之后你将不在需要手动执行这个函数,它会在贴图加载成功之后自动执行。
  6863. @param premultiplied premultiplied
  6864. */
  6865. handleLoadedTexture(premultiplied?: boolean): void;
  6866. /**
  6867. !#en
  6868. Description of cc.Texture2D.
  6869. !#zh cc.Texture2D 描述。
  6870. */
  6871. description(): string;
  6872. /**
  6873. !#en
  6874. Release texture, please use destroy instead.
  6875. !#zh 释放纹理,请使用 destroy 替代。
  6876. */
  6877. releaseTexture(): void;
  6878. /**
  6879. !#en Sets the wrap s and wrap t options. <br/>
  6880. 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}.
  6881. !#zh 设置纹理包装模式。
  6882. 若纹理贴图尺寸是 NPOT(non power of 2),则只能使用 Texture2D.WrapMode.CLAMP_TO_EDGE。
  6883. @param wrapS wrapS
  6884. @param wrapT wrapT
  6885. */
  6886. setWrapMode(wrapS: Texture2D.WrapMode, wrapT: Texture2D.WrapMode): void;
  6887. /**
  6888. !#en Sets the minFilter and magFilter options
  6889. !#zh 设置纹理贴图缩小和放大过滤器算法选项。
  6890. @param minFilter minFilter
  6891. @param magFilter magFilter
  6892. */
  6893. setFilters(minFilter: Texture2D.Filter, magFilter: Texture2D.Filter): void;
  6894. /**
  6895. !#en
  6896. Sets the flipY options
  6897. !#zh 设置贴图的纵向翻转选项。
  6898. @param flipY flipY
  6899. */
  6900. setFlipY(flipY: boolean): void;
  6901. /**
  6902. !#en
  6903. Sets the premultiply alpha options
  6904. !#zh 设置贴图的预乘选项。
  6905. @param premultiply premultiply
  6906. */
  6907. setPremultiplyAlpha(premultiply: boolean): void;
  6908. /**
  6909. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  6910. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  6911. @param type The type of event.
  6912. */
  6913. hasEventListener(type: string): boolean;
  6914. /**
  6915. !#en
  6916. Register an callback of a specific event type on the EventTarget.
  6917. This type of event should be triggered via `emit`.
  6918. !#zh
  6919. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  6920. @param type A string representing the event type to listen for.
  6921. @param callback The callback that will be invoked when the event is dispatched.
  6922. The callback is ignored if it is a duplicate (the callbacks are unique).
  6923. @param target The target (this object) to invoke the callback, can be null
  6924. @example
  6925. ```js
  6926. eventTarget.on('fire', function () {
  6927. cc.log("fire in the hole");
  6928. }, node);
  6929. ```
  6930. */
  6931. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  6932. /**
  6933. !#en
  6934. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  6935. if only type is passed as parameter, all listeners registered with that type will be removed.
  6936. !#zh
  6937. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  6938. @param type A string representing the event type being removed.
  6939. @param callback The callback to remove.
  6940. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  6941. @example
  6942. ```js
  6943. // register fire eventListener
  6944. var callback = eventTarget.on('fire', function () {
  6945. cc.log("fire in the hole");
  6946. }, target);
  6947. // remove fire event listener
  6948. eventTarget.off('fire', callback, target);
  6949. // remove all fire event listeners
  6950. eventTarget.off('fire');
  6951. ```
  6952. */
  6953. off(type: string, callback?: Function, target?: any): void;
  6954. /**
  6955. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  6956. This is not for removing all listeners in the current event target,
  6957. and this is not for removing all listeners the target parameter have registered.
  6958. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  6959. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  6960. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  6961. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  6962. @param target The target to be searched for all related listeners
  6963. */
  6964. targetOff(target: any): void;
  6965. /**
  6966. !#en
  6967. Register an callback of a specific event type on the EventTarget,
  6968. the callback will remove itself after the first time it is triggered.
  6969. !#zh
  6970. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  6971. @param type A string representing the event type to listen for.
  6972. @param callback The callback that will be invoked when the event is dispatched.
  6973. The callback is ignored if it is a duplicate (the callbacks are unique).
  6974. @param target The target (this object) to invoke the callback, can be null
  6975. @example
  6976. ```js
  6977. eventTarget.once('fire', function () {
  6978. cc.log("this is the callback and will be invoked only once");
  6979. }, node);
  6980. ```
  6981. */
  6982. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  6983. /**
  6984. !#en
  6985. Send an event with the event object.
  6986. !#zh
  6987. 通过事件对象派发事件
  6988. @param event event
  6989. */
  6990. dispatchEvent(event: Event): void;
  6991. /**
  6992. !#en
  6993. Destroy all callbackInfos.
  6994. !#zh
  6995. 销毁记录的事件
  6996. */
  6997. clear(): void;
  6998. }
  6999. /** !#en
  7000. EventTarget is an object to which an event is dispatched when something has occurred.
  7001. Entity are the most common event targets, but other objects can be event targets too.
  7002. Event targets are an important part of the Fireball event model.
  7003. The event target serves as the focal point for how events flow through the scene graph.
  7004. When an event such as a mouse click or a keypress occurs, Fireball dispatches an event object
  7005. into the event flow from the root of the hierarchy. The event object then makes its way through
  7006. the scene graph until it reaches the event target, at which point it begins its return trip through
  7007. the scene graph. This round-trip journey to the event target is conceptually divided into three phases:
  7008. - The capture phase comprises the journey from the root to the last node before the event target's node
  7009. - The target phase comprises only the event target node
  7010. - The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the tree
  7011. See also: http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7012. Event targets can implement the following methods:
  7013. - _getCapturingTargets
  7014. - _getBubblingTargets
  7015. !#zh
  7016. 事件目标是事件触发时,分派的事件对象,Node 是最常见的事件目标,
  7017. 但是其他对象也可以是事件目标。<br/> */
  7018. export class EventTarget extends CallbacksInvoker {
  7019. /**
  7020. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  7021. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  7022. @param type The type of event.
  7023. */
  7024. hasEventListener(type: string): boolean;
  7025. /**
  7026. !#en
  7027. Register an callback of a specific event type on the EventTarget.
  7028. This type of event should be triggered via `emit`.
  7029. !#zh
  7030. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  7031. @param type A string representing the event type to listen for.
  7032. @param callback The callback that will be invoked when the event is dispatched.
  7033. The callback is ignored if it is a duplicate (the callbacks are unique).
  7034. @param target The target (this object) to invoke the callback, can be null
  7035. @example
  7036. ```js
  7037. eventTarget.on('fire', function () {
  7038. cc.log("fire in the hole");
  7039. }, node);
  7040. ```
  7041. */
  7042. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  7043. /**
  7044. !#en
  7045. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  7046. if only type is passed as parameter, all listeners registered with that type will be removed.
  7047. !#zh
  7048. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  7049. @param type A string representing the event type being removed.
  7050. @param callback The callback to remove.
  7051. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  7052. @example
  7053. ```js
  7054. // register fire eventListener
  7055. var callback = eventTarget.on('fire', function () {
  7056. cc.log("fire in the hole");
  7057. }, target);
  7058. // remove fire event listener
  7059. eventTarget.off('fire', callback, target);
  7060. // remove all fire event listeners
  7061. eventTarget.off('fire');
  7062. ```
  7063. */
  7064. off(type: string, callback?: Function, target?: any): void;
  7065. /**
  7066. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  7067. This is not for removing all listeners in the current event target,
  7068. and this is not for removing all listeners the target parameter have registered.
  7069. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  7070. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  7071. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  7072. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  7073. @param target The target to be searched for all related listeners
  7074. */
  7075. targetOff(target: any): void;
  7076. /**
  7077. !#en
  7078. Register an callback of a specific event type on the EventTarget,
  7079. the callback will remove itself after the first time it is triggered.
  7080. !#zh
  7081. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7082. @param type A string representing the event type to listen for.
  7083. @param callback The callback that will be invoked when the event is dispatched.
  7084. The callback is ignored if it is a duplicate (the callbacks are unique).
  7085. @param target The target (this object) to invoke the callback, can be null
  7086. @example
  7087. ```js
  7088. eventTarget.once('fire', function () {
  7089. cc.log("this is the callback and will be invoked only once");
  7090. }, node);
  7091. ```
  7092. */
  7093. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7094. /**
  7095. !#en
  7096. Send an event with the event object.
  7097. !#zh
  7098. 通过事件对象派发事件
  7099. @param event event
  7100. */
  7101. dispatchEvent(event: Event): void;
  7102. /**
  7103. !#en
  7104. Destroy all callbackInfos.
  7105. !#zh
  7106. 销毁记录的事件
  7107. */
  7108. clear(): void;
  7109. }
  7110. /** !#en Base class of all kinds of events.
  7111. !#zh 包含事件相关信息的对象。 */
  7112. export class Event {
  7113. /**
  7114. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  7115. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  7116. */
  7117. constructor(type: string, bubbles: boolean);
  7118. /** !#en The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  7119. !#zh 事件类型。 */
  7120. type: string;
  7121. /** !#en Indicate whether the event bubbles up through the tree or not.
  7122. !#zh 表示该事件是否进行冒泡。 */
  7123. bubbles: boolean;
  7124. /** !#en A reference to the target to which the event was originally dispatched.
  7125. !#zh 最初事件触发的目标 */
  7126. target: any;
  7127. /** !#en A reference to the currently registered target for the event.
  7128. !#zh 当前目标 */
  7129. currentTarget: any;
  7130. /** !#en
  7131. Indicates which phase of the event flow is currently being evaluated.
  7132. Returns an integer value represented by 4 constants:
  7133. - Event.NONE = 0
  7134. - Event.CAPTURING_PHASE = 1
  7135. - Event.AT_TARGET = 2
  7136. - Event.BUBBLING_PHASE = 3
  7137. The phases are explained in the [section 3.1, Event dispatch and DOM event flow]
  7138. (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
  7139. !#zh 事件阶段 */
  7140. eventPhase: number;
  7141. /**
  7142. !#en Reset the event for being stored in the object pool.
  7143. !#zh 重置对象池中存储的事件。
  7144. */
  7145. unuse(): string;
  7146. /**
  7147. !#en Reuse the event for being used again by the object pool.
  7148. !#zh 用于对象池再次使用的事件。
  7149. */
  7150. reuse(): string;
  7151. /**
  7152. !#en Stops propagation for current event.
  7153. !#zh 停止传递当前事件。
  7154. */
  7155. stopPropagation(): void;
  7156. /**
  7157. !#en Stops propagation for current event immediately,
  7158. the event won't even be dispatched to the listeners attached in the current target.
  7159. !#zh 立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
  7160. */
  7161. stopPropagationImmediate(): void;
  7162. /**
  7163. !#en Checks whether the event has been stopped.
  7164. !#zh 检查该事件是否已经停止传递.
  7165. */
  7166. isStopped(): boolean;
  7167. /**
  7168. !#en
  7169. <p>
  7170. Gets current target of the event <br/>
  7171. note: It only be available when the event listener is associated with node. <br/>
  7172. It returns 0 when the listener is associated with fixed priority.
  7173. </p>
  7174. !#zh 获取当前目标节点
  7175. */
  7176. getCurrentTarget(): Node;
  7177. /**
  7178. !#en Gets the event type.
  7179. !#zh 获取事件类型
  7180. */
  7181. getType(): string;
  7182. /** !#en Code for event without type.
  7183. !#zh 没有类型的事件 */
  7184. static NO_TYPE: string;
  7185. /** !#en The type code of Touch event.
  7186. !#zh 触摸事件类型 */
  7187. static TOUCH: string;
  7188. /** !#en The type code of Mouse event.
  7189. !#zh 鼠标事件类型 */
  7190. static MOUSE: string;
  7191. /** !#en The type code of Keyboard event.
  7192. !#zh 键盘事件类型 */
  7193. static KEYBOARD: string;
  7194. /** !#en The type code of Acceleration event.
  7195. !#zh 加速器事件类型 */
  7196. static ACCELERATION: string;
  7197. /** !#en Events not currently dispatched are in this phase
  7198. !#zh 尚未派发事件阶段 */
  7199. static NONE: number;
  7200. /** !#en
  7201. The capturing phase comprises the journey from the root to the last node before the event target's node
  7202. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7203. !#zh 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。 */
  7204. static CAPTURING_PHASE: number;
  7205. /** !#en
  7206. The target phase comprises only the event target node
  7207. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7208. !#zh 目标阶段仅包括事件目标节点。 */
  7209. static AT_TARGET: number;
  7210. /** !#en
  7211. The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy
  7212. see http://www.w3.org/TR/DOM-Level-3-Events/#event-flow
  7213. !#zh 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。 */
  7214. static BUBBLING_PHASE: number;
  7215. }
  7216. /** !#en
  7217. The System event, it currently supports keyboard events and accelerometer events.<br>
  7218. You can get the SystemEvent instance with cc.systemEvent.<br>
  7219. !#zh
  7220. 系统事件,它目前支持按键事件和重力感应事件。<br>
  7221. 你可以通过 cc.systemEvent 获取到 SystemEvent 的实例。<br> */
  7222. export class SystemEvent extends EventTarget {
  7223. /**
  7224. !#en whether enable accelerometer event
  7225. !#zh 是否启用加速度计事件
  7226. @param isEnable isEnable
  7227. */
  7228. setAccelerometerEnabled(isEnable: boolean): void;
  7229. /**
  7230. !#en set accelerometer interval value
  7231. !#zh 设置加速度计间隔值
  7232. @param interval interval
  7233. */
  7234. setAccelerometerInterval(interval: number): void;
  7235. }
  7236. /** !#en The animation component is used to play back animations.
  7237. Animation provide several events to register:
  7238. - play : Emit when begin playing animation
  7239. - stop : Emit when stop playing animation
  7240. - pause : Emit when pause animation
  7241. - resume : Emit when resume animation
  7242. - lastframe : If animation repeat count is larger than 1, emit when animation play to the last frame
  7243. - finished : Emit when finish playing animation
  7244. !#zh Animation 组件用于播放动画。
  7245. Animation 提供了一系列可注册的事件:
  7246. - play : 开始播放时
  7247. - stop : 停止播放时
  7248. - pause : 暂停播放时
  7249. - resume : 恢复播放时
  7250. - lastframe : 假如动画循环次数大于 1,当动画播放到最后一帧时
  7251. - finished : 动画播放完成时 */
  7252. export class Animation extends Component implements EventTarget {
  7253. /** !#en Animation will play the default clip when start game.
  7254. !#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 */
  7255. defaultClip: AnimationClip;
  7256. /** !#en Current played clip.
  7257. !#zh 当前播放的动画剪辑。 */
  7258. currentClip: AnimationClip;
  7259. /** !#en Whether the animation should auto play the default clip when start game.
  7260. !#zh 是否在运行游戏后自动播放默认动画剪辑。 */
  7261. playOnLoad: boolean;
  7262. /**
  7263. !#en Get all the clips used in this animation.
  7264. !#zh 获取动画组件上的所有动画剪辑。
  7265. */
  7266. getClips(): AnimationClip[];
  7267. /**
  7268. !#en Plays an animation and stop other animations.
  7269. !#zh 播放指定的动画,并且停止当前正在播放动画。如果没有指定动画,则播放默认动画。
  7270. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  7271. @param startTime play an animation from startTime
  7272. @example
  7273. ```js
  7274. var animCtrl = this.node.getComponent(cc.Animation);
  7275. animCtrl.play("linear");
  7276. ```
  7277. */
  7278. play(name?: string, startTime?: number): AnimationState;
  7279. /**
  7280. !#en
  7281. Plays an additive animation, it will not stop other animations.
  7282. If there are other animations playing, then will play several animations at the same time.
  7283. !#zh 播放指定的动画(将不会停止当前播放的动画)。如果没有指定动画,则播放默认动画。
  7284. @param name The name of animation to play. If no name is supplied then the default animation will be played.
  7285. @param startTime play an animation from startTime
  7286. @example
  7287. ```js
  7288. // linear_1 and linear_2 at the same time playing.
  7289. var animCtrl = this.node.getComponent(cc.Animation);
  7290. animCtrl.playAdditive("linear_1");
  7291. animCtrl.playAdditive("linear_2");
  7292. ```
  7293. */
  7294. playAdditive(name?: string, startTime?: number): AnimationState;
  7295. /**
  7296. !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. <br/>
  7297. Stopping an animation also Rewinds it to the Start.
  7298. !#zh 停止指定的动画。如果没有指定名字,则停止当前正在播放的动画。
  7299. @param name The animation to stop, if not supplied then stops all playing animations.
  7300. */
  7301. stop(name?: string): void;
  7302. /**
  7303. !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.
  7304. !#zh 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。
  7305. @param name The animation to pauses, if not supplied then pauses all playing animations.
  7306. */
  7307. pause(name?: string): void;
  7308. /**
  7309. !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.
  7310. !#zh 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。
  7311. @param name The animation to resumes, if not supplied then resumes all paused animations.
  7312. */
  7313. resume(name?: string): void;
  7314. /**
  7315. !#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.
  7316. !#zh 设置指定动画的播放时间。如果没有指定名字,则设置当前播放动画的播放时间。
  7317. @param time The time to go to
  7318. @param name Specified animation name, if not supplied then make all animations go to the time.
  7319. */
  7320. setCurrentTime(time?: number, name?: string): void;
  7321. /**
  7322. !#en Returns the animation state named name. If no animation with the specified name, the function will return null.
  7323. !#zh 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 null。
  7324. @param name name
  7325. */
  7326. getAnimationState(name: string): AnimationState;
  7327. /**
  7328. !#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.
  7329. !#zh 添加动画剪辑,并且可以重新设置该动画剪辑的名称。
  7330. @param clip the clip to add
  7331. @param newName newName
  7332. */
  7333. addClip(clip: AnimationClip, newName?: string): AnimationState;
  7334. /**
  7335. !#en
  7336. Remove clip from the animation list. This will remove the clip and any animation states based on it.
  7337. If there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.
  7338. 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
  7339. !#zh
  7340. 从动画列表中移除指定的动画剪辑,<br/>
  7341. 如果依赖于 clip 的 AnimationState 正在播放或者 clip 是 defaultClip 的话,默认是不会删除 clip 的。
  7342. 但是如果 force 参数为 true,则会强制停止该动画,然后移除该动画剪辑和相关的动画。这时候如果 clip 是 defaultClip,defaultClip 将会被重置为 null。
  7343. @param clip clip
  7344. @param force If force is true, then will always remove the clip and any animation states based on it.
  7345. */
  7346. removeClip(clip: AnimationClip, force?: boolean): void;
  7347. /**
  7348. !#en
  7349. Samples animations at the current state.<br/>
  7350. This is useful when you explicitly want to set up some animation state, and sample it once.
  7351. !#zh 对指定或当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。
  7352. @param name name
  7353. */
  7354. sample(name: string): void;
  7355. /**
  7356. !#en
  7357. Register animation event callback.
  7358. The event arguments will provide the AnimationState which emit the event.
  7359. When play an animation, will auto register the event callback to the AnimationState, and unregister the event callback from the AnimationState when animation stopped.
  7360. !#zh
  7361. 注册动画事件回调。
  7362. 回调的事件里将会附上发送事件的 AnimationState。
  7363. 当播放一个动画时,会自动将事件注册到对应的 AnimationState 上,停止播放时会将事件从这个 AnimationState 上取消注册。
  7364. @param type A string representing the event type to listen for.
  7365. @param callback The callback that will be invoked when the event is dispatched.
  7366. The callback is ignored if it is a duplicate (the callbacks are unique).
  7367. @param state state
  7368. @param target The target (this object) to invoke the callback, can be null
  7369. @param useCapture When set to true, the capture argument prevents callback
  7370. from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
  7371. When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
  7372. Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
  7373. @example
  7374. ```js
  7375. onPlay: function (type, state) {
  7376. // callback
  7377. }
  7378. // register event to all animation
  7379. animation.on('play', this.onPlay, this);
  7380. ```
  7381. */
  7382. on(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void;
  7383. on<T>(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void;
  7384. on(type: string, callback: (type: string, state: cc.AnimationState) => void, target?: any, useCapture?: boolean): (type: string, state: cc.AnimationState) => void;
  7385. /**
  7386. !#en
  7387. Unregister animation event callback.
  7388. !#zh
  7389. 取消注册动画事件回调。
  7390. @param type A string representing the event type being removed.
  7391. @param callback The callback to remove.
  7392. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  7393. @param useCapture Specifies whether the callback being removed was registered as a capturing callback or not.
  7394. If not specified, useCapture defaults to false. If a callback was registered twice,
  7395. one with capture and one without, each must be removed separately. Removal of a capturing callback
  7396. does not affect a non-capturing version of the same listener, and vice versa.
  7397. @example
  7398. ```js
  7399. // unregister event to all animation
  7400. animation.off('play', this.onPlay, this);
  7401. ```
  7402. */
  7403. off(type: string, callback?: Function, target?: any, useCapture?: boolean): void;
  7404. /**
  7405. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  7406. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  7407. @param type The type of event.
  7408. */
  7409. hasEventListener(type: string): boolean;
  7410. /**
  7411. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  7412. This is not for removing all listeners in the current event target,
  7413. and this is not for removing all listeners the target parameter have registered.
  7414. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  7415. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  7416. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  7417. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  7418. @param target The target to be searched for all related listeners
  7419. */
  7420. targetOff(target: any): void;
  7421. /**
  7422. !#en
  7423. Register an callback of a specific event type on the EventTarget,
  7424. the callback will remove itself after the first time it is triggered.
  7425. !#zh
  7426. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  7427. @param type A string representing the event type to listen for.
  7428. @param callback The callback that will be invoked when the event is dispatched.
  7429. The callback is ignored if it is a duplicate (the callbacks are unique).
  7430. @param target The target (this object) to invoke the callback, can be null
  7431. @example
  7432. ```js
  7433. eventTarget.once('fire', function () {
  7434. cc.log("this is the callback and will be invoked only once");
  7435. }, node);
  7436. ```
  7437. */
  7438. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  7439. /**
  7440. !#en
  7441. Send an event with the event object.
  7442. !#zh
  7443. 通过事件对象派发事件
  7444. @param event event
  7445. */
  7446. dispatchEvent(event: Event): void;
  7447. /**
  7448. !#en
  7449. Destroy all callbackInfos.
  7450. !#zh
  7451. 销毁记录的事件
  7452. */
  7453. clear(): void;
  7454. }
  7455. /** !#en Audio Source.
  7456. !#zh 音频源组件,能对音频剪辑。 */
  7457. export class AudioSource extends Component {
  7458. /** !#en
  7459. Is the audio source playing (Read Only). <br/>
  7460. Note: isPlaying is not supported for Native platforms.
  7461. !#zh
  7462. 该音频剪辑是否正播放(只读)。<br/>
  7463. 注意:Native 平台暂时不支持 isPlaying。 */
  7464. isPlaying: boolean;
  7465. /** !#en The clip of the audio source to play.
  7466. !#zh 要播放的音频剪辑。 */
  7467. clip: AudioClip;
  7468. /** !#en The volume of the audio source.
  7469. !#zh 音频源的音量(0.0 ~ 1.0)。 */
  7470. volume: number;
  7471. /** !#en Is the audio source mute?
  7472. !#zh 是否静音音频源。Mute 是设置音量为 0,取消静音是恢复原来的音量。 */
  7473. mute: boolean;
  7474. /** !#en Is the audio source looping?
  7475. !#zh 音频源是否循环播放? */
  7476. loop: boolean;
  7477. /** !#en If set to true, the audio source will automatically start playing on onEnable.
  7478. !#zh 如果设置为 true,音频源将在 onEnable 时自动播放。 */
  7479. playOnLoad: boolean;
  7480. /** !#en If set to true and AudioClip is a deferred load resource, the component will preload AudioClip in the onLoad phase.
  7481. !#zh 如果设置为 true 且 AudioClip 为延迟加载资源,组件将在 onLoad 阶段预加载 AudioClip。 */
  7482. preload: boolean;
  7483. /**
  7484. !#en Plays the clip.
  7485. !#zh 播放音频剪辑。
  7486. */
  7487. play(): void;
  7488. /**
  7489. !#en Stops the clip.
  7490. !#zh 停止当前音频剪辑。
  7491. */
  7492. stop(): void;
  7493. /**
  7494. !#en Pause the clip.
  7495. !#zh 暂停当前音频剪辑。
  7496. */
  7497. pause(): void;
  7498. /**
  7499. !#en Resume the clip.
  7500. !#zh 恢复播放。
  7501. */
  7502. resume(): void;
  7503. /**
  7504. !#en Rewind playing music.
  7505. !#zh 从头开始播放。
  7506. */
  7507. rewind(): void;
  7508. /**
  7509. !#en Get current time
  7510. !#zh 获取当前的播放时间
  7511. */
  7512. getCurrentTime(): number;
  7513. /**
  7514. !#en Set current time
  7515. !#zh 设置当前的播放时间
  7516. @param time time
  7517. */
  7518. setCurrentTime(time: number): number;
  7519. /**
  7520. !#en Get audio duration
  7521. !#zh 获取当前音频的长度
  7522. */
  7523. getDuration(): number;
  7524. }
  7525. /** !#en
  7526. 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>
  7527. This component does not have any API interface and can be added directly to the scene to take effect.
  7528. !#zh
  7529. 该组件将拦截所属节点 bounding box 内的所有输入事件(鼠标和触摸),防止输入穿透到下层节点,一般用于上层 UI 的背景。<br>
  7530. 该组件没有任何 API 接口,直接添加到场景即可生效。 */
  7531. export class BlockInputEvents extends Component {
  7532. }
  7533. /** !#en
  7534. Button component. Can be pressed or clicked. Button has 4 Transition types:
  7535. - Button.Transition.NONE // Button will do nothing
  7536. - Button.Transition.COLOR // Button will change target's color
  7537. - Button.Transition.SPRITE // Button will change target Sprite's sprite
  7538. - Button.Transition.SCALE // Button will change target node's scale
  7539. The button can bind events (but you must be on the button's node to bind events).<br/>
  7540. The following events can be triggered on all platforms.
  7541. - cc.Node.EventType.TOUCH_START // Press
  7542. - cc.Node.EventType.TOUCH_MOVE // After pressing and moving
  7543. - cc.Node.EventType.TOUCH_END // After pressing and releasing
  7544. - cc.Node.EventType.TOUCH_CANCEL // Press to cancel
  7545. The following events are only triggered on the PC platform:
  7546. - cc.Node.EventType.MOUSE_DOWN
  7547. - cc.Node.EventType.MOUSE_MOVE
  7548. - cc.Node.EventType.MOUSE_ENTER
  7549. - cc.Node.EventType.MOUSE_LEAVE
  7550. - cc.Node.EventType.MOUSE_UP
  7551. - cc.Node.EventType.MOUSE_WHEEL
  7552. 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.
  7553. !#zh
  7554. 按钮组件。可以被按下,或者点击。
  7555. 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
  7556. - Button.Transition.NONE // 不做任何过渡
  7557. - Button.Transition.COLOR // 进行颜色之间过渡
  7558. - Button.Transition.SPRITE // 进行精灵之间过渡
  7559. - Button.Transition.SCALE // 进行缩放过渡
  7560. 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):<br/>
  7561. 以下事件可以在全平台上都触发:
  7562. - cc.Node.EventType.TOUCH_START // 按下时事件
  7563. - cc.Node.EventType.TOUCH_MOVE // 按住移动后事件
  7564. - cc.Node.EventType.TOUCH_END // 按下后松开后事件
  7565. - cc.Node.EventType.TOUCH_CANCEL // 按下取消事件
  7566. 以下事件只在 PC 平台上触发:
  7567. - cc.Node.EventType.MOUSE_DOWN // 鼠标按下时事件
  7568. - cc.Node.EventType.MOUSE_MOVE // 鼠标按住移动后事件
  7569. - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
  7570. - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
  7571. - cc.Node.EventType.MOUSE_UP // 鼠标松开事件
  7572. - cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件
  7573. 用户可以通过获取 __点击事件__ 回调函数的参数 event 的 target 属性获取当前点击对象。 */
  7574. export class Button extends Component implements GraySpriteState {
  7575. /** !#en
  7576. Whether the Button is disabled.
  7577. If true, the Button will trigger event and do transition.
  7578. !#zh
  7579. 按钮事件是否被响应,如果为 false,则按钮将被禁用。 */
  7580. interactable: boolean;
  7581. /** !#en When this flag is true, Button target sprite will turn gray when interactable is false.
  7582. !#zh 如果这个标记为 true,当 button 的 interactable 属性为 false 的时候,会使用内置 shader 让 button 的 target 节点的 sprite 组件变灰 */
  7583. enableAutoGrayEffect: boolean;
  7584. /** !#en Transition type
  7585. !#zh 按钮状态改变时过渡方式。 */
  7586. transition: Button.Transition;
  7587. /** !#en Normal state color.
  7588. !#zh 普通状态下按钮所显示的颜色。 */
  7589. normalColor: Color;
  7590. /** !#en Pressed state color
  7591. !#zh 按下状态时按钮所显示的颜色。 */
  7592. pressedColor: Color;
  7593. /** !#en Hover state color
  7594. !#zh 悬停状态下按钮所显示的颜色。 */
  7595. hoverColor: Color;
  7596. /** !#en Disabled state color
  7597. !#zh 禁用状态下按钮所显示的颜色。 */
  7598. disabledColor: Color;
  7599. /** !#en Color and Scale transition duration
  7600. !#zh 颜色过渡和缩放过渡时所需时间 */
  7601. duration: number;
  7602. /** !#en When user press the button, the button will zoom to a scale.
  7603. The final scale of the button equals (button original scale * zoomScale)
  7604. !#zh 当用户点击按钮后,按钮会缩放到一个值,这个值等于 Button 原始 scale * zoomScale */
  7605. zoomScale: number;
  7606. /** !#en Normal state sprite
  7607. !#zh 普通状态下按钮所显示的 Sprite 。 */
  7608. normalSprite: SpriteFrame;
  7609. /** !#en Pressed state sprite
  7610. !#zh 按下状态时按钮所显示的 Sprite 。 */
  7611. pressedSprite: SpriteFrame;
  7612. /** !#en Hover state sprite
  7613. !#zh 悬停状态下按钮所显示的 Sprite 。 */
  7614. hoverSprite: SpriteFrame;
  7615. /** !#en Disabled state sprite
  7616. !#zh 禁用状态下按钮所显示的 Sprite 。 */
  7617. disabledSprite: SpriteFrame;
  7618. /** !#en
  7619. Transition target.
  7620. When Button state changed:
  7621. If Transition type is Button.Transition.NONE, Button will do nothing
  7622. If Transition type is Button.Transition.COLOR, Button will change target's color
  7623. If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
  7624. !#zh
  7625. 需要过渡的目标。
  7626. 当前按钮状态改变规则:
  7627. -如果 Transition type 选择 Button.Transition.NONE,按钮不做任何过渡。
  7628. -如果 Transition type 选择 Button.Transition.COLOR,按钮会对目标颜色进行颜色之间的过渡。
  7629. -如果 Transition type 选择 Button.Transition.Sprite,按钮会对目标 Sprite 进行 Sprite 之间的过渡。 */
  7630. target: Node;
  7631. /** !#en If Button is clicked, it will trigger event's handler
  7632. !#zh 按钮的点击事件列表。 */
  7633. clickEvents: Component.EventHandler[];
  7634. /** !#en The normal material.
  7635. !#zh 正常状态的材质。 */
  7636. normalMaterial: Material;
  7637. /** !#en The gray material.
  7638. !#zh 置灰状态的材质。 */
  7639. grayMaterial: Material;
  7640. }
  7641. /** !#zh 作为 UI 根节点,为所有子节点提供视窗四边的位置信息以供对齐,另外提供屏幕适配策略接口,方便从编辑器设置。<br>
  7642. 注:由于本节点的尺寸会跟随屏幕拉伸,所以 anchorPoint 只支持 (0.5, 0.5),否则适配不同屏幕时坐标会有偏差。 */
  7643. export class Canvas extends Component {
  7644. /** !#en Current active canvas, the scene should only have one active canvas at the same time.
  7645. !#zh 当前激活的画布组件,场景同一时间只能有一个激活的画布。 */
  7646. static instance: Canvas;
  7647. /** !#en The desigin resolution for current scene.
  7648. !#zh 当前场景设计分辨率。 */
  7649. designResolution: Size;
  7650. /** !#en TODO
  7651. !#zh: 是否优先将设计分辨率高度撑满视图高度。 */
  7652. fitHeight: boolean;
  7653. /** !#en TODO
  7654. !#zh: 是否优先将设计分辨率宽度撑满视图宽度。 */
  7655. fitWidth: boolean;
  7656. }
  7657. /** !#en
  7658. Base class for everything attached to Node(Entity).<br/>
  7659. <br/>
  7660. NOTE: Not allowed to use construction parameters for Component's subclasses,
  7661. because Component is created by the engine.
  7662. !#zh
  7663. 所有附加到节点的基类。<br/>
  7664. <br/>
  7665. 注意:不允许使用组件的子类构造参数,因为组件是由引擎创建的。 */
  7666. export class Component extends Object {
  7667. /** !#en The node this component is attached to. A component is always attached to a node.
  7668. !#zh 该组件被附加到的节点。组件总会附加到一个节点。 */
  7669. node: Node;
  7670. /** !#en The uuid for editor.
  7671. !#zh 组件的 uuid,用于编辑器。 */
  7672. uuid: string;
  7673. /** !#en indicates whether this component is enabled or not.
  7674. !#zh 表示该组件自身是否启用。 */
  7675. enabled: boolean;
  7676. /** !#en indicates whether this component is enabled and its node is also active in the hierarchy.
  7677. !#zh 表示该组件是否被启用并且所在的节点也处于激活状态。 */
  7678. enabledInHierarchy: boolean;
  7679. /** !#en Returns a value which used to indicate the onLoad get called or not.
  7680. !#zh 返回一个值用来判断 onLoad 是否被调用过,不等于 0 时调用过,等于 0 时未调用。 */
  7681. _isOnLoadCalled: number;
  7682. /**
  7683. !#en Update is called every frame, if the Component is enabled.<br/>
  7684. 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.
  7685. !#zh 如果该组件启用,则每帧调用 update。<br/>
  7686. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7687. @param dt the delta time in seconds it took to complete the last frame
  7688. */
  7689. protected update(dt: number): void;
  7690. /**
  7691. !#en LateUpdate is called every frame, if the Component is enabled.<br/>
  7692. 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.
  7693. !#zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
  7694. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7695. @param dt the delta time in seconds it took to complete the last frame
  7696. */
  7697. protected lateUpdate(dt: number): void;
  7698. /**
  7699. !#en
  7700. When attaching to an active node or its node first activated.
  7701. onLoad is always called before any start functions, this allows you to order initialization of scripts.<br/>
  7702. 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.
  7703. !#zh
  7704. 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
  7705. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7706. */
  7707. protected onLoad(): void;
  7708. /**
  7709. !#en
  7710. Called before all scripts' update if the Component is enabled the first time.
  7711. Usually used to initialize some logic which need to be called after all components' `onload` methods called.<br/>
  7712. 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.
  7713. !#zh
  7714. 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
  7715. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7716. */
  7717. protected start(): void;
  7718. /**
  7719. !#en Called when this component becomes enabled and its node is active.<br/>
  7720. 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.
  7721. !#zh 当该组件被启用,并且它的节点也激活时。<br/>
  7722. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7723. */
  7724. protected onEnable(): void;
  7725. /**
  7726. !#en Called when this component becomes disabled or its node becomes inactive.<br/>
  7727. 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.
  7728. !#zh 当该组件被禁用或节点变为无效时调用。<br/>
  7729. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7730. */
  7731. protected onDisable(): void;
  7732. /**
  7733. !#en Called when this component will be destroyed.<br/>
  7734. 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.
  7735. !#zh 当该组件被销毁时调用<br/>
  7736. 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
  7737. */
  7738. protected onDestroy(): void;
  7739. protected onFocusInEditor(): void;
  7740. protected onLostFocusInEditor(): void;
  7741. /**
  7742. !#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.
  7743. !#zh 用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。
  7744. */
  7745. protected resetInEditor(): void;
  7746. /**
  7747. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  7748. !#zh 向节点添加一个组件类,你还可以通过传入脚本的名称来添加组件。
  7749. @param typeOrClassName the constructor or the class name of the component to add
  7750. @example
  7751. ```js
  7752. var sprite = node.addComponent(cc.Sprite);
  7753. var test = node.addComponent("Test");
  7754. ```
  7755. */
  7756. addComponent<T extends Component>(type: {new(): T}): T;
  7757. addComponent(className: string): any;
  7758. /**
  7759. !#en
  7760. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  7761. You can also get component in the node by passing in the name of the script.
  7762. !#zh
  7763. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  7764. 传入参数也可以是脚本的名称。
  7765. @param typeOrClassName typeOrClassName
  7766. @example
  7767. ```js
  7768. // get sprite component.
  7769. var sprite = node.getComponent(cc.Sprite);
  7770. // get custom test calss.
  7771. var test = node.getComponent("Test");
  7772. ```
  7773. */
  7774. getComponent<T extends Component>(type: {prototype: T}): T;
  7775. getComponent(className: string): any;
  7776. /**
  7777. !#en Returns all components of supplied Type in the node.
  7778. !#zh 返回节点上指定类型的所有组件。
  7779. @param typeOrClassName typeOrClassName
  7780. @example
  7781. ```js
  7782. var sprites = node.getComponents(cc.Sprite);
  7783. var tests = node.getComponents("Test");
  7784. ```
  7785. */
  7786. getComponents<T extends Component>(type: {prototype: T}): T[];
  7787. getComponents(className: string): any[];
  7788. /**
  7789. !#en Returns the component of supplied type in any of its children using depth first search.
  7790. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  7791. @param typeOrClassName typeOrClassName
  7792. @example
  7793. ```js
  7794. var sprite = node.getComponentInChildren(cc.Sprite);
  7795. var Test = node.getComponentInChildren("Test");
  7796. ```
  7797. */
  7798. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  7799. getComponentInChildren(className: string): any;
  7800. /**
  7801. !#en Returns the components of supplied type in self or any of its children using depth first search.
  7802. !#zh 递归查找自身或所有子节点中指定类型的组件
  7803. @param typeOrClassName typeOrClassName
  7804. @example
  7805. ```js
  7806. var sprites = node.getComponentsInChildren(cc.Sprite);
  7807. var tests = node.getComponentsInChildren("Test");
  7808. ```
  7809. */
  7810. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  7811. getComponentsInChildren(className: string): any[];
  7812. /**
  7813. !#en
  7814. If the component's bounding box is different from the node's, you can implement this method to supply
  7815. a custom axis aligned bounding box (AABB), so the editor's scene view can perform hit test properly.
  7816. !#zh
  7817. 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
  7818. 以便编辑器的场景视图可以正确地执行点选测试。
  7819. @param out_rect the Rect to receive the bounding box
  7820. */
  7821. _getLocalBounds(out_rect: Rect): void;
  7822. /**
  7823. !#en
  7824. onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs
  7825. an undo operation on this component.<br/>
  7826. <br/>
  7827. If the component contains the "internal state", short for "temporary member variables which not included<br/>
  7828. in its CCClass properties", then you may need to implement this function.<br/>
  7829. <br/>
  7830. The editor will call the getset accessors of your component to record/restore the component's state<br/>
  7831. for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement<br/>
  7832. this function to manually synchronize your component's "internal states" with its public properties.<br/>
  7833. Once you implement this function, all the getset accessors of your component will not be called when<br/>
  7834. the user performs an undo/redo operation. Which means that only the properties with default value<br/>
  7835. will be recorded or restored by editor.<br/>
  7836. <br/>
  7837. Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need<br/>
  7838. to support the reset menu, you should manually synchronize your component's "internal states" with its<br/>
  7839. properties in this function. Once you implement this function, all the getset accessors of your component<br/>
  7840. will not be called during reset operation. Which means that only the properties with default value<br/>
  7841. will be reset by editor.
  7842. This function is only called in editor mode.
  7843. !#zh
  7844. onRestore 是用户在检查器菜单点击 Reset 时,对此组件执行撤消操作后调用的。<br/>
  7845. <br/>
  7846. 如果组件包含了“内部状态”(不在 CCClass 属性中定义的临时成员变量),那么你可能需要实现该方法。<br/>
  7847. <br/>
  7848. 编辑器执行撤销/重做操作时,将调用组件的 get set 来录制和还原组件的状态。然而,在极端的情况下,它可能无法良好运作。<br/>
  7849. 那么你就应该实现这个方法,手动根据组件的属性同步“内部状态”。一旦你实现这个方法,当用户撤销或重做时,组件的所有 get set 都不会再被调用。这意味着仅仅指定了默认值的属性将被编辑器记录和还原。<br/>
  7850. <br/>
  7851. 同样的,编辑可能无法在极端情况下正确地重置您的组件。如果你需要支持组件重置菜单,则需要在该方法中手工同步组件属性到“内部状态”。一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。这意味着仅仅指定了默认值的属性将被编辑器重置。
  7852. <br/>
  7853. 此方法仅在编辑器下会被调用。
  7854. */
  7855. onRestore(): void;
  7856. /**
  7857. !#en
  7858. Schedules a custom selector.<br/>
  7859. If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
  7860. !#zh
  7861. 调度一个自定义的回调函数。<br/>
  7862. 如果回调函数已调度,那么将不会重复调度它,只会更新时间间隔参数。
  7863. @param callback The callback function
  7864. @param interval Tick interval in seconds. 0 means tick every frame.
  7865. @param repeat The selector will be executed (repeat + 1) times, you can use cc.macro.REPEAT_FOREVER for tick infinitely.
  7866. @param delay The amount of time that the first tick will wait before execution. Unit: s
  7867. @example
  7868. ```js
  7869. var timeCallback = function (dt) {
  7870. cc.log("time: " + dt);
  7871. }
  7872. this.schedule(timeCallback, 1);
  7873. ```
  7874. */
  7875. schedule(callback: Function, interval?: number, repeat?: number, delay?: number): void;
  7876. /**
  7877. !#en Schedules a callback function that runs only once, with a delay of 0 or larger.
  7878. !#zh 调度一个只运行一次的回调函数,可以指定 0 让回调函数在下一帧立即执行或者在一定的延时之后执行。
  7879. @param callback A function wrapped as a selector
  7880. @param delay The amount of time that the first tick will wait before execution. Unit: s
  7881. @example
  7882. ```js
  7883. var timeCallback = function (dt) {
  7884. cc.log("time: " + dt);
  7885. }
  7886. this.scheduleOnce(timeCallback, 2);
  7887. ```
  7888. */
  7889. scheduleOnce(callback: Function, delay?: number): void;
  7890. /**
  7891. !#en Unschedules a custom callback function.
  7892. !#zh 取消调度一个自定义的回调函数。
  7893. @param callback_fn A function wrapped as a selector
  7894. @example
  7895. ```js
  7896. this.unschedule(_callback);
  7897. ```
  7898. */
  7899. unschedule(callback_fn: Function): void;
  7900. /**
  7901. !#en
  7902. unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.<br/>
  7903. Actions are not affected by this method.
  7904. !#zh 取消调度所有已调度的回调函数:定制的回调函数以及 `update` 回调函数。动作不受此方法影响。
  7905. @example
  7906. ```js
  7907. this.unscheduleAllCallbacks();
  7908. ```
  7909. */
  7910. unscheduleAllCallbacks(): void;
  7911. }
  7912. /** !#en The Label Component.
  7913. !#zh 文字标签组件 */
  7914. export class Label extends RenderComponent {
  7915. /** !#en Content string of label.
  7916. !#zh 标签显示的文本内容。 */
  7917. string: string;
  7918. /** !#en Horizontal Alignment of label.
  7919. !#zh 文本内容的水平对齐方式。 */
  7920. horizontalAlign: Label.HorizontalAlign;
  7921. /** !#en Vertical Alignment of label.
  7922. !#zh 文本内容的垂直对齐方式。 */
  7923. verticalAlign: Label.VerticalAlign;
  7924. /** !#en The actual rendering font size in shrink mode
  7925. !#zh SHRINK 模式下面文本实际渲染的字体大小 */
  7926. actualFontSize: number;
  7927. /** !#en Font size of label.
  7928. !#zh 文本字体大小。 */
  7929. fontSize: number;
  7930. /** !#en Font family of label, only take effect when useSystemFont property is true.
  7931. !#zh 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。 */
  7932. fontFamily: string;
  7933. /** !#en Line Height of label.
  7934. !#zh 文本行高。 */
  7935. lineHeight: number;
  7936. /** !#en Overflow of label.
  7937. !#zh 文字显示超出范围时的处理方式。 */
  7938. overflow: Label.Overflow;
  7939. /** !#en Whether auto wrap label when string width is large than label width.
  7940. !#zh 是否自动换行。 */
  7941. enableWrapText: boolean;
  7942. /** !#en The font of label.
  7943. !#zh 文本字体。 */
  7944. font: Font;
  7945. /** !#en Whether use system font name or not.
  7946. !#zh 是否使用系统字体。 */
  7947. useSystemFont: boolean;
  7948. /** !#en The spacing of the x axis between characters, only take Effect when using bitmap fonts.
  7949. !#zh 文字之间 x 轴的间距,仅在使用位图字体时生效。 */
  7950. spacingX: number;
  7951. /** !#en The cache mode of label. This mode only supports system fonts.
  7952. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  7953. cacheMode: Label.CacheMode;
  7954. /** !#en Whether enable bold.
  7955. !#zh 是否启用黑体。 */
  7956. enableBold: boolean;
  7957. /** !#en Whether enable italic.
  7958. !#zh 是否启用斜体。 */
  7959. enableItalic: boolean;
  7960. /** !#en Whether enable underline.
  7961. !#zh 是否启用下划线。 */
  7962. enableUnderline: boolean;
  7963. /** !#en The height of underline.
  7964. !#zh 下划线高度。 */
  7965. underlineHeight: number;
  7966. /**
  7967. !#zh 需要保证当前场景中没有使用CHAR缓存的Label才可以清除,否则已渲染的文字没有重新绘制会不显示
  7968. !#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.
  7969. */
  7970. static clearCharCache(): void;
  7971. }
  7972. /** !#en Outline effect used to change the display, only for system fonts or TTF fonts
  7973. !#zh 描边效果组件,用于字体描边,只能用于系统字体 */
  7974. export class LabelOutline extends Component {
  7975. /** !#en outline color
  7976. !#zh 改变描边的颜色 */
  7977. color: Color;
  7978. /** !#en Change the outline width
  7979. !#zh 改变描边的宽度 */
  7980. width: number;
  7981. }
  7982. /** !#en Shadow effect for Label component, only for system fonts or TTF fonts
  7983. !#zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体 */
  7984. export class LabelShadow extends Component {
  7985. /** !#en The shadow color
  7986. !#zh 阴影的颜色 */
  7987. color: Color;
  7988. /** !#en Offset between font and shadow
  7989. !#zh 字体与阴影的偏移 */
  7990. offset: Vec2;
  7991. /** !#en A non-negative float specifying the level of shadow blur
  7992. !#zh 阴影的模糊程度 */
  7993. blur: number;
  7994. }
  7995. /** !#en
  7996. The Layout is a container component, use it to arrange child elements easily.<br>
  7997. Note:<br>
  7998. 1.Scaling and rotation of child nodes are not considered.<br>
  7999. 2.After setting the Layout, the results need to be updated until the next frame,
  8000. unless you manually call {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。
  8001. !#zh
  8002. Layout 组件相当于一个容器,能自动对它的所有子节点进行统一排版。<br>
  8003. 注意:<br>
  8004. 1.不会考虑子节点的缩放和旋转。<br>
  8005. 2.对 Layout 设置后结果需要到下一帧才会更新,除非你设置完以后手动调用 {{#crossLink "Layout/updateLayout:method"}}{{/crossLink}}。 */
  8006. export class Layout extends Component {
  8007. /** !#en The layout type.
  8008. !#zh 布局类型 */
  8009. type: Layout.Type;
  8010. /** !#en
  8011. The are three resize modes for Layout.
  8012. None, resize Container and resize children.
  8013. !#zh 缩放模式 */
  8014. resizeMode: Layout.ResizeMode;
  8015. /** !#en The cell size for grid layout.
  8016. !#zh 每个格子的大小,只有布局类型为 GRID 的时候才有效。 */
  8017. cellSize: Size;
  8018. /** !#en
  8019. The start axis for grid layout. If you choose horizontal, then children will layout horizontally at first,
  8020. and then break line on demand. Choose vertical if you want to layout vertically at first .
  8021. !#zh 起始轴方向类型,可进行水平和垂直布局排列,只有布局类型为 GRID 的时候才有效。 */
  8022. startAxis: Layout.AxisDirection;
  8023. /** !#en The left padding of layout, it only effect the layout in one direction.
  8024. !#zh 容器内左边距,只会在一个布局方向上生效。 */
  8025. paddingLeft: number;
  8026. /** !#en The right padding of layout, it only effect the layout in one direction.
  8027. !#zh 容器内右边距,只会在一个布局方向上生效。 */
  8028. paddingRight: number;
  8029. /** !#en The top padding of layout, it only effect the layout in one direction.
  8030. !#zh 容器内上边距,只会在一个布局方向上生效。 */
  8031. paddingTop: number;
  8032. /** !#en The bottom padding of layout, it only effect the layout in one direction.
  8033. !#zh 容器内下边距,只会在一个布局方向上生效。 */
  8034. paddingBottom: number;
  8035. /** !#en The distance in x-axis between each element in layout.
  8036. !#zh 子节点之间的水平间距。 */
  8037. spacingX: number;
  8038. /** !#en The distance in y-axis between each element in layout.
  8039. !#zh 子节点之间的垂直间距。 */
  8040. spacingY: number;
  8041. /** !#en
  8042. Only take effect in Vertical layout mode.
  8043. This option changes the start element's positioning.
  8044. !#zh 垂直排列子节点的方向。 */
  8045. verticalDirection: Layout.VerticalDirection;
  8046. /** !#en
  8047. Only take effect in Horizontal layout mode.
  8048. This option changes the start element's positioning.
  8049. !#zh 水平排列子节点的方向。 */
  8050. horizontalDirection: Layout.HorizontalDirection;
  8051. /** !#en Adjust the layout if the children scaled.
  8052. !#zh 子节点缩放比例是否影响布局。 */
  8053. affectedByScale: boolean;
  8054. /**
  8055. !#en Perform the layout update
  8056. !#zh 立即执行更新布局
  8057. @example
  8058. ```js
  8059. layout.type = cc.Layout.HORIZONTAL;
  8060. layout.node.addChild(childNode);
  8061. cc.log(childNode.x); // not yet changed
  8062. layout.updateLayout();
  8063. cc.log(childNode.x); // changed
  8064. ```
  8065. */
  8066. updateLayout(): void;
  8067. }
  8068. /** !#en The Mask Component
  8069. !#zh 遮罩组件 */
  8070. export class Mask extends RenderComponent {
  8071. /** !#en The mask type.
  8072. !#zh 遮罩类型 */
  8073. type: Mask.Type;
  8074. /** !#en The mask image
  8075. !#zh 遮罩所需要的贴图 */
  8076. spriteFrame: SpriteFrame;
  8077. /** !#en
  8078. The alpha threshold.(Not supported Canvas Mode) <br/>
  8079. The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold. <br/>
  8080. Should be a float between 0 and 1. <br/>
  8081. This default to 0.1.
  8082. When it's set to 1, the stencil will discard all pixels, nothing will be shown.
  8083. !#zh
  8084. Alpha 阈值(不支持 Canvas 模式)<br/>
  8085. 只有当模板的像素的 alpha 大于等于 alphaThreshold 时,才会绘制内容。<br/>
  8086. 该数值 0 ~ 1 之间的浮点数,默认值为 0.1
  8087. 当被设置为 1 时,会丢弃所有蒙版像素,所以不会显示任何内容 */
  8088. alphaThreshold: number;
  8089. /** !#en Reverse mask (Not supported Canvas Mode)
  8090. !#zh 反向遮罩(不支持 Canvas 模式) */
  8091. inverted: boolean;
  8092. /** TODO: remove segments, not supported by graphics
  8093. !#en The segements for ellipse mask.
  8094. !#zh 椭圆遮罩的曲线细分数 */
  8095. segements: number;
  8096. }
  8097. /** !#en
  8098. cc.MotionStreak manages a Ribbon based on it's motion in absolute space. <br/>
  8099. You construct it with a fadeTime, minimum segment size, texture path, texture <br/>
  8100. length and color. The fadeTime controls how long it takes each vertex in <br/>
  8101. the streak to fade out, the minimum segment size it how many pixels the <br/>
  8102. streak will move before adding a new ribbon segment, and the texture <br/>
  8103. length is the how many pixels the texture is stretched across. The texture <br/>
  8104. is vertically aligned along the streak segment.
  8105. !#zh 运动轨迹,用于游戏对象的运动轨迹上实现拖尾渐隐效果。 */
  8106. export class MotionStreak extends Component implements BlendFunc {
  8107. /** !#en
  8108. !#zh 在编辑器模式下预览拖尾效果。 */
  8109. preview: boolean;
  8110. /** !#en The fade time to fade.
  8111. !#zh 拖尾的渐隐时间,以秒为单位。 */
  8112. fadeTime: number;
  8113. /** !#en The minimum segment size.
  8114. !#zh 拖尾之间最小距离。 */
  8115. minSeg: number;
  8116. /** !#en The stroke's width.
  8117. !#zh 拖尾的宽度。 */
  8118. stroke: number;
  8119. /** !#en The texture of the MotionStreak.
  8120. !#zh 拖尾的贴图。 */
  8121. texture: Texture2D;
  8122. /** !#en The color of the MotionStreak.
  8123. !#zh 拖尾的颜色 */
  8124. color: Color;
  8125. /** !#en The fast Mode.
  8126. !#zh 是否启用了快速模式。当启用快速模式,新的点会被更快地添加,但精度较低。 */
  8127. fastMode: boolean;
  8128. /**
  8129. !#en Remove all living segments of the ribbon.
  8130. !#zh 删除当前所有的拖尾片段。
  8131. @example
  8132. ```js
  8133. // Remove all living segments of the ribbon.
  8134. myMotionStreak.reset();
  8135. ```
  8136. */
  8137. reset(): void;
  8138. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  8139. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  8140. srcBlendFactor: macro.BlendFactor;
  8141. /** !#en specify the destination Blend Factor.
  8142. !#zh 指定目标的混合模式 */
  8143. dstBlendFactor: macro.BlendFactor;
  8144. }
  8145. /** !#en The PageView control
  8146. !#zh 页面视图组件 */
  8147. export class PageView extends ScrollView {
  8148. /** !#en Specify the size type of each page in PageView.
  8149. !#zh 页面视图中每个页面大小类型 */
  8150. sizeMode: PageView.SizeMode;
  8151. /** !#en The page view direction
  8152. !#zh 页面视图滚动类型 */
  8153. direction: PageView.Direction;
  8154. /** !#en
  8155. The scroll threshold value, when drag exceeds this value,
  8156. release the next page will automatically scroll, less than the restore
  8157. !#zh 滚动临界值,默认单位百分比,当拖拽超出该数值时,松开会自动滚动下一页,小于时则还原。 */
  8158. scrollThreshold: number;
  8159. /** !#en
  8160. Auto page turning velocity threshold. When users swipe the PageView quickly,
  8161. it will calculate a velocity based on the scroll distance and time,
  8162. if the calculated velocity is larger than the threshold, then it will trigger page turning.
  8163. !#zh
  8164. 快速滑动翻页临界值。
  8165. 当用户快速滑动时,会根据滑动开始和结束的距离与时间计算出一个速度值,
  8166. 该值与此临界值相比较,如果大于临界值,则进行自动翻页。 */
  8167. autoPageTurningThreshold: number;
  8168. /** !#en Change the PageTurning event timing of PageView.
  8169. !#zh 设置 PageView PageTurning 事件的发送时机。 */
  8170. pageTurningEventTiming: number;
  8171. /** !#en The Page View Indicator
  8172. !#zh 页面视图指示器组件 */
  8173. indicator: PageViewIndicator;
  8174. /** !#en The time required to turn over a page. unit: second
  8175. !#zh 每个页面翻页时所需时间。单位:秒 */
  8176. pageTurningSpeed: number;
  8177. /** !#en PageView events callback
  8178. !#zh 滚动视图的事件回调函数 */
  8179. pageEvents: Component.EventHandler[];
  8180. /**
  8181. !#en Returns current page index
  8182. !#zh 返回当前页面索引
  8183. */
  8184. getCurrentPageIndex(): number;
  8185. /**
  8186. !#en Set current page index
  8187. !#zh 设置当前页面索引
  8188. @param index index
  8189. */
  8190. setCurrentPageIndex(index: number): void;
  8191. /**
  8192. !#en Returns all pages of pageview
  8193. !#zh 返回视图中的所有页面
  8194. */
  8195. getPages(): Node[];
  8196. /**
  8197. !#en At the end of the current page view to insert a new view
  8198. !#zh 在当前页面视图的尾部插入一个新视图
  8199. @param page page
  8200. */
  8201. addPage(page: Node): void;
  8202. /**
  8203. !#en Inserts a page in the specified location
  8204. !#zh 将页面插入指定位置中
  8205. @param page page
  8206. @param index index
  8207. */
  8208. insertPage(page: Node, index: number): void;
  8209. /**
  8210. !#en Removes a page from PageView.
  8211. !#zh 移除指定页面
  8212. @param page page
  8213. */
  8214. removePage(page: Node): void;
  8215. /**
  8216. !#en Removes a page at index of PageView.
  8217. !#zh 移除指定下标的页面
  8218. @param index index
  8219. */
  8220. removePageAtIndex(index: number): void;
  8221. /**
  8222. !#en Removes all pages from PageView
  8223. !#zh 移除所有页面
  8224. */
  8225. removeAllPages(): void;
  8226. /**
  8227. !#en Scroll PageView to index.
  8228. !#zh 滚动到指定页面
  8229. @param idx index of page.
  8230. @param timeInSecond scrolling time
  8231. */
  8232. scrollToPage(idx: number, timeInSecond: number): void;
  8233. }
  8234. /** !#en
  8235. Visual indicator of progress in some operation.
  8236. Displays a bar to the user representing how far the operation has progressed.
  8237. !#zh
  8238. 进度条组件,可用于显示加载资源时的进度。 */
  8239. export class ProgressBar extends Component {
  8240. /** !#en The targeted Sprite which will be changed progressively.
  8241. !#zh 用来显示进度条比例的 Sprite 对象。 */
  8242. barSprite: Sprite;
  8243. /** !#en The progress mode, there are two modes supported now: horizontal and vertical.
  8244. !#zh 进度条的模式 */
  8245. mode: ProgressBar.Mode;
  8246. /** !#en The total width or height of the bar sprite.
  8247. !#zh 进度条实际的总长度 */
  8248. totalLength: number;
  8249. /** !#en The current progress of the bar sprite. The valid value is between 0-1.
  8250. !#zh 当前进度值,该数值的区间是 0-1 之间。 */
  8251. progress: number;
  8252. /** !#en Whether reverse the progress direction of the bar sprite.
  8253. !#zh 进度条是否进行反方向变化。 */
  8254. reverse: boolean;
  8255. }
  8256. /** !#en The Page View Indicator Component
  8257. !#zh 页面视图每页标记组件 */
  8258. export class PageViewIndicator extends Component {
  8259. /** !#en The spriteFrame for each element.
  8260. !#zh 每个页面标记显示的图片 */
  8261. spriteFrame: SpriteFrame;
  8262. /** !#en The location direction of PageViewIndicator.
  8263. !#zh 页面标记摆放方向 */
  8264. direction: PageViewIndicator.Direction;
  8265. /** !#en The cellSize for each element.
  8266. !#zh 每个页面标记的大小 */
  8267. cellSize: Size;
  8268. /** !#en The distance between each element.
  8269. !#zh 每个页面标记之间的边距 */
  8270. spacing: number;
  8271. /**
  8272. !#en Set Page View
  8273. !#zh 设置页面视图
  8274. @param target target
  8275. */
  8276. setPageView(target: PageView): void;
  8277. }
  8278. /** !#en
  8279. Base class for components which supports rendering features.
  8280. !#zh
  8281. 所有支持渲染的组件的基类 */
  8282. export class RenderComponent extends Component {
  8283. /** !#en The materials used by this render component.
  8284. !#zh 渲染组件使用的材质。 */
  8285. sharedMaterials: Material[];
  8286. /**
  8287. !#en Get the material by index.
  8288. !#zh 根据指定索引获取材质
  8289. @param index index
  8290. */
  8291. getMaterial(index: number): MaterialVariant;
  8292. /**
  8293. !#en Gets all the materials.
  8294. !#zh 获取所有材质。
  8295. */
  8296. getMaterials(): MaterialVariant[];
  8297. /**
  8298. !#en Set the material by index.
  8299. !#zh 根据指定索引设置材质
  8300. @param index index
  8301. @param material material
  8302. */
  8303. setMaterial(index: number, material: Material): Material;
  8304. }
  8305. /** !#en The RichText Component.
  8306. !#zh 富文本组件 */
  8307. export class RichText extends Component {
  8308. /** !#en Content string of RichText.
  8309. !#zh 富文本显示的文本内容。 */
  8310. string: string;
  8311. /** !#en Horizontal Alignment of each line in RichText.
  8312. !#zh 文本内容的水平对齐方式。 */
  8313. horizontalAlign: macro.TextAlignment;
  8314. /** !#en Font size of RichText.
  8315. !#zh 富文本字体大小。 */
  8316. fontSize: number;
  8317. /** !#en Custom System font of RichText
  8318. !#zh 富文本定制系统字体 */
  8319. fontFamily: string;
  8320. /** !#en Custom TTF font of RichText
  8321. !#zh 富文本定制字体 */
  8322. font: TTFFont;
  8323. /** !#en Whether use system font name or not.
  8324. !#zh 是否使用系统字体。 */
  8325. useSystemFont: boolean;
  8326. /** !#en The cache mode of label. This mode only supports system fonts.
  8327. !#zh 文本缓存模式, 该模式只支持系统字体。 */
  8328. cacheMode: Label.CacheMode;
  8329. /** !#en The maximize width of the RichText
  8330. !#zh 富文本的最大宽度 */
  8331. maxWidth: number;
  8332. /** !#en Line Height of RichText.
  8333. !#zh 富文本行高。 */
  8334. lineHeight: number;
  8335. /** !#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.
  8336. !#zh 对于 img 标签里面的 src 属性名称,都需要在 imageAtlas 里面找到一个有效的 spriteFrame,否则 img tag 会判定为无效。 */
  8337. imageAtlas: SpriteAtlas;
  8338. /** !#en
  8339. Once checked, the RichText will block all input events (mouse and touch) within
  8340. the bounding box of the node, preventing the input from penetrating into the underlying node.
  8341. !#zh
  8342. 选中此选项后,RichText 将阻止节点边界框中的所有输入事件(鼠标和触摸),从而防止输入事件穿透到底层节点。 */
  8343. handleTouchEvent: boolean;
  8344. }
  8345. /** !#en
  8346. 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.
  8347. 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).
  8348. 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.
  8349. You are strongly discouraged from providing controls outside of this area. But your screen background could embellish edges.
  8350. This component internally uses the API `cc.sys.getSafeAreaRect();` to obtain the safe area of the current iOS or Android device,
  8351. and implements the adaptation by using the Widget component and set anchor.
  8352. !#zh
  8353. 该组件会将所在节点的布局适配到 iPhone X 等异形屏手机的安全区域内,通常用于 UI 交互区域的顶层节点,具体用法可参考官方范例 [example-cases/02_ui/16_safeArea/SafeArea.fire](https://github.com/cocos-creator/example-cases)。
  8354. 该组件内部通过 API `cc.sys.getSafeAreaRect();` 获取到当前 iOS 或 Android 设备的安全区域,并通过 Widget 组件实现适配。 */
  8355. export class SafeArea extends Component {
  8356. /**
  8357. !#en Adapt to safe area
  8358. !#zh 立即适配安全区域
  8359. @example
  8360. ```js
  8361. let safeArea = this.node.addComponent(cc.SafeArea);
  8362. safeArea.updateArea();
  8363. ```
  8364. */
  8365. updateArea(): void;
  8366. }
  8367. /** !#en
  8368. The Scrollbar control allows the user to scroll an image or other view that is too large to see completely
  8369. !#zh 滚动条组件 */
  8370. export class Scrollbar extends Component {
  8371. /** !#en The "handle" part of the scrollbar.
  8372. !#zh 作为当前滚动区域位置显示的滑块 Sprite。 */
  8373. handle: Sprite;
  8374. /** !#en The direction of scrollbar.
  8375. !#zh ScrollBar 的滚动方向。 */
  8376. direction: Scrollbar.Direction;
  8377. /** !#en Whether enable auto hide or not.
  8378. !#zh 是否在没有滚动动作时自动隐藏 ScrollBar。 */
  8379. enableAutoHide: boolean;
  8380. /** !#en
  8381. The time to hide scrollbar when scroll finished.
  8382. Note: This value is only useful when enableAutoHide is true.
  8383. !#zh
  8384. 没有滚动动作后经过多久会自动隐藏。
  8385. 注意:只要当 “enableAutoHide” 为 true 时,才有效。 */
  8386. autoHideTime: number;
  8387. }
  8388. /** !#en
  8389. Layout container for a view hierarchy that can be scrolled by the user,
  8390. allowing it to be larger than the physical display.
  8391. !#zh
  8392. 滚动视图组件 */
  8393. export class ScrollView extends Component {
  8394. /** !#en This is a reference to the UI element to be scrolled.
  8395. !#zh 可滚动展示内容的节点。 */
  8396. content: Node;
  8397. /** !#en Enable horizontal scroll.
  8398. !#zh 是否开启水平滚动。 */
  8399. horizontal: boolean;
  8400. /** !#en Enable vertical scroll.
  8401. !#zh 是否开启垂直滚动。 */
  8402. vertical: boolean;
  8403. /** !#en When inertia is set, the content will continue to move when touch ended.
  8404. !#zh 是否开启滚动惯性。 */
  8405. inertia: boolean;
  8406. /** !#en
  8407. It determines how quickly the content stop moving. A value of 1 will stop the movement immediately.
  8408. A value of 0 will never stop the movement until it reaches to the boundary of scrollview.
  8409. !#zh
  8410. 开启惯性后,在用户停止触摸后滚动多快停止,0表示永不停止,1表示立刻停止。 */
  8411. brake: number;
  8412. /** !#en When elastic is set, the content will be bounce back when move out of boundary.
  8413. !#zh 是否允许滚动内容超过边界,并在停止触摸后回弹。 */
  8414. elastic: boolean;
  8415. /** !#en The elapse time of bouncing back. A value of 0 will bounce back immediately.
  8416. !#zh 回弹持续的时间,0 表示将立即反弹。 */
  8417. bounceDuration: number;
  8418. /** !#en The horizontal scrollbar reference.
  8419. !#zh 水平滚动的 ScrollBar。 */
  8420. horizontalScrollBar: Scrollbar;
  8421. /** !#en The vertical scrollbar reference.
  8422. !#zh 垂直滚动的 ScrollBar。 */
  8423. verticalScrollBar: Scrollbar;
  8424. /** !#en Scrollview events callback
  8425. !#zh 滚动视图的事件回调函数 */
  8426. scrollEvents: Component.EventHandler[];
  8427. /** !#en If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes
  8428. It's set to true by default.
  8429. !#zh 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。
  8430. 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。 */
  8431. cancelInnerEvents: boolean;
  8432. /**
  8433. !#en Scroll the content to the bottom boundary of ScrollView.
  8434. !#zh 视图内容将在规定时间内滚动到视图底部。
  8435. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8436. the content will jump to the bottom boundary immediately.
  8437. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8438. @example
  8439. ```js
  8440. // Scroll to the bottom of the view.
  8441. scrollView.scrollToBottom(0.1);
  8442. ```
  8443. */
  8444. scrollToBottom(timeInSecond?: number, attenuated?: boolean): void;
  8445. /**
  8446. !#en Scroll the content to the top boundary of ScrollView.
  8447. !#zh 视图内容将在规定时间内滚动到视图顶部。
  8448. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8449. the content will jump to the top boundary immediately.
  8450. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8451. @example
  8452. ```js
  8453. // Scroll to the top of the view.
  8454. scrollView.scrollToTop(0.1);
  8455. ```
  8456. */
  8457. scrollToTop(timeInSecond?: number, attenuated?: boolean): void;
  8458. /**
  8459. !#en Scroll the content to the left boundary of ScrollView.
  8460. !#zh 视图内容将在规定时间内滚动到视图左边。
  8461. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8462. the content will jump to the left boundary immediately.
  8463. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8464. @example
  8465. ```js
  8466. // Scroll to the left of the view.
  8467. scrollView.scrollToLeft(0.1);
  8468. ```
  8469. */
  8470. scrollToLeft(timeInSecond?: number, attenuated?: boolean): void;
  8471. /**
  8472. !#en Scroll the content to the right boundary of ScrollView.
  8473. !#zh 视图内容将在规定时间内滚动到视图右边。
  8474. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8475. the content will jump to the right boundary immediately.
  8476. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8477. @example
  8478. ```js
  8479. // Scroll to the right of the view.
  8480. scrollView.scrollToRight(0.1);
  8481. ```
  8482. */
  8483. scrollToRight(timeInSecond?: number, attenuated?: boolean): void;
  8484. /**
  8485. !#en Scroll the content to the top left boundary of ScrollView.
  8486. !#zh 视图内容将在规定时间内滚动到视图左上角。
  8487. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8488. the content will jump to the top left boundary immediately.
  8489. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8490. @example
  8491. ```js
  8492. // Scroll to the upper left corner of the view.
  8493. scrollView.scrollToTopLeft(0.1);
  8494. ```
  8495. */
  8496. scrollToTopLeft(timeInSecond?: number, attenuated?: boolean): void;
  8497. /**
  8498. !#en Scroll the content to the top right boundary of ScrollView.
  8499. !#zh 视图内容将在规定时间内滚动到视图右上角。
  8500. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8501. the content will jump to the top right boundary immediately.
  8502. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8503. @example
  8504. ```js
  8505. // Scroll to the top right corner of the view.
  8506. scrollView.scrollToTopRight(0.1);
  8507. ```
  8508. */
  8509. scrollToTopRight(timeInSecond?: number, attenuated?: boolean): void;
  8510. /**
  8511. !#en Scroll the content to the bottom left boundary of ScrollView.
  8512. !#zh 视图内容将在规定时间内滚动到视图左下角。
  8513. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8514. the content will jump to the bottom left boundary immediately.
  8515. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8516. @example
  8517. ```js
  8518. // Scroll to the lower left corner of the view.
  8519. scrollView.scrollToBottomLeft(0.1);
  8520. ```
  8521. */
  8522. scrollToBottomLeft(timeInSecond?: number, attenuated?: boolean): void;
  8523. /**
  8524. !#en Scroll the content to the bottom right boundary of ScrollView.
  8525. !#zh 视图内容将在规定时间内滚动到视图右下角。
  8526. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8527. the content will jump to the bottom right boundary immediately.
  8528. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8529. @example
  8530. ```js
  8531. // Scroll to the lower right corner of the view.
  8532. scrollView.scrollToBottomRight(0.1);
  8533. ```
  8534. */
  8535. scrollToBottomRight(timeInSecond?: number, attenuated?: boolean): void;
  8536. /**
  8537. !#en Scroll with an offset related to the ScrollView's top left origin, if timeInSecond is omitted, then it will jump to the
  8538. specific offset immediately.
  8539. !#zh 视图内容在规定时间内将滚动到 ScrollView 相对左上角原点的偏移位置, 如果 timeInSecond参数不传,则立即滚动到指定偏移位置。
  8540. @param offset A Vec2, the value of which each axis between 0 and maxScrollOffset
  8541. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8542. the content will jump to the specific offset of ScrollView immediately.
  8543. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8544. @example
  8545. ```js
  8546. // Scroll to middle position in 0.1 second in x-axis
  8547. let maxScrollOffset = this.getMaxScrollOffset();
  8548. scrollView.scrollToOffset(cc.v2(maxScrollOffset.x / 2, 0), 0.1);
  8549. ```
  8550. */
  8551. scrollToOffset(offset: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  8552. /**
  8553. !#en Get the positive offset value corresponds to the content's top left boundary.
  8554. !#zh 获取滚动视图相对于左上角原点的当前滚动偏移
  8555. */
  8556. getScrollOffset(): Vec2;
  8557. /**
  8558. !#en Get the maximize available scroll offset
  8559. !#zh 获取滚动视图最大可以滚动的偏移量
  8560. */
  8561. getMaxScrollOffset(): Vec2;
  8562. /**
  8563. !#en Scroll the content to the horizontal percent position of ScrollView.
  8564. !#zh 视图内容在规定时间内将滚动到 ScrollView 水平方向的百分比位置上。
  8565. @param percent A value between 0 and 1.
  8566. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8567. the content will jump to the horizontal percent position of ScrollView immediately.
  8568. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8569. @example
  8570. ```js
  8571. // Scroll to middle position.
  8572. scrollView.scrollToBottomRight(0.5, 0.1);
  8573. ```
  8574. */
  8575. scrollToPercentHorizontal(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  8576. /**
  8577. !#en Scroll the content to the percent position of ScrollView in any direction.
  8578. !#zh 视图内容在规定时间内进行垂直方向和水平方向的滚动,并且滚动到指定百分比位置上。
  8579. @param anchor A point which will be clamp between cc.v2(0,0) and cc.v2(1,1).
  8580. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8581. the content will jump to the percent position of ScrollView immediately.
  8582. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8583. @example
  8584. ```js
  8585. // Vertical scroll to the bottom of the view.
  8586. scrollView.scrollTo(cc.v2(0, 1), 0.1);
  8587. // Horizontal scroll to view right.
  8588. scrollView.scrollTo(cc.v2(1, 0), 0.1);
  8589. ```
  8590. */
  8591. scrollTo(anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void;
  8592. /**
  8593. !#en Scroll the content to the vertical percent position of ScrollView.
  8594. !#zh 视图内容在规定时间内滚动到 ScrollView 垂直方向的百分比位置上。
  8595. @param percent A value between 0 and 1.
  8596. @param timeInSecond Scroll time in second, if you don't pass timeInSecond,
  8597. the content will jump to the vertical percent position of ScrollView immediately.
  8598. @param attenuated Whether the scroll acceleration attenuated, default is true.
  8599. // Scroll to middle position.
  8600. scrollView.scrollToPercentVertical(0.5, 0.1);
  8601. */
  8602. scrollToPercentVertical(percent: number, timeInSecond?: number, attenuated?: boolean): void;
  8603. /**
  8604. !#en Stop auto scroll immediately
  8605. !#zh 停止自动滚动, 调用此 API 可以让 Scrollview 立即停止滚动
  8606. */
  8607. stopAutoScroll(): void;
  8608. /**
  8609. !#en Modify the content position.
  8610. !#zh 设置当前视图内容的坐标点。
  8611. @param position The position in content's parent space.
  8612. */
  8613. setContentPosition(position: Vec2): void;
  8614. /**
  8615. !#en Query the content's position in its parent space.
  8616. !#zh 获取当前视图内容的坐标点。
  8617. */
  8618. getContentPosition(): Vec2;
  8619. /**
  8620. !#en Query whether the user is currently dragging the ScrollView to scroll it
  8621. !#zh 用户是否在拖拽当前滚动视图
  8622. */
  8623. isScrolling(): boolean;
  8624. /**
  8625. !#en Query whether the ScrollView is currently scrolling because of a bounceback or inertia slowdown.
  8626. !#zh 当前滚动视图是否在惯性滚动
  8627. */
  8628. isAutoScrolling(): boolean;
  8629. }
  8630. /** !#en The Slider Control
  8631. !#zh 滑动器组件 */
  8632. export class Slider extends Component {
  8633. /** !#en The "handle" part of the slider
  8634. !#zh 滑动器滑块按钮部件 */
  8635. handle: Button;
  8636. /** !#en The slider direction
  8637. !#zh 滑动器方向 */
  8638. direction: Slider.Direction;
  8639. /** !#en The current progress of the slider. The valid value is between 0-1
  8640. !#zh 当前进度值,该数值的区间是 0-1 之间 */
  8641. progress: number;
  8642. /** !#en The slider slide events' callback array
  8643. !#zh 滑动器组件滑动事件回调函数数组 */
  8644. slideEvents: Component.EventHandler[];
  8645. }
  8646. /** !#en Renders a sprite in the scene.
  8647. !#zh 该组件用于在场景中渲染精灵。 */
  8648. export class Sprite extends RenderComponent implements BlendFunc {
  8649. /** !#en The sprite frame of the sprite.
  8650. !#zh 精灵的精灵帧 */
  8651. spriteFrame: SpriteFrame;
  8652. /** !#en The sprite render type.
  8653. !#zh 精灵渲染类型 */
  8654. type: Sprite.Type;
  8655. /** !#en
  8656. The fill type, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8657. !#zh
  8658. 精灵填充类型,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8659. fillType: Sprite.FillType;
  8660. /** !#en
  8661. The fill Center, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8662. !#zh
  8663. 填充中心点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8664. fillCenter: Vec2;
  8665. /** !#en
  8666. The fill Start, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8667. !#zh
  8668. 填充起始点,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8669. fillStart: number;
  8670. /** !#en
  8671. The fill Range, This will only have any effect if the "type" is set to “cc.Sprite.Type.FILLED”.
  8672. !#zh
  8673. 填充范围,仅渲染类型设置为 cc.Sprite.Type.FILLED 时有效。 */
  8674. fillRange: number;
  8675. /** !#en specify the frame is trimmed or not.
  8676. !#zh 是否使用裁剪模式 */
  8677. trim: boolean;
  8678. /** !#en specify the size tracing mode.
  8679. !#zh 精灵尺寸调整模式 */
  8680. sizeMode: Sprite.SizeMode;
  8681. /**
  8682. Change the state of sprite.
  8683. @param state NORMAL or GRAY State.
  8684. */
  8685. setState(state: Sprite.State): void;
  8686. /**
  8687. Gets the current state.
  8688. */
  8689. getState(): Sprite.State;
  8690. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  8691. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  8692. srcBlendFactor: macro.BlendFactor;
  8693. /** !#en specify the destination Blend Factor.
  8694. !#zh 指定目标的混合模式 */
  8695. dstBlendFactor: macro.BlendFactor;
  8696. }
  8697. /** !#en The toggle component is a CheckBox, when it used together with a ToggleGroup, it
  8698. could be treated as a RadioButton.
  8699. !#zh Toggle 是一个 CheckBox,当它和 ToggleGroup 一起使用的时候,可以变成 RadioButton。 */
  8700. export class Toggle extends Button implements GraySpriteState {
  8701. /** !#en When this value is true, the check mark component will be enabled, otherwise
  8702. the check mark component will be disabled.
  8703. !#zh 如果这个设置为 true,则 check mark 组件会处于 enabled 状态,否则处于 disabled 状态。 */
  8704. isChecked: boolean;
  8705. /** !#en The toggle group which the toggle belongs to, when it is null, the toggle is a CheckBox.
  8706. Otherwise, the toggle is a RadioButton.
  8707. !#zh Toggle 所属的 ToggleGroup,这个属性是可选的。如果这个属性为 null,则 Toggle 是一个 CheckBox,
  8708. 否则,Toggle 是一个 RadioButton。 */
  8709. toggleGroup: ToggleGroup;
  8710. /** !#en The image used for the checkmark.
  8711. !#zh Toggle 处于选中状态时显示的图片 */
  8712. checkMark: Sprite;
  8713. /** !#en If Toggle is clicked, it will trigger event's handler
  8714. !#zh Toggle 按钮的点击事件列表。 */
  8715. checkEvents: Component.EventHandler[];
  8716. /**
  8717. !#en Make the toggle button checked.
  8718. !#zh 使 toggle 按钮处于选中状态
  8719. */
  8720. check(): void;
  8721. /**
  8722. !#en Make the toggle button unchecked.
  8723. !#zh 使 toggle 按钮处于未选中状态
  8724. */
  8725. uncheck(): void;
  8726. /** !#en The normal material.
  8727. !#zh 正常状态的材质。 */
  8728. normalMaterial: Material;
  8729. /** !#en The gray material.
  8730. !#zh 置灰状态的材质。 */
  8731. grayMaterial: Material;
  8732. }
  8733. /** !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles. <br/>
  8734. Toggles that belong to the same group could only have one of them to be switched on at a time.<br/>
  8735. Note: All the first layer child node containing the toggle component will auto be added to the container
  8736. !#zh ToggleContainer 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。<br/>
  8737. 当一组 Toggle 属于同一个 ToggleContainer 的时候,任何时候只能有一个 Toggle 处于选中状态。<br/>
  8738. 注意:所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中 */
  8739. export class ToggleContainer extends Component {
  8740. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  8741. If it is false, it will make sure there is always only one toggle could be switched on
  8742. and the already switched on toggle can't be switched off.
  8743. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  8744. allowSwitchOff: boolean;
  8745. /** !#en If Toggle is clicked, it will trigger event's handler
  8746. !#zh Toggle 按钮的点击事件列表。 */
  8747. checkEvents: Component.EventHandler[];
  8748. /** !#en Read only property, return the toggle items array reference managed by ToggleContainer.
  8749. !#zh 只读属性,返回 ToggleContainer 管理的 toggle 数组引用 */
  8750. toggleItems: Toggle[];
  8751. }
  8752. /** !#en ToggleGroup is not a visiable UI component but a way to modify the behavior of a set of Toggles.
  8753. Toggles that belong to the same group could only have one of them to be switched on at a time.
  8754. !#zh ToggleGroup 不是一个可见的 UI 组件,它可以用来修改一组 Toggle 组件的行为。当一组 Toggle 属于同一个 ToggleGroup 的时候,
  8755. 任何时候只能有一个 Toggle 处于选中状态。 */
  8756. export class ToggleGroup extends Component {
  8757. /** !#en If this setting is true, a toggle could be switched off and on when pressed.
  8758. If it is false, it will make sure there is always only one toggle could be switched on
  8759. and the already switched on toggle can't be switched off.
  8760. !#zh 如果这个设置为 true, 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。 */
  8761. allowSwitchOff: boolean;
  8762. /** !#en Read only property, return the toggle items array reference managed by toggleGroup.
  8763. !#zh 只读属性,返回 toggleGroup 管理的 toggle 数组引用 */
  8764. toggleItems: any[];
  8765. }
  8766. /** !#en
  8767. Handling touch events in a ViewGroup takes special care,
  8768. because it's common for a ViewGroup to have children that are targets for different touch events than the ViewGroup itself.
  8769. To make sure that each view correctly receives the touch events intended for it,
  8770. ViewGroup should register capture phase event and handle the event propagation properly.
  8771. Please refer to Scrollview for more information.
  8772. !#zh
  8773. ViewGroup的事件处理比较特殊,因为 ViewGroup 里面的子节点关心的事件跟 ViewGroup 本身可能不一样。
  8774. 为了让子节点能够正确地处理事件,ViewGroup 需要注册 capture 阶段的事件,并且合理地处理 ViewGroup 之间的事件传递。
  8775. 请参考 ScrollView 的实现来获取更多信息。 */
  8776. export class ViewGroup extends Component {
  8777. }
  8778. /** !#en
  8779. Stores and manipulate the anchoring based on its parent.
  8780. Widget are used for GUI but can also be used for other things.
  8781. 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.
  8782. !#zh
  8783. Widget 组件,用于设置和适配其相对于父节点的边距,Widget 通常被用于 UI 界面,也可以用于其他地方。
  8784. Widget 会自动调整当前节点的坐标和宽高,不过目前调整后的结果要到下一帧才能在脚本里获取到,除非你先手动调用 {{#crossLink "Widget/updateAlignment:method"}}{{/crossLink}}。 */
  8785. export class Widget extends Component {
  8786. /** !#en Specifies an alignment target that can only be one of the parent nodes of the current node.
  8787. The default value is null, and when null, indicates the current parent.
  8788. !#zh 指定一个对齐目标,只能是当前节点的其中一个父节点,默认为空,为空时表示当前父节点。 */
  8789. target: Node;
  8790. /** !#en Whether to align the top.
  8791. !#zh 是否对齐上边。 */
  8792. isAlignTop: boolean;
  8793. /** !#en
  8794. Vertically aligns the midpoint, This will open the other vertical alignment options cancel.
  8795. !#zh
  8796. 是否垂直方向对齐中点,开启此项会将垂直方向其他对齐选项取消。 */
  8797. isAlignVerticalCenter: boolean;
  8798. /** !#en Whether to align the bottom.
  8799. !#zh 是否对齐下边。 */
  8800. isAlignBottom: boolean;
  8801. /** !#en Whether to align the left.
  8802. !#zh 是否对齐左边 */
  8803. isAlignLeft: boolean;
  8804. /** !#en
  8805. Horizontal aligns the midpoint. This will open the other horizontal alignment options canceled.
  8806. !#zh
  8807. 是否水平方向对齐中点,开启此选项会将水平方向其他对齐选项取消。 */
  8808. isAlignHorizontalCenter: boolean;
  8809. /** !#en Whether to align the right.
  8810. !#zh 是否对齐右边。 */
  8811. isAlignRight: boolean;
  8812. /** !#en
  8813. Whether the stretched horizontally, when enable the left and right alignment will be stretched horizontally,
  8814. the width setting is invalid (read only).
  8815. !#zh
  8816. 当前是否水平拉伸。当同时启用左右对齐时,节点将会被水平拉伸,此时节点的宽度只读。 */
  8817. isStretchWidth: boolean;
  8818. /** !#en
  8819. Whether the stretched vertically, when enable the left and right alignment will be stretched vertically,
  8820. then height setting is invalid (read only)
  8821. !#zh
  8822. 当前是否垂直拉伸。当同时启用上下对齐时,节点将会被垂直拉伸,此时节点的高度只读。 */
  8823. isStretchHeight: boolean;
  8824. /** !#en
  8825. The margins between the top of this node and the top of parent node,
  8826. the value can be negative, Only available in 'isAlignTop' open.
  8827. !#zh
  8828. 本节点顶边和父节点顶边的距离,可填写负值,只有在 isAlignTop 开启时才有作用。 */
  8829. top: number;
  8830. /** !#en
  8831. The margins between the bottom of this node and the bottom of parent node,
  8832. the value can be negative, Only available in 'isAlignBottom' open.
  8833. !#zh
  8834. 本节点底边和父节点底边的距离,可填写负值,只有在 isAlignBottom 开启时才有作用。 */
  8835. bottom: number;
  8836. /** !#en
  8837. The margins between the left of this node and the left of parent node,
  8838. the value can be negative, Only available in 'isAlignLeft' open.
  8839. !#zh
  8840. 本节点左边和父节点左边的距离,可填写负值,只有在 isAlignLeft 开启时才有作用。 */
  8841. left: number;
  8842. /** !#en
  8843. The margins between the right of this node and the right of parent node,
  8844. the value can be negative, Only available in 'isAlignRight' open.
  8845. !#zh
  8846. 本节点右边和父节点右边的距离,可填写负值,只有在 isAlignRight 开启时才有作用。 */
  8847. right: number;
  8848. /** !#en
  8849. Horizontal aligns the midpoint offset value,
  8850. the value can be negative, Only available in 'isAlignHorizontalCenter' open.
  8851. !#zh 水平居中的偏移值,可填写负值,只有在 isAlignHorizontalCenter 开启时才有作用。 */
  8852. horizontalCenter: number;
  8853. /** !#en
  8854. Vertical aligns the midpoint offset value,
  8855. the value can be negative, Only available in 'isAlignVerticalCenter' open.
  8856. !#zh 垂直居中的偏移值,可填写负值,只有在 isAlignVerticalCenter 开启时才有作用。 */
  8857. verticalCenter: number;
  8858. /** !#en If true, horizontalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  8859. !#zh 如果为 true,"horizontalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  8860. isAbsoluteHorizontalCenter: boolean;
  8861. /** !#en If true, verticalCenter is pixel margin, otherwise is percentage (0 - 1) margin.
  8862. !#zh 如果为 true,"verticalCenter" 将会以像素作为偏移值,反之为百分比(0 到 1)。 */
  8863. isAbsoluteVerticalCenter: boolean;
  8864. /** !#en
  8865. If true, top is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  8866. !#zh
  8867. 如果为 true,"top" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  8868. isAbsoluteTop: boolean;
  8869. /** !#en
  8870. If true, bottom is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's height.
  8871. !#zh
  8872. 如果为 true,"bottom" 将会以像素作为边距,否则将会以相对父物体高度的百分比(0 到 1)作为边距。 */
  8873. isAbsoluteBottom: boolean;
  8874. /** !#en
  8875. If true, left is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  8876. !#zh
  8877. 如果为 true,"left" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  8878. isAbsoluteLeft: boolean;
  8879. /** !#en
  8880. If true, right is pixel margin, otherwise is percentage (0 - 1) margin relative to the parent's width.
  8881. !#zh
  8882. 如果为 true,"right" 将会以像素作为边距,否则将会以相对父物体宽度的百分比(0 到 1)作为边距。 */
  8883. isAbsoluteRight: boolean;
  8884. /** !#en Specifies the alignment mode of the Widget, which determines when the widget should refresh.
  8885. !#zh 指定 Widget 的对齐模式,用于决定 Widget 应该何时刷新。 */
  8886. alignMode: Widget.AlignMode;
  8887. /**
  8888. !#en
  8889. Immediately perform the widget alignment. You need to manually call this method only if
  8890. you need to get the latest results after the alignment before the end of current frame.
  8891. !#zh
  8892. 立刻执行 widget 对齐操作。这个接口一般不需要手工调用。
  8893. 只有当你需要在当前帧结束前获得 widget 对齐后的最新结果时才需要手动调用这个方法。
  8894. @example
  8895. ```js
  8896. widget.top = 10; // change top margin
  8897. cc.log(widget.node.y); // not yet changed
  8898. widget.updateAlignment();
  8899. cc.log(widget.node.y); // changed
  8900. ```
  8901. */
  8902. updateAlignment(): void;
  8903. /** !#en
  8904. When turned on, it will only be aligned once at the end of the onEnable frame,
  8905. then immediately disables the current component.
  8906. This will allow the script or animation to continue controlling the current node.
  8907. Note: It will still be aligned at the frame when onEnable is called.
  8908. !#zh
  8909. 开启后仅会在 onEnable 的当帧结束时对齐一次,然后立刻禁用当前组件。
  8910. 这样便于脚本或动画继续控制当前节点。
  8911. 注意:onEnable 时所在的那一帧仍然会进行对齐。 */
  8912. isAlignOnce: boolean;
  8913. }
  8914. /** !#en SubContextView is a view component which controls open data context viewport in minigame platform.<br/>
  8915. The component's node size decide the viewport of the sub context content in main context,
  8916. the entire sub context texture will be scaled to the node's bounding box area.<br/>
  8917. This component provides multiple important features:<br/>
  8918. 1. Sub context could use its own resolution size and policy.<br/>
  8919. 2. Sub context could be minized to smallest size it needed.<br/>
  8920. 3. Resolution of sub context content could be increased.<br/>
  8921. 4. User touch input is transformed to the correct viewport.<br/>
  8922. 5. Texture update is handled by this component. User don't need to worry.<br/>
  8923. One important thing to be noted, whenever the node's bounding box change,
  8924. !#zh SubContextView 可以用来控制小游戏平台开放数据域在主域中的视窗的位置。<br/>
  8925. 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
  8926. 在这个组件的控制下,用户可以更自由得控制开放数据域:<br/>
  8927. 1. 子域中可以使用独立的设计分辨率和适配模式<br/>
  8928. 2. 子域区域尺寸可以缩小到只容纳内容即可<br/>
  8929. 3. 子域的分辨率也可以被放大,以便获得更清晰的显示效果<br/>
  8930. 4. 用户输入坐标会被自动转换到正确的子域视窗中<br/>
  8931. 5. 子域内容贴图的更新由组件负责,用户不需要处理<br/> */
  8932. export class SubContextView extends Component {
  8933. /**
  8934. !#en Reset open data context size and viewport
  8935. !#zh 重置开放数据域的尺寸和视窗
  8936. */
  8937. reset(): void;
  8938. /**
  8939. !#en Update the sub context viewport manually, it should be called whenever the node's bounding box changes.
  8940. !#zh 更新开放数据域相对于主域的 viewport,这个函数应该在节点包围盒改变时手动调用。
  8941. */
  8942. updateSubContextViewport(): void;
  8943. }
  8944. /** !#en WXSubContextView is deprecated since v2.4.1, please use SubContextView instead.
  8945. !#zh 自 v2.4.1 起,WXSubContextView 已经废弃,请使用 SubContextView */
  8946. export class WXSubContextView extends Component {
  8947. }
  8948. /** !#en SwanSubContextView is deprecated since v2.4.1, please use SubContextView instead.
  8949. !#zh 自 v2.4.1 起,SwanSubContextView 已经废弃,请使用 SubContextView */
  8950. export class SwanSubContextView extends Component {
  8951. }
  8952. /** !#en The touch event class
  8953. !#zh 封装了触摸相关的信息。 */
  8954. export class Touch {
  8955. /**
  8956. !#en Returns the current touch location in OpenGL coordinates.、
  8957. !#zh 获取当前触点位置。
  8958. */
  8959. getLocation(): Vec2;
  8960. /**
  8961. !#en Returns X axis location value.
  8962. !#zh 获取当前触点 X 轴位置。
  8963. */
  8964. getLocationX(): number;
  8965. /**
  8966. !#en Returns Y axis location value.
  8967. !#zh 获取当前触点 Y 轴位置。
  8968. */
  8969. getLocationY(): number;
  8970. /**
  8971. !#en Returns the previous touch location in OpenGL coordinates.
  8972. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  8973. */
  8974. getPreviousLocation(): Vec2;
  8975. /**
  8976. !#en Returns the start touch location in OpenGL coordinates.
  8977. !#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  8978. */
  8979. getStartLocation(): Vec2;
  8980. /**
  8981. !#en Returns the delta distance from the previous touche to the current one in screen coordinates.
  8982. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  8983. */
  8984. getDelta(): Vec2;
  8985. /**
  8986. !#en Returns the current touch location in screen coordinates.
  8987. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  8988. */
  8989. getLocationInView(): Vec2;
  8990. /**
  8991. !#en Returns the previous touch location in screen coordinates.
  8992. !#zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  8993. */
  8994. getPreviousLocationInView(): Vec2;
  8995. /**
  8996. !#en Returns the start touch location in screen coordinates.
  8997. !#zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
  8998. */
  8999. getStartLocationInView(): Vec2;
  9000. /**
  9001. !#en Returns the id of cc.Touch.
  9002. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  9003. */
  9004. getID(): number;
  9005. /**
  9006. !#en Sets information to touch.
  9007. !#zh 设置触摸相关的信息。用于监控触摸事件。
  9008. @param id id
  9009. @param x x
  9010. @param y y
  9011. */
  9012. setTouchInfo(id: number, x: number, y: number): void;
  9013. }
  9014. /** undefined */
  9015. export class Graphics extends RenderComponent {
  9016. /** !#en
  9017. Current line width.
  9018. !#zh
  9019. 当前线条宽度 */
  9020. lineWidth: number;
  9021. /** !#en
  9022. lineJoin determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together.
  9023. !#zh
  9024. lineJoin 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性。 */
  9025. lineJoin: Graphics.LineJoin;
  9026. /** !#en
  9027. lineCap determines how the end points of every line are drawn.
  9028. !#zh
  9029. lineCap 指定如何绘制每一条线段末端。 */
  9030. lineCap: Graphics.LineCap;
  9031. /** !#en
  9032. stroke color
  9033. !#zh
  9034. 线段颜色 */
  9035. strokeColor: Color;
  9036. /** !#en
  9037. fill color
  9038. !#zh
  9039. 填充颜色 */
  9040. fillColor: Color;
  9041. /** !#en
  9042. Sets the miter limit ratio
  9043. !#zh
  9044. 设置斜接面限制比例 */
  9045. miterLimit: number;
  9046. /**
  9047. !#en Move path start point to (x,y).
  9048. !#zh 移动路径起点到坐标(x, y)
  9049. @param x The x axis of the coordinate for the end point.
  9050. @param y The y axis of the coordinate for the end point.
  9051. */
  9052. moveTo(x?: number, y?: number): void;
  9053. /**
  9054. !#en Adds a straight line to the path
  9055. !#zh 绘制直线路径
  9056. @param x The x axis of the coordinate for the end point.
  9057. @param y The y axis of the coordinate for the end point.
  9058. */
  9059. lineTo(x?: number, y?: number): void;
  9060. /**
  9061. !#en Adds a cubic Bézier curve to the path
  9062. !#zh 绘制三次贝赛尔曲线路径
  9063. @param c1x The x axis of the coordinate for the first control point.
  9064. @param c1y The y axis of the coordinate for first control point.
  9065. @param c2x The x axis of the coordinate for the second control point.
  9066. @param c2y The y axis of the coordinate for the second control point.
  9067. @param x The x axis of the coordinate for the end point.
  9068. @param y The y axis of the coordinate for the end point.
  9069. */
  9070. bezierCurveTo(c1x?: number, c1y?: number, c2x?: number, c2y?: number, x?: number, y?: number): void;
  9071. /**
  9072. !#en Adds a quadratic Bézier curve to the path
  9073. !#zh 绘制二次贝赛尔曲线路径
  9074. @param cx The x axis of the coordinate for the control point.
  9075. @param cy The y axis of the coordinate for the control point.
  9076. @param x The x axis of the coordinate for the end point.
  9077. @param y The y axis of the coordinate for the end point.
  9078. */
  9079. quadraticCurveTo(cx?: number, cy?: number, x?: number, y?: number): void;
  9080. /**
  9081. !#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).
  9082. !#zh 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
  9083. @param cx The x axis of the coordinate for the center point.
  9084. @param cy The y axis of the coordinate for the center point.
  9085. @param r The arc's radius.
  9086. @param startAngle The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.
  9087. @param endAngle The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.
  9088. @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.
  9089. */
  9090. arc(cx?: number, cy?: number, r?: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
  9091. /**
  9092. !#en Adds an ellipse to the path.
  9093. !#zh 绘制椭圆路径。
  9094. @param cx The x axis of the coordinate for the center point.
  9095. @param cy The y axis of the coordinate for the center point.
  9096. @param rx The ellipse's x-axis radius.
  9097. @param ry The ellipse's y-axis radius.
  9098. */
  9099. ellipse(cx?: number, cy?: number, rx?: number, ry?: number): void;
  9100. /**
  9101. !#en Adds an circle to the path.
  9102. !#zh 绘制圆形路径。
  9103. @param cx The x axis of the coordinate for the center point.
  9104. @param cy The y axis of the coordinate for the center point.
  9105. @param r The circle's radius.
  9106. */
  9107. circle(cx?: number, cy?: number, r?: number): void;
  9108. /**
  9109. !#en Adds an rectangle to the path.
  9110. !#zh 绘制矩形路径。
  9111. @param x The x axis of the coordinate for the rectangle starting point.
  9112. @param y The y axis of the coordinate for the rectangle starting point.
  9113. @param w The rectangle's width.
  9114. @param h The rectangle's height.
  9115. */
  9116. rect(x?: number, y?: number, w?: number, h?: number): void;
  9117. /**
  9118. !#en Adds an round corner rectangle to the path.
  9119. !#zh 绘制圆角矩形路径。
  9120. @param x The x axis of the coordinate for the rectangle starting point.
  9121. @param y The y axis of the coordinate for the rectangle starting point.
  9122. @param w The rectangles width.
  9123. @param h The rectangle's height.
  9124. @param r The radius of the rectangle.
  9125. */
  9126. roundRect(x?: number, y?: number, w?: number, h?: number, r?: number): void;
  9127. /**
  9128. !#en Draws a filled rectangle.
  9129. !#zh 绘制填充矩形。
  9130. @param x The x axis of the coordinate for the rectangle starting point.
  9131. @param y The y axis of the coordinate for the rectangle starting point.
  9132. @param w The rectangle's width.
  9133. @param h The rectangle's height.
  9134. */
  9135. fillRect(x?: number, y?: number, w?: number, h?: number): void;
  9136. /**
  9137. !#en Erasing any previously drawn content.
  9138. !#zh 擦除之前绘制的所有内容的方法。
  9139. @param clean Whether to clean the graphics inner cache.
  9140. */
  9141. clear(clean?: boolean): void;
  9142. /**
  9143. !#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.
  9144. !#zh 将笔点返回到当前路径起始点的。它尝试从当前点到起始点绘制一条直线。
  9145. */
  9146. close(): void;
  9147. /**
  9148. !#en Strokes the current or given path with the current stroke style.
  9149. !#zh 根据当前的画线样式,绘制当前或已经存在的路径。
  9150. */
  9151. stroke(): void;
  9152. /**
  9153. !#en Fills the current or given path with the current fill style.
  9154. !#zh 根据当前的画线样式,填充当前或已经存在的路径。
  9155. */
  9156. fill(): void;
  9157. }
  9158. /** !#en
  9159. Camera is usefull when making reel game or other games which need scroll screen.
  9160. Using camera will be more efficient than moving node to scroll screen.
  9161. Camera
  9162. !#zh
  9163. 摄像机在制作卷轴或是其他需要移动屏幕的游戏时比较有用,使用摄像机将会比移动节点来移动屏幕更加高效。 */
  9164. export class Camera extends Component {
  9165. /** !#en
  9166. The camera zoom ratio, only support 2D camera.
  9167. !#zh
  9168. 摄像机缩放比率, 只支持 2D camera。 */
  9169. zoomRatio: number;
  9170. /** !#en
  9171. Field of view. The width of the Camera’s view angle, measured in degrees along the local Y axis.
  9172. !#zh
  9173. 决定摄像机视角的宽度,当摄像机处于透视投影模式下这个属性才会生效。 */
  9174. fov: number;
  9175. /** !#en
  9176. The viewport size of the Camera when set to orthographic projection.
  9177. !#zh
  9178. 摄像机在正交投影模式下的视窗大小。 */
  9179. orthoSize: number;
  9180. /** !#en
  9181. The near clipping plane.
  9182. !#zh
  9183. 摄像机的近剪裁面。 */
  9184. nearClip: number;
  9185. /** !#en
  9186. The far clipping plane.
  9187. !#zh
  9188. 摄像机的远剪裁面。 */
  9189. farClip: number;
  9190. /** !#en
  9191. Is the camera orthographic (true) or perspective (false)?
  9192. !#zh
  9193. 设置摄像机的投影模式是正交还是透视模式。 */
  9194. ortho: boolean;
  9195. /** !#en
  9196. Four values (0 ~ 1) that indicate where on the screen this camera view will be drawn.
  9197. !#zh
  9198. 决定摄像机绘制在屏幕上哪个位置,值为(0 ~ 1)。 */
  9199. rect: Rect;
  9200. /** !#en
  9201. This is used to render parts of the scene selectively.
  9202. !#zh
  9203. 决定摄像机会渲染场景的哪一部分。 */
  9204. cullingMask: number;
  9205. /** !#en
  9206. Determining what to clear when camera rendering.
  9207. !#zh
  9208. 决定摄像机渲染时会清除哪些状态。 */
  9209. clearFlags: Camera.ClearFlags;
  9210. /** !#en
  9211. The color with which the screen will be cleared.
  9212. !#zh
  9213. 摄像机用于清除屏幕的背景色。 */
  9214. backgroundColor: Color;
  9215. /** !#en
  9216. Camera's depth in the camera rendering order. Cameras with higher depth are rendered after cameras with lower depth.
  9217. !#zh
  9218. 摄像机深度。用于决定摄像机的渲染顺序,值越大渲染在越上层。 */
  9219. depth: number;
  9220. /** !#en
  9221. Destination render texture.
  9222. Usually cameras render directly to screen, but for some effects it is useful to make a camera render into a texture.
  9223. !#zh
  9224. 摄像机渲染的目标 RenderTexture。
  9225. 一般摄像机会直接渲染到屏幕上,但是有一些效果可以使用摄像机渲染到 RenderTexture 上再对 RenderTexture 进行处理来实现。 */
  9226. targetTexture: RenderTexture;
  9227. /** !#en
  9228. Sets the camera's render stages.
  9229. !#zh
  9230. 设置摄像机渲染的阶段 */
  9231. renderStages: number;
  9232. /** !#en Whether auto align camera viewport to screen
  9233. !#zh 是否自动将摄像机的视口对准屏幕 */
  9234. alignWithScreen: boolean;
  9235. /** !#en
  9236. The primary camera in the scene. Returns the rear most rendered camera, which is the camera with the lowest depth.
  9237. !#zh
  9238. 当前场景中激活的主摄像机。将会返回渲染在屏幕最底层,也就是 depth 最小的摄像机。 */
  9239. static main: Camera;
  9240. /** !#en
  9241. All enabled cameras.
  9242. !#zh
  9243. 当前激活的所有摄像机。 */
  9244. static cameras: Camera[];
  9245. /**
  9246. !#en
  9247. Get the first camera which the node belong to.
  9248. !#zh
  9249. 获取节点所在的第一个摄像机。
  9250. @param node node
  9251. */
  9252. static findCamera(node: Node): Camera;
  9253. /**
  9254. !#en
  9255. Get the screen to world matrix, only support 2D camera which alignWithScreen is true.
  9256. !#zh
  9257. 获取屏幕坐标系到世界坐标系的矩阵,只适用于 alignWithScreen 为 true 的 2D 摄像机。
  9258. @param out the matrix to receive the result
  9259. */
  9260. getScreenToWorldMatrix2D(out: Mat4): Mat4;
  9261. /**
  9262. !#en
  9263. Get the world to camera matrix, only support 2D camera which alignWithScreen is true.
  9264. !#zh
  9265. 获取世界坐标系到摄像机坐标系的矩阵,只适用于 alignWithScreen 为 true 的 2D 摄像机。
  9266. @param out the matrix to receive the result
  9267. */
  9268. getWorldToScreenMatrix2D(out: Mat4): Mat4;
  9269. /**
  9270. !#en
  9271. Convert point from screen to world.
  9272. !#zh
  9273. 将坐标从屏幕坐标系转换到世界坐标系。
  9274. @param screenPosition screenPosition
  9275. @param out out
  9276. */
  9277. getScreenToWorldPoint(screenPosition: Vec3|Vec2, out?: Vec3|Vec2): Vec3;
  9278. /**
  9279. !#en
  9280. Convert point from world to screen.
  9281. !#zh
  9282. 将坐标从世界坐标系转化到屏幕坐标系。
  9283. @param worldPosition worldPosition
  9284. @param out out
  9285. */
  9286. getWorldToScreenPoint(worldPosition: Vec3|Vec2, out?: Vec3|Vec2): Vec3;
  9287. /**
  9288. !#en
  9289. Get a ray from screen position
  9290. !#zh
  9291. 从屏幕坐标获取一条射线
  9292. @param screenPos screenPos
  9293. */
  9294. getRay(screenPos: Vec2): geomUtils.Ray;
  9295. /**
  9296. !#en
  9297. Check whether the node is in the camera.
  9298. !#zh
  9299. 检测节点是否被此摄像机影响
  9300. @param node the node which need to check
  9301. */
  9302. containsNode(node: Node): boolean;
  9303. /**
  9304. !#en
  9305. Render the camera manually.
  9306. !#zh
  9307. 手动渲染摄像机。
  9308. @param rootNode rootNode
  9309. */
  9310. render(rootNode?: Node): void;
  9311. /**
  9312. !#en
  9313. Returns the matrix that transform the node's (local) space coordinates into the camera's space coordinates.
  9314. !#zh
  9315. 返回一个将节点坐标系转换到摄像机坐标系下的矩阵
  9316. @param node the node which should transform
  9317. */
  9318. getNodeToCameraTransform(node: Node): AffineTransform;
  9319. /**
  9320. !#en
  9321. Conver a camera coordinates point to world coordinates.
  9322. !#zh
  9323. 将一个摄像机坐标系下的点转换到世界坐标系下。
  9324. @param point the point which should transform
  9325. @param out the point to receive the result
  9326. */
  9327. getCameraToWorldPoint(point: Vec2, out?: Vec2): Vec2;
  9328. /**
  9329. !#en
  9330. Conver a world coordinates point to camera coordinates.
  9331. !#zh
  9332. 将一个世界坐标系下的点转换到摄像机坐标系下。
  9333. @param point point
  9334. @param out the point to receive the result
  9335. */
  9336. getWorldToCameraPoint(point: Vec2, out?: Vec2): Vec2;
  9337. /**
  9338. !#en
  9339. Get the camera to world matrix
  9340. !#zh
  9341. 获取摄像机坐标系到世界坐标系的矩阵
  9342. @param out the matrix to receive the result
  9343. */
  9344. getCameraToWorldMatrix(out: Mat4): Mat4;
  9345. /**
  9346. !#en
  9347. Get the world to camera matrix
  9348. !#zh
  9349. 获取世界坐标系到摄像机坐标系的矩阵
  9350. @param out the matrix to receive the result
  9351. */
  9352. getWorldToCameraMatrix(out: Mat4): Mat4;
  9353. }
  9354. /** !#en Mesh Asset.
  9355. !#zh 网格资源。 */
  9356. export class Mesh extends Asset implements EventTarget {
  9357. /** !#en Get ir set the sub meshes.
  9358. !#zh 设置或者获取子网格。 */
  9359. subMeshes: InputAssembler[];
  9360. /**
  9361. !#en
  9362. Init vertex buffer according to the vertex format.
  9363. !#zh
  9364. 根据顶点格式初始化顶点内存。
  9365. @param vertexFormat vertex format
  9366. @param vertexCount how much vertex should be create in this buffer.
  9367. @param dynamic whether or not to use dynamic buffer.
  9368. @param index index
  9369. */
  9370. init(vertexFormat: gfx.VertexFormat, vertexCount: number, dynamic?: boolean, index?: boolean): void;
  9371. /**
  9372. !#en
  9373. Set the vertex values.
  9374. !#zh
  9375. 设置顶点数据
  9376. @param name the attribute name, e.g. gfx.ATTR_POSITION
  9377. @param values the vertex values
  9378. */
  9379. setVertices(name: string, values: Vec2[]|Vec3[]|Color[]|number[]|Uint8Array|Float32Array): void;
  9380. /**
  9381. !#en
  9382. Set the sub mesh indices.
  9383. !#zh
  9384. 设置子网格索引。
  9385. @param indices the sub mesh indices.
  9386. @param index sub mesh index.
  9387. @param dynamic whether or not to use dynamic buffer.
  9388. */
  9389. setIndices(indices: number[]|Uint16Array|Uint8Array, index?: number, dynamic?: boolean): void;
  9390. /**
  9391. !#en
  9392. Set the sub mesh primitive type.
  9393. !#zh
  9394. 设置子网格绘制线条的方式。
  9395. @param type type
  9396. @param index index
  9397. */
  9398. setPrimitiveType(type: number, index: number): void;
  9399. /**
  9400. !#en
  9401. Clear the buffer data.
  9402. !#zh
  9403. 清除网格创建的内存数据。
  9404. */
  9405. clear(): void;
  9406. /**
  9407. !#en Set mesh bounding box
  9408. !#zh 设置网格的包围盒
  9409. @param min min
  9410. @param max max
  9411. */
  9412. setBoundingBox(min: Vec3, max: Vec3): void;
  9413. /**
  9414. !#en Read the specified attributes of the subgrid into the target buffer.
  9415. !#zh 读取子网格的指定属性到目标缓冲区中。
  9416. @param primitiveIndex The subgrid index.
  9417. @param attributeName attribute name.
  9418. @param buffer The target buffer.
  9419. @param stride The byte interval between adjacent attributes in the target buffer.
  9420. @param offset The offset of the first attribute in the target buffer.
  9421. */
  9422. copyAttribute(primitiveIndex: number, attributeName: string, buffer: ArrayBuffer, stride: number, offset: number): boolean;
  9423. /**
  9424. !#en Read the index data of the subgrid into the target array.
  9425. !#zh 读取子网格的索引数据到目标数组中。
  9426. @param primitiveIndex The subgrid index.
  9427. @param outputArray The target array.
  9428. */
  9429. copyIndices(primitiveIndex: number, outputArray: DataView): boolean;
  9430. /**
  9431. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  9432. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  9433. @param type The type of event.
  9434. */
  9435. hasEventListener(type: string): boolean;
  9436. /**
  9437. !#en
  9438. Register an callback of a specific event type on the EventTarget.
  9439. This type of event should be triggered via `emit`.
  9440. !#zh
  9441. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  9442. @param type A string representing the event type to listen for.
  9443. @param callback The callback that will be invoked when the event is dispatched.
  9444. The callback is ignored if it is a duplicate (the callbacks are unique).
  9445. @param target The target (this object) to invoke the callback, can be null
  9446. @example
  9447. ```js
  9448. eventTarget.on('fire', function () {
  9449. cc.log("fire in the hole");
  9450. }, node);
  9451. ```
  9452. */
  9453. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  9454. /**
  9455. !#en
  9456. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  9457. if only type is passed as parameter, all listeners registered with that type will be removed.
  9458. !#zh
  9459. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  9460. @param type A string representing the event type being removed.
  9461. @param callback The callback to remove.
  9462. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  9463. @example
  9464. ```js
  9465. // register fire eventListener
  9466. var callback = eventTarget.on('fire', function () {
  9467. cc.log("fire in the hole");
  9468. }, target);
  9469. // remove fire event listener
  9470. eventTarget.off('fire', callback, target);
  9471. // remove all fire event listeners
  9472. eventTarget.off('fire');
  9473. ```
  9474. */
  9475. off(type: string, callback?: Function, target?: any): void;
  9476. /**
  9477. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  9478. This is not for removing all listeners in the current event target,
  9479. and this is not for removing all listeners the target parameter have registered.
  9480. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  9481. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  9482. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  9483. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  9484. @param target The target to be searched for all related listeners
  9485. */
  9486. targetOff(target: any): void;
  9487. /**
  9488. !#en
  9489. Register an callback of a specific event type on the EventTarget,
  9490. the callback will remove itself after the first time it is triggered.
  9491. !#zh
  9492. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  9493. @param type A string representing the event type to listen for.
  9494. @param callback The callback that will be invoked when the event is dispatched.
  9495. The callback is ignored if it is a duplicate (the callbacks are unique).
  9496. @param target The target (this object) to invoke the callback, can be null
  9497. @example
  9498. ```js
  9499. eventTarget.once('fire', function () {
  9500. cc.log("this is the callback and will be invoked only once");
  9501. }, node);
  9502. ```
  9503. */
  9504. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  9505. /**
  9506. !#en
  9507. Send an event with the event object.
  9508. !#zh
  9509. 通过事件对象派发事件
  9510. @param event event
  9511. */
  9512. dispatchEvent(event: Event): void;
  9513. }
  9514. /** !#en
  9515. Mesh Renderer Component
  9516. !#zh
  9517. 网格渲染组件 */
  9518. export class MeshRenderer extends RenderComponent {
  9519. /** !#en
  9520. The mesh which the renderer uses.
  9521. !#zh
  9522. 设置使用的网格 */
  9523. mesh: Mesh;
  9524. /** !#en
  9525. Whether the mesh should receive shadows.
  9526. !#zh
  9527. 网格是否接受光源投射的阴影 */
  9528. receiveShadows: boolean;
  9529. /** !#en
  9530. Shadow Casting Mode
  9531. !#zh
  9532. 网格投射阴影的模式 */
  9533. shadowCastingMode: MeshRenderer.ShadowCastingMode;
  9534. /** !#en
  9535. Enable auto merge mesh, only support when mesh's VertexFormat, PrimitiveType, materials are all the same
  9536. !#zh
  9537. 开启自动合并 mesh 功能,只有在网格的 顶点格式,PrimitiveType, 使用的材质 都一致的情况下才会有效 */
  9538. enableAutoBatch: boolean;
  9539. }
  9540. /** The class BufferRange denotes a range of the buffer. */
  9541. export class BufferRange {
  9542. /** The offset of the range. */
  9543. offset: number;
  9544. /** The length of the range. */
  9545. length: number;
  9546. }
  9547. /** undefined */
  9548. export class VertexFormat {
  9549. /** The data range of this bundle.
  9550. This range of data is essentially mapped to a GPU vertex buffer. */
  9551. data: BufferRange;
  9552. /** The attribute formats. */
  9553. formats: VertexFormat;
  9554. /** The vertex bundle that the primitive use. */
  9555. vertexBundleIndices: number[];
  9556. /** The data range of the primitive.
  9557. This range of data is essentially mapped to a GPU indices buffer. */
  9558. data: BufferRange;
  9559. /** The type of this primitive's indices. */
  9560. indexUnit: number;
  9561. /** The primitive's topology. */
  9562. topology: number;
  9563. }
  9564. /** undefined */
  9565. export class WorldManifold {
  9566. /** !#en
  9567. world contact point (point of intersection)
  9568. !#zh
  9569. 碰撞点集合 */
  9570. points: Vec2[];
  9571. /** !#en
  9572. world vector pointing from A to B
  9573. !#zh
  9574. 世界坐标系下由 A 指向 B 的向量 */
  9575. normal: Vec2;
  9576. }
  9577. /** !#en
  9578. A manifold point is a contact point belonging to a contact manifold.
  9579. It holds details related to the geometry and dynamics of the contact points.
  9580. Note: the impulses are used for internal caching and may not
  9581. provide reliable contact forces, especially for high speed collisions.
  9582. !#zh
  9583. ManifoldPoint 是接触信息中的接触点信息。它拥有关于几何和接触点的详细信息。
  9584. 注意:信息中的冲量用于系统内部缓存,提供的接触力可能不是很准确,特别是高速移动中的碰撞信息。 */
  9585. export class ManifoldPoint {
  9586. /** !#en
  9587. The local point usage depends on the manifold type:
  9588. -e_circles: the local center of circleB
  9589. -e_faceA: the local center of circleB or the clip point of polygonB
  9590. -e_faceB: the clip point of polygonA
  9591. !#zh
  9592. 本地坐标点的用途取决于 manifold 的类型
  9593. - e_circles: circleB 的本地中心点
  9594. - e_faceA: circleB 的本地中心点 或者是 polygonB 的截取点
  9595. - e_faceB: polygonB 的截取点 */
  9596. localPoint: Vec2;
  9597. /** !#en
  9598. Normal impulse.
  9599. !#zh
  9600. 法线冲量。 */
  9601. normalImpulse: number;
  9602. /** !#en
  9603. Tangent impulse.
  9604. !#zh
  9605. 切线冲量。 */
  9606. tangentImpulse: number;
  9607. }
  9608. /** undefined */
  9609. export class Manifold {
  9610. /** !#en
  9611. Manifold type : 0: e_circles, 1: e_faceA, 2: e_faceB
  9612. !#zh
  9613. Manifold 类型 : 0: e_circles, 1: e_faceA, 2: e_faceB */
  9614. type: number;
  9615. /** !#en
  9616. The local point usage depends on the manifold type:
  9617. -e_circles: the local center of circleA
  9618. -e_faceA: the center of faceA
  9619. -e_faceB: the center of faceB
  9620. !#zh
  9621. 用途取决于 manifold 类型
  9622. -e_circles: circleA 的本地中心点
  9623. -e_faceA: faceA 的本地中心点
  9624. -e_faceB: faceB 的本地中心点 */
  9625. localPoint: Vec2;
  9626. /** !#en
  9627. -e_circles: not used
  9628. -e_faceA: the normal on polygonA
  9629. -e_faceB: the normal on polygonB
  9630. !#zh
  9631. -e_circles: 没被使用到
  9632. -e_faceA: polygonA 的法向量
  9633. -e_faceB: polygonB 的法向量 */
  9634. localNormal: Vec2;
  9635. /** !#en
  9636. the points of contact.
  9637. !#zh
  9638. 接触点信息。 */
  9639. points: ManifoldPoint[];
  9640. }
  9641. /** !#en
  9642. Contact impulses for reporting.
  9643. !#zh
  9644. 用于返回给回调的接触冲量。 */
  9645. export class PhysicsImpulse {
  9646. /** !#en
  9647. Normal impulses.
  9648. !#zh
  9649. 法线方向的冲量 */
  9650. normalImpulses: any;
  9651. /** !#en
  9652. Tangent impulses
  9653. !#zh
  9654. 切线方向的冲量 */
  9655. tangentImpulses: any;
  9656. }
  9657. /** !#en
  9658. PhysicsContact will be generated during begin and end collision as a parameter of the collision callback.
  9659. Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
  9660. !#zh
  9661. 物理接触会在开始和结束碰撞之间生成,并作为参数传入到碰撞回调函数中。
  9662. 注意:传入的物理接触会被系统进行重用,所以不要在使用中缓存里面的任何信息。 */
  9663. export class PhysicsContact {
  9664. /**
  9665. !#en
  9666. Get the world manifold.
  9667. !#zh
  9668. 获取世界坐标系下的碰撞信息。
  9669. */
  9670. getWorldManifold(): WorldManifold;
  9671. /**
  9672. !#en
  9673. Get the manifold.
  9674. !#zh
  9675. 获取本地(局部)坐标系下的碰撞信息。
  9676. */
  9677. getManifold(): Manifold;
  9678. /**
  9679. !#en
  9680. Get the impulses.
  9681. Note: PhysicsImpulse can only used in onPostSolve callback.
  9682. !#zh
  9683. 获取冲量信息
  9684. 注意:这个信息只有在 onPostSolve 回调中才能获取到
  9685. */
  9686. getImpulse(): PhysicsImpulse;
  9687. /** !#en
  9688. One of the collider that collided
  9689. !#zh
  9690. 发生碰撞的碰撞体之一 */
  9691. colliderA: Collider;
  9692. /** !#en
  9693. One of the collider that collided
  9694. !#zh
  9695. 发生碰撞的碰撞体之一 */
  9696. colliderB: Collider;
  9697. /** !#en
  9698. If set disabled to true, the contact will be ignored until contact end.
  9699. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
  9700. !#zh
  9701. 如果 disabled 被设置为 true,那么直到接触结束此接触都将被忽略。
  9702. 如果只是希望在当前时间步或子步中忽略此接触,请使用 disabledOnce 。 */
  9703. disabled: boolean;
  9704. /** !#en
  9705. Disabled contact for current time step or sub-step.
  9706. !#zh
  9707. 在当前时间步或子步中忽略此接触。 */
  9708. disabledOnce: boolean;
  9709. /**
  9710. !#en
  9711. Is this contact touching?
  9712. !#zh
  9713. 返回碰撞体是否已经接触到。
  9714. */
  9715. isTouching(): boolean;
  9716. /**
  9717. !#en
  9718. Set the desired tangent speed for a conveyor belt behavior.
  9719. !#zh
  9720. 为传送带设置期望的切线速度
  9721. @param tangentSpeed tangentSpeed
  9722. */
  9723. setTangentSpeed(tangentSpeed: number): void;
  9724. /**
  9725. !#en
  9726. Get the desired tangent speed.
  9727. !#zh
  9728. 获取切线速度
  9729. */
  9730. getTangentSpeed(): number;
  9731. /**
  9732. !#en
  9733. Override the default friction mixture. You can call this in onPreSolve callback.
  9734. !#zh
  9735. 覆盖默认的摩擦力系数。你可以在 onPreSolve 回调中调用此函数。
  9736. @param friction friction
  9737. */
  9738. setFriction(friction: number): void;
  9739. /**
  9740. !#en
  9741. Get the friction.
  9742. !#zh
  9743. 获取当前摩擦力系数
  9744. */
  9745. getFriction(): number;
  9746. /**
  9747. !#en
  9748. Reset the friction mixture to the default value.
  9749. !#zh
  9750. 重置摩擦力系数到默认值
  9751. */
  9752. resetFriction(): void;
  9753. /**
  9754. !#en
  9755. Override the default restitution mixture. You can call this in onPreSolve callback.
  9756. !#zh
  9757. 覆盖默认的恢复系数。你可以在 onPreSolve 回调中调用此函数。
  9758. @param restitution restitution
  9759. */
  9760. setRestitution(restitution: number): void;
  9761. /**
  9762. !#en
  9763. Get the restitution.
  9764. !#zh
  9765. 获取当前恢复系数
  9766. */
  9767. getRestitution(): number;
  9768. /**
  9769. !#en
  9770. Reset the restitution mixture to the default value.
  9771. !#zh
  9772. 重置恢复系数到默认值
  9773. */
  9774. resetRestitution(): void;
  9775. }
  9776. /** !#en
  9777. Physics manager uses box2d as the inner physics system, and hide most box2d implement details(creating rigidbody, synchronize rigidbody info to node).
  9778. You can visit some common box2d function through physics manager(hit testing, raycast, debug info).
  9779. Physics manager distributes the collision information to each collision callback when collision is produced.
  9780. Note: You need first enable the collision listener in the rigidbody.
  9781. !#zh
  9782. 物理系统将 box2d 作为内部物理系统,并且隐藏了大部分 box2d 实现细节(比如创建刚体,同步刚体信息到节点中等)。
  9783. 你可以通过物理系统访问一些 box2d 常用的功能,比如点击测试,射线测试,设置测试信息等。
  9784. 物理系统还管理碰撞信息的分发,她会在产生碰撞时,将碰撞信息分发到各个碰撞回调中。
  9785. 注意:你需要先在刚体中开启碰撞接听才会产生相应的碰撞回调。<br>
  9786. 支持的物理系统指定绘制信息事件,请参阅 {{#crossLink "PhysicsManager.DrawBits"}}{{/crossLink}} */
  9787. export class PhysicsManager implements EventTarget {
  9788. /** !#en
  9789. The ratio transform between physics unit and pixel unit, generally is 32.
  9790. !#zh
  9791. 物理单位与像素单位互相转换的比率,一般是 32。 */
  9792. static PTM_RATIO: number;
  9793. /** !#en
  9794. The velocity iterations for the velocity constraint solver.
  9795. !#zh
  9796. 速度更新迭代数 */
  9797. static VELOCITY_ITERATIONS: number;
  9798. /** !#en
  9799. The position Iterations for the position constraint solver.
  9800. !#zh
  9801. 位置迭代更新数 */
  9802. static POSITION_ITERATIONS: number;
  9803. /** !#en
  9804. Specify the fixed time step.
  9805. Need enabledAccumulator to make it work.
  9806. !#zh
  9807. 指定固定的物理更新间隔时间,需要开启 enabledAccumulator 才有效。 */
  9808. static FIXED_TIME_STEP: number;
  9809. /** !#en
  9810. Specify the max accumulator time.
  9811. Need enabledAccumulator to make it work.
  9812. !#zh
  9813. 每次可用于更新物理系统的最大时间,需要开启 enabledAccumulator 才有效。 */
  9814. static MAX_ACCUMULATOR: number;
  9815. /** !#en
  9816. If enabled accumulator, then will call step function with the fixed time step FIXED_TIME_STEP.
  9817. And if the update dt is bigger than the time step, then will call step function several times.
  9818. If disabled accumulator, then will call step function with a time step calculated with the frame rate.
  9819. !#zh
  9820. 如果开启此选项,那么将会以固定的间隔时间 FIXED_TIME_STEP 来更新物理引擎,如果一个 update 的间隔时间大于 FIXED_TIME_STEP,则会对物理引擎进行多次更新。
  9821. 如果关闭此选项,那么将会根据设定的 frame rate 计算出一个间隔时间来更新物理引擎。 */
  9822. enabledAccumulator: boolean;
  9823. /**
  9824. !#en
  9825. Test which collider contains the given world point
  9826. !#zh
  9827. 获取包含给定世界坐标系点的碰撞体
  9828. @param point the world point
  9829. */
  9830. testPoint(point: Vec2): PhysicsCollider;
  9831. /**
  9832. !#en
  9833. Test which colliders intersect the given world rect
  9834. !#zh
  9835. 获取与给定世界坐标系矩形相交的碰撞体
  9836. @param rect the world rect
  9837. */
  9838. testAABB(rect: Rect): PhysicsCollider[];
  9839. /**
  9840. !#en
  9841. Raycast the world for all colliders in the path of the ray.
  9842. The raycast ignores colliders that contain the starting point.
  9843. !#zh
  9844. 检测哪些碰撞体在给定射线的路径上,射线检测将忽略包含起始点的碰撞体。
  9845. @param p1 start point of the raycast
  9846. @param p2 end point of the raycast
  9847. @param type optional, default is RayCastType.Closest
  9848. */
  9849. rayCast(p1: Vec2, p2: Vec2, type: RayCastType): PhysicsRayCastResult[];
  9850. /** !#en
  9851. Enabled the physics manager?
  9852. !#zh
  9853. 指定是否启用物理系统? */
  9854. enabled: boolean;
  9855. /** !#en
  9856. Debug draw flags.
  9857. !#zh
  9858. 设置调试绘制标志 */
  9859. debugDrawFlags: number;
  9860. /** !#en
  9861. The physics world gravity.
  9862. !#zh
  9863. 物理世界重力值 */
  9864. gravity: Vec2;
  9865. /**
  9866. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  9867. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  9868. @param type The type of event.
  9869. */
  9870. hasEventListener(type: string): boolean;
  9871. /**
  9872. !#en
  9873. Register an callback of a specific event type on the EventTarget.
  9874. This type of event should be triggered via `emit`.
  9875. !#zh
  9876. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  9877. @param type A string representing the event type to listen for.
  9878. @param callback The callback that will be invoked when the event is dispatched.
  9879. The callback is ignored if it is a duplicate (the callbacks are unique).
  9880. @param target The target (this object) to invoke the callback, can be null
  9881. @example
  9882. ```js
  9883. eventTarget.on('fire', function () {
  9884. cc.log("fire in the hole");
  9885. }, node);
  9886. ```
  9887. */
  9888. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  9889. /**
  9890. !#en
  9891. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  9892. if only type is passed as parameter, all listeners registered with that type will be removed.
  9893. !#zh
  9894. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  9895. @param type A string representing the event type being removed.
  9896. @param callback The callback to remove.
  9897. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  9898. @example
  9899. ```js
  9900. // register fire eventListener
  9901. var callback = eventTarget.on('fire', function () {
  9902. cc.log("fire in the hole");
  9903. }, target);
  9904. // remove fire event listener
  9905. eventTarget.off('fire', callback, target);
  9906. // remove all fire event listeners
  9907. eventTarget.off('fire');
  9908. ```
  9909. */
  9910. off(type: string, callback?: Function, target?: any): void;
  9911. /**
  9912. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  9913. This is not for removing all listeners in the current event target,
  9914. and this is not for removing all listeners the target parameter have registered.
  9915. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  9916. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  9917. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  9918. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  9919. @param target The target to be searched for all related listeners
  9920. */
  9921. targetOff(target: any): void;
  9922. /**
  9923. !#en
  9924. Register an callback of a specific event type on the EventTarget,
  9925. the callback will remove itself after the first time it is triggered.
  9926. !#zh
  9927. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  9928. @param type A string representing the event type to listen for.
  9929. @param callback The callback that will be invoked when the event is dispatched.
  9930. The callback is ignored if it is a duplicate (the callbacks are unique).
  9931. @param target The target (this object) to invoke the callback, can be null
  9932. @example
  9933. ```js
  9934. eventTarget.once('fire', function () {
  9935. cc.log("this is the callback and will be invoked only once");
  9936. }, node);
  9937. ```
  9938. */
  9939. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  9940. /**
  9941. !#en
  9942. Send an event with the event object.
  9943. !#zh
  9944. 通过事件对象派发事件
  9945. @param event event
  9946. */
  9947. dispatchEvent(event: Event): void;
  9948. /**
  9949. !#en
  9950. Destroy all callbackInfos.
  9951. !#zh
  9952. 销毁记录的事件
  9953. */
  9954. clear(): void;
  9955. }
  9956. /** undefined */
  9957. export class PhysicsRayCastResult {
  9958. /** !#en
  9959. The PhysicsCollider which intersects with the raycast
  9960. !#zh
  9961. 与射线相交的碰撞体 */
  9962. collider: PhysicsCollider;
  9963. /** !#en
  9964. The intersection point
  9965. !#zh
  9966. 射线与碰撞体相交的点 */
  9967. point: Vec2;
  9968. /** !#en
  9969. The normal vector at the point of intersection
  9970. !#zh
  9971. 射线与碰撞体相交的点的法向量 */
  9972. normal: Vec2;
  9973. /** !#en
  9974. The fraction of the raycast path at the point of intersection
  9975. !#zh
  9976. 射线与碰撞体相交的点占射线长度的分数 */
  9977. fraction: number;
  9978. }
  9979. /** !#en Enum for RigidBodyType.
  9980. !#zh 刚体类型 */
  9981. export enum RigidBodyType {
  9982. Static = 0,
  9983. Kinematic = 0,
  9984. Dynamic = 0,
  9985. Animated = 0,
  9986. }
  9987. /** !#en Enum for RayCastType.
  9988. !#zh 射线检测类型 */
  9989. export enum RayCastType {
  9990. Closest = 0,
  9991. Any = 0,
  9992. AllClosest = 0,
  9993. All = 0,
  9994. }
  9995. /** undefined */
  9996. export class RigidBody extends Component {
  9997. /** !#en
  9998. Should enabled contact listener?
  9999. When a collision is trigger, the collision callback will only be called when enabled contact listener.
  10000. !#zh
  10001. 是否启用接触接听器。
  10002. 当 collider 产生碰撞时,只有开启了接触接听器才会调用相应的回调函数 */
  10003. enabledContactListener: boolean;
  10004. /**
  10005. !#en
  10006. Collision callback.
  10007. Called when two collider begin to touch.
  10008. !#zh
  10009. 碰撞回调。
  10010. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体开始接触时被调用。
  10011. @param contact contact information
  10012. @param selfCollider the collider belong to this rigidbody
  10013. @param otherCollider the collider belong to another rigidbody
  10014. */
  10015. onBeginContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  10016. /**
  10017. !#en
  10018. Collision callback.
  10019. Called when two collider cease to touch.
  10020. !#zh
  10021. 碰撞回调。
  10022. 如果你的脚本中实现了这个函数,那么它将会在两个碰撞体停止接触时被调用。
  10023. @param contact contact information
  10024. @param selfCollider the collider belong to this rigidbody
  10025. @param otherCollider the collider belong to another rigidbody
  10026. */
  10027. onEndContact(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  10028. /**
  10029. !#en
  10030. Collision callback.
  10031. This is called when a contact is updated.
  10032. This allows you to inspect a contact before it goes to the solver(e.g. disable contact).
  10033. Note: this is called only for awake bodies.
  10034. Note: this is called even when the number of contact points is zero.
  10035. Note: this is not called for sensors.
  10036. !#zh
  10037. 碰撞回调。
  10038. 如果你的脚本中实现了这个函数,那么它将会在接触更新时被调用。
  10039. 你可以在接触被处理前根据他包含的信息作出相应的处理,比如将这个接触禁用掉。
  10040. 注意:回调只会为醒着的刚体调用。
  10041. 注意:接触点为零的时候也有可能被调用。
  10042. 注意:感知体(sensor)的回调不会被调用。
  10043. @param contact contact information
  10044. @param selfCollider the collider belong to this rigidbody
  10045. @param otherCollider the collider belong to another rigidbody
  10046. */
  10047. onPreSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  10048. /**
  10049. !#en
  10050. Collision callback.
  10051. This is called after a contact is updated.
  10052. You can get the impulses from the contact in this callback.
  10053. !#zh
  10054. 碰撞回调。
  10055. 如果你的脚本中实现了这个函数,那么它将会在接触更新完后被调用。
  10056. 你可以在这个回调中从接触信息中获取到冲量信息。
  10057. @param contact contact information
  10058. @param selfCollider the collider belong to this rigidbody
  10059. @param otherCollider the collider belong to another rigidbody
  10060. */
  10061. onPostSolve(contact: PhysicsContact, selfCollider: PhysicsCollider, otherCollider: PhysicsCollider): void;
  10062. /** !#en
  10063. Is this a fast moving body that should be prevented from tunneling through
  10064. other moving bodies?
  10065. Note :
  10066. - All bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
  10067. - You should use this flag sparingly since it increases processing time.
  10068. !#zh
  10069. 这个刚体是否是一个快速移动的刚体,并且需要禁止穿过其他快速移动的刚体?
  10070. 需要注意的是 :
  10071. - 所有刚体都被禁止从 运动刚体 和 静态刚体 中穿过。此选项只关注于 动态刚体。
  10072. - 应该尽量少的使用此选项,因为它会增加程序处理时间。 */
  10073. bullet: boolean;
  10074. /** !#en
  10075. Rigidbody type : Static, Kinematic, Dynamic or Animated.
  10076. !#zh
  10077. 刚体类型: Static, Kinematic, Dynamic or Animated. */
  10078. type: RigidBodyType;
  10079. /** !#en
  10080. Set this flag to false if this body should never fall asleep.
  10081. Note that this increases CPU usage.
  10082. !#zh
  10083. 如果此刚体永远都不应该进入睡眠,那么设置这个属性为 false。
  10084. 需要注意这将使 CPU 占用率提高。 */
  10085. allowSleep: boolean;
  10086. /** !#en
  10087. Scale the gravity applied to this body.
  10088. !#zh
  10089. 缩放应用在此刚体上的重力值 */
  10090. gravityScale: number;
  10091. /** !#en
  10092. Linear damping is use to reduce the linear velocity.
  10093. The damping parameter can be larger than 1, but the damping effect becomes sensitive to the
  10094. time step when the damping parameter is large.
  10095. !#zh
  10096. Linear damping 用于衰减刚体的线性速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  10097. linearDamping: number;
  10098. /** !#en
  10099. Angular damping is use to reduce the angular velocity. The damping parameter
  10100. can be larger than 1 but the damping effect becomes sensitive to the
  10101. time step when the damping parameter is large.
  10102. !#zh
  10103. Angular damping 用于衰减刚体的角速度。衰减系数可以大于 1,但是当衰减系数比较大的时候,衰减的效果会变得比较敏感。 */
  10104. angularDamping: number;
  10105. /** !#en
  10106. The linear velocity of the body's origin in world co-ordinates.
  10107. !#zh
  10108. 刚体在世界坐标下的线性速度 */
  10109. linearVelocity: Vec2;
  10110. /** !#en
  10111. The angular velocity of the body.
  10112. !#zh
  10113. 刚体的角速度 */
  10114. angularVelocity: number;
  10115. /** !#en
  10116. Should this body be prevented from rotating?
  10117. !#zh
  10118. 是否禁止此刚体进行旋转 */
  10119. fixedRotation: boolean;
  10120. /** !#en
  10121. 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.)
  10122. !#zh
  10123. 设置刚体的睡眠状态。 睡眠的刚体具有非常低的 CPU 成本。(当刚体被碰撞到时,如果刚体处于睡眠状态,它会立即被唤醒) */
  10124. awake: boolean;
  10125. /** !#en
  10126. Whether to wake up this rigid body during initialization
  10127. !#zh
  10128. 是否在初始化时唤醒此刚体 */
  10129. awakeOnLoad: boolean;
  10130. /** !#en
  10131. Set the active state of the body. An inactive body is not
  10132. simulated and cannot be collided with or woken up.
  10133. If body is active, all fixtures will be added to the
  10134. broad-phase.
  10135. If body is inactive, all fixtures will be removed from
  10136. the broad-phase and all contacts will be destroyed.
  10137. Fixtures on an inactive body are implicitly inactive and will
  10138. not participate in collisions, ray-casts, or queries.
  10139. Joints connected to an inactive body are implicitly inactive.
  10140. !#zh
  10141. 设置刚体的激活状态。一个非激活状态下的刚体是不会被模拟和碰撞的,不管它是否处于睡眠状态下。
  10142. 如果刚体处于激活状态下,所有夹具会被添加到 粗测阶段(broad-phase)。
  10143. 如果刚体处于非激活状态下,所有夹具会被从 粗测阶段(broad-phase)中移除。
  10144. 在非激活状态下的夹具不会参与到碰撞,射线,或者查找中
  10145. 链接到非激活状态下刚体的关节也是非激活的。 */
  10146. active: boolean;
  10147. /**
  10148. !#en
  10149. Converts a given point in the world coordinate system to this rigid body's local coordinate system
  10150. !#zh
  10151. 将一个给定的世界坐标系下的点转换为刚体本地坐标系下的点
  10152. @param worldPoint a point in world coordinates.
  10153. @param out optional, the receiving point
  10154. */
  10155. getLocalPoint(worldPoint: Vec2, out: Vec2): Vec2;
  10156. /**
  10157. !#en
  10158. Converts a given point in this rigid body's local coordinate system to the world coordinate system
  10159. !#zh
  10160. 将一个给定的刚体本地坐标系下的点转换为世界坐标系下的点
  10161. @param localPoint a point in local coordinates.
  10162. @param out optional, the receiving point
  10163. */
  10164. getWorldPoint(localPoint: Vec2, out: Vec2): Vec2;
  10165. /**
  10166. !#en
  10167. Converts a given vector in this rigid body's local coordinate system to the world coordinate system
  10168. !#zh
  10169. 将一个给定的刚体本地坐标系下的向量转换为世界坐标系下的向量
  10170. @param localVector a vector in world coordinates.
  10171. @param out optional, the receiving vector
  10172. */
  10173. getWorldVector(localVector: Vec2, out: Vec2): Vec2;
  10174. /**
  10175. !#en
  10176. Converts a given vector in the world coordinate system to this rigid body's local coordinate system
  10177. !#zh
  10178. 将一个给定的世界坐标系下的向量转换为刚体本地坐标系下的向量
  10179. @param worldVector a vector in world coordinates.
  10180. @param out optional, the receiving vector
  10181. */
  10182. getLocalVector(worldVector: Vec2, out: Vec2): Vec2;
  10183. /**
  10184. !#en
  10185. Get the world body origin position.
  10186. !#zh
  10187. 获取刚体世界坐标系下的原点值
  10188. @param out optional, the receiving point
  10189. */
  10190. getWorldPosition(out: Vec2): Vec2;
  10191. /**
  10192. !#en
  10193. Get the world body rotation angle.
  10194. !#zh
  10195. 获取刚体世界坐标系下的旋转值。
  10196. */
  10197. getWorldRotation(): number;
  10198. /**
  10199. !#en
  10200. Get the local position of the center of mass.
  10201. !#zh
  10202. 获取刚体本地坐标系下的质心
  10203. */
  10204. getLocalCenter(): Vec2;
  10205. /**
  10206. !#en
  10207. Get the world position of the center of mass.
  10208. !#zh
  10209. 获取刚体世界坐标系下的质心
  10210. */
  10211. getWorldCenter(): Vec2;
  10212. /**
  10213. !#en
  10214. Get the world linear velocity of a world point attached to this body.
  10215. !#zh
  10216. 获取刚体上指定点的线性速度
  10217. @param worldPoint a point in world coordinates.
  10218. @param out optional, the receiving point
  10219. */
  10220. getLinearVelocityFromWorldPoint(worldPoint: Vec2, out: Vec2): Vec2;
  10221. /**
  10222. !#en
  10223. Get total mass of the body.
  10224. !#zh
  10225. 获取刚体的质量。
  10226. */
  10227. getMass(): number;
  10228. /**
  10229. !#en
  10230. Get the rotational inertia of the body about the local origin.
  10231. !#zh
  10232. 获取刚体本地坐标系下原点的旋转惯性
  10233. */
  10234. getInertia(): number;
  10235. /**
  10236. !#en
  10237. Get all the joints connect to the rigidbody.
  10238. !#zh
  10239. 获取链接到此刚体的所有关节
  10240. */
  10241. getJointList(): Joint[];
  10242. /**
  10243. !#en
  10244. Apply a force at a world point. If the force is not
  10245. applied at the center of mass, it will generate a torque and
  10246. affect the angular velocity.
  10247. !#zh
  10248. 施加一个力到刚体上的一个点。如果力没有施加到刚体的质心上,还会产生一个扭矩并且影响到角速度。
  10249. @param force the world force vector.
  10250. @param point the world position.
  10251. @param wake also wake up the body.
  10252. */
  10253. applyForce(force: Vec2, point: Vec2, wake: boolean): void;
  10254. /**
  10255. !#en
  10256. Apply a force to the center of mass.
  10257. !#zh
  10258. 施加一个力到刚体上的质心上。
  10259. @param force the world force vector.
  10260. @param wake also wake up the body.
  10261. */
  10262. applyForceToCenter(force: Vec2, wake: boolean): void;
  10263. /**
  10264. !#en
  10265. Apply a torque. This affects the angular velocity.
  10266. !#zh
  10267. 施加一个扭矩力,将影响刚体的角速度
  10268. @param torque about the z-axis (out of the screen), usually in N-m.
  10269. @param wake also wake up the body
  10270. */
  10271. applyTorque(torque: number, wake: boolean): void;
  10272. /**
  10273. !#en
  10274. Apply a impulse at a world point, This immediately modifies the velocity.
  10275. If the impulse is not applied at the center of mass, it will generate a torque and
  10276. affect the angular velocity.
  10277. !#zh
  10278. 施加冲量到刚体上的一个点,将立即改变刚体的线性速度。
  10279. 如果冲量施加到的点不是刚体的质心,那么将产生一个扭矩并影响刚体的角速度。
  10280. @param impulse the world impulse vector, usually in N-seconds or kg-m/s.
  10281. @param point the world position
  10282. @param wake alse wake up the body
  10283. */
  10284. applyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): void;
  10285. /**
  10286. !#en
  10287. Apply an angular impulse.
  10288. !#zh
  10289. 施加一个角速度冲量。
  10290. @param impulse the angular impulse in units of kg*m*m/s
  10291. @param wake also wake up the body
  10292. */
  10293. applyAngularImpulse(impulse: number, wake: boolean): void;
  10294. /**
  10295. !#en
  10296. Synchronize node's world position to box2d rigidbody's position.
  10297. If enableAnimated is true and rigidbody's type is Animated type,
  10298. will set linear velocity instead of directly set rigidbody's position.
  10299. !#zh
  10300. 同步节点的世界坐标到 box2d 刚体的坐标上。
  10301. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的线性速度来代替直接设置刚体的位置。
  10302. @param enableAnimated enableAnimated
  10303. */
  10304. syncPosition(enableAnimated: boolean): void;
  10305. /**
  10306. !#en
  10307. Synchronize node's world angle to box2d rigidbody's angle.
  10308. If enableAnimated is true and rigidbody's type is Animated type,
  10309. will set angular velocity instead of directly set rigidbody's angle.
  10310. !#zh
  10311. 同步节点的世界旋转角度值到 box2d 刚体的旋转值上。
  10312. 如果 enableAnimated 是 true,并且刚体的类型是 Animated ,那么将设置刚体的角速度来代替直接设置刚体的角度。
  10313. @param enableAnimated enableAnimated
  10314. */
  10315. syncRotation(enableAnimated: boolean): void;
  10316. }
  10317. /** !#en the device accelerometer reports values for each axis in units of g-force.
  10318. !#zh 设备重力传感器传递的各个轴的数据。 */
  10319. export class constructor {
  10320. /**
  10321. whether enable accelerometer event
  10322. @param isEnable isEnable
  10323. */
  10324. setAccelerometerEnabled(isEnable: boolean): void;
  10325. /**
  10326. set accelerometer interval value
  10327. @param interval interval
  10328. */
  10329. setAccelerometerInterval(interval: number): void;
  10330. }
  10331. /** undefined */
  10332. export enum VerticalTextAlignment {
  10333. TOP = 0,
  10334. CENTER = 0,
  10335. BOTTOM = 0,
  10336. }
  10337. /** The base class of most of all the objects in Fireball. */
  10338. export class Object {
  10339. /** !#en The name of the object.
  10340. !#zh 该对象的名称。 */
  10341. name: string;
  10342. /** !#en
  10343. Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)<br>
  10344. When an object's `destroy` is called, it is actually destroyed after the end of this frame.
  10345. So `isValid` will return false from the next frame, while `isValid` in the current frame will still be true.
  10346. If you want to determine whether the current frame has called `destroy`, use `cc.isValid(obj, true)`,
  10347. but this is often caused by a particular logical requirements, which is not normally required.
  10348. !#zh
  10349. 表示该对象是否可用(被 destroy 后将不可用)。<br>
  10350. 当一个对象的 `destroy` 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 `isValid` 就会返回 false,而当前帧内 `isValid` 仍然会是 true。如果希望判断当前帧是否调用过 `destroy`,请使用 `cc.isValid(obj, true)`,不过这往往是特殊的业务需求引起的,通常情况下不需要这样。 */
  10351. isValid: boolean;
  10352. /**
  10353. !#en
  10354. Destroy this Object, and release all its own references to other objects.<br/>
  10355. Actual object destruction will delayed until before rendering.
  10356. From the next frame, this object is not usable anymore.
  10357. You can use `cc.isValid(obj)` to check whether the object is destroyed before accessing it.
  10358. !#zh
  10359. 销毁该对象,并释放所有它对其它对象的引用。<br/>
  10360. 实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
  10361. 您可以在访问对象之前使用 `cc.isValid(obj)` 来检查对象是否已被销毁。
  10362. @example
  10363. ```js
  10364. obj.destroy();
  10365. ```
  10366. */
  10367. destroy(): boolean;
  10368. }
  10369. /** Bit mask that controls object states. */
  10370. export enum Flags {
  10371. DontSave = 0,
  10372. EditorOnly = 0,
  10373. HideInHierarchy = 0,
  10374. }
  10375. /** The fullscreen API provides an easy way for web content to be presented using the user's entire screen.
  10376. It's invalid on safari, QQbrowser and android browser */
  10377. export class screen {
  10378. /**
  10379. initialize
  10380. */
  10381. init(): void;
  10382. /**
  10383. return true if it's full now.
  10384. */
  10385. fullScreen(): boolean;
  10386. /**
  10387. change the screen to full mode.
  10388. @param element element
  10389. @param onFullScreenChange onFullScreenChange
  10390. @param onFullScreenError onFullScreenError
  10391. */
  10392. requestFullScreen(element: Element, onFullScreenChange: Function, onFullScreenError: Function): void;
  10393. /**
  10394. exit the full mode.
  10395. */
  10396. exitFullScreen(): boolean;
  10397. /**
  10398. Automatically request full screen with a touch/click event
  10399. @param element element
  10400. @param onFullScreenChange onFullScreenChange
  10401. */
  10402. autoFullScreen(element: Element, onFullScreenChange: Function): void;
  10403. }
  10404. /** System variables */
  10405. export class sys {
  10406. /** English language code */
  10407. static LANGUAGE_ENGLISH: string;
  10408. /** Chinese language code */
  10409. static LANGUAGE_CHINESE: string;
  10410. /** French language code */
  10411. static LANGUAGE_FRENCH: string;
  10412. /** Italian language code */
  10413. static LANGUAGE_ITALIAN: string;
  10414. /** German language code */
  10415. static LANGUAGE_GERMAN: string;
  10416. /** Spanish language code */
  10417. static LANGUAGE_SPANISH: string;
  10418. /** Spanish language code */
  10419. static LANGUAGE_DUTCH: string;
  10420. /** Russian language code */
  10421. static LANGUAGE_RUSSIAN: string;
  10422. /** Korean language code */
  10423. static LANGUAGE_KOREAN: string;
  10424. /** Japanese language code */
  10425. static LANGUAGE_JAPANESE: string;
  10426. /** Hungarian language code */
  10427. static LANGUAGE_HUNGARIAN: string;
  10428. /** Portuguese language code */
  10429. static LANGUAGE_PORTUGUESE: string;
  10430. /** Arabic language code */
  10431. static LANGUAGE_ARABIC: string;
  10432. /** Norwegian language code */
  10433. static LANGUAGE_NORWEGIAN: string;
  10434. /** Polish language code */
  10435. static LANGUAGE_POLISH: string;
  10436. /** Turkish language code */
  10437. static LANGUAGE_TURKISH: string;
  10438. /** Ukrainian language code */
  10439. static LANGUAGE_UKRAINIAN: string;
  10440. /** Romanian language code */
  10441. static LANGUAGE_ROMANIAN: string;
  10442. /** Bulgarian language code */
  10443. static LANGUAGE_BULGARIAN: string;
  10444. /** Unknown language code */
  10445. static LANGUAGE_UNKNOWN: string;
  10446. static OS_IOS: string;
  10447. static OS_ANDROID: string;
  10448. static OS_WINDOWS: string;
  10449. static OS_MARMALADE: string;
  10450. static OS_LINUX: string;
  10451. static OS_BADA: string;
  10452. static OS_BLACKBERRY: string;
  10453. static OS_OSX: string;
  10454. static OS_WP8: string;
  10455. static OS_WINRT: string;
  10456. static OS_UNKNOWN: string;
  10457. static UNKNOWN: number;
  10458. static WIN32: number;
  10459. static LINUX: number;
  10460. static MACOS: number;
  10461. static ANDROID: number;
  10462. static IPHONE: number;
  10463. static IPAD: number;
  10464. static BLACKBERRY: number;
  10465. static NACL: number;
  10466. static EMSCRIPTEN: number;
  10467. static TIZEN: number;
  10468. static WINRT: number;
  10469. static WP8: number;
  10470. static MOBILE_BROWSER: number;
  10471. static DESKTOP_BROWSER: number;
  10472. /** Indicates whether executes in editor's window process (Electron's renderer context) */
  10473. static EDITOR_PAGE: number;
  10474. /** Indicates whether executes in editor's main process (Electron's browser context) */
  10475. static EDITOR_CORE: number;
  10476. static WECHAT_GAME: number;
  10477. static QQ_PLAY: number;
  10478. static FB_PLAYABLE_ADS: number;
  10479. static BAIDU_GAME: number;
  10480. static VIVO_GAME: number;
  10481. static OPPO_GAME: number;
  10482. static HUAWEI_GAME: number;
  10483. static XIAOMI_GAME: number;
  10484. static JKW_GAME: number;
  10485. static ALIPAY_GAME: number;
  10486. static WECHAT_GAME_SUB: number;
  10487. static BAIDU_GAME_SUB: number;
  10488. static QTT_GAME: number;
  10489. static BYTEDANCE_GAME: number;
  10490. static BYTEDANCE_GAME_SUB: number;
  10491. static LINKSURE: number;
  10492. /** BROWSER_TYPE_WECHAT */
  10493. static BROWSER_TYPE_WECHAT: string;
  10494. static BROWSER_TYPE_ANDROID: string;
  10495. static BROWSER_TYPE_IE: string;
  10496. static BROWSER_TYPE_EDGE: string;
  10497. static BROWSER_TYPE_QQ: string;
  10498. static BROWSER_TYPE_MOBILE_QQ: string;
  10499. static BROWSER_TYPE_UC: string;
  10500. /** uc third party integration. */
  10501. static BROWSER_TYPE_UCBS: string;
  10502. static BROWSER_TYPE_360: string;
  10503. static BROWSER_TYPE_BAIDU_APP: string;
  10504. static BROWSER_TYPE_BAIDU: string;
  10505. static BROWSER_TYPE_MAXTHON: string;
  10506. static BROWSER_TYPE_OPERA: string;
  10507. static BROWSER_TYPE_OUPENG: string;
  10508. static BROWSER_TYPE_MIUI: string;
  10509. static BROWSER_TYPE_FIREFOX: string;
  10510. static BROWSER_TYPE_SAFARI: string;
  10511. static BROWSER_TYPE_CHROME: string;
  10512. static BROWSER_TYPE_LIEBAO: string;
  10513. static BROWSER_TYPE_QZONE: string;
  10514. static BROWSER_TYPE_SOUGOU: string;
  10515. static BROWSER_TYPE_HUAWEI: string;
  10516. static BROWSER_TYPE_UNKNOWN: string;
  10517. /** Is native ? This is set to be true in jsb auto. */
  10518. static isNative: boolean;
  10519. /** Is web browser ? */
  10520. static isBrowser: boolean;
  10521. /**
  10522. Is webgl extension support?
  10523. @param name name
  10524. */
  10525. static glExtension(name: any): boolean;
  10526. /**
  10527. Get max joint matrix size for skinned mesh renderer.
  10528. */
  10529. static getMaxJointMatrixSize(): void;
  10530. /**
  10531. !#en
  10532. Returns the safe area of the screen (in design resolution). If the screen is not notched, the visibleRect will be returned by default.
  10533. Currently supports Android, iOS and WeChat Mini Game platform.
  10534. !#zh
  10535. 返回手机屏幕安全区域(设计分辨率为单位),如果不是异形屏将默认返回 visibleRect。目前支持安卓、iOS 原生平台和微信小游戏平台。
  10536. */
  10537. static getSafeAreaRect(): Rect;
  10538. /** Indicate whether system is mobile system */
  10539. static isMobile: boolean;
  10540. /** Indicate the running platform */
  10541. static platform: number;
  10542. /** Get current language iso 639-1 code.
  10543. Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc.
  10544. The actual value totally depends on results provided by destination platform. */
  10545. static languageCode: string;
  10546. /** Indicate the current language of the running system */
  10547. static language: string;
  10548. /** Indicate the running os name */
  10549. static os: string;
  10550. /** Indicate the running os version */
  10551. static osVersion: string;
  10552. /** Indicate the running os main version */
  10553. static osMainVersion: number;
  10554. /** Indicate the running browser type */
  10555. static browserType: string|void;
  10556. /** Indicate the running browser version */
  10557. static browserVersion: string|void;
  10558. /** Indicate the real pixel resolution of the whole game window */
  10559. static windowPixelResolution: Size;
  10560. /** cc.sys.localStorage is a local storage component. */
  10561. static localStorage: any;
  10562. /** The capabilities of the current platform */
  10563. static capabilities: any;
  10564. /**
  10565. !#en
  10566. Get the network type of current device, return cc.sys.NetworkType.LAN if failure.
  10567. !#zh
  10568. 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
  10569. */
  10570. static getNetworkType(): sys.NetworkType;
  10571. /**
  10572. !#en
  10573. Get the battery level of current device, return 1.0 if failure.
  10574. !#zh
  10575. 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
  10576. */
  10577. static getBatteryLevel(): number;
  10578. /**
  10579. Forces the garbage collection, only available in JSB
  10580. */
  10581. static garbageCollect(): void;
  10582. /**
  10583. Restart the JS VM, only available in JSB
  10584. */
  10585. static restartVM(): void;
  10586. /**
  10587. Check whether an object is valid,
  10588. In web engine, it will return true if the object exist
  10589. In native engine, it will return true if the JS object and the correspond native object are both valid
  10590. @param obj obj
  10591. */
  10592. static isObjectValid(obj: any): boolean;
  10593. /**
  10594. Dump system informations
  10595. */
  10596. static dump(): void;
  10597. /**
  10598. Open a url in browser
  10599. @param url url
  10600. */
  10601. static openURL(url: string): void;
  10602. /**
  10603. Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
  10604. */
  10605. static now(): number;
  10606. }
  10607. /** cc.view is the singleton object which represents the game window.<br/>
  10608. It's main task include: <br/>
  10609. - Apply the design resolution policy<br/>
  10610. - Provide interaction with the window, like resize event on web, retina display support, etc...<br/>
  10611. - Manage the game view port which can be different with the window<br/>
  10612. - Manage the content scale and translation<br/>
  10613. <br/>
  10614. Since the cc.view is a singleton, you don't need to call any constructor or create functions,<br/>
  10615. the standard way to use it is by calling:<br/>
  10616. - cc.view.methodName(); <br/> */
  10617. export class View extends EventTarget {
  10618. /**
  10619. !#en
  10620. Sets view's target-densitydpi for android mobile browser. it can be set to: <br/>
  10621. 1. cc.macro.DENSITYDPI_DEVICE, value is "device-dpi" <br/>
  10622. 2. cc.macro.DENSITYDPI_HIGH, value is "high-dpi" (default value) <br/>
  10623. 3. cc.macro.DENSITYDPI_MEDIUM, value is "medium-dpi" (browser's default value) <br/>
  10624. 4. cc.macro.DENSITYDPI_LOW, value is "low-dpi" <br/>
  10625. 5. Custom value, e.g: "480" <br/>
  10626. !#zh 设置目标内容的每英寸像素点密度。
  10627. @param densityDPI densityDPI
  10628. */
  10629. setTargetDensityDPI(densityDPI: string): void;
  10630. /**
  10631. !#en
  10632. Returns the current target-densitydpi value of cc.view.
  10633. !#zh 获取目标内容的每英寸像素点密度。
  10634. */
  10635. getTargetDensityDPI(): string;
  10636. /**
  10637. !#en
  10638. Sets whether resize canvas automatically when browser's size changed.<br/>
  10639. Useful only on web.
  10640. !#zh 设置当发现浏览器的尺寸改变时,是否自动调整 canvas 尺寸大小。
  10641. 仅在 Web 模式下有效。
  10642. @param enabled Whether enable automatic resize with browser's resize event
  10643. */
  10644. resizeWithBrowserSize(enabled: boolean): void;
  10645. /**
  10646. !#en
  10647. Sets the callback function for cc.view's resize action,<br/>
  10648. this callback will be invoked before applying resolution policy, <br/>
  10649. so you can do any additional modifications within the callback.<br/>
  10650. Useful only on web.
  10651. !#zh 设置 cc.view 调整视窗尺寸行为的回调函数,
  10652. 这个回调函数会在应用适配模式之前被调用,
  10653. 因此你可以在这个回调函数内添加任意附加改变,
  10654. 仅在 Web 平台下有效。
  10655. @param callback The callback function
  10656. */
  10657. setResizeCallback(callback: Function|void): void;
  10658. /**
  10659. !#en
  10660. Sets the orientation of the game, it can be landscape, portrait or auto.
  10661. When set it to landscape or portrait, and screen w/h ratio doesn't fit,
  10662. cc.view will automatically rotate the game canvas using CSS.
  10663. Note that this function doesn't have any effect in native,
  10664. in native, you need to set the application orientation in native project settings
  10665. !#zh 设置游戏屏幕朝向,它能够是横版,竖版或自动。
  10666. 当设置为横版或竖版,并且屏幕的宽高比例不匹配时,
  10667. cc.view 会自动用 CSS 旋转游戏场景的 canvas,
  10668. 这个方法不会对 native 部分产生任何影响,对于 native 而言,你需要在应用设置中的设置排版。
  10669. @param orientation Possible values: cc.macro.ORIENTATION_LANDSCAPE | cc.macro.ORIENTATION_PORTRAIT | cc.macro.ORIENTATION_AUTO
  10670. */
  10671. setOrientation(orientation: number): void;
  10672. /**
  10673. !#en
  10674. Sets whether the engine modify the "viewport" meta in your web page.<br/>
  10675. It's enabled by default, we strongly suggest you not to disable it.<br/>
  10676. And even when it's enabled, you can still set your own "viewport" meta, it won't be overridden<br/>
  10677. Only useful on web
  10678. !#zh 设置引擎是否调整 viewport meta 来配合屏幕适配。
  10679. 默认设置为启动,我们强烈建议你不要将它设置为关闭。
  10680. 即使当它启动时,你仍然能够设置你的 viewport meta,它不会被覆盖。
  10681. 仅在 Web 模式下有效
  10682. @param enabled Enable automatic modification to "viewport" meta
  10683. */
  10684. adjustViewportMeta(enabled: boolean): void;
  10685. /**
  10686. !#en
  10687. Retina support is enabled by default for Apple device but disabled for other devices,<br/>
  10688. it takes effect only when you called setDesignResolutionPolicy<br/>
  10689. Only useful on web
  10690. !#zh 对于 Apple 这种支持 Retina 显示的设备上默认进行优化而其他类型设备默认不进行优化,
  10691. 它仅会在你调用 setDesignResolutionPolicy 方法时有影响。
  10692. 仅在 Web 模式下有效。
  10693. @param enabled Enable or disable retina display
  10694. */
  10695. enableRetina(enabled: boolean): void;
  10696. /**
  10697. !#en
  10698. Check whether retina display is enabled.<br/>
  10699. Only useful on web
  10700. !#zh 检查是否对 Retina 显示设备进行优化。
  10701. 仅在 Web 模式下有效。
  10702. */
  10703. isRetinaEnabled(): boolean;
  10704. /**
  10705. !#en Whether to Enable on anti-alias
  10706. !#zh 控制抗锯齿是否开启
  10707. @param enabled Enable or not anti-alias
  10708. */
  10709. enableAntiAlias(enabled: boolean): void;
  10710. /**
  10711. !#en Returns whether the current enable on anti-alias
  10712. !#zh 返回当前是否抗锯齿
  10713. */
  10714. isAntiAliasEnabled(): boolean;
  10715. /**
  10716. !#en
  10717. If enabled, the application will try automatically to enter full screen mode on mobile devices<br/>
  10718. You can pass true as parameter to enable it and disable it by passing false.<br/>
  10719. Only useful on web
  10720. !#zh 启动时,移动端游戏会在移动端自动尝试进入全屏模式。
  10721. 你能够传入 true 为参数去启动它,用 false 参数来关闭它。
  10722. @param enabled Enable or disable auto full screen on mobile devices
  10723. */
  10724. enableAutoFullScreen(enabled: boolean): void;
  10725. /**
  10726. !#en
  10727. Check whether auto full screen is enabled.<br/>
  10728. Only useful on web
  10729. !#zh 检查自动进入全屏模式是否启动。
  10730. 仅在 Web 模式下有效。
  10731. */
  10732. isAutoFullScreenEnabled(): boolean;
  10733. /**
  10734. !#en
  10735. Returns the canvas size of the view.<br/>
  10736. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  10737. On web, it returns the size of the canvas element.
  10738. !#zh 返回视图中 canvas 的尺寸。
  10739. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  10740. 在 Web 平台下,它返回 canvas 元素尺寸。
  10741. */
  10742. getCanvasSize(): Size;
  10743. /**
  10744. !#en
  10745. Returns the frame size of the view.<br/>
  10746. On native platforms, it returns the screen size since the view is a fullscreen view.<br/>
  10747. On web, it returns the size of the canvas's outer DOM element.
  10748. !#zh 返回视图中边框尺寸。
  10749. 在 native 平台下,它返回全屏视图下屏幕的尺寸。
  10750. 在 web 平台下,它返回 canvas 元素的外层 DOM 元素尺寸。
  10751. */
  10752. getFrameSize(): Size;
  10753. /**
  10754. !#en
  10755. On native, it sets the frame size of view.<br/>
  10756. On web, it sets the size of the canvas's outer DOM element.
  10757. !#zh 在 native 平台下,设置视图框架尺寸。
  10758. 在 web 平台下,设置 canvas 外层 DOM 元素尺寸。
  10759. @param width width
  10760. @param height height
  10761. */
  10762. setFrameSize(width: number, height: number): void;
  10763. /**
  10764. !#en
  10765. Returns the visible area size of the view port.
  10766. !#zh 返回视图窗口可见区域尺寸。
  10767. */
  10768. getVisibleSize(): Size;
  10769. /**
  10770. !#en
  10771. Returns the visible area size of the view port.
  10772. !#zh 返回视图窗口可见区域像素尺寸。
  10773. */
  10774. getVisibleSizeInPixel(): Size;
  10775. /**
  10776. !#en
  10777. Returns the visible origin of the view port.
  10778. !#zh 返回视图窗口可见区域原点。
  10779. */
  10780. getVisibleOrigin(): Vec2;
  10781. /**
  10782. !#en
  10783. Returns the visible origin of the view port.
  10784. !#zh 返回视图窗口可见区域像素原点。
  10785. */
  10786. getVisibleOriginInPixel(): Vec2;
  10787. /**
  10788. !#en
  10789. Returns the current resolution policy
  10790. !#zh 返回当前分辨率方案
  10791. */
  10792. getResolutionPolicy(): ResolutionPolicy;
  10793. /**
  10794. !#en
  10795. Sets the current resolution policy
  10796. !#zh 设置当前分辨率模式
  10797. @param resolutionPolicy resolutionPolicy
  10798. */
  10799. setResolutionPolicy(resolutionPolicy: ResolutionPolicy|number): void;
  10800. /**
  10801. !#en
  10802. Sets the resolution policy with designed view size in points.<br/>
  10803. The resolution policy include: <br/>
  10804. [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/>
  10805. [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/>
  10806. [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/>
  10807. [4] ResolutionFixedHeight Scale the content's height to screen's height and proportionally scale its width<br/>
  10808. [5] ResolutionFixedWidth Scale the content's width to screen's width and proportionally scale its height<br/>
  10809. [cc.ResolutionPolicy] [Web only feature] Custom resolution policy, constructed by cc.ResolutionPolicy<br/>
  10810. !#zh 通过设置设计分辨率和匹配模式来进行游戏画面的屏幕适配。
  10811. @param width Design resolution width.
  10812. @param height Design resolution height.
  10813. @param resolutionPolicy The resolution policy desired
  10814. */
  10815. setDesignResolutionSize(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  10816. /**
  10817. !#en
  10818. Returns the designed size for the view.
  10819. Default resolution size is the same as 'getFrameSize'.
  10820. !#zh 返回视图的设计分辨率。
  10821. 默认下分辨率尺寸同 `getFrameSize` 方法相同
  10822. */
  10823. getDesignResolutionSize(): Size;
  10824. /**
  10825. !#en
  10826. Sets the container to desired pixel resolution and fit the game content to it.
  10827. This function is very useful for adaptation in mobile browsers.
  10828. In some HD android devices, the resolution is very high, but its browser performance may not be very good.
  10829. In this case, enabling retina display is very costy and not suggested, and if retina is disabled, the image may be blurry.
  10830. But this API can be helpful to set a desired pixel resolution which is in between.
  10831. This API will do the following:
  10832. 1. Set viewport's width to the desired width in pixel
  10833. 2. Set body width to the exact pixel resolution
  10834. 3. The resolution policy will be reset with designed view size in points.
  10835. !#zh 设置容器(container)需要的像素分辨率并且适配相应分辨率的游戏内容。
  10836. @param width Design resolution width.
  10837. @param height Design resolution height.
  10838. @param resolutionPolicy The resolution policy desired
  10839. */
  10840. setRealPixelResolution(width: number, height: number, resolutionPolicy: ResolutionPolicy|number): void;
  10841. /**
  10842. !#en
  10843. Sets view port rectangle with points.
  10844. !#zh 用设计分辨率下的点尺寸来设置视窗。
  10845. @param x x
  10846. @param y y
  10847. @param w width
  10848. @param h height
  10849. */
  10850. setViewportInPoints(x: number, y: number, w: number, h: number): void;
  10851. /**
  10852. !#en
  10853. Sets Scissor rectangle with points.
  10854. !#zh 用设计分辨率下的点的尺寸来设置 scissor 剪裁区域。
  10855. @param x x
  10856. @param y y
  10857. @param w w
  10858. @param h h
  10859. */
  10860. setScissorInPoints(x: number, y: number, w: number, h: number): void;
  10861. /**
  10862. !#en
  10863. Returns whether GL_SCISSOR_TEST is enable
  10864. !#zh 检查 scissor 是否生效。
  10865. */
  10866. isScissorEnabled(): boolean;
  10867. /**
  10868. !#en
  10869. Returns the current scissor rectangle
  10870. !#zh 返回当前的 scissor 剪裁区域。
  10871. */
  10872. getScissorRect(): Rect;
  10873. /**
  10874. !#en
  10875. Returns the view port rectangle.
  10876. !#zh 返回视窗剪裁区域。
  10877. */
  10878. getViewportRect(): Rect;
  10879. /**
  10880. !#en
  10881. Returns scale factor of the horizontal direction (X axis).
  10882. !#zh 返回横轴的缩放比,这个缩放比是将画布像素分辨率放到设计分辨率的比例。
  10883. */
  10884. getScaleX(): number;
  10885. /**
  10886. !#en
  10887. Returns scale factor of the vertical direction (Y axis).
  10888. !#zh 返回纵轴的缩放比,这个缩放比是将画布像素分辨率缩放到设计分辨率的比例。
  10889. */
  10890. getScaleY(): number;
  10891. /**
  10892. !#en
  10893. Returns device pixel ratio for retina display.
  10894. !#zh 返回设备或浏览器像素比例。
  10895. */
  10896. getDevicePixelRatio(): number;
  10897. /**
  10898. !#en
  10899. Returns the real location in view for a translation based on a related position
  10900. !#zh 将屏幕坐标转换为游戏视图下的坐标。
  10901. @param tx The X axis translation
  10902. @param ty The Y axis translation
  10903. @param relatedPos The related position object including "left", "top", "width", "height" informations
  10904. */
  10905. convertToLocationInView(tx: number, ty: number, relatedPos: any): Vec2;
  10906. }
  10907. /** <p>cc.game.containerStrategy class is the root strategy class of container's scale strategy,
  10908. it controls the behavior of how to scale the cc.game.container and cc.game.canvas object</p> */
  10909. export class ContainerStrategy {
  10910. /**
  10911. !#en
  10912. Manipulation before appling the strategy
  10913. !#zh 在应用策略之前的操作
  10914. @param view The target view
  10915. */
  10916. preApply(view: View): void;
  10917. /**
  10918. !#en
  10919. Function to apply this strategy
  10920. !#zh 策略应用方法
  10921. @param view view
  10922. @param designedResolution designedResolution
  10923. */
  10924. apply(view: View, designedResolution: Size): void;
  10925. /**
  10926. !#en
  10927. Manipulation after applying the strategy
  10928. !#zh 策略调用之后的操作
  10929. @param view The target view
  10930. */
  10931. postApply(view: View): void;
  10932. }
  10933. /** <p>cc.ContentStrategy class is the root strategy class of content's scale strategy,
  10934. it controls the behavior of how to scale the scene and setup the viewport for the game</p> */
  10935. export class ContentStrategy {
  10936. /**
  10937. !#en
  10938. Manipulation before applying the strategy
  10939. !#zh 策略应用前的操作
  10940. @param view The target view
  10941. */
  10942. preApply(view: View): void;
  10943. /**
  10944. !#en Function to apply this strategy
  10945. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10946. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10947. !#zh 调用策略方法
  10948. @param view view
  10949. @param designedResolution designedResolution
  10950. */
  10951. apply(view: View, designedResolution: Size): any;
  10952. /**
  10953. !#en
  10954. Manipulation after applying the strategy
  10955. !#zh 策略调用之后的操作
  10956. @param view The target view
  10957. */
  10958. postApply(view: View): void;
  10959. }
  10960. /** undefined */
  10961. export class EqualToFrame extends ContainerStrategy {
  10962. }
  10963. /** undefined */
  10964. export class ProportionalToFrame extends ContainerStrategy {
  10965. }
  10966. /** undefined */
  10967. export class EqualToWindow extends EqualToFrame {
  10968. }
  10969. /** undefined */
  10970. export class ProportionalToWindow extends ProportionalToFrame {
  10971. }
  10972. /** undefined */
  10973. export class OriginalContainer extends ContainerStrategy {
  10974. }
  10975. /** <p>cc.ResolutionPolicy class is the root strategy class of scale strategy,
  10976. its main task is to maintain the compatibility with Cocos2d-x</p> */
  10977. export class ResolutionPolicy {
  10978. /**
  10979. @param containerStg The container strategy
  10980. @param contentStg The content strategy
  10981. */
  10982. constructor(containerStg: ContainerStrategy, contentStg: ContentStrategy);
  10983. /**
  10984. !#en Manipulation before applying the resolution policy
  10985. !#zh 策略应用前的操作
  10986. @param view The target view
  10987. */
  10988. preApply(view: View): void;
  10989. /**
  10990. !#en Function to apply this resolution policy
  10991. The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}},
  10992. The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  10993. !#zh 调用策略方法
  10994. @param view The target view
  10995. @param designedResolution The user defined design resolution
  10996. */
  10997. apply(view: View, designedResolution: Size): any;
  10998. /**
  10999. !#en Manipulation after appyling the strategy
  11000. !#zh 策略应用之后的操作
  11001. @param view The target view
  11002. */
  11003. postApply(view: View): void;
  11004. /**
  11005. !#en
  11006. Setup the container's scale strategy
  11007. !#zh 设置容器的适配策略
  11008. @param containerStg containerStg
  11009. */
  11010. setContainerStrategy(containerStg: ContainerStrategy): void;
  11011. /**
  11012. !#en
  11013. Setup the content's scale strategy
  11014. !#zh 设置内容的适配策略
  11015. @param contentStg contentStg
  11016. */
  11017. setContentStrategy(contentStg: ContentStrategy): void;
  11018. /** The entire application is visible in the specified area without trying to preserve the original aspect ratio.<br/>
  11019. Distortion can occur, and the application may appear stretched or compressed. */
  11020. static EXACT_FIT: number;
  11021. /** The entire application fills the specified area, without distortion but possibly with some cropping,<br/>
  11022. while maintaining the original aspect ratio of the application. */
  11023. static NO_BORDER: number;
  11024. /** The entire application is visible in the specified area without distortion while maintaining the original<br/>
  11025. aspect ratio of the application. Borders can appear on two sides of the application. */
  11026. static SHOW_ALL: number;
  11027. /** The application takes the height of the design resolution size and modifies the width of the internal<br/>
  11028. canvas so that it fits the aspect ratio of the device<br/>
  11029. no distortion will occur however you must make sure your application works on different<br/>
  11030. aspect ratios */
  11031. static FIXED_HEIGHT: number;
  11032. /** The application takes the width of the design resolution size and modifies the height of the internal<br/>
  11033. canvas so that it fits the aspect ratio of the device<br/>
  11034. no distortion will occur however you must make sure your application works on different<br/>
  11035. aspect ratios */
  11036. static FIXED_WIDTH: number;
  11037. /** Unknow policy */
  11038. static UNKNOWN: number;
  11039. }
  11040. /** cc.visibleRect is a singleton object which defines the actual visible rect of the current view,
  11041. it should represent the same rect as cc.view.getViewportRect() */
  11042. export class visibleRect {
  11043. /**
  11044. initialize
  11045. @param visibleRect visibleRect
  11046. */
  11047. static init(visibleRect: Rect): void;
  11048. /** Top left coordinate of the screen related to the game scene. */
  11049. static topLeft: Vec2;
  11050. /** Top right coordinate of the screen related to the game scene. */
  11051. static topRight: Vec2;
  11052. /** Top center coordinate of the screen related to the game scene. */
  11053. static top: Vec2;
  11054. /** Bottom left coordinate of the screen related to the game scene. */
  11055. static bottomLeft: Vec2;
  11056. /** Bottom right coordinate of the screen related to the game scene. */
  11057. static bottomRight: Vec2;
  11058. /** Bottom center coordinate of the screen related to the game scene. */
  11059. static bottom: Vec2;
  11060. /** Center coordinate of the screen related to the game scene. */
  11061. static center: Vec2;
  11062. /** Left center coordinate of the screen related to the game scene. */
  11063. static left: Vec2;
  11064. /** Right center coordinate of the screen related to the game scene. */
  11065. static right: Vec2;
  11066. /** Width of the screen. */
  11067. static width: number;
  11068. /** Height of the screen. */
  11069. static height: number;
  11070. }
  11071. /** !#en The callbacks invoker to handle and invoke callbacks by key.
  11072. !#zh CallbacksInvoker 用来根据 Key 管理并调用回调方法。 */
  11073. export class CallbacksInvoker {
  11074. /**
  11075. !#zh
  11076. 检查指定事件是否已注册回调。
  11077. !#en
  11078. Check if the specified key has any registered callback. If a callback is also specified,
  11079. it will only return true if the callback is registered.
  11080. @param key key
  11081. @param callback callback
  11082. @param target target
  11083. */
  11084. hasEventListener(key: string, callback?: Function, target?: any): boolean;
  11085. /**
  11086. !#zh
  11087. 移除在特定事件类型中注册的所有回调或在某个目标中注册的所有回调。
  11088. !#en
  11089. Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  11090. @param keyOrTarget The event key to be removed or the target to be removed
  11091. */
  11092. removeAll(keyOrTarget: string|any): void;
  11093. /**
  11094. !#zh
  11095. 删除之前与同类型,回调,目标注册的回调。
  11096. @param key key
  11097. @param callback callback
  11098. @param target target
  11099. */
  11100. off(key: string, callback: Function, target?: any): void;
  11101. /**
  11102. !#en
  11103. Trigger an event directly with the event name and necessary arguments.
  11104. !#zh
  11105. 通过事件名发送自定义事件
  11106. @param key event type
  11107. @param arg1 First argument
  11108. @param arg2 Second argument
  11109. @param arg3 Third argument
  11110. @param arg4 Fourth argument
  11111. @param arg5 Fifth argument
  11112. @example
  11113. ```js
  11114. eventTarget.emit('fire', event);
  11115. eventTarget.emit('fire', message, emitter);
  11116. ```
  11117. */
  11118. emit(key: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): void;
  11119. }
  11120. /** !#en Contains information collected during deserialization
  11121. !#zh 包含反序列化时的一些信息 */
  11122. export class Details {
  11123. /** the obj list whose field needs to load asset by uuid */
  11124. uuidObjList: any[];
  11125. /** the corresponding field name which referenced to the asset */
  11126. uuidPropList: (String|Number)[];
  11127. /** list of the depends assets' uuid */
  11128. uuidList: string[];
  11129. /**
  11130. @param data data
  11131. */
  11132. init(data: any): void;
  11133. reset(): void;
  11134. /**
  11135. @param obj obj
  11136. @param propName propName
  11137. @param uuid uuid
  11138. */
  11139. push(obj: any, propName: string, uuid: string): void;
  11140. /** list of the depends assets' uuid */
  11141. uuidList: string[];
  11142. /** the obj list whose field needs to load asset by uuid */
  11143. uuidObjList: any[];
  11144. /** the corresponding field name which referenced to the asset */
  11145. uuidPropList: string[];
  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. }
  11154. /** !#en
  11155. Representation of RGBA colors.
  11156. Each color component is a floating point value with a range from 0 to 255.
  11157. You can also use the convenience method {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} to create a new Color.
  11158. !#zh
  11159. cc.Color 用于表示颜色。
  11160. 它包含 RGBA 四个以浮点数保存的颜色分量,每个的值都在 0 到 255 之间。
  11161. 您也可以通过使用 {{#crossLink "cc/color:method"}}cc.color{{/crossLink}} 的便捷方法来创建一个新的 Color。 */
  11162. export class Color extends ValueType {
  11163. /** !#en Solid white, RGBA is [255, 255, 255, 255].
  11164. !#zh 纯白色,RGBA 是 [255, 255, 255, 255]。 */
  11165. static WHITE: Color;
  11166. /** !#en Solid black, RGBA is [0, 0, 0, 255].
  11167. !#zh 纯黑色,RGBA 是 [0, 0, 0, 255]。 */
  11168. static BLACK: Color;
  11169. /** !#en Transparent, RGBA is [0, 0, 0, 0].
  11170. !#zh 透明,RGBA 是 [0, 0, 0, 0]。 */
  11171. static TRANSPARENT: Color;
  11172. /** !#en Grey, RGBA is [127.5, 127.5, 127.5].
  11173. !#zh 灰色,RGBA 是 [127.5, 127.5, 127.5]。 */
  11174. static GRAY: Color;
  11175. /** !#en Solid red, RGBA is [255, 0, 0].
  11176. !#zh 纯红色,RGBA 是 [255, 0, 0]。 */
  11177. static RED: Color;
  11178. /** !#en Solid green, RGBA is [0, 255, 0].
  11179. !#zh 纯绿色,RGBA 是 [0, 255, 0]。 */
  11180. static GREEN: Color;
  11181. /** !#en Solid blue, RGBA is [0, 0, 255].
  11182. !#zh 纯蓝色,RGBA 是 [0, 0, 255]。 */
  11183. static BLUE: Color;
  11184. /** !#en Yellow, RGBA is [255, 235, 4].
  11185. !#zh 黄色,RGBA 是 [255, 235, 4]。 */
  11186. static YELLOW: Color;
  11187. /** !#en Orange, RGBA is [255, 127, 0].
  11188. !#zh 橙色,RGBA 是 [255, 127, 0]。 */
  11189. static ORANGE: Color;
  11190. /** !#en Cyan, RGBA is [0, 255, 255].
  11191. !#zh 青色,RGBA 是 [0, 255, 255]。 */
  11192. static CYAN: Color;
  11193. /** !#en Magenta, RGBA is [255, 0, 255].
  11194. !#zh 洋红色(品红色),RGBA 是 [255, 0, 255]。 */
  11195. static MAGENTA: Color;
  11196. /**
  11197. Copy content of a color into another.
  11198. */
  11199. static copy (out: Color, a: Color): Color;
  11200. /**
  11201. Clone a new color.
  11202. */
  11203. static clone (a: Color): Color;
  11204. /**
  11205. Set the components of a color to the given values.
  11206. */
  11207. static set (out: Color, r?: number, g?: number, b?: number, a?: number): Color;
  11208. /**
  11209. Converts the hexadecimal formal color into rgb formal.
  11210. */
  11211. static fromHex (out: Color, hex: number): Color;
  11212. /**
  11213. Converts the hexadecimal formal color into rgb formal.
  11214. */
  11215. static fromHEX (out: Color, hex: string): Color;
  11216. /**
  11217. Add components of two colors, respectively.
  11218. */
  11219. static add (out: Color, a: Color, b: Color): Color;
  11220. /**
  11221. Subtract components of color b from components of color a, respectively.
  11222. */
  11223. static subtract (out: Color, a: Color, b: Color): Color;
  11224. /**
  11225. Multiply components of two colors, respectively.
  11226. */
  11227. static multiply (out: Color, a: Color, b: Color): Color;
  11228. /**
  11229. Divide components of color a by components of color b, respectively.
  11230. */
  11231. static divide (out: Color, a: Color, b: Color): Color;
  11232. /**
  11233. Scales a color by a number.
  11234. */
  11235. static scale (out: Color, a: Color, b: number): Color;
  11236. /**
  11237. Performs a linear interpolation between two colors.
  11238. */
  11239. static lerp (out: Color, a: Color, b: Color, t: number): Color;
  11240. /**
  11241. !#zh 颜色转数组
  11242. !#en Turn an array of colors
  11243. @param ofs 数组起始偏移量
  11244. */
  11245. static toArray <Out extends IWritableArrayLike<number>> (out: Out, a: IColorLike, ofs?: number): Out;
  11246. /**
  11247. !#zh 数组转颜色
  11248. !#en An array of colors turn
  11249. @param ofs 数组起始偏移量
  11250. */
  11251. static fromArray <Out extends IColorLike> (arr: IWritableArrayLike<number>, out: Out, ofs?: number): Out;
  11252. /**
  11253. !#zh 颜色 RGB 预乘 Alpha 通道
  11254. !#en RGB premultiply alpha channel
  11255. @param out 返回颜色
  11256. @param color 预乘处理的目标颜色
  11257. */
  11258. static premultiplyAlpha <Out extends IColorLike> (out: Out, a: IColorLike);
  11259. /**
  11260. @param r red component of the color, default value is 0.
  11261. @param g green component of the color, defualt value is 0.
  11262. @param b blue component of the color, default value is 0.
  11263. @param a alpha component of the color, default value is 255.
  11264. */
  11265. constructor(r?: number, g?: number, b?: number, a?: number);
  11266. /**
  11267. !#en Clone a new color from the current color.
  11268. !#zh 克隆当前颜色。
  11269. @example
  11270. ```js
  11271. var color = new cc.Color();
  11272. var newColor = color.clone();// Color {r: 0, g: 0, b: 0, a: 255}
  11273. ```
  11274. */
  11275. clone(): Color;
  11276. /**
  11277. !#en TODO
  11278. !#zh 判断两个颜色是否相等。
  11279. @param other other
  11280. @example
  11281. ```js
  11282. var color1 = cc.Color.WHITE;
  11283. var color2 = new cc.Color(255, 255, 255);
  11284. cc.log(color1.equals(color2)); // true;
  11285. color2 = cc.Color.RED;
  11286. cc.log(color2.equals(color1)); // false;
  11287. ```
  11288. */
  11289. equals(other: Color): boolean;
  11290. /**
  11291. !#en TODO
  11292. !#zh 线性插值
  11293. @param to to
  11294. @param ratio the interpolation coefficient.
  11295. @param out optional, the receiving vector.
  11296. @example
  11297. ```js
  11298. // Converts a white color to a black one trough time.
  11299. update: function (dt) {
  11300. var color = this.node.color;
  11301. if (color.equals(cc.Color.BLACK)) {
  11302. return;
  11303. }
  11304. this.ratio += dt * 0.1;
  11305. this.node.color = cc.Color.WHITE.lerp(cc.Color.BLACK, ratio);
  11306. }
  11307. ```
  11308. */
  11309. lerp(to: Color, ratio: number, out?: Color): Color;
  11310. /**
  11311. !#en TODO
  11312. !#zh 转换为方便阅读的字符串。
  11313. @example
  11314. ```js
  11315. var color = cc.Color.WHITE;
  11316. color.toString(); // "rgba(255, 255, 255, 255)"
  11317. ```
  11318. */
  11319. toString(): string;
  11320. /** !#en Get or set red channel value
  11321. !#zh 获取或者设置红色通道 */
  11322. r: number;
  11323. /** !#en Get or set green channel value
  11324. !#zh 获取或者设置绿色通道 */
  11325. g: number;
  11326. /** !#en Get or set blue channel value
  11327. !#zh 获取或者设置蓝色通道 */
  11328. b: number;
  11329. /** !#en Get or set alpha channel value
  11330. !#zh 获取或者设置透明通道 */
  11331. a: number;
  11332. /**
  11333. !#en Gets red channel value
  11334. !#zh 获取当前颜色的红色值。
  11335. */
  11336. getR(): number;
  11337. /**
  11338. !#en Sets red value and return the current color object
  11339. !#zh 设置当前的红色值,并返回当前对象。
  11340. @param red the new Red component.
  11341. @example
  11342. ```js
  11343. var color = new cc.Color();
  11344. color.setR(255); // Color {r: 255, g: 0, b: 0, a: 255}
  11345. ```
  11346. */
  11347. setR(red: number): Color;
  11348. /**
  11349. !#en Gets green channel value
  11350. !#zh 获取当前颜色的绿色值。
  11351. */
  11352. getG(): number;
  11353. /**
  11354. !#en Sets green value and return the current color object
  11355. !#zh 设置当前的绿色值,并返回当前对象。
  11356. @param green the new Green component.
  11357. @example
  11358. ```js
  11359. var color = new cc.Color();
  11360. color.setG(255); // Color {r: 0, g: 255, b: 0, a: 255}
  11361. ```
  11362. */
  11363. setG(green: number): Color;
  11364. /**
  11365. !#en Gets blue channel value
  11366. !#zh 获取当前颜色的蓝色值。
  11367. */
  11368. getB(): number;
  11369. /**
  11370. !#en Sets blue value and return the current color object
  11371. !#zh 设置当前的蓝色值,并返回当前对象。
  11372. @param blue the new Blue component.
  11373. @example
  11374. ```js
  11375. var color = new cc.Color();
  11376. color.setB(255); // Color {r: 0, g: 0, b: 255, a: 255}
  11377. ```
  11378. */
  11379. setB(blue: number): Color;
  11380. /**
  11381. !#en Gets alpha channel value
  11382. !#zh 获取当前颜色的透明度值。
  11383. */
  11384. getA(): number;
  11385. /**
  11386. !#en Sets alpha value and return the current color object
  11387. !#zh 设置当前的透明度,并返回当前对象。
  11388. @param alpha the new Alpha component.
  11389. @example
  11390. ```js
  11391. var color = new cc.Color();
  11392. color.setA(0); // Color {r: 0, g: 0, b: 0, a: 0}
  11393. ```
  11394. */
  11395. setA(alpha: number): Color;
  11396. /**
  11397. !#en Convert color to css format.
  11398. !#zh 转换为 CSS 格式。
  11399. @param opt "rgba", "rgb", "#rgb" or "#rrggbb".
  11400. @example
  11401. ```js
  11402. var color = cc.Color.BLACK;
  11403. color.toCSS(); // "rgba(0,0,0,1.00)";
  11404. color.toCSS("rgba"); // "rgba(0,0,0,1.00)";
  11405. color.toCSS("rgb"); // "rgba(0,0,0)";
  11406. color.toCSS("#rgb"); // "#000";
  11407. color.toCSS("#rrggbb"); // "#000000";
  11408. ```
  11409. */
  11410. toCSS(opt?: string): string;
  11411. /**
  11412. !#en Read hex string and store color data into the current color object, the hex string must be formated as rgba or rgb.
  11413. !#zh 读取 16 进制颜色。
  11414. @param hexString hexString
  11415. @example
  11416. ```js
  11417. var color = cc.Color.BLACK;
  11418. color.fromHEX("#FFFF33"); // Color {r: 255, g: 255, b: 51, a: 255};
  11419. ```
  11420. */
  11421. fromHEX(hexString: string): Color;
  11422. /**
  11423. !#en convert Color to HEX color string.
  11424. !#zh 转换为 16 进制。
  11425. @param fmt "#rgb", "#rrggbb" or "#rrggbbaa".
  11426. @example
  11427. ```js
  11428. var color = cc.Color.BLACK;
  11429. color.toHEX("#rgb"); // "000";
  11430. color.toHEX("#rrggbb"); // "000000";
  11431. ```
  11432. */
  11433. toHEX(fmt?: string): string;
  11434. /**
  11435. !#en Convert to 24bit rgb value.
  11436. !#zh 转换为 24bit 的 RGB 值。
  11437. @example
  11438. ```js
  11439. var color = cc.Color.YELLOW;
  11440. color.toRGBValue(); // 16771844;
  11441. ```
  11442. */
  11443. toRGBValue(): number;
  11444. /**
  11445. !#en Read HSV model color and convert to RGB color
  11446. !#zh 读取 HSV(色彩模型)格式。
  11447. @param h h
  11448. @param s s
  11449. @param v v
  11450. @example
  11451. ```js
  11452. var color = cc.Color.YELLOW;
  11453. color.fromHSV(0, 0, 1); // Color {r: 255, g: 255, b: 255, a: 255};
  11454. ```
  11455. */
  11456. fromHSV(h: number, s: number, v: number): Color;
  11457. /**
  11458. !#en Transform to HSV model color
  11459. !#zh 转换为 HSV(色彩模型)格式。
  11460. @example
  11461. ```js
  11462. var color = cc.Color.YELLOW;
  11463. color.toHSV(); // Object {h: 0.1533864541832669, s: 0.9843137254901961, v: 1};
  11464. ```
  11465. */
  11466. toHSV(): any;
  11467. /**
  11468. !#en Set the color
  11469. !#zh 设置颜色
  11470. @param color color
  11471. */
  11472. set (color: Color): Color;
  11473. /**
  11474. !#en Multiplies the current color by the specified color
  11475. !#zh 将当前颜色乘以与指定颜色
  11476. @param other other
  11477. */
  11478. multiply(other: Color): Color;
  11479. }
  11480. /** !#en Representation of 4*4 matrix.
  11481. !#zh 表示 4*4 矩阵 */
  11482. export class Mat4 extends ValueType {
  11483. /**
  11484. !#en Multiply the current matrix with another one
  11485. !#zh 将当前矩阵与指定矩阵相乘
  11486. @param other the second operand
  11487. @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
  11488. */
  11489. mul(other: Mat4, out?: Mat4): Mat4;
  11490. /**
  11491. !#en Multiply each element of the matrix by a scalar.
  11492. !#zh 将矩阵的每一个元素都乘以指定的缩放值。
  11493. @param number amount to scale the matrix's elements by
  11494. @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
  11495. */
  11496. mulScalar(number: number, out?: Mat4): Mat4;
  11497. /**
  11498. !#en Subtracts the current matrix with another one
  11499. !#zh 将当前矩阵与指定的矩阵相减
  11500. @param other the second operand
  11501. @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
  11502. */
  11503. sub(other: Mat4, out?: Mat4): Mat4;
  11504. /** Identity of Mat4 */
  11505. static IDENTITY: Mat4;
  11506. /**
  11507. !#zh 获得指定矩阵的拷贝
  11508. !#en Copy of the specified matrix to obtain
  11509. */
  11510. static clone<Out extends IMat4Like> (a: Out): Mat4;
  11511. /**
  11512. !#zh 复制目标矩阵
  11513. !#en Copy the target matrix
  11514. */
  11515. static copy<Out extends IMat4Like> (out: Out, a: Out): Out;
  11516. /**
  11517. !#zh 将目标赋值为单位矩阵
  11518. !#en The target of an assignment is the identity matrix
  11519. */
  11520. static identity<Out extends IMat4Like> (out: Out): Out;
  11521. /**
  11522. !#zh 转置矩阵
  11523. !#en Transposed matrix
  11524. */
  11525. static transpose<Out extends IMat4Like> (out: Out, a: Out): Out;
  11526. /**
  11527. !#zh 矩阵求逆
  11528. !#en Matrix inversion
  11529. */
  11530. static invert<Out extends IMat4Like> (out: Out, a: Out): Out;
  11531. /**
  11532. !#zh 矩阵行列式
  11533. !#en Matrix determinant
  11534. */
  11535. static determinant<Out extends IMat4Like> (a: Out): number;
  11536. /**
  11537. !#zh 矩阵乘法
  11538. !#en Matrix Multiplication
  11539. */
  11540. static multiply<Out extends IMat4Like> (out: Out, a: Out, b: Out): Out;
  11541. /**
  11542. !#zh 在给定矩阵变换基础上加入变换
  11543. !#en Was added in a given transformation matrix transformation on the basis of
  11544. */
  11545. static transform<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike): Out;
  11546. /**
  11547. !#zh 在给定矩阵变换基础上加入新位移变换
  11548. !#en Add new displacement transducer in a matrix transformation on the basis of a given
  11549. */
  11550. static translate<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike): Out;
  11551. /**
  11552. !#zh 在给定矩阵变换基础上加入新缩放变换
  11553. !#en Add new scaling transformation in a given matrix transformation on the basis of
  11554. */
  11555. static scale<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, v: VecLike): Out;
  11556. /**
  11557. !#zh 在给定矩阵变换基础上加入新旋转变换
  11558. !#en Add a new rotational transform matrix transformation on the basis of a given
  11559. @param rad 旋转角度
  11560. @param axis 旋转轴
  11561. */
  11562. static rotate<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, a: Out, rad: number, axis: VecLike): Out;
  11563. /**
  11564. !#zh 在给定矩阵变换基础上加入绕 X 轴的旋转变换
  11565. !#en Add rotational transformation around the X axis at a given matrix transformation on the basis of
  11566. @param rad 旋转角度
  11567. */
  11568. static rotateX<Out extends IMat4Like> (out: Out, a: Out, rad: number): Out;
  11569. /**
  11570. !#zh 在给定矩阵变换基础上加入绕 Y 轴的旋转变换
  11571. !#en Add about the Y axis rotation transformation in a given matrix transformation on the basis of
  11572. @param rad 旋转角度
  11573. */
  11574. static rotateY<Out extends IMat4Like> (out: Out, a: Out, rad: number): Out;
  11575. /**
  11576. !#zh 在给定矩阵变换基础上加入绕 Z 轴的旋转变换
  11577. !#en Added about the Z axis at a given rotational transformation matrix transformation on the basis of
  11578. @param rad 旋转角度
  11579. */
  11580. static rotateZ<Out extends IMat4Like> (out: Out, a: Out, rad: number): Out;
  11581. /**
  11582. !#zh 计算位移矩阵
  11583. !#en Displacement matrix calculation
  11584. */
  11585. static fromTranslation<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, v: VecLike): Out;
  11586. /**
  11587. !#zh 计算缩放矩阵
  11588. !#en Scaling matrix calculation
  11589. */
  11590. static fromScaling<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, v: VecLike): Out;
  11591. /**
  11592. !#zh 计算旋转矩阵
  11593. !#en Calculates the rotation matrix
  11594. */
  11595. static fromRotation<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, rad: number, axis: VecLike): Out;
  11596. /**
  11597. !#zh 计算绕 X 轴的旋转矩阵
  11598. !#en Calculating rotation matrix about the X axis
  11599. */
  11600. static fromXRotation<Out extends IMat4Like> (out: Out, rad: number): Out;
  11601. /**
  11602. !#zh 计算绕 Y 轴的旋转矩阵
  11603. !#en Calculating rotation matrix about the Y axis
  11604. */
  11605. static fromYRotation<Out extends IMat4Like> (out: Out, rad: number): Out;
  11606. /**
  11607. !#zh 计算绕 Z 轴的旋转矩阵
  11608. !#en Calculating rotation matrix about the Z axis
  11609. */
  11610. static fromZRotation<Out extends IMat4Like> (out: Out, rad: number): Out;
  11611. /**
  11612. !#zh 根据旋转和位移信息计算矩阵
  11613. !#en The rotation and displacement information calculating matrix
  11614. */
  11615. static fromRT<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike): Out;
  11616. /**
  11617. !#zh 提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  11618. !#en Extracting displacement information of the matrix, the matrix transform to the default sequential application S-> R-> T is
  11619. */
  11620. static getTranslation<Out extends IMat4Like, VecLike extends IVec3Like> (out: VecLike, mat: Out): VecLike;
  11621. /**
  11622. !#zh 提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  11623. !#en Scaling information extraction matrix, the matrix transform to the default sequential application S-> R-> T is
  11624. */
  11625. static getScaling<Out extends IMat4Like, VecLike extends IVec3Like> (out: VecLike, mat: Out): VecLike;
  11626. /**
  11627. !#zh 提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息,如考虑缩放应使用 `toRTS` 函数。
  11628. !#en Rotation information extraction matrix, the matrix containing no default input scaling information, such as the use of `toRTS` should consider the scaling function.
  11629. */
  11630. static getRotation<Out extends IMat4Like> (out: Quat, mat: Out): Quat;
  11631. /**
  11632. !#zh 提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
  11633. !#en Extracting rotational displacement, zoom information, the default matrix transformation in order S-> R-> T applications
  11634. */
  11635. static toRTS<Out extends IMat4Like, VecLike extends IVec3Like> (mat: Out, q: Quat, v: VecLike, s: VecLike): void;
  11636. /**
  11637. !#zh 根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用
  11638. !#en The rotary displacement, the scaling matrix calculation information, the order S-> R-> T applications
  11639. */
  11640. static fromRTS<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike, s: VecLike): Out;
  11641. /**
  11642. !#zh 根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 S->R->T 的顺序应用
  11643. !#en According to the specified rotation, displacement, and scale conversion matrix calculation information center, order S-> R-> T applications
  11644. @param q 旋转值
  11645. @param v 位移值
  11646. @param s 缩放值
  11647. @param o 指定变换中心
  11648. */
  11649. static fromRTSOrigin<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, q: Quat, v: VecLike, s: VecLike, o: VecLike): Out;
  11650. /**
  11651. !#zh 根据指定的旋转信息计算矩阵
  11652. !#en The rotation matrix calculation information specified
  11653. */
  11654. static fromQuat<Out extends IMat4Like> (out: Out, q: Quat): Out;
  11655. /**
  11656. !#zh 根据指定的视锥体信息计算矩阵
  11657. !#en The matrix calculation information specified frustum
  11658. @param left 左平面距离
  11659. @param right 右平面距离
  11660. @param bottom 下平面距离
  11661. @param top 上平面距离
  11662. @param near 近平面距离
  11663. @param far 远平面距离
  11664. */
  11665. static frustum<Out extends IMat4Like> (out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number): Out;
  11666. /**
  11667. !#zh 计算透视投影矩阵
  11668. !#en Perspective projection matrix calculation
  11669. @param fovy 纵向视角高度
  11670. @param aspect 长宽比
  11671. @param near 近平面距离
  11672. @param far 远平面距离
  11673. */
  11674. static perspective<Out extends IMat4Like> (out: Out, fovy: number, aspect: number, near: number, far: number): Out;
  11675. /**
  11676. !#zh 计算正交投影矩阵
  11677. !#en Computing orthogonal projection matrix
  11678. @param left 左平面距离
  11679. @param right 右平面距离
  11680. @param bottom 下平面距离
  11681. @param top 上平面距离
  11682. @param near 近平面距离
  11683. @param far 远平面距离
  11684. */
  11685. static ortho<Out extends IMat4Like> (out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number): Out;
  11686. /**
  11687. !#zh 根据视点计算矩阵,注意 `eye - center` 不能为零向量或与 `up` 向量平行
  11688. !#en `Up` parallel vector or vector center` not be zero - the matrix calculation according to the viewpoint, note` eye
  11689. @param eye 当前位置
  11690. @param center 目标视点
  11691. @param up 视口上方向
  11692. */
  11693. static lookAt<Out extends IMat4Like, VecLike extends IVec3Like> (out: Out, eye: VecLike, center: VecLike, up: VecLike): Out;
  11694. /**
  11695. !#zh 计算逆转置矩阵
  11696. !#en Reversal matrix calculation
  11697. */
  11698. static inverseTranspose<Out extends IMat4Like> (out: Out, a: Out): Out;
  11699. /**
  11700. !#zh 逐元素矩阵加法
  11701. !#en Element by element matrix addition
  11702. */
  11703. static add<Out extends IMat4Like> (out: Out, a: Out, b: Out): Out;
  11704. /**
  11705. !#zh 逐元素矩阵减法
  11706. !#en Matrix element by element subtraction
  11707. */
  11708. static subtract<Out extends IMat4Like> (out: Out, a: Out, b: Out): Out;
  11709. /**
  11710. !#zh 矩阵标量乘法
  11711. !#en Matrix scalar multiplication
  11712. */
  11713. static multiplyScalar<Out extends IMat4Like> (out: Out, a: Out, b: number): Out;
  11714. /**
  11715. !#zh 逐元素矩阵标量乘加: A + B * scale
  11716. !#en Elements of the matrix by the scalar multiplication and addition: A + B * scale
  11717. */
  11718. static multiplyScalarAndAdd<Out extends IMat4Like> (out: Out, a: Out, b: Out, scale: number): Out;
  11719. /**
  11720. !#zh 矩阵等价判断
  11721. !#en Analyzing the equivalent matrix
  11722. */
  11723. static strictEquals<Out extends IMat4Like> (a: Out, b: Out): boolean;
  11724. /**
  11725. !#zh 排除浮点数误差的矩阵近似等价判断
  11726. !#en Negative floating point error is approximately equivalent to determining a matrix
  11727. */
  11728. static equals<Out extends IMat4Like> (a: Out, b: Out, epsilon?: number): boolean;
  11729. /**
  11730. !#zh 矩阵转数组
  11731. !#en Matrix transpose array
  11732. @param ofs 数组内的起始偏移量
  11733. */
  11734. static toArray <Out extends IWritableArrayLike<number>> (out: Out, mat: IMat4Like, ofs?: number): Out;
  11735. /**
  11736. !#zh 数组转矩阵
  11737. !#en Transfer matrix array
  11738. @param ofs 数组起始偏移量
  11739. */
  11740. static fromArray <Out extends IMat4Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  11741. /** !#en Matrix Data
  11742. !#zh 矩阵数据 */
  11743. m: Float64Array|Float32Array;
  11744. /**
  11745. !#en
  11746. Constructor
  11747. see {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  11748. !#zh
  11749. 构造函数,可查看 {{#crossLink "cc/mat4:method"}}cc.mat4{{/crossLink}}
  11750. */
  11751. 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);
  11752. /**
  11753. !#en clone a Mat4 object
  11754. !#zh 克隆一个 Mat4 对象
  11755. */
  11756. clone(): Mat4;
  11757. /**
  11758. !#en Sets the matrix with another one's value
  11759. !#zh 用另一个矩阵设置这个矩阵的值。
  11760. @param srcObj srcObj
  11761. */
  11762. set(srcObj: Mat4): Mat4;
  11763. /**
  11764. !#en Check whether two matrix equal
  11765. !#zh 当前的矩阵是否与指定的矩阵相等。
  11766. @param other other
  11767. */
  11768. equals(other: Mat4): boolean;
  11769. /**
  11770. !#en Check whether two matrix equal with default degree of variance.
  11771. !#zh
  11772. 近似判断两个矩阵是否相等。<br/>
  11773. 判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
  11774. @param other other
  11775. */
  11776. fuzzyEquals(other: Mat4): boolean;
  11777. /**
  11778. !#en Transform to string with matrix informations
  11779. !#zh 转换为方便阅读的字符串。
  11780. */
  11781. toString(): string;
  11782. /**
  11783. Set the matrix to the identity matrix
  11784. */
  11785. identity(): Mat4;
  11786. /**
  11787. Transpose the values of a mat4
  11788. @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.
  11789. */
  11790. transpose(out?: Mat4): Mat4;
  11791. /**
  11792. Inverts a mat4
  11793. @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.
  11794. */
  11795. invert(out?: Mat4): Mat4;
  11796. /**
  11797. Calculates the adjugate of a mat4
  11798. @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.
  11799. */
  11800. adjoint(out?: Mat4): Mat4;
  11801. /**
  11802. Calculates the determinant of a mat4
  11803. */
  11804. determinant(): number;
  11805. /**
  11806. Adds two Mat4
  11807. @param other the second operand
  11808. @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.
  11809. */
  11810. add(other: Mat4, out?: Mat4): Mat4;
  11811. /**
  11812. Subtracts the current matrix with another one
  11813. @param other the second operand
  11814. */
  11815. subtract(other: Mat4): Mat4;
  11816. /**
  11817. Subtracts the current matrix with another one
  11818. @param other the second operand
  11819. */
  11820. multiply(other: Mat4): Mat4;
  11821. /**
  11822. Multiply each element of the matrix by a scalar.
  11823. @param number amount to scale the matrix's elements by
  11824. */
  11825. multiplyScalar(number: number): Mat4;
  11826. /**
  11827. Translate a mat4 by the given vector
  11828. @param v vector to translate by
  11829. @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
  11830. */
  11831. translate(v: Vec3, out?: Mat4): Mat4;
  11832. /**
  11833. Scales the mat4 by the dimensions in the given vec3
  11834. @param v vector to scale by
  11835. @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
  11836. */
  11837. scale(v: Vec3, out?: Mat4): Mat4;
  11838. /**
  11839. Rotates a mat4 by the given angle around the given axis
  11840. @param rad the angle to rotate the matrix by
  11841. @param axis the axis to rotate around
  11842. @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
  11843. */
  11844. rotate(rad: number, axis: Vec3, out?: Mat4): Mat4;
  11845. /**
  11846. Returns the translation vector component of a transformation matrix.
  11847. @param out Vector to receive translation component, if not provided, a new vec3 will be created
  11848. */
  11849. getTranslation(out: Vec3): Vec3;
  11850. /**
  11851. Returns the scale factor component of a transformation matrix
  11852. @param out Vector to receive scale component, if not provided, a new vec3 will be created
  11853. */
  11854. getScale(out: Vec3): Vec3;
  11855. /**
  11856. Returns the rotation factor component of a transformation matrix
  11857. @param out Vector to receive rotation component, if not provided, a new quaternion object will be created
  11858. */
  11859. getRotation(out: Quat): Quat;
  11860. /**
  11861. Restore the matrix values from a quaternion rotation, vector translation and vector scale
  11862. @param q Rotation quaternion
  11863. @param v Translation vector
  11864. @param s Scaling vector
  11865. */
  11866. fromRTS(q: Quat, v: Vec3, s: Vec3): Mat4;
  11867. /**
  11868. Restore the matrix values from a quaternion rotation
  11869. @param q Rotation quaternion
  11870. */
  11871. fromQuat(q: Quat): Mat4;
  11872. }
  11873. /** !#en Representation of 2D vectors and points.
  11874. !#zh 表示 2D 向量和坐标 */
  11875. export class Quat extends ValueType {
  11876. /**
  11877. !#en
  11878. Constructor
  11879. see {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  11880. !#zh
  11881. 构造函数,可查看 {{#crossLink "cc/quat:method"}}cc.quat{{/crossLink}}
  11882. @param x x
  11883. @param y y
  11884. @param z z
  11885. @param w w
  11886. */
  11887. constructor(x?: number, y?: number, z?: number, w?: number);
  11888. /**
  11889. !#en Calculate the multiply result between this quaternion and another one
  11890. !#zh 计算四元数乘积的结果
  11891. @param other other
  11892. @param out out
  11893. */
  11894. mul(other: Quat, out?: Quat): Quat;
  11895. /**
  11896. !#zh 获得指定四元数的拷贝
  11897. !#en Obtaining copy specified quaternion
  11898. */
  11899. static clone<Out extends IQuatLike> (a: Out): Quat;
  11900. /**
  11901. !#zh 复制目标四元数
  11902. !#en Copy quaternion target
  11903. */
  11904. static copy<Out extends IQuatLike, QuatLike extends IQuatLike> (out: Out, a: QuatLike): Out;
  11905. /**
  11906. !#zh 设置四元数值
  11907. !#en Provided Quaternion Value
  11908. */
  11909. static set<Out extends IQuatLike> (out: Out, x: number, y: number, z: number, w: number): Out;
  11910. /**
  11911. !#zh 将目标赋值为单位四元数
  11912. !#en The target of an assignment as a unit quaternion
  11913. */
  11914. static identity<Out extends IQuatLike> (out: Out): Out;
  11915. /**
  11916. !#zh 设置四元数为两向量间的最短路径旋转,默认两向量都已归一化
  11917. !#en Set quaternion rotation is the shortest path between two vectors, the default two vectors are normalized
  11918. */
  11919. static rotationTo<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, a: VecLike, b: VecLike): Out;
  11920. /**
  11921. !#zh 获取四元数的旋转轴和旋转弧度
  11922. !#en Get the rotary shaft and the arc of rotation quaternion
  11923. @param outAxis 旋转轴输出
  11924. @param q 源四元数
  11925. */
  11926. static getAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like> (outAxis: VecLike, q: Out): number;
  11927. /**
  11928. !#zh 四元数乘法
  11929. !#en Quaternion multiplication
  11930. */
  11931. static multiply<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike> (out: Out, a: QuatLike_1, b: QuatLike_2): Out;
  11932. /**
  11933. !#zh 四元数标量乘法
  11934. !#en Quaternion scalar multiplication
  11935. */
  11936. static multiplyScalar<Out extends IQuatLike> (out: Out, a: Out, b: number): Out;
  11937. /**
  11938. !#zh 四元数乘加:A + B * scale
  11939. !#en Quaternion multiplication and addition: A + B * scale
  11940. */
  11941. static scaleAndAdd<Out extends IQuatLike> (out: Out, a: Out, b: Out, scale: number): Out;
  11942. /**
  11943. !#zh 绕 X 轴旋转指定四元数
  11944. !#en About the X axis specified quaternion
  11945. @param rad 旋转弧度
  11946. */
  11947. static rotateX<Out extends IQuatLike> (out: Out, a: Out, rad: number): Out;
  11948. /**
  11949. !#zh 绕 Y 轴旋转指定四元数
  11950. !#en Rotation about the Y axis designated quaternion
  11951. @param rad 旋转弧度
  11952. */
  11953. static rotateY<Out extends IQuatLike> (out: Out, a: Out, rad: number): Out;
  11954. /**
  11955. !#zh 绕 Z 轴旋转指定四元数
  11956. !#en Around the Z axis specified quaternion
  11957. @param rad 旋转弧度
  11958. */
  11959. static rotateZ<Out extends IQuatLike> (out: Out, a: Out, rad: number): Out;
  11960. /**
  11961. !#zh 绕世界空间下指定轴旋转四元数
  11962. !#en Space around the world at a given axis of rotation quaternion
  11963. @param axis 旋转轴,默认已归一化
  11964. @param rad 旋转弧度
  11965. */
  11966. static rotateAround<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number): Out;
  11967. /**
  11968. !#zh 绕本地空间下指定轴旋转四元数
  11969. !#en Local space around the specified axis rotation quaternion
  11970. @param axis 旋转轴
  11971. @param rad 旋转弧度
  11972. */
  11973. static rotateAroundLocal<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, rot: Out, axis: VecLike, rad: number): Out;
  11974. /**
  11975. !#zh 根据 xyz 分量计算 w 分量,默认已归一化
  11976. !#en The component w xyz components calculated, normalized by default
  11977. */
  11978. static calculateW<Out extends IQuatLike> (out: Out, a: Out): Out;
  11979. /**
  11980. !#zh 四元数点积(数量积)
  11981. !#en Quaternion dot product (scalar product)
  11982. */
  11983. static dot<Out extends IQuatLike> (a: Out, b: Out): number;
  11984. /**
  11985. !#zh 逐元素线性插值: A + t * (B - A)
  11986. !#en Element by element linear interpolation: A + t * (B - A)
  11987. */
  11988. static lerp<Out extends IQuatLike> (out: Out, a: Out, b: Out, t: number): Out;
  11989. /**
  11990. !#zh 四元数球面插值
  11991. !#en Spherical quaternion interpolation
  11992. */
  11993. static slerp<Out extends IQuatLike, QuatLike_1 extends IQuatLike, QuatLike_2 extends IQuatLike>(out: Out, a: QuatLike_1, b: QuatLike_2, t: number): Out;
  11994. /**
  11995. !#zh 带两个控制点的四元数球面插值
  11996. !#en Quaternion with two spherical interpolation control points
  11997. */
  11998. static sqlerp<Out extends IQuatLike> (out: Out, a: Out, b: Out, c: Out, d: Out, t: number): Out;
  11999. /**
  12000. !#zh 四元数求逆
  12001. !#en Quaternion inverse
  12002. */
  12003. static invert<Out extends IQuatLike, QuatLike extends IQuatLike> (out: Out, a: QuatLike): Out;
  12004. /**
  12005. !#zh 求共轭四元数,对单位四元数与求逆等价,但更高效
  12006. !#en Conjugating a quaternion, and the unit quaternion equivalent to inversion, but more efficient
  12007. */
  12008. static conjugate<Out extends IQuatLike> (out: Out, a: Out): Out;
  12009. /**
  12010. !#zh 求四元数长度
  12011. !#en Seek length quaternion
  12012. */
  12013. static len<Out extends IQuatLike> (a: Out): number;
  12014. /**
  12015. !#zh 求四元数长度平方
  12016. !#en Seeking quaternion square of the length
  12017. */
  12018. static lengthSqr<Out extends IQuatLike> (a: Out): number;
  12019. /**
  12020. !#zh 归一化四元数
  12021. !#en Normalized quaternions
  12022. */
  12023. static normalize<Out extends IQuatLike> (out: Out, a: Out): Out;
  12024. /**
  12025. !#zh 根据本地坐标轴朝向计算四元数,默认三向量都已归一化且相互垂直
  12026. !#en Calculated according to the local orientation quaternion coordinate axis, the default three vectors are normalized and mutually perpendicular
  12027. */
  12028. static fromAxes<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, xAxis: VecLike, yAxis: VecLike, zAxis: VecLike): Out;
  12029. /**
  12030. !#zh 根据视口的前方向和上方向计算四元数
  12031. !#en The forward direction and the direction of the viewport computing quaternion
  12032. @param view 视口面向的前方向,必须归一化
  12033. @param up 视口的上方向,必须归一化,默认为 (0, 1, 0)
  12034. */
  12035. static fromViewUp<Out extends IQuatLike> (out: Out, view: Vec3, up?: Vec3): Out;
  12036. /**
  12037. !#zh 根据旋转轴和旋转弧度计算四元数
  12038. !#en The quaternion calculated and the arc of rotation of the rotary shaft
  12039. */
  12040. static fromAxisAngle<Out extends IQuatLike, VecLike extends IVec3Like> (out: Out, axis: VecLike, rad: number): Out;
  12041. /**
  12042. !#zh 根据三维矩阵信息计算四元数,默认输入矩阵不含有缩放信息
  12043. !#en Calculating the three-dimensional quaternion matrix information, default zoom information input matrix does not contain
  12044. */
  12045. static fromMat3<Out extends IQuatLike> (out: Out, mat: Mat3): Out;
  12046. /**
  12047. !#zh 根据欧拉角信息计算四元数,旋转顺序为 YZX
  12048. !#en The quaternion calculated Euler angle information, rotation order YZX
  12049. */
  12050. static fromEuler<Out extends IQuatLike> (out: Out, x: number, y: number, z: number): Out;
  12051. /**
  12052. !#zh 返回定义此四元数的坐标系 X 轴向量
  12053. !#en This returns the result of the quaternion coordinate system X-axis vector
  12054. */
  12055. static toAxisX<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out): VecLike;
  12056. /**
  12057. !#zh 返回定义此四元数的坐标系 Y 轴向量
  12058. !#en This returns the result of the quaternion coordinate system Y axis vector
  12059. */
  12060. static toAxisY<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out): VecLike;
  12061. /**
  12062. !#zh 返回定义此四元数的坐标系 Z 轴向量
  12063. !#en This returns the result of the quaternion coordinate system the Z-axis vector
  12064. */
  12065. static toAxisZ<Out extends IQuatLike, VecLike extends IVec3Like> (out: VecLike, q: Out): VecLike;
  12066. /**
  12067. !#zh 根据四元数计算欧拉角,返回角度 x, y 在 [-180, 180] 区间内, z 默认在 [-90, 90] 区间内,旋转顺序为 YZX
  12068. !#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
  12069. @param outerZ z 取值范围区间改为 [-180, -90] U [90, 180]
  12070. */
  12071. static toEuler<Out extends IVec3Like> (out: Out, q: IQuatLike, outerZ?: boolean): Out;
  12072. /**
  12073. !#zh 四元数等价判断
  12074. !#en Analyzing quaternion equivalent
  12075. */
  12076. static strictEquals<Out extends IQuatLike> (a: Out, b: Out): boolean;
  12077. /**
  12078. !#zh 排除浮点数误差的四元数近似等价判断
  12079. !#en Negative floating point error quaternion approximately equivalent Analyzing
  12080. */
  12081. static equals<Out extends IQuatLike> (a: Out, b: Out, epsilon?: number): boolean;
  12082. /**
  12083. !#zh 四元数转数组
  12084. !#en Quaternion rotation array
  12085. @param ofs 数组内的起始偏移量
  12086. */
  12087. static toArray <Out extends IWritableArrayLike<number>> (out: Out, q: IQuatLike, ofs?: number): Out;
  12088. /**
  12089. !#zh 数组转四元数
  12090. !#en Array to a quaternion
  12091. @param ofs 数组起始偏移量
  12092. */
  12093. static fromArray <Out extends IQuatLike> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  12094. x: number;
  12095. y: number;
  12096. z: number;
  12097. w: number;
  12098. /**
  12099. !#en clone a Quat object and return the new object
  12100. !#zh 克隆一个四元数并返回
  12101. */
  12102. clone(): Quat;
  12103. /**
  12104. !#en Set values with another quaternion
  12105. !#zh 用另一个四元数的值设置到当前对象上。
  12106. @param newValue !#en new value to set. !#zh 要设置的新值
  12107. */
  12108. set(newValue: Quat): Quat;
  12109. /**
  12110. !#en Check whether current quaternion equals another
  12111. !#zh 当前的四元数是否与指定的四元数相等。
  12112. @param other other
  12113. */
  12114. equals(other: Quat): boolean;
  12115. /**
  12116. !#en Convert quaternion to euler
  12117. !#zh 转换四元数到欧拉角
  12118. @param out out
  12119. */
  12120. toEuler(out: Vec3): Vec3;
  12121. /**
  12122. !#en Convert euler to quaternion
  12123. !#zh 转换欧拉角到四元数
  12124. @param euler euler
  12125. */
  12126. fromEuler(euler: Vec3): Quat;
  12127. /**
  12128. !#en Calculate the interpolation result between this quaternion and another one with given ratio
  12129. !#zh 计算四元数的插值结果
  12130. @param to to
  12131. @param ratio ratio
  12132. @param out out
  12133. */
  12134. lerp(to: Quat, ratio: number, out?: Quat): Quat;
  12135. /**
  12136. !#en Calculate the multiply result between this quaternion and another one
  12137. !#zh 计算四元数乘积的结果
  12138. @param other other
  12139. */
  12140. multiply(other: Quat): Quat;
  12141. /**
  12142. !#en Rotates a quaternion by the given angle (in radians) about a world space axis.
  12143. !#zh 围绕世界空间轴按给定弧度旋转四元数
  12144. @param rot Quaternion to rotate
  12145. @param axis The axis around which to rotate in world space
  12146. @param rad Angle (in radians) to rotate
  12147. @param out Quaternion to store result
  12148. */
  12149. rotateAround(rot: Quat, axis: Vec3, rad: number, out?: Quat): Quat;
  12150. }
  12151. /** Mathematical 3x3 matrix.
  12152. NOTE: we use column-major matrix for all matrix calculation.
  12153. This may lead to some confusion when referencing OpenGL documentation,
  12154. however, which represents out all matricies in column-major format.
  12155. This means that while in code a matrix may be typed out as:
  12156. [1, 0, 0, 0,
  12157. 0, 1, 0, 0,
  12158. 0, 0, 1, 0,
  12159. x, y, z, 0]
  12160. The same matrix in the [OpenGL documentation](https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml)
  12161. is written as:
  12162. 1 0 0 x
  12163. 0 1 0 y
  12164. 0 0 1 z
  12165. 0 0 0 0
  12166. Please rest assured, however, that they are the same thing!
  12167. This is not unique to glMatrix, either, as OpenGL developers have long been confused by the
  12168. apparent lack of consistency between the memory layout and the documentation. */
  12169. export class Mat3 extends ValueType {
  12170. /** Identity of Mat3 */
  12171. static IDENTITY: Mat3;
  12172. /**
  12173. !#zh 矩阵转数组
  12174. !#en Matrix transpose array
  12175. @param ofs 数组内的起始偏移量
  12176. */
  12177. static toArray <Out extends IWritableArrayLike<number>> (out: Out, mat: IMat3Like, ofs?: number): Out;
  12178. /**
  12179. !#zh 数组转矩阵
  12180. !#en Transfer matrix array
  12181. @param ofs 数组起始偏移量
  12182. */
  12183. static fromArray <Out extends IMat3Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  12184. /** !#en Matrix Data
  12185. !#zh 矩阵数据 */
  12186. m: Float64Array|Float32Array;
  12187. constructor (m00?: number | Float32Array, m01?: number, m02?: number, m03?: number, m04?: number, m05?: number, m06?: number, m07?: number, m08?: number);
  12188. }
  12189. /** !#en
  12190. cc.Size is the class for size object,<br/>
  12191. please do not use its constructor to create sizes,<br/>
  12192. use {{#crossLink "cc/size:method"}}{{/crossLink}} alias function instead.<br/>
  12193. It will be deprecated soon, please use cc.Vec2 instead.
  12194. !#zh
  12195. cc.Size 是 size 对象的类。<br/>
  12196. 请不要使用它的构造函数创建的 size,<br/>
  12197. 使用 {{#crossLink "cc/size:method"}}{{/crossLink}} 别名函数。<br/>
  12198. 它不久将被取消,请使用cc.Vec2代替。 */
  12199. export class Size {
  12200. /**
  12201. @param width width
  12202. @param height height
  12203. */
  12204. constructor(width: number|Size, height?: number);
  12205. /** !#en return a Size object with width = 0 and height = 0.
  12206. !#zh 返回一个宽度为 0 和高度为 0 的 Size 对象。 */
  12207. static ZERO: Size;
  12208. width: number;
  12209. height: number;
  12210. /**
  12211. !#en TODO
  12212. !#zh 克隆 size 对象。
  12213. @example
  12214. ```js
  12215. var a = new cc.size(10, 10);
  12216. a.clone();// return Size {width: 0, height: 0};
  12217. ```
  12218. */
  12219. clone(): Size;
  12220. /**
  12221. !#en TODO
  12222. !#zh 当前 Size 对象是否等于指定 Size 对象。
  12223. @param other other
  12224. @example
  12225. ```js
  12226. var a = new cc.size(10, 10);
  12227. a.equals(new cc.size(10, 10));// return true;
  12228. ```
  12229. */
  12230. equals(other: Size): boolean;
  12231. /**
  12232. !#en TODO
  12233. !#zh 线性插值。
  12234. @param to to
  12235. @param ratio the interpolation coefficient.
  12236. @param out optional, the receiving vector.
  12237. @example
  12238. ```js
  12239. var a = new cc.size(10, 10);
  12240. var b = new cc.rect(50, 50, 100, 100);
  12241. update (dt) {
  12242. // method 1;
  12243. var c = a.lerp(b, dt * 0.1);
  12244. // method 2;
  12245. a.lerp(b, dt * 0.1, c);
  12246. }
  12247. ```
  12248. */
  12249. lerp(to: Rect, ratio: number, out?: Size): Size;
  12250. /**
  12251. !#en TODO
  12252. !#zh 转换为方便阅读的字符串。
  12253. @example
  12254. ```js
  12255. var a = new cc.size(10, 10);
  12256. a.toString();// return "(10.00, 10.00)";
  12257. ```
  12258. */
  12259. toString(): string;
  12260. }
  12261. /** !#en The base class of all value types.
  12262. !#zh 所有值类型的基类。 */
  12263. export class ValueType {
  12264. /**
  12265. !#en This method returns an exact copy of current value.
  12266. !#zh 克隆当前值,该方法返回一个新对象,新对象的值和原对象相等。
  12267. */
  12268. clone(): ValueType;
  12269. /**
  12270. !#en Compares this object with the other one.
  12271. !#zh 当前对象是否等于指定对象。
  12272. @param other other
  12273. */
  12274. equals(other: ValueType): boolean;
  12275. /**
  12276. !#en
  12277. Linearly interpolates between this value to to value by ratio which is in the range [0, 1].
  12278. When ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.
  12279. !#zh
  12280. 线性插值。<br/>
  12281. 当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
  12282. @param to the to value
  12283. @param ratio the interpolation coefficient
  12284. */
  12285. lerp(to: ValueType, ratio: number): ValueType;
  12286. /**
  12287. !#en
  12288. Copys all the properties from another given object to this value.
  12289. !#zh
  12290. 从其它对象把所有属性复制到当前对象。
  12291. @param source the source to copy
  12292. */
  12293. set(source: ValueType): void;
  12294. /**
  12295. !#en Convert to a readable string.
  12296. !#zh 转换为方便阅读的字符串。
  12297. */
  12298. toString(): string;
  12299. }
  12300. /** !#en Representation of 2D vectors and points.
  12301. !#zh 表示 2D 向量和坐标 */
  12302. export class Vec2 extends ValueType {
  12303. /**
  12304. !#en Returns the length of this vector.
  12305. !#zh 返回该向量的长度。
  12306. @example
  12307. ```js
  12308. var v = cc.v2(10, 10);
  12309. v.mag(); // return 14.142135623730951;
  12310. ```
  12311. */
  12312. mag(): number;
  12313. /**
  12314. !#en Returns the squared length of this vector.
  12315. !#zh 返回该向量的长度平方。
  12316. @example
  12317. ```js
  12318. var v = cc.v2(10, 10);
  12319. v.magSqr(); // return 200;
  12320. ```
  12321. */
  12322. magSqr(): number;
  12323. /**
  12324. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  12325. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  12326. @param vector vector
  12327. @example
  12328. ```js
  12329. var v = cc.v2(10, 10);
  12330. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  12331. ```
  12332. */
  12333. subSelf(vector: Vec2): Vec2;
  12334. /**
  12335. !#en Subtracts one vector from this, and returns the new result.
  12336. !#zh 向量减法,并返回新结果。
  12337. @param vector vector
  12338. @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
  12339. @example
  12340. ```js
  12341. var v = cc.v2(10, 10);
  12342. v.sub(cc.v2(5, 5)); // return Vec2 {x: 5, y: 5};
  12343. var v1 = new Vec2;
  12344. v.sub(cc.v2(5, 5), v1); // return Vec2 {x: 5, y: 5};
  12345. ```
  12346. */
  12347. sub(vector: Vec2, out?: Vec2): Vec2;
  12348. /**
  12349. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  12350. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  12351. @param num num
  12352. @example
  12353. ```js
  12354. var v = cc.v2(10, 10);
  12355. v.mulSelf(5);// return Vec2 {x: 50, y: 50};
  12356. ```
  12357. */
  12358. mulSelf(num: number): Vec2;
  12359. /**
  12360. !#en Multiplies by a number, and returns the new result.
  12361. !#zh 缩放向量,并返回新结果。
  12362. @param num num
  12363. @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
  12364. @example
  12365. ```js
  12366. var v = cc.v2(10, 10);
  12367. v.mul(5); // return Vec2 {x: 50, y: 50};
  12368. var v1 = new Vec2;
  12369. v.mul(5, v1); // return Vec2 {x: 50, y: 50};
  12370. ```
  12371. */
  12372. mul(num: number, out?: Vec2): Vec2;
  12373. /**
  12374. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  12375. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  12376. @param num num
  12377. @example
  12378. ```js
  12379. var v = cc.v2(10, 10);
  12380. v.divSelf(5); // return Vec2 {x: 2, y: 2};
  12381. ```
  12382. */
  12383. divSelf(num: number): Vec2;
  12384. /**
  12385. !#en Divides by a number, and returns the new result.
  12386. !#zh 向量除法,并返回新的结果。
  12387. @param num num
  12388. @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
  12389. @example
  12390. ```js
  12391. var v = cc.v2(10, 10);
  12392. v.div(5); // return Vec2 {x: 2, y: 2};
  12393. var v1 = new Vec2;
  12394. v.div(5, v1); // return Vec2 {x: 2, y: 2};
  12395. ```
  12396. */
  12397. div(num: number, out?: Vec2): Vec2;
  12398. /**
  12399. !#en Multiplies two vectors.
  12400. !#zh 分量相乘。
  12401. @param vector vector
  12402. @example
  12403. ```js
  12404. var v = cc.v2(10, 10);
  12405. v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  12406. ```
  12407. */
  12408. scaleSelf(vector: Vec2): Vec2;
  12409. /**
  12410. !#en Multiplies two vectors, and returns the new result.
  12411. !#zh 分量相乘,并返回新的结果。
  12412. @param vector vector
  12413. @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
  12414. @example
  12415. ```js
  12416. var v = cc.v2(10, 10);
  12417. v.scale(cc.v2(5, 5)); // return Vec2 {x: 50, y: 50};
  12418. var v1 = new Vec2;
  12419. v.scale(cc.v2(5, 5), v1); // return Vec2 {x: 50, y: 50};
  12420. ```
  12421. */
  12422. scale(vector: Vec2, out?: Vec2): Vec2;
  12423. /**
  12424. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  12425. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  12426. @example
  12427. ```js
  12428. var v = cc.v2(10, 10);
  12429. v.negSelf(); // return Vec2 {x: -10, y: -10};
  12430. ```
  12431. */
  12432. negSelf(): Vec2;
  12433. /**
  12434. !#en Negates the components, and returns the new result.
  12435. !#zh 返回取反后的新向量。
  12436. @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
  12437. @example
  12438. ```js
  12439. var v = cc.v2(10, 10);
  12440. var v1 = new Vec2;
  12441. v.neg(v1); // return Vec2 {x: -10, y: -10};
  12442. ```
  12443. */
  12444. neg(out?: Vec2): Vec2;
  12445. /** !#en return a Vec2 object with x = 1 and y = 1.
  12446. !#zh 新 Vec2 对象。 */
  12447. static ONE: Vec2;
  12448. /** !#en return a Vec2 object with x = 0 and y = 0.
  12449. !#zh 返回 x = 0 和 y = 0 的 Vec2 对象。 */
  12450. static ZERO: Vec2;
  12451. /** !#en return a readonly Vec2 object with x = 0 and y = 0.
  12452. !#zh 返回一个 x = 0 和 y = 0 的 Vec2 只读对象。 */
  12453. static ZERO_R: Vec2;
  12454. /** !#en return a Vec2 object with x = 0 and y = 1.
  12455. !#zh 返回 x = 0 和 y = 1 的 Vec2 对象。 */
  12456. static UP: Vec2;
  12457. /** !#en return a readonly Vec2 object with x = 0 and y = 1.
  12458. !#zh 返回 x = 0 和 y = 1 的 Vec2 只读对象。 */
  12459. static UP_R: Vec2;
  12460. /** !#en return a readonly Vec2 object with x = 1 and y = 0.
  12461. !#zh 返回 x = 1 和 y = 0 的 Vec2 只读对象。 */
  12462. static RIGHT: Vec2;
  12463. /** !#en return a Vec2 object with x = 1 and y = 0.
  12464. !#zh 返回 x = 1 和 y = 0 的 Vec2 对象。 */
  12465. static RIGHT_R: Vec2;
  12466. /**
  12467. !#zh 获得指定向量的拷贝
  12468. */
  12469. static clone <Out extends IVec2Like> (a: Out): Vec2;
  12470. /**
  12471. !#zh 复制指定向量的值
  12472. */
  12473. static copy <Out extends IVec2Like> (out: Out, a: Out): Out;
  12474. /**
  12475. !#zh 设置向量值
  12476. */
  12477. static set <Out extends IVec2Like> (out: Out, x: number, y: number): Out;
  12478. /**
  12479. !#zh 逐元素向量加法
  12480. */
  12481. static add <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  12482. /**
  12483. !#zh 逐元素向量减法
  12484. */
  12485. static subtract <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  12486. /**
  12487. !#zh 逐元素向量乘法
  12488. */
  12489. static multiply <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  12490. /**
  12491. !#zh 逐元素向量除法
  12492. */
  12493. static divide <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  12494. /**
  12495. !#zh 逐元素向量向上取整
  12496. */
  12497. static ceil <Out extends IVec2Like> (out: Out, a: Out): Out;
  12498. /**
  12499. !#zh 逐元素向量向下取整
  12500. */
  12501. static floor <Out extends IVec2Like> (out: Out, a: Out): Out;
  12502. /**
  12503. !#zh 逐元素向量最小值
  12504. */
  12505. static min <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  12506. /**
  12507. !#zh 逐元素向量最大值
  12508. */
  12509. static max <Out extends IVec2Like> (out: Out, a: Out, b: Out): Out;
  12510. /**
  12511. !#zh 逐元素向量四舍五入取整
  12512. */
  12513. static round <Out extends IVec2Like> (out: Out, a: Out): Out;
  12514. /**
  12515. !#zh 向量标量乘法
  12516. */
  12517. static multiplyScalar <Out extends IVec2Like> (out: Out, a: Out, b: number): Out;
  12518. /**
  12519. !#zh 逐元素向量乘加: A + B * scale
  12520. */
  12521. static scaleAndAdd <Out extends IVec2Like> (out: Out, a: Out, b: Out, scale: number): Out;
  12522. /**
  12523. !#zh 求两向量的欧氏距离
  12524. */
  12525. static distance <Out extends IVec2Like> (a: Out, b: Out): number;
  12526. /**
  12527. !#zh 求两向量的欧氏距离平方
  12528. */
  12529. static squaredDistance <Out extends IVec2Like> (a: Out, b: Out): number;
  12530. /**
  12531. !#zh 求向量长度
  12532. */
  12533. static len <Out extends IVec2Like> (a: Out): number;
  12534. /**
  12535. !#zh 求向量长度平方
  12536. */
  12537. static lengthSqr <Out extends IVec2Like> (a: Out): number;
  12538. /**
  12539. !#zh 逐元素向量取负
  12540. */
  12541. static negate <Out extends IVec2Like> (out: Out, a: Out): Out;
  12542. /**
  12543. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  12544. */
  12545. static inverse <Out extends IVec2Like> (out: Out, a: Out): Out;
  12546. /**
  12547. !#zh 逐元素向量取倒数,接近 0 时返回 0
  12548. */
  12549. static inverseSafe <Out extends IVec2Like> (out: Out, a: Out): Out;
  12550. /**
  12551. !#zh 归一化向量
  12552. */
  12553. static normalize <Out extends IVec2Like, Vec2Like extends IVec2Like> (out: Out, a: Vec2Like): Out;
  12554. /**
  12555. !#zh 向量点积(数量积)
  12556. */
  12557. static dot <Out extends IVec2Like> (a: Out, b: Out): number;
  12558. /**
  12559. !#zh 向量叉积(向量积),注意二维向量的叉积为与 Z 轴平行的三维向量
  12560. */
  12561. static cross <Out extends IVec2Like> (out: Vec2, a: Out, b: Out): Vec2;
  12562. /**
  12563. !#zh 逐元素向量线性插值: A + t * (B - A)
  12564. */
  12565. static lerp <Out extends IVec2Like> (out: Out, a: Out, b: Out, t: number): Out;
  12566. /**
  12567. !#zh 生成一个在单位圆上均匀分布的随机向量
  12568. */
  12569. static random <Out extends IVec2Like> (out: Out, scale?: number): Out;
  12570. /**
  12571. !#zh 向量与三维矩阵乘法,默认向量第三位为 1。
  12572. */
  12573. static transformMat3 <Out extends IVec2Like, MatLike extends IMat3Like> (out: Out, a: Out, mat: IMat3Like): Out;
  12574. /**
  12575. !#zh 向量与四维矩阵乘法,默认向量第三位为 0,第四位为 1。
  12576. */
  12577. static transformMat4 <Out extends IVec2Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike): Out;
  12578. /**
  12579. !#zh 向量等价判断
  12580. */
  12581. static strictEquals <Out extends IVec2Like> (a: Out, b: Out): boolean;
  12582. /**
  12583. !#zh 排除浮点数误差的向量近似等价判断
  12584. */
  12585. static equals <Out extends IVec2Like> (a: Out, b: Out, epsilon?: number): boolean;
  12586. /**
  12587. !#zh 排除浮点数误差的向量近似等价判断
  12588. */
  12589. static angle <Out extends IVec2Like> (a: Out, b: Out): number;
  12590. /**
  12591. !#zh 向量转数组
  12592. */
  12593. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec2Like, ofs?: number): Out;
  12594. /**
  12595. !#zh 数组转向量
  12596. */
  12597. static fromArray <Out extends IVec2Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  12598. x: number;
  12599. y: number;
  12600. /**
  12601. !#en
  12602. Constructor
  12603. see {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} or {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  12604. !#zh
  12605. 构造函数,可查看 {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} 或者 {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
  12606. @param x x
  12607. @param y y
  12608. */
  12609. constructor(x?: number, y?: number);
  12610. /**
  12611. !#en clone a Vec2 object
  12612. !#zh 克隆一个 Vec2 对象
  12613. */
  12614. clone(): Vec2;
  12615. /**
  12616. !#en Sets vector with another's value
  12617. !#zh 设置向量值。
  12618. @param newValue !#en new value to set. !#zh 要设置的新值
  12619. */
  12620. set(newValue: Vec2): Vec2;
  12621. /**
  12622. !#en Check whether two vector equal
  12623. !#zh 当前的向量是否与指定的向量相等。
  12624. @param other other
  12625. */
  12626. equals(other: Vec2): boolean;
  12627. /**
  12628. !#en Check whether two vector equal with some degree of variance.
  12629. !#zh
  12630. 近似判断两个点是否相等。<br/>
  12631. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  12632. @param other other
  12633. @param variance variance
  12634. */
  12635. fuzzyEquals(other: Vec2, variance: number): boolean;
  12636. /**
  12637. !#en Transform to string with vector informations
  12638. !#zh 转换为方便阅读的字符串。
  12639. */
  12640. toString(): string;
  12641. /**
  12642. !#en Calculate linear interpolation result between this vector and another one with given ratio
  12643. !#zh 线性插值。
  12644. @param to to
  12645. @param ratio the interpolation coefficient
  12646. @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
  12647. */
  12648. lerp(to: Vec2, ratio: number, out?: Vec2): Vec2;
  12649. /**
  12650. !#en Clamp the vector between from float and to float.
  12651. !#zh
  12652. 返回指定限制区域后的向量。<br/>
  12653. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  12654. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  12655. 否则返回自身。
  12656. @param min_inclusive min_inclusive
  12657. @param max_inclusive max_inclusive
  12658. @example
  12659. ```js
  12660. var min_inclusive = cc.v2(0, 0);
  12661. var max_inclusive = cc.v2(20, 20);
  12662. var v1 = cc.v2(20, 20).clampf(min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};
  12663. var v2 = cc.v2(0, 0).clampf(min_inclusive, max_inclusive); // Vec2 {x: 0, y: 0};
  12664. var v3 = cc.v2(10, 10).clampf(min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};
  12665. ```
  12666. */
  12667. clampf(min_inclusive: Vec2, max_inclusive: Vec2): Vec2;
  12668. /**
  12669. !#en Adds this vector.
  12670. !#zh 向量加法。
  12671. @param vector vector
  12672. @param out out
  12673. @example
  12674. ```js
  12675. var v = cc.v2(10, 10);
  12676. v.add(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
  12677. ```
  12678. */
  12679. add(vector: Vec2, out?: Vec2): Vec2;
  12680. /**
  12681. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  12682. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  12683. @param vector vector
  12684. */
  12685. addSelf(vector: Vec2): Vec2;
  12686. /**
  12687. !#en Subtracts one vector from this.
  12688. !#zh 向量减法。
  12689. @param vector vector
  12690. @example
  12691. ```js
  12692. var v = cc.v2(10, 10);
  12693. v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
  12694. ```
  12695. */
  12696. subtract(vector: Vec2): Vec2;
  12697. /**
  12698. !#en Multiplies this by a number.
  12699. !#zh 缩放当前向量。
  12700. @param num num
  12701. @example
  12702. ```js
  12703. var v = cc.v2(10, 10);
  12704. v.multiply(5);// return Vec2 {x: 50, y: 50};
  12705. ```
  12706. */
  12707. multiplyScalar(num: number): Vec2;
  12708. /**
  12709. !#en Multiplies two vectors.
  12710. !#zh 分量相乘。
  12711. @param vector vector
  12712. @example
  12713. ```js
  12714. var v = cc.v2(10, 10);
  12715. v.multiply(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
  12716. ```
  12717. */
  12718. multiply(vector: Vec2): Vec2;
  12719. /**
  12720. !#en Divides by a number.
  12721. !#zh 向量除法。
  12722. @param num num
  12723. @example
  12724. ```js
  12725. var v = cc.v2(10, 10);
  12726. v.divide(5); // return Vec2 {x: 2, y: 2};
  12727. ```
  12728. */
  12729. divide(num: number): Vec2;
  12730. /**
  12731. !#en Negates the components.
  12732. !#zh 向量取反。
  12733. @example
  12734. ```js
  12735. var v = cc.v2(10, 10);
  12736. v.negate(); // return Vec2 {x: -10, y: -10};
  12737. ```
  12738. */
  12739. negate(): Vec2;
  12740. /**
  12741. !#en Dot product
  12742. !#zh 当前向量与指定向量进行点乘。
  12743. @param vector vector
  12744. @example
  12745. ```js
  12746. var v = cc.v2(10, 10);
  12747. v.dot(cc.v2(5, 5)); // return 100;
  12748. ```
  12749. */
  12750. dot(vector?: Vec2): number;
  12751. /**
  12752. !#en Cross product
  12753. !#zh 当前向量与指定向量进行叉乘。
  12754. @param vector vector
  12755. @example
  12756. ```js
  12757. var v = cc.v2(10, 10);
  12758. v.cross(cc.v2(5, 5)); // return 0;
  12759. ```
  12760. */
  12761. cross(vector?: Vec2): number;
  12762. /**
  12763. !#en Returns the length of this vector.
  12764. !#zh 返回该向量的长度。
  12765. @example
  12766. ```js
  12767. var v = cc.v2(10, 10);
  12768. v.len(); // return 14.142135623730951;
  12769. ```
  12770. */
  12771. len(): number;
  12772. /**
  12773. !#en Returns the squared length of this vector.
  12774. !#zh 返回该向量的长度平方。
  12775. @example
  12776. ```js
  12777. var v = cc.v2(10, 10);
  12778. v.lengthSqr(); // return 200;
  12779. ```
  12780. */
  12781. lengthSqr(): number;
  12782. /**
  12783. !#en Make the length of this vector to 1.
  12784. !#zh 向量归一化,让这个向量的长度为 1。
  12785. @example
  12786. ```js
  12787. var v = cc.v2(10, 10);
  12788. v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
  12789. ```
  12790. */
  12791. normalizeSelf(): Vec2;
  12792. /**
  12793. !#en
  12794. Returns this vector with a magnitude of 1.<br/>
  12795. <br/>
  12796. 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.
  12797. !#zh
  12798. 返回归一化后的向量。<br/>
  12799. <br/>
  12800. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  12801. @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
  12802. */
  12803. normalize(out?: Vec2): Vec2;
  12804. /**
  12805. !#en Get angle in radian between this and vector.
  12806. !#zh 夹角的弧度。
  12807. @param vector vector
  12808. */
  12809. angle(vector: Vec2): number;
  12810. /**
  12811. !#en Get angle in radian between this and vector with direction.
  12812. !#zh 带方向的夹角的弧度。
  12813. @param vector vector
  12814. */
  12815. signAngle(vector: Vec2): number;
  12816. /**
  12817. !#en rotate
  12818. !#zh 返回旋转给定弧度后的新向量。
  12819. @param radians radians
  12820. @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
  12821. */
  12822. rotate(radians: number, out?: Vec2): Vec2;
  12823. /**
  12824. !#en rotate self
  12825. !#zh 按指定弧度旋转向量。
  12826. @param radians radians
  12827. */
  12828. rotateSelf(radians: number): Vec2;
  12829. /**
  12830. !#en Calculates the projection of the current vector over the given vector.
  12831. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  12832. @param vector vector
  12833. @example
  12834. ```js
  12835. var v1 = cc.v2(20, 20);
  12836. var v2 = cc.v2(5, 5);
  12837. v1.project(v2); // Vec2 {x: 20, y: 20};
  12838. ```
  12839. */
  12840. project(vector: Vec2): Vec2;
  12841. /**
  12842. Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
  12843. @param m matrix to transform with
  12844. @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
  12845. */
  12846. transformMat4(m: Mat4, out?: Vec2): Vec2;
  12847. /**
  12848. Returns the maximum value in x, y.
  12849. */
  12850. maxAxis(): number;
  12851. }
  12852. /** !#en A 2D rectangle defined by x, y position and width, height.
  12853. !#zh 通过位置和宽高定义的 2D 矩形。 */
  12854. export class Rect extends ValueType {
  12855. /**
  12856. !#en
  12857. Constructor of Rect class.
  12858. see {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} for convenience method.
  12859. !#zh
  12860. Rect类的构造函数。可以通过 {{#crossLink "cc/rect:method"}} cc.rect {{/crossLink}} 简便方法进行创建。
  12861. @param x x
  12862. @param y y
  12863. @param w w
  12864. @param h h
  12865. */
  12866. constructor(x?: number, y?: number, w?: number, h?: number);
  12867. /**
  12868. !#en Creates a rectangle from two coordinate values.
  12869. !#zh 根据指定 2 个坐标创建出一个矩形区域。
  12870. @param v1 v1
  12871. @param v2 v2
  12872. @example
  12873. ```js
  12874. cc.Rect.fromMinMax(cc.v2(10, 10), cc.v2(20, 20)); // Rect {x: 10, y: 10, width: 10, height: 10};
  12875. ```
  12876. */
  12877. static fromMinMax(v1: Vec2, v2: Vec2): Rect;
  12878. x: number;
  12879. y: number;
  12880. width: number;
  12881. height: number;
  12882. /**
  12883. !#en TODO
  12884. !#zh 克隆一个新的 Rect。
  12885. @example
  12886. ```js
  12887. var a = new cc.Rect(0, 0, 10, 10);
  12888. a.clone();// Rect {x: 0, y: 0, width: 10, height: 10}
  12889. ```
  12890. */
  12891. clone(): Rect;
  12892. /**
  12893. !#en TODO
  12894. !#zh 是否等于指定的矩形。
  12895. @param other other
  12896. @example
  12897. ```js
  12898. var a = new cc.Rect(0, 0, 10, 10);
  12899. var b = new cc.Rect(0, 0, 10, 10);
  12900. a.equals(b);// true;
  12901. ```
  12902. */
  12903. equals(other: Rect): boolean;
  12904. /**
  12905. !#en TODO
  12906. !#zh 线性插值
  12907. @param to to
  12908. @param ratio the interpolation coefficient.
  12909. @param out optional, the receiving vector.
  12910. @example
  12911. ```js
  12912. var a = new cc.Rect(0, 0, 10, 10);
  12913. var b = new cc.Rect(50, 50, 100, 100);
  12914. update (dt) {
  12915. // method 1;
  12916. var c = a.lerp(b, dt * 0.1);
  12917. // method 2;
  12918. a.lerp(b, dt * 0.1, c);
  12919. }
  12920. ```
  12921. */
  12922. lerp(to: Rect, ratio: number, out?: Rect): Rect;
  12923. /**
  12924. !#en Check whether the current rectangle intersects with the given one
  12925. !#zh 当前矩形与指定矩形是否相交。
  12926. @param rect rect
  12927. @example
  12928. ```js
  12929. var a = new cc.Rect(0, 0, 10, 10);
  12930. var b = new cc.Rect(0, 0, 20, 20);
  12931. a.intersects(b);// true
  12932. ```
  12933. */
  12934. intersects(rect: Rect): boolean;
  12935. /**
  12936. !#en Returns the overlapping portion of 2 rectangles.
  12937. !#zh 返回 2 个矩形重叠的部分。
  12938. @param out Stores the result
  12939. @param rectB rectB
  12940. @example
  12941. ```js
  12942. var a = new cc.Rect(0, 10, 20, 20);
  12943. var b = new cc.Rect(0, 10, 10, 10);
  12944. var intersection = new cc.Rect();
  12945. a.intersection(intersection, b); // intersection {x: 0, y: 10, width: 10, height: 10};
  12946. ```
  12947. */
  12948. intersection(out: Rect, rectB: Rect): Rect;
  12949. /**
  12950. !#en Check whether the current rect contains the given point
  12951. !#zh 当前矩形是否包含指定坐标点。
  12952. Returns true if the point inside this rectangle.
  12953. @param point point
  12954. @example
  12955. ```js
  12956. var a = new cc.Rect(0, 0, 10, 10);
  12957. var b = new cc.Vec2(0, 5);
  12958. a.contains(b);// true
  12959. ```
  12960. */
  12961. contains(point: Vec2): boolean;
  12962. /**
  12963. !#en Returns true if the other rect totally inside this rectangle.
  12964. !#zh 当前矩形是否包含指定矩形。
  12965. @param rect rect
  12966. @example
  12967. ```js
  12968. var a = new cc.Rect(0, 0, 20, 20);
  12969. var b = new cc.Rect(0, 0, 10, 10);
  12970. a.containsRect(b);// true
  12971. ```
  12972. */
  12973. containsRect(rect: Rect): boolean;
  12974. /**
  12975. !#en Returns the smallest rectangle that contains the current rect and the given rect.
  12976. !#zh 返回一个包含当前矩形和指定矩形的最小矩形。
  12977. @param out Stores the result
  12978. @param rectB rectB
  12979. @example
  12980. ```js
  12981. var a = new cc.Rect(0, 10, 20, 20);
  12982. var b = new cc.Rect(0, 10, 10, 10);
  12983. var union = new cc.Rect();
  12984. a.union(union, b); // union {x: 0, y: 10, width: 20, height: 20};
  12985. ```
  12986. */
  12987. union(out: Rect, rectB: Rect): Rect;
  12988. /**
  12989. !#en Apply matrix4 to the rect.
  12990. !#zh 使用 mat4 对矩形进行矩阵转换。
  12991. @param out The output rect
  12992. @param mat The matrix4
  12993. */
  12994. transformMat4(out: Rect, mat: Mat4): void;
  12995. /**
  12996. !#en Output rect informations to string
  12997. !#zh 转换为方便阅读的字符串
  12998. @example
  12999. ```js
  13000. var a = new cc.Rect(0, 0, 10, 10);
  13001. a.toString();// "(0.00, 0.00, 10.00, 10.00)";
  13002. ```
  13003. */
  13004. toString(): string;
  13005. /** !#en The minimum x value, equals to rect.x
  13006. !#zh 矩形 x 轴上的最小值,等价于 rect.x。 */
  13007. xMin: number;
  13008. /** !#en The minimum y value, equals to rect.y
  13009. !#zh 矩形 y 轴上的最小值。 */
  13010. yMin: number;
  13011. /** !#en The maximum x value.
  13012. !#zh 矩形 x 轴上的最大值。 */
  13013. xMax: number;
  13014. /** !#en The maximum y value.
  13015. !#zh 矩形 y 轴上的最大值。 */
  13016. yMax: number;
  13017. /** !#en The position of the center of the rectangle.
  13018. !#zh 矩形的中心点。 */
  13019. center: Vec2;
  13020. /** !#en The X and Y position of the rectangle.
  13021. !#zh 矩形的 x 和 y 坐标。 */
  13022. origin: Vec2;
  13023. /** !#en Width and height of the rectangle.
  13024. !#zh 矩形的大小。 */
  13025. size: Size;
  13026. }
  13027. /** !#en Representation of 3D vectors and points.
  13028. !#zh 表示 3D 向量和坐标 */
  13029. export class Vec3 extends ValueType {
  13030. /**
  13031. !#en Returns the length of this vector.
  13032. !#zh 返回该向量的长度。
  13033. @example
  13034. ```js
  13035. var v = cc.v3(10, 10, 10);
  13036. v.mag(); // return 17.320508075688775;
  13037. ```
  13038. */
  13039. mag(): number;
  13040. /**
  13041. !#en Returns the squared length of this vector.
  13042. !#zh 返回该向量的长度平方。
  13043. */
  13044. magSqr(): number;
  13045. /**
  13046. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  13047. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  13048. @param vector vector
  13049. */
  13050. subSelf(vector: Vec3): Vec3;
  13051. /**
  13052. !#en Subtracts one vector from this, and returns the new result.
  13053. !#zh 向量减法,并返回新结果。
  13054. @param vector vector
  13055. @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
  13056. */
  13057. sub(vector: Vec3, out?: Vec3): Vec3;
  13058. /**
  13059. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  13060. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  13061. @param num num
  13062. */
  13063. mulSelf(num: number): Vec3;
  13064. /**
  13065. !#en Multiplies by a number, and returns the new result.
  13066. !#zh 缩放向量,并返回新结果。
  13067. @param num num
  13068. @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
  13069. */
  13070. mul(num: number, out?: Vec3): Vec3;
  13071. /**
  13072. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  13073. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  13074. @param num num
  13075. */
  13076. divSelf(num: number): Vec3;
  13077. /**
  13078. !#en Divides by a number, and returns the new result.
  13079. !#zh 向量除法,并返回新的结果。
  13080. @param num num
  13081. @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
  13082. */
  13083. div(num: number, out?: Vec3): Vec3;
  13084. /**
  13085. !#en Multiplies two vectors.
  13086. !#zh 分量相乘。
  13087. @param vector vector
  13088. */
  13089. scaleSelf(vector: Vec3): Vec3;
  13090. /**
  13091. !#en Multiplies two vectors, and returns the new result.
  13092. !#zh 分量相乘,并返回新的结果。
  13093. @param vector vector
  13094. @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
  13095. */
  13096. scale(vector: Vec3, out?: Vec3): Vec3;
  13097. /**
  13098. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  13099. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  13100. */
  13101. negSelf(): Vec3;
  13102. /**
  13103. !#en Negates the components, and returns the new result.
  13104. !#zh 返回取反后的新向量。
  13105. @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
  13106. */
  13107. neg(out?: Vec3): Vec3;
  13108. /** !#en return a Vec3 object with x = 1, y = 1, z = 1.
  13109. !#zh 新 Vec3 对象。 */
  13110. static ONE: Vec3;
  13111. /** !#en return a Vec3 object with x = 0, y = 0, z = 0.
  13112. !#zh 返回 x = 0,y = 0,z = 0 的 Vec3 对象。 */
  13113. static ZERO: Vec3;
  13114. /** !#en return a Vec3 object with x = 0, y = 1, z = 0.
  13115. !#zh 返回 x = 0, y = 1, z = 0 的 Vec3 对象。 */
  13116. static UP: Vec3;
  13117. /** !#en return a Vec3 object with x = 1, y = 0, z = 0.
  13118. !#zh 返回 x = 1,y = 0,z = 0 的 Vec3 对象。 */
  13119. static RIGHT: Vec3;
  13120. /** !#en return a Vec3 object with x = 0, y = 0, z = 1.
  13121. !#zh 返回 x = 0,y = 0,z = 1 的 Vec3 对象。 */
  13122. static FORWARD: Vec3;
  13123. /**
  13124. !#zh 将目标赋值为零向量
  13125. !#en The target of an assignment zero vector
  13126. */
  13127. static zero<Out extends IVec3Like> (out: Out): Out;
  13128. /**
  13129. !#zh 获得指定向量的拷贝
  13130. !#en Obtaining copy vectors designated
  13131. */
  13132. static clone<Out extends IVec3Like> (a: Out): Vec3;
  13133. /**
  13134. !#zh 复制目标向量
  13135. !#en Copy the target vector
  13136. */
  13137. static copy<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like): Out;
  13138. /**
  13139. !#zh 设置向量值
  13140. !#en Set to value
  13141. */
  13142. static set<Out extends IVec3Like> (out: Out, x: number, y: number, z: number): Out;
  13143. /**
  13144. !#zh 逐元素向量加法
  13145. !#en Element-wise vector addition
  13146. */
  13147. static add<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13148. /**
  13149. !#zh 逐元素向量减法
  13150. !#en Element-wise vector subtraction
  13151. */
  13152. static subtract<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13153. /**
  13154. !#zh 逐元素向量乘法 (分量积)
  13155. !#en Element-wise vector multiplication (product component)
  13156. */
  13157. static multiply<Out extends IVec3Like, Vec3Like_1 extends IVec3Like, Vec3Like_2 extends IVec3Like> (out: Out, a: Vec3Like_1, b: Vec3Like_2): Out;
  13158. /**
  13159. !#zh 逐元素向量除法
  13160. !#en Element-wise vector division
  13161. */
  13162. static divide<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13163. /**
  13164. !#zh 逐元素向量向上取整
  13165. !#en Rounding up by elements of the vector
  13166. */
  13167. static ceil<Out extends IVec3Like> (out: Out, a: Out): Out;
  13168. /**
  13169. !#zh 逐元素向量向下取整
  13170. !#en Element vector by rounding down
  13171. */
  13172. static floor<Out extends IVec3Like> (out: Out, a: Out): Out;
  13173. /**
  13174. !#zh 逐元素向量最小值
  13175. !#en The minimum by-element vector
  13176. */
  13177. static min<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13178. /**
  13179. !#zh 逐元素向量最大值
  13180. !#en The maximum value of the element-wise vector
  13181. */
  13182. static max<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13183. /**
  13184. !#zh 逐元素向量四舍五入取整
  13185. !#en Element-wise vector of rounding to whole
  13186. */
  13187. static round<Out extends IVec3Like> (out: Out, a: Out): Out;
  13188. /**
  13189. !#zh 向量标量乘法
  13190. !#en Vector scalar multiplication
  13191. */
  13192. static multiplyScalar<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like, b: number): Out;
  13193. /**
  13194. !#zh 逐元素向量乘加: A + B * scale
  13195. !#en Element-wise vector multiply add: A + B * scale
  13196. */
  13197. static scaleAndAdd<Out extends IVec3Like> (out: Out, a: Out, b: Out, scale: number): Out;
  13198. /**
  13199. !#zh 求两向量的欧氏距离
  13200. !#en Seeking two vectors Euclidean distance
  13201. */
  13202. static distance<Out extends IVec3Like> (a: Out, b: Out): number;
  13203. /**
  13204. !#zh 求两向量的欧氏距离平方
  13205. !#en Euclidean distance squared seeking two vectors
  13206. */
  13207. static squaredDistance<Out extends IVec3Like> (a: Out, b: Out): number;
  13208. /**
  13209. !#zh 求向量长度
  13210. !#en Seeking vector length
  13211. */
  13212. static len<Out extends IVec3Like> (a: Out): number;
  13213. /**
  13214. !#zh 求向量长度平方
  13215. !#en Seeking squared vector length
  13216. */
  13217. static lengthSqr<Out extends IVec3Like> (a: Out): number;
  13218. /**
  13219. !#zh 逐元素向量取负
  13220. !#en By taking the negative elements of the vector
  13221. */
  13222. static negate<Out extends IVec3Like> (out: Out, a: Out): Out;
  13223. /**
  13224. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13225. !#en Element vector by taking the inverse, return near 0 Infinity
  13226. */
  13227. static inverse<Out extends IVec3Like> (out: Out, a: Out): Out;
  13228. /**
  13229. !#zh 逐元素向量取倒数,接近 0 时返回 0
  13230. !#en Element vector by taking the inverse, return near 0 0
  13231. */
  13232. static inverseSafe<Out extends IVec3Like> (out: Out, a: Out): Out;
  13233. /**
  13234. !#zh 归一化向量
  13235. !#en Normalized vector
  13236. */
  13237. static normalize<Out extends IVec3Like, Vec3Like extends IVec3Like> (out: Out, a: Vec3Like): Out;
  13238. /**
  13239. !#zh 向量点积(数量积)
  13240. !#en Vector dot product (scalar product)
  13241. */
  13242. static dot<Out extends IVec3Like> (a: Out, b: Out): number;
  13243. /**
  13244. !#zh 向量叉积(向量积)
  13245. !#en Vector cross product (vector product)
  13246. */
  13247. static cross<Out extends IVec3Like, Vec3Like_1 extends IVec3Like, Vec3Like_2 extends IVec3Like> (out: Out, a: Vec3Like_1, b: Vec3Like_2): Out;
  13248. /**
  13249. !#zh 逐元素向量线性插值: A + t * (B - A)
  13250. !#en Vector element by element linear interpolation: A + t * (B - A)
  13251. */
  13252. static lerp<Out extends IVec3Like> (out: Out, a: Out, b: Out, t: number): Out;
  13253. /**
  13254. !#zh 生成一个在单位球体上均匀分布的随机向量
  13255. !#en Generates a uniformly distributed random vectors on the unit sphere
  13256. @param scale 生成的向量长度
  13257. */
  13258. static random<Out extends IVec3Like> (out: Out, scale?: number): Out;
  13259. /**
  13260. !#zh 向量与四维矩阵乘法,默认向量第四位为 1。
  13261. !#en Four-dimensional vector and matrix multiplication, the default vectors fourth one.
  13262. */
  13263. static transformMat4<Out extends IVec3Like, Vec3Like extends IVec3Like, MatLike extends IMat4Like> (out: Out, a: Vec3Like, mat: MatLike): Out;
  13264. /**
  13265. !#zh 向量与四维矩阵乘法,默认向量第四位为 0。
  13266. !#en Four-dimensional vector and matrix multiplication, vector fourth default is 0.
  13267. */
  13268. static transformMat4Normal<Out extends IVec3Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike): Out;
  13269. /**
  13270. !#zh 向量与三维矩阵乘法
  13271. !#en Dimensional vector matrix multiplication
  13272. */
  13273. static transformMat3<Out extends IVec3Like, MatLike extends IMat3Like> (out: Out, a: Out, mat: MatLike): Out;
  13274. /**
  13275. !#zh 向量仿射变换
  13276. !#en Affine transformation vector
  13277. */
  13278. static transformAffine<Out extends IVec3Like, VecLike extends IVec3Like, MatLike extends IMat4Like>(out: Out, v: VecLike, mat: MatLike): Out;
  13279. /**
  13280. !#zh 向量四元数乘法
  13281. !#en Vector quaternion multiplication
  13282. */
  13283. static transformQuat<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike> (out: Out, a: VecLike, q: QuatLike): Out;
  13284. /**
  13285. !#zh 以缩放 -> 旋转 -> 平移顺序变换向量
  13286. !#en To scale -> rotation -> transformation vector sequence translation
  13287. */
  13288. static transformRTS<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike>(out: Out, a: VecLike, r: QuatLike, t: VecLike, s: VecLike): Out;
  13289. /**
  13290. !#zh 以平移 -> 旋转 -> 缩放顺序逆变换向量
  13291. !#en Translational -> rotation -> Zoom inverse transformation vector sequence
  13292. */
  13293. static transformInverseRTS<Out extends IVec3Like, VecLike extends IVec3Like, QuatLike extends IQuatLike>(out: Out, a: VecLike, r: QuatLike, t: VecLike, s: VecLike): Out;
  13294. /**
  13295. !#zh 绕 X 轴旋转向量指定弧度
  13296. !#en Rotation vector specified angle about the X axis
  13297. @param v 待旋转向量
  13298. @param o 旋转中心
  13299. @param a 旋转弧度
  13300. */
  13301. static rotateX<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number): Out;
  13302. /**
  13303. !#zh 绕 Y 轴旋转向量指定弧度
  13304. !#en Rotation vector specified angle around the Y axis
  13305. @param v 待旋转向量
  13306. @param o 旋转中心
  13307. @param a 旋转弧度
  13308. */
  13309. static rotateY<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number): Out;
  13310. /**
  13311. !#zh 绕 Z 轴旋转向量指定弧度
  13312. !#en Around the Z axis specified angle vector
  13313. @param v 待旋转向量
  13314. @param o 旋转中心
  13315. @param a 旋转弧度
  13316. */
  13317. static rotateZ<Out extends IVec3Like> (out: Out, v: Out, o: Out, a: number): Out;
  13318. /**
  13319. !#zh 向量等价判断
  13320. !#en Equivalent vectors Analyzing
  13321. */
  13322. static strictEquals<Out extends IVec3Like> (a: Out, b: Out): boolean;
  13323. /**
  13324. !#zh 排除浮点数误差的向量近似等价判断
  13325. !#en Negative error vector floating point approximately equivalent Analyzing
  13326. */
  13327. static equals<Out extends IVec3Like> (a: Out, b: Out, epsilon?: number): boolean;
  13328. /**
  13329. !#zh 求两向量夹角弧度
  13330. !#en Radian angle between two vectors seek
  13331. */
  13332. static angle<Out extends IVec3Like> (a: Out, b: Out): number;
  13333. /**
  13334. !#zh 计算向量在指定平面上的投影
  13335. !#en Calculating a projection vector in the specified plane
  13336. @param a 待投影向量
  13337. @param n 指定平面的法线
  13338. */
  13339. static projectOnPlane<Out extends IVec3Like> (out: Out, a: Out, n: Out): Out;
  13340. /**
  13341. !#zh 计算向量在指定向量上的投影
  13342. !#en Projection vector calculated in the vector designated
  13343. @param a 待投影向量
  13344. @param n 目标向量
  13345. */
  13346. static project<Out extends IVec3Like> (out: Out, a: Out, b: Out): Out;
  13347. /**
  13348. !#zh 向量转数组
  13349. !#en Vector transfer array
  13350. @param ofs 数组起始偏移量
  13351. */
  13352. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec3Like, ofs?: number): Out;
  13353. /**
  13354. !#zh 数组转向量
  13355. !#en Array steering amount
  13356. @param ofs 数组起始偏移量
  13357. */
  13358. static fromArray <Out extends IVec3Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  13359. x: number;
  13360. y: number;
  13361. z: number;
  13362. /**
  13363. !#en
  13364. Constructor
  13365. see {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  13366. !#zh
  13367. 构造函数,可查看 {{#crossLink "cc/vec3:method"}}cc.v3{{/crossLink}}
  13368. @param x x
  13369. @param y y
  13370. @param z z
  13371. */
  13372. constructor(x?: Vec3|number, y?: number, z?: number);
  13373. /**
  13374. !#en clone a Vec3 value
  13375. !#zh 克隆一个 Vec3 值
  13376. */
  13377. clone(): Vec3;
  13378. /**
  13379. !#en Set the current vector value with the given vector.
  13380. !#zh 用另一个向量设置当前的向量对象值。
  13381. @param newValue !#en new value to set. !#zh 要设置的新值
  13382. */
  13383. set(newValue: Vec3): Vec3;
  13384. /**
  13385. !#en Check whether the vector equals another one
  13386. !#zh 当前的向量是否与指定的向量相等。
  13387. @param other other
  13388. */
  13389. equals(other: Vec3): boolean;
  13390. /**
  13391. !#en Check whether two vector equal with some degree of variance.
  13392. !#zh
  13393. 近似判断两个点是否相等。<br/>
  13394. 判断 2 个向量是否在指定数值的范围之内,如果在则返回 true,反之则返回 false。
  13395. @param other other
  13396. @param variance variance
  13397. */
  13398. fuzzyEquals(other: Vec3, variance: number): boolean;
  13399. /**
  13400. !#en Transform to string with vector informations
  13401. !#zh 转换为方便阅读的字符串。
  13402. */
  13403. toString(): string;
  13404. /**
  13405. !#en Calculate linear interpolation result between this vector and another one with given ratio
  13406. !#zh 线性插值。
  13407. @param to to
  13408. @param ratio the interpolation coefficient
  13409. @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
  13410. */
  13411. lerp(to: Vec3, ratio: number, out?: Vec3): Vec3;
  13412. /**
  13413. !#en Clamp the vector between from float and to float.
  13414. !#zh
  13415. 返回指定限制区域后的向量。<br/>
  13416. 向量大于 max_inclusive 则返回 max_inclusive。<br/>
  13417. 向量小于 min_inclusive 则返回 min_inclusive。<br/>
  13418. 否则返回自身。
  13419. @param min_inclusive min_inclusive
  13420. @param max_inclusive max_inclusive
  13421. */
  13422. clampf(min_inclusive: Vec3, max_inclusive: Vec3): Vec3;
  13423. /**
  13424. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  13425. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  13426. @param vector vector
  13427. */
  13428. addSelf(vector: Vec3): Vec3;
  13429. /**
  13430. !#en Adds two vectors, and returns the new result.
  13431. !#zh 向量加法,并返回新结果。
  13432. @param vector vector
  13433. @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
  13434. */
  13435. add(vector: Vec3, out?: Vec3): Vec3;
  13436. /**
  13437. !#en Subtracts one vector from this.
  13438. !#zh 向量减法。
  13439. @param vector vector
  13440. */
  13441. subtract(vector: Vec3): Vec3;
  13442. /**
  13443. !#en Multiplies this by a number.
  13444. !#zh 缩放当前向量。
  13445. @param num num
  13446. */
  13447. multiplyScalar(num: number): Vec3;
  13448. /**
  13449. !#en Multiplies two vectors.
  13450. !#zh 分量相乘。
  13451. @param vector vector
  13452. */
  13453. multiply(vector: Vec3): Vec3;
  13454. /**
  13455. !#en Divides by a number.
  13456. !#zh 向量除法。
  13457. @param num num
  13458. */
  13459. divide(num: number): Vec3;
  13460. /**
  13461. !#en Negates the components.
  13462. !#zh 向量取反。
  13463. */
  13464. negate(): Vec3;
  13465. /**
  13466. !#en Dot product
  13467. !#zh 当前向量与指定向量进行点乘。
  13468. @param vector vector
  13469. */
  13470. dot(vector?: Vec3): number;
  13471. /**
  13472. !#en Cross product
  13473. !#zh 当前向量与指定向量进行叉乘。
  13474. @param vector vector
  13475. @param out out
  13476. */
  13477. cross(vector: Vec3, out?: Vec3): Vec3;
  13478. /**
  13479. !#en Returns the length of this vector.
  13480. !#zh 返回该向量的长度。
  13481. @example
  13482. ```js
  13483. var v = cc.v3(10, 10, 10);
  13484. v.len(); // return 17.320508075688775;
  13485. ```
  13486. */
  13487. len(): number;
  13488. /**
  13489. !#en Returns the squared length of this vector.
  13490. !#zh 返回该向量的长度平方。
  13491. */
  13492. lengthSqr(): number;
  13493. /**
  13494. !#en Make the length of this vector to 1.
  13495. !#zh 向量归一化,让这个向量的长度为 1。
  13496. */
  13497. normalizeSelf(): Vec3;
  13498. /**
  13499. !#en
  13500. Returns this vector with a magnitude of 1.<br/>
  13501. <br/>
  13502. 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.
  13503. !#zh
  13504. 返回归一化后的向量。<br/>
  13505. <br/>
  13506. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  13507. @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
  13508. */
  13509. normalize(out?: Vec3): Vec3;
  13510. /**
  13511. Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
  13512. @param m matrix to transform with
  13513. @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
  13514. */
  13515. transformMat4(m: Mat4, out?: Vec3): Vec3;
  13516. /**
  13517. Returns the maximum value in x, y, and z
  13518. */
  13519. maxAxis(): number;
  13520. /**
  13521. !#en Get angle in radian between this and vector.
  13522. !#zh 夹角的弧度。
  13523. @param vector vector
  13524. */
  13525. angle(vector: Vec3): number;
  13526. /**
  13527. !#en Calculates the projection of the current vector over the given vector.
  13528. !#zh 返回当前向量在指定 vector 向量上的投影向量。
  13529. @param vector vector
  13530. @example
  13531. ```js
  13532. var v1 = cc.v3(20, 20, 20);
  13533. var v2 = cc.v3(5, 5, 5);
  13534. v1.project(v2); // Vec3 {x: 20, y: 20, z: 20};
  13535. ```
  13536. */
  13537. project(vector: Vec3): Vec3;
  13538. /**
  13539. !#en Get angle in radian between this and vector with direction. <br/>
  13540. In order to compatible with the vec2 API.
  13541. !#zh 带方向的夹角的弧度。该方法仅用做兼容 2D 计算。
  13542. @param vector vector
  13543. */
  13544. signAngle(vector: Vec3|Vec2): number;
  13545. /**
  13546. !#en rotate. In order to compatible with the vec2 API.
  13547. !#zh 返回旋转给定弧度后的新向量。该方法仅用做兼容 2D 计算。
  13548. @param radians radians
  13549. @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
  13550. */
  13551. rotate(radians: number, out?: Vec3): Vec2;
  13552. /**
  13553. !#en rotate self. In order to compatible with the vec2 API.
  13554. !#zh 按指定弧度旋转向量。该方法仅用做兼容 2D 计算。
  13555. @param radians radians
  13556. */
  13557. rotateSelf(radians: number): Vec3;
  13558. }
  13559. /** !#en Representation of 3D vectors and points.
  13560. !#zh 表示 3D 向量和坐标 */
  13561. export class Vec4 extends ValueType {
  13562. /**
  13563. !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
  13564. !#zh 向量减法。如果你想保存结果到另一个向量,可使用 sub() 代替。
  13565. @param vector vector
  13566. */
  13567. subSelf(vector: Vec4): Vec4;
  13568. /**
  13569. !#en Subtracts one vector from this, and returns the new result.
  13570. !#zh 向量减法,并返回新结果。
  13571. @param vector vector
  13572. @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
  13573. */
  13574. sub(vector: Vec4, out?: Vec4): Vec4;
  13575. /**
  13576. !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
  13577. !#zh 缩放当前向量。如果你想结果保存到另一个向量,可使用 mul() 代替。
  13578. @param num num
  13579. */
  13580. mulSelf(num: number): Vec4;
  13581. /**
  13582. !#en Multiplies by a number, and returns the new result.
  13583. !#zh 缩放向量,并返回新结果。
  13584. @param num num
  13585. @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
  13586. */
  13587. mul(num: number, out?: Vec4): Vec4;
  13588. /**
  13589. !#en Divides by a number. If you want to save result to another vector, use div() instead.
  13590. !#zh 向量除法。如果你想结果保存到另一个向量,可使用 div() 代替。
  13591. @param num num
  13592. */
  13593. divSelf(num: number): Vec4;
  13594. /**
  13595. !#en Divides by a number, and returns the new result.
  13596. !#zh 向量除法,并返回新的结果。
  13597. @param num num
  13598. @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
  13599. */
  13600. div(num: number, out?: Vec4): Vec4;
  13601. /**
  13602. !#en Multiplies two vectors.
  13603. !#zh 分量相乘。
  13604. @param vector vector
  13605. */
  13606. scaleSelf(vector: Vec4): Vec4;
  13607. /**
  13608. !#en Multiplies two vectors, and returns the new result.
  13609. !#zh 分量相乘,并返回新的结果。
  13610. @param vector vector
  13611. @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
  13612. */
  13613. scale(vector: Vec4, out?: Vec4): Vec4;
  13614. /**
  13615. !#en Negates the components. If you want to save result to another vector, use neg() instead.
  13616. !#zh 向量取反。如果你想结果保存到另一个向量,可使用 neg() 代替。
  13617. */
  13618. negSelf(): Vec4;
  13619. /**
  13620. !#en Negates the components, and returns the new result.
  13621. !#zh 返回取反后的新向量。
  13622. @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
  13623. */
  13624. neg(out?: Vec4): Vec4;
  13625. /**
  13626. !#zh 获得指定向量的拷贝
  13627. !#en Obtaining copy vectors designated
  13628. */
  13629. static clone <Out extends IVec4Like> (a: Out): Vec4;
  13630. /**
  13631. !#zh 复制目标向量
  13632. !#en Copy the target vector
  13633. */
  13634. static copy <Out extends IVec4Like> (out: Out, a: Out): Out;
  13635. /**
  13636. !#zh 设置向量值
  13637. !#en Set to value
  13638. */
  13639. static set <Out extends IVec4Like> (out: Out, x: number, y: number, z: number, w: number): Out;
  13640. /**
  13641. !#zh 逐元素向量加法
  13642. !#en Element-wise vector addition
  13643. */
  13644. static add <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  13645. /**
  13646. !#zh 逐元素向量减法
  13647. !#en Element-wise vector subtraction
  13648. */
  13649. static subtract <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  13650. /**
  13651. !#zh 逐元素向量乘法
  13652. !#en Element-wise vector multiplication
  13653. */
  13654. static multiply <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  13655. /**
  13656. !#zh 逐元素向量除法
  13657. !#en Element-wise vector division
  13658. */
  13659. static divide <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  13660. /**
  13661. !#zh 逐元素向量向上取整
  13662. !#en Rounding up by elements of the vector
  13663. */
  13664. static ceil <Out extends IVec4Like> (out: Out, a: Out): Out;
  13665. /**
  13666. !#zh 逐元素向量向下取整
  13667. !#en Element vector by rounding down
  13668. */
  13669. static floor <Out extends IVec4Like> (out: Out, a: Out): Out;
  13670. /**
  13671. !#zh 逐元素向量最小值
  13672. !#en The minimum by-element vector
  13673. */
  13674. static min <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  13675. /**
  13676. !#zh 逐元素向量最大值
  13677. !#en The maximum value of the element-wise vector
  13678. */
  13679. static max <Out extends IVec4Like> (out: Out, a: Out, b: Out): Out;
  13680. /**
  13681. !#zh 逐元素向量四舍五入取整
  13682. !#en Element-wise vector of rounding to whole
  13683. */
  13684. static round <Out extends IVec4Like> (out: Out, a: Out): Out;
  13685. /**
  13686. !#zh 向量标量乘法
  13687. !#en Vector scalar multiplication
  13688. */
  13689. static multiplyScalar <Out extends IVec4Like> (out: Out, a: Out, b: number): Out;
  13690. /**
  13691. !#zh 逐元素向量乘加: A + B * scale
  13692. !#en Element-wise vector multiply add: A + B * scale
  13693. */
  13694. static scaleAndAdd <Out extends IVec4Like> (out: Out, a: Out, b: Out, scale: number): Out;
  13695. /**
  13696. !#zh 求两向量的欧氏距离
  13697. !#en Seeking two vectors Euclidean distance
  13698. */
  13699. static distance <Out extends IVec4Like> (a: Out, b: Out): number;
  13700. /**
  13701. !#zh 求两向量的欧氏距离平方
  13702. !#en Euclidean distance squared seeking two vectors
  13703. */
  13704. static squaredDistance <Out extends IVec4Like> (a: Out, b: Out): number;
  13705. /**
  13706. !#zh 求向量长度
  13707. !#en Seeking vector length
  13708. */
  13709. static len <Out extends IVec4Like> (a: Out): number;
  13710. /**
  13711. !#zh 求向量长度平方
  13712. !#en Seeking squared vector length
  13713. */
  13714. static lengthSqr <Out extends IVec4Like> (a: Out): number;
  13715. /**
  13716. !#zh 逐元素向量取负
  13717. !#en By taking the negative elements of the vector
  13718. */
  13719. static negate <Out extends IVec4Like> (out: Out, a: Out): Out;
  13720. /**
  13721. !#zh 逐元素向量取倒数,接近 0 时返回 Infinity
  13722. !#en Element vector by taking the inverse, return near 0 Infinity
  13723. */
  13724. static inverse <Out extends IVec4Like> (out: Out, a: Out): Out;
  13725. /**
  13726. !#zh 逐元素向量取倒数,接近 0 时返回 0
  13727. !#en Element vector by taking the inverse, return near 0 0
  13728. */
  13729. static inverseSafe <Out extends IVec4Like> (out: Out, a: Out): Out;
  13730. /**
  13731. !#zh 归一化向量
  13732. !#en Normalized vector
  13733. */
  13734. static normalize <Out extends IVec4Like> (out: Out, a: Out): Out;
  13735. /**
  13736. !#zh 向量点积(数量积)
  13737. !#en Vector dot product (scalar product)
  13738. */
  13739. static dot <Out extends IVec4Like> (a: Out, b: Out): number;
  13740. /**
  13741. !#zh 逐元素向量线性插值: A + t * (B - A)
  13742. !#en Vector element by element linear interpolation: A + t * (B - A)
  13743. */
  13744. static lerp <Out extends IVec4Like> (out: Out, a: Out, b: Out, t: number): Out;
  13745. /**
  13746. !#zh 生成一个在单位球体上均匀分布的随机向量
  13747. !#en Generates a uniformly distributed random vectors on the unit sphere
  13748. @param scale 生成的向量长度
  13749. */
  13750. static random <Out extends IVec4Like> (out: Out, scale?: number): Out;
  13751. /**
  13752. !#zh 向量矩阵乘法
  13753. !#en Vector matrix multiplication
  13754. */
  13755. static transformMat4 <Out extends IVec4Like, MatLike extends IMat4Like> (out: Out, a: Out, mat: MatLike): Out;
  13756. /**
  13757. !#zh 向量仿射变换
  13758. !#en Affine transformation vector
  13759. */
  13760. static transformAffine<Out extends IVec4Like, VecLike extends IVec4Like, MatLike extends IMat4Like>(out: Out, v: VecLike, mat: MatLike): Out;
  13761. /**
  13762. !#zh 向量四元数乘法
  13763. !#en Vector quaternion multiplication
  13764. */
  13765. static transformQuat <Out extends IVec4Like, QuatLike extends IQuatLike> (out: Out, a: Out, q: QuatLike): Out;
  13766. /**
  13767. !#zh 向量等价判断
  13768. !#en Equivalent vectors Analyzing
  13769. */
  13770. static strictEquals <Out extends IVec4Like> (a: Out, b: Out): boolean;
  13771. /**
  13772. !#zh 排除浮点数误差的向量近似等价判断
  13773. !#en Negative error vector floating point approximately equivalent Analyzing
  13774. */
  13775. static equals <Out extends IVec4Like> (a: Out, b: Out, epsilon?: number): boolean;
  13776. /**
  13777. !#zh 向量转数组
  13778. !#en Vector transfer array
  13779. @param ofs 数组起始偏移量
  13780. */
  13781. static toArray <Out extends IWritableArrayLike<number>> (out: Out, v: IVec4Like, ofs?: number): Out;
  13782. /**
  13783. !#zh 数组转向量
  13784. !#en Array steering amount
  13785. @param ofs 数组起始偏移量
  13786. */
  13787. static fromArray <Out extends IVec4Like> (out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out;
  13788. x: number;
  13789. y: number;
  13790. z: number;
  13791. w: number;
  13792. /**
  13793. !#en
  13794. Constructor
  13795. see {{#crossLink "cc/vec4:method"}}cc.v4{{/crossLink}}
  13796. !#zh
  13797. 构造函数,可查看 {{#crossLink "cc/vec4:method"}}cc.v4{{/crossLink}}
  13798. @param x x
  13799. @param y y
  13800. @param z z
  13801. @param w w
  13802. */
  13803. constructor(x?: number, y?: number, z?: number, w?: number);
  13804. /**
  13805. !#en clone a Vec4 value
  13806. !#zh 克隆一个 Vec4 值
  13807. */
  13808. clone(): Vec4;
  13809. /**
  13810. !#en Set the current vector value with the given vector.
  13811. !#zh 用另一个向量设置当前的向量对象值。
  13812. @param newValue !#en new value to set. !#zh 要设置的新值
  13813. */
  13814. set(newValue: Vec4): Vec4;
  13815. /**
  13816. !#en Check whether the vector equals another one
  13817. !#zh 当前的向量是否与指定的向量相等。
  13818. @param other other
  13819. @param epsilon epsilon
  13820. */
  13821. equals(other: Vec4, epsilon?: number): boolean;
  13822. /**
  13823. !#en Check whether the vector equals another one
  13824. !#zh 判断当前向量是否在误差范围内与指定分量的向量相等。
  13825. @param x 相比较的向量的 x 分量。
  13826. @param y 相比较的向量的 y 分量。
  13827. @param z 相比较的向量的 z 分量。
  13828. @param w 相比较的向量的 w 分量。
  13829. @param epsilon 允许的误差,应为非负数。
  13830. */
  13831. equals4f(x: number, y: number, z: number, w: number, epsilon?: number): boolean;
  13832. /**
  13833. !#en Check whether strict equals other Vec4
  13834. !#zh 判断当前向量是否与指定向量相等。两向量的各分量都分别相等时返回 `true`;否则返回 `false`。
  13835. @param other 相比较的向量。
  13836. */
  13837. strictEquals(other: Vec4): boolean;
  13838. /**
  13839. !#en Check whether strict equals other Vec4
  13840. !#zh 判断当前向量是否与指定分量的向量相等。两向量的各分量都分别相等时返回 `true`;否则返回 `false`。
  13841. @param x 指定向量的 x 分量。
  13842. @param y 指定向量的 y 分量。
  13843. @param z 指定向量的 z 分量。
  13844. @param w 指定向量的 w 分量。
  13845. */
  13846. strictEquals4f(x: number, y: number, z: number, w: number): boolean;
  13847. /**
  13848. !#en Calculate linear interpolation result between this vector and another one with given ratio
  13849. !#zh 根据指定的插值比率,从当前向量到目标向量之间做插值。
  13850. @param to 目标向量。
  13851. @param ratio 插值比率,范围为 [0,1]。
  13852. */
  13853. lerp(to: Vec4, ratio: number): Vec4;
  13854. /**
  13855. !#en Transform to string with vector informations
  13856. !#zh 返回当前向量的字符串表示。
  13857. */
  13858. toString(): string;
  13859. /**
  13860. !#en Clamp the vector between minInclusive and maxInclusive.
  13861. !#zh 设置当前向量的值,使其各个分量都处于指定的范围内。
  13862. @param minInclusive 每个分量都代表了对应分量允许的最小值。
  13863. @param maxInclusive 每个分量都代表了对应分量允许的最大值。
  13864. */
  13865. clampf(minInclusive: Vec4, maxInclusive: Vec4): Vec4;
  13866. /**
  13867. !#en Adds this vector. If you want to save result to another vector, use add() instead.
  13868. !#zh 向量加法。如果你想保存结果到另一个向量,使用 add() 代替。
  13869. @param vector vector
  13870. */
  13871. addSelf(vector: Vec4): Vec4;
  13872. /**
  13873. !#en Adds two vectors, and returns the new result.
  13874. !#zh 向量加法,并返回新结果。
  13875. @param vector vector
  13876. @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
  13877. */
  13878. add(vector: Vec4, out?: Vec4): Vec4;
  13879. /**
  13880. !#en Subtracts one vector from this, and returns the new result.
  13881. !#zh 向量减法,并返回新结果。
  13882. @param vector vector
  13883. @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
  13884. */
  13885. subtract(vector: Vec4, out?: Vec4): Vec4;
  13886. /**
  13887. !#en Multiplies this by a number.
  13888. !#zh 缩放当前向量。
  13889. @param num num
  13890. */
  13891. multiplyScalar(num: number): Vec4;
  13892. /**
  13893. !#en Multiplies two vectors.
  13894. !#zh 分量相乘。
  13895. @param vector vector
  13896. */
  13897. multiply(vector: Vec4): Vec4;
  13898. /**
  13899. !#en Divides by a number.
  13900. !#zh 向量除法。
  13901. @param num num
  13902. */
  13903. divide(num: number): Vec4;
  13904. /**
  13905. !#en Negates the components.
  13906. !#zh 向量取反
  13907. */
  13908. negate(): Vec4;
  13909. /**
  13910. !#en Dot product
  13911. !#zh 当前向量与指定向量进行点乘。
  13912. @param vector vector
  13913. */
  13914. dot(vector?: Vec4): number;
  13915. /**
  13916. !#en Cross product
  13917. !#zh 当前向量与指定向量进行叉乘。
  13918. @param vector vector
  13919. @param out out
  13920. */
  13921. cross(vector: Vec4, out?: Vec4): Vec4;
  13922. /**
  13923. !#en Returns the length of this vector.
  13924. !#zh 返回该向量的长度。
  13925. @example
  13926. ```js
  13927. var v = cc.v4(10, 10);
  13928. v.len(); // return 14.142135623730951;
  13929. ```
  13930. */
  13931. len(): number;
  13932. /**
  13933. !#en Returns the squared length of this vector.
  13934. !#zh 返回该向量的长度平方。
  13935. */
  13936. lengthSqr(): number;
  13937. /**
  13938. !#en Make the length of this vector to 1.
  13939. !#zh 向量归一化,让这个向量的长度为 1。
  13940. */
  13941. normalizeSelf(): Vec4;
  13942. /**
  13943. !#en
  13944. Returns this vector with a magnitude of 1.<br/>
  13945. <br/>
  13946. 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.
  13947. !#zh
  13948. 返回归一化后的向量。<br/>
  13949. <br/>
  13950. 注意,当前向量不变,并返回一个新的归一化向量。如果你想来归一化当前向量,可使用 normalizeSelf 函数。
  13951. @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
  13952. */
  13953. normalize(out?: Vec4): Vec4;
  13954. /**
  13955. Transforms the vec4 with a mat4. 4th vector component is implicitly '1'
  13956. @param m matrix to transform with
  13957. @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
  13958. */
  13959. transformMat4(m: Mat4, out?: Vec4): Vec4;
  13960. /**
  13961. Returns the maximum value in x, y, z, w.
  13962. */
  13963. maxAxis(): number;
  13964. }
  13965. /** !#en The module provides utilities for working with file and directory paths
  13966. !#zh 用于处理文件与目录的路径的模块 */
  13967. export class path {
  13968. /**
  13969. !#en Join strings to be a path.
  13970. !#zh 拼接字符串为 Path
  13971. @example
  13972. ```js
  13973. ------------------------------
  13974. cc.path.join("a", "b.png"); //-->"a/b.png"
  13975. cc.path.join("a", "b", "c.png"); //-->"a/b/c.png"
  13976. cc.path.join("a", "b"); //-->"a/b"
  13977. cc.path.join("a", "b", "/"); //-->"a/b/"
  13978. cc.path.join("a", "b/", "/"); //-->"a/b/"
  13979. ```
  13980. */
  13981. static join(): string;
  13982. /**
  13983. !#en Get the ext name of a path including '.', like '.png'.
  13984. !#zh 返回 Path 的扩展名,包括 '.',例如 '.png'。
  13985. @param pathStr pathStr
  13986. @example
  13987. ```js
  13988. ---------------------------
  13989. cc.path.extname("a/b.png"); //-->".png"
  13990. cc.path.extname("a/b.png?a=1&b=2"); //-->".png"
  13991. cc.path.extname("a/b"); //-->null
  13992. cc.path.extname("a/b?a=1&b=2"); //-->null
  13993. ```
  13994. */
  13995. static extname(pathStr: string): any;
  13996. /**
  13997. !#en Get the main name of a file name
  13998. !#zh 获取文件名的主名称
  13999. @param fileName fileName
  14000. */
  14001. static mainFileName(fileName: string): string;
  14002. /**
  14003. !#en Get the file name of a file path.
  14004. !#zh 获取文件路径的文件名。
  14005. @param pathStr pathStr
  14006. @param extname extname
  14007. @example
  14008. ```js
  14009. ---------------------------------
  14010. cc.path.basename("a/b.png"); //-->"b.png"
  14011. cc.path.basename("a/b.png?a=1&b=2"); //-->"b.png"
  14012. cc.path.basename("a/b.png", ".png"); //-->"b"
  14013. cc.path.basename("a/b.png?a=1&b=2", ".png"); //-->"b"
  14014. cc.path.basename("a/b.png", ".txt"); //-->"b.png"
  14015. ```
  14016. */
  14017. static basename(pathStr: string, extname?: string): any;
  14018. /**
  14019. !#en Get dirname of a file path.
  14020. !#zh 获取文件路径的目录名。
  14021. @param pathStr pathStr
  14022. @example
  14023. ```js
  14024. ---------------------------------
  14025. * unix
  14026. cc.path.driname("a/b/c.png"); //-->"a/b"
  14027. cc.path.driname("a/b/c.png?a=1&b=2"); //-->"a/b"
  14028. cc.path.dirname("a/b/"); //-->"a/b"
  14029. cc.path.dirname("c.png"); //-->""
  14030. * windows
  14031. cc.path.driname("a\\b\\c.png"); //-->"a\b"
  14032. cc.path.driname("a\\b\\c.png?a=1&b=2"); //-->"a\b"
  14033. ```
  14034. */
  14035. static dirname(pathStr: string): any;
  14036. /**
  14037. !#en Change extname of a file path.
  14038. !#zh 更改文件路径的扩展名。
  14039. @param pathStr pathStr
  14040. @param extname extname
  14041. @example
  14042. ```js
  14043. ---------------------------------
  14044. cc.path.changeExtname("a/b.png", ".plist"); //-->"a/b.plist"
  14045. cc.path.changeExtname("a/b.png?a=1&b=2", ".plist"); //-->"a/b.plist?a=1&b=2"
  14046. ```
  14047. */
  14048. static changeExtname(pathStr: string, extname?: string): string;
  14049. }
  14050. /** !#en
  14051. AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.<br/>
  14052. !#zh
  14053. AffineTransform 类代表一个仿射变换矩阵。它基本上是由平移旋转,缩放转变所组成。<br/> */
  14054. export class AffineTransform {
  14055. /**
  14056. !#en Create a AffineTransform object with all contents in the matrix.
  14057. !#zh 用在矩阵中的所有内容创建一个 AffineTransform 对象。
  14058. @param a a
  14059. @param b b
  14060. @param c c
  14061. @param d d
  14062. @param tx tx
  14063. @param ty ty
  14064. */
  14065. static create(a: number, b: number, c: number, d: number, tx: number, ty: number): AffineTransform;
  14066. /**
  14067. !#en
  14068. Create a identity transformation matrix: <br/>
  14069. [ 1, 0, 0, <br/>
  14070. 0, 1, 0 ]
  14071. !#zh
  14072. 单位矩阵:<br/>
  14073. [ 1, 0, 0, <br/>
  14074. 0, 1, 0 ]
  14075. */
  14076. static identity(): AffineTransform;
  14077. /**
  14078. !#en Clone a AffineTransform object from the specified transform.
  14079. !#zh 克隆指定的 AffineTransform 对象。
  14080. @param t t
  14081. */
  14082. static clone(t: AffineTransform): AffineTransform;
  14083. /**
  14084. !#en
  14085. Concatenate a transform matrix to another
  14086. The results are reflected in the out affine transform
  14087. out = t1 * t2
  14088. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  14089. !#zh
  14090. 拼接两个矩阵,将结果保存到 out 矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  14091. out = t1 * t2
  14092. @param out Out object to store the concat result
  14093. @param t1 The first transform object.
  14094. @param t2 The transform object to concatenate.
  14095. */
  14096. static concat(out: AffineTransform, t1: AffineTransform, t2: AffineTransform): AffineTransform;
  14097. /**
  14098. !#en Get the invert transform of an AffineTransform object.
  14099. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  14100. !#zh 求逆矩阵。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  14101. @param out out
  14102. @param t t
  14103. */
  14104. static invert(out: AffineTransform, t: AffineTransform): AffineTransform;
  14105. /**
  14106. !#en Get an AffineTransform object from a given matrix 4x4.
  14107. This function is memory free, you should create the output affine transform by yourself and manage its memory.
  14108. !#zh 从一个 4x4 Matrix 获取 AffineTransform 对象。这个函数不创建任何内存,你需要先创建 AffineTransform 对象用来存储结果,并作为第一个参数传入函数。
  14109. @param out out
  14110. @param mat mat
  14111. */
  14112. static invert(out: AffineTransform, mat: Mat4): AffineTransform;
  14113. /**
  14114. !#en Apply the affine transformation on a point.
  14115. This function is memory free, you should create the output Vec2 by yourself and manage its memory.
  14116. !#zh 对一个点应用矩阵变换。这个函数不创建任何内存,你需要先创建一个 Vec2 对象用来存储结果,并作为第一个参数传入函数。
  14117. @param out The output point to store the result
  14118. @param point Point to apply transform or x.
  14119. @param transOrY transform matrix or y.
  14120. @param t transform matrix.
  14121. */
  14122. static transformVec2(out: Vec2, point: Vec2|number, transOrY: AffineTransform|number, t?: AffineTransform): Vec2;
  14123. /**
  14124. !#en Apply the affine transformation on a size.
  14125. This function is memory free, you should create the output Size by yourself and manage its memory.
  14126. !#zh 应用仿射变换矩阵到 Size 上。这个函数不创建任何内存,你需要先创建一个 Size 对象用来存储结果,并作为第一个参数传入函数。
  14127. @param out The output point to store the result
  14128. @param size size
  14129. @param t t
  14130. */
  14131. static transformSize(out: Size, size: Size, t: AffineTransform): Size;
  14132. /**
  14133. !#en Apply the affine transformation on a rect.
  14134. This function is memory free, you should create the output Rect by yourself and manage its memory.
  14135. !#zh 应用仿射变换矩阵到 Rect 上。这个函数不创建任何内存,你需要先创建一个 Rect 对象用来存储结果,并作为第一个参数传入函数。
  14136. @param out out
  14137. @param rect rect
  14138. @param anAffineTransform anAffineTransform
  14139. */
  14140. static transformRect(out: Rect, rect: Rect, anAffineTransform: AffineTransform): Rect;
  14141. /**
  14142. !#en Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
  14143. This function is memory free, you should create the output vectors by yourself and manage their memory.
  14144. !#zh 应用仿射变换矩阵到 Rect 上, 并转换为有向包围盒。这个函数不创建任何内存,你需要先创建包围盒的四个 Vector 对象用来存储结果,并作为前四个参数传入函数。
  14145. @param out_bl out_bl
  14146. @param out_tl out_tl
  14147. @param out_tr out_tr
  14148. @param out_br out_br
  14149. @param rect rect
  14150. @param anAffineTransform anAffineTransform
  14151. */
  14152. static transformObb(out_bl: Vec2, out_tl: Vec2, out_tr: Vec2, out_br: Vec2, rect: Rect, anAffineTransform: AffineTransform): void;
  14153. }
  14154. /** A base node for CCNode, it will:
  14155. - maintain scene hierarchy and active logic
  14156. - notifications if some properties changed
  14157. - define some interfaces shares between CCNode
  14158. - define machanisms for Enity Component Systems
  14159. - define prefab and serialize functions */
  14160. export class _BaseNode extends Object implements EventTarget {
  14161. /** !#en Name of node.
  14162. !#zh 该节点名称。 */
  14163. name: string;
  14164. /** !#en The uuid for editor, will be stripped before building project.
  14165. !#zh 主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。 */
  14166. uuid: string;
  14167. /** !#en All children nodes.
  14168. !#zh 节点的所有子节点。 */
  14169. children: Node[];
  14170. /** !#en All children nodes.
  14171. !#zh 节点的子节点数量。 */
  14172. childrenCount: number;
  14173. /** !#en
  14174. The local active state of this node.<br/>
  14175. Note that a Node may be inactive because a parent is not active, even if this returns true.<br/>
  14176. Use {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}} if you want to check if the Node is actually treated as active in the scene.
  14177. !#zh
  14178. 当前节点的自身激活状态。<br/>
  14179. 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。<br/>
  14180. 如果你想检查节点在场景中实际的激活状态可以使用 {{#crossLink "Node/activeInHierarchy:property"}}{{/crossLink}}。 */
  14181. active: boolean;
  14182. /** !#en Indicates whether this node is active in the scene.
  14183. !#zh 表示此节点是否在场景中激活。 */
  14184. activeInHierarchy: boolean;
  14185. /**
  14186. @param name name
  14187. */
  14188. constructor(name?: string);
  14189. /** !#en The parent of the node.
  14190. !#zh 该节点的父节点。 */
  14191. parent: Node;
  14192. /**
  14193. !#en Get parent of the node.
  14194. !#zh 获取该节点的父节点。
  14195. @example
  14196. ```js
  14197. var parent = this.node.getParent();
  14198. ```
  14199. */
  14200. getParent(): Node;
  14201. /**
  14202. !#en Set parent of the node.
  14203. !#zh 设置该节点的父节点。
  14204. @param value value
  14205. @example
  14206. ```js
  14207. node.setParent(newNode);
  14208. ```
  14209. */
  14210. setParent(value: Node): void;
  14211. /**
  14212. !#en
  14213. Properties configuration function <br/>
  14214. All properties in attrs will be set to the node, <br/>
  14215. when the setter of the node is available, <br/>
  14216. the property will be set via setter function.<br/>
  14217. !#zh 属性配置函数。在 attrs 的所有属性将被设置为节点属性。
  14218. @param attrs Properties to be set to node
  14219. @example
  14220. ```js
  14221. var attrs = { key: 0, num: 100 };
  14222. node.attr(attrs);
  14223. ```
  14224. */
  14225. attr(attrs: any): void;
  14226. /**
  14227. !#en Returns a child from the container given its uuid.
  14228. !#zh 通过 uuid 获取节点的子节点。
  14229. @param uuid The uuid to find the child node.
  14230. @example
  14231. ```js
  14232. var child = node.getChildByUuid(uuid);
  14233. ```
  14234. */
  14235. getChildByUuid(uuid: string): Node;
  14236. /**
  14237. !#en Returns a child from the container given its name.
  14238. !#zh 通过名称获取节点的子节点。
  14239. @param name A name to find the child node.
  14240. @example
  14241. ```js
  14242. var child = node.getChildByName("Test Node");
  14243. ```
  14244. */
  14245. getChildByName(name: string): Node;
  14246. /**
  14247. !#en
  14248. Inserts a child to the node at a specified index.
  14249. !#zh
  14250. 插入子节点到指定位置
  14251. @param child the child node to be inserted
  14252. @param siblingIndex the sibling index to place the child in
  14253. @example
  14254. ```js
  14255. node.insertChild(child, 2);
  14256. ```
  14257. */
  14258. insertChild(child: Node, siblingIndex: number): void;
  14259. /**
  14260. !#en Get the sibling index.
  14261. !#zh 获取同级索引。
  14262. @example
  14263. ```js
  14264. var index = node.getSiblingIndex();
  14265. ```
  14266. */
  14267. getSiblingIndex(): number;
  14268. /**
  14269. !#en Set the sibling index of this node.
  14270. !#zh 设置节点同级索引。
  14271. @param index index
  14272. @example
  14273. ```js
  14274. node.setSiblingIndex(1);
  14275. ```
  14276. */
  14277. setSiblingIndex(index: number): void;
  14278. /**
  14279. !#en Walk though the sub children tree of the current node.
  14280. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children.
  14281. This function call is not recursive, it's based on stack.
  14282. Please don't walk any other node inside the walk process.
  14283. !#zh 遍历该节点的子树里的所有节点并按规则执行回调函数。
  14284. 对子树中的所有节点,包含当前节点,会执行两次回调,prefunc 会在访问它的子节点之前调用,postfunc 会在访问所有子节点之后调用。
  14285. 这个函数的实现不是基于递归的,而是基于栈展开递归的方式。
  14286. 请不要在 walk 过程中对任何其他的节点嵌套执行 walk。
  14287. @param prefunc The callback to process node when reach the node for the first time
  14288. @param postfunc The callback to process node when re-visit the node after walked all children in its sub tree
  14289. @example
  14290. ```js
  14291. node.walk(function (target) {
  14292. console.log('Walked through node ' + target.name + ' for the first time');
  14293. }, function (target) {
  14294. console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
  14295. });
  14296. ```
  14297. */
  14298. walk(prefunc: (target: _BaseNode) => void, postfunc: (target: _BaseNode) => void): void;
  14299. /**
  14300. !#en
  14301. Remove itself from its parent node. If cleanup is `true`, then also remove all events and actions. <br/>
  14302. 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/>
  14303. If the node orphan, then nothing happens.
  14304. !#zh
  14305. 从父节点中删除该节点。如果不传入 cleanup 参数或者传入 `true`,那么这个节点上所有绑定的事件、action 都会被删除。<br/>
  14306. 因此建议调用这个 API 时总是传入 `false` 参数。<br/>
  14307. 如果这个节点是一个孤节点,那么什么都不会发生。
  14308. @param cleanup true if all actions and callbacks on this node should be removed, false otherwise.
  14309. @example
  14310. ```js
  14311. node.removeFromParent();
  14312. node.removeFromParent(false);
  14313. ```
  14314. */
  14315. removeFromParent(cleanup?: boolean): void;
  14316. /**
  14317. !#en
  14318. Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter. </p>
  14319. If the cleanup parameter is not passed, it will force a cleanup. <br/>
  14320. "remove" logic MUST only be on this method <br/>
  14321. If a class wants to extend the 'removeChild' behavior it only needs <br/>
  14322. to override this method.
  14323. !#zh
  14324. 移除节点中指定的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  14325. 如果 cleanup 参数不传入,默认为 true 表示清理。<br/>
  14326. @param child The child node which will be removed.
  14327. @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
  14328. @example
  14329. ```js
  14330. node.removeChild(newNode);
  14331. node.removeChild(newNode, false);
  14332. ```
  14333. */
  14334. removeChild(child: Node, cleanup?: boolean): void;
  14335. /**
  14336. !#en
  14337. Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
  14338. If the cleanup parameter is not passed, it will force a cleanup.
  14339. !#zh
  14340. 移除节点所有的子节点,是否需要清理所有正在运行的行为取决于 cleanup 参数。<br/>
  14341. 如果 cleanup 参数不传入,默认为 true 表示清理。
  14342. @param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
  14343. @example
  14344. ```js
  14345. node.removeAllChildren();
  14346. node.removeAllChildren(false);
  14347. ```
  14348. */
  14349. removeAllChildren(cleanup?: boolean): void;
  14350. /**
  14351. !#en Is this node a child of the given node?
  14352. !#zh 是否是指定节点的子节点?
  14353. @param parent parent
  14354. @example
  14355. ```js
  14356. node.isChildOf(newNode);
  14357. ```
  14358. */
  14359. isChildOf(parent: Node): boolean;
  14360. /**
  14361. !#en
  14362. Returns the component of supplied type if the node has one attached, null if it doesn't.<br/>
  14363. You can also get component in the node by passing in the name of the script.
  14364. !#zh
  14365. 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。<br/>
  14366. 传入参数也可以是脚本的名称。
  14367. @param typeOrClassName typeOrClassName
  14368. @example
  14369. ```js
  14370. // get sprite component
  14371. var sprite = node.getComponent(cc.Sprite);
  14372. // get custom test class
  14373. var test = node.getComponent("Test");
  14374. ```
  14375. */
  14376. getComponent<T extends Component>(type: {prototype: T}): T;
  14377. getComponent(className: string): any;
  14378. /**
  14379. !#en Returns all components of supplied type in the node.
  14380. !#zh 返回节点上指定类型的所有组件。
  14381. @param typeOrClassName typeOrClassName
  14382. @example
  14383. ```js
  14384. var sprites = node.getComponents(cc.Sprite);
  14385. var tests = node.getComponents("Test");
  14386. ```
  14387. */
  14388. getComponents<T extends Component>(type: {prototype: T}): T[];
  14389. getComponents(className: string): any[];
  14390. /**
  14391. !#en Returns the component of supplied type in any of its children using depth first search.
  14392. !#zh 递归查找所有子节点中第一个匹配指定类型的组件。
  14393. @param typeOrClassName typeOrClassName
  14394. @example
  14395. ```js
  14396. var sprite = node.getComponentInChildren(cc.Sprite);
  14397. var Test = node.getComponentInChildren("Test");
  14398. ```
  14399. */
  14400. getComponentInChildren<T extends Component>(type: {prototype: T}): T;
  14401. getComponentInChildren(className: string): any;
  14402. /**
  14403. !#en Returns all components of supplied type in self or any of its children.
  14404. !#zh 递归查找自身或所有子节点中指定类型的组件
  14405. @param typeOrClassName typeOrClassName
  14406. @example
  14407. ```js
  14408. var sprites = node.getComponentsInChildren(cc.Sprite);
  14409. var tests = node.getComponentsInChildren("Test");
  14410. ```
  14411. */
  14412. getComponentsInChildren<T extends Component>(type: {prototype: T}): T[];
  14413. getComponentsInChildren(className: string): any[];
  14414. /**
  14415. !#en Adds a component class to the node. You can also add component to node by passing in the name of the script.
  14416. !#zh 向节点添加一个指定类型的组件类,你还可以通过传入脚本的名称来添加组件。
  14417. @param typeOrClassName The constructor or the class name of the component to add
  14418. @example
  14419. ```js
  14420. var sprite = node.addComponent(cc.Sprite);
  14421. var test = node.addComponent("Test");
  14422. ```
  14423. */
  14424. addComponent<T extends Component>(type: {new(): T}): T;
  14425. addComponent(className: string): any;
  14426. /**
  14427. !#en
  14428. Removes a component identified by the given name or removes the component object given.
  14429. You can also use component.destroy() if you already have the reference.
  14430. !#zh
  14431. 删除节点上的指定组件,传入参数可以是一个组件构造函数或组件名,也可以是已经获得的组件引用。
  14432. 如果你已经获得组件引用,你也可以直接调用 component.destroy()
  14433. @param component The need remove component.
  14434. @example
  14435. ```js
  14436. node.removeComponent(cc.Sprite);
  14437. var Test = require("Test");
  14438. node.removeComponent(Test);
  14439. ```
  14440. */
  14441. removeComponent(component: string|Function|Component): void;
  14442. /**
  14443. !#en
  14444. Destroy all children from the node, and release all their own references to other objects.<br/>
  14445. Actual destruct operation will delayed until before rendering.
  14446. !#zh
  14447. 销毁所有子节点,并释放所有它们对其它对象的引用。<br/>
  14448. 实际销毁操作会延迟到当前帧渲染前执行。
  14449. @example
  14450. ```js
  14451. node.destroyAllChildren();
  14452. ```
  14453. */
  14454. destroyAllChildren(): void;
  14455. /**
  14456. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  14457. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  14458. @param type The type of event.
  14459. */
  14460. hasEventListener(type: string): boolean;
  14461. /**
  14462. !#en
  14463. Register an callback of a specific event type on the EventTarget.
  14464. This type of event should be triggered via `emit`.
  14465. !#zh
  14466. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  14467. @param type A string representing the event type to listen for.
  14468. @param callback The callback that will be invoked when the event is dispatched.
  14469. The callback is ignored if it is a duplicate (the callbacks are unique).
  14470. @param target The target (this object) to invoke the callback, can be null
  14471. @example
  14472. ```js
  14473. eventTarget.on('fire', function () {
  14474. cc.log("fire in the hole");
  14475. }, node);
  14476. ```
  14477. */
  14478. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  14479. /**
  14480. !#en
  14481. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  14482. if only type is passed as parameter, all listeners registered with that type will be removed.
  14483. !#zh
  14484. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  14485. @param type A string representing the event type being removed.
  14486. @param callback The callback to remove.
  14487. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
  14488. @example
  14489. ```js
  14490. // register fire eventListener
  14491. var callback = eventTarget.on('fire', function () {
  14492. cc.log("fire in the hole");
  14493. }, target);
  14494. // remove fire event listener
  14495. eventTarget.off('fire', callback, target);
  14496. // remove all fire event listeners
  14497. eventTarget.off('fire');
  14498. ```
  14499. */
  14500. off(type: string, callback?: Function, target?: any): void;
  14501. /**
  14502. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  14503. This is not for removing all listeners in the current event target,
  14504. and this is not for removing all listeners the target parameter have registered.
  14505. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  14506. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  14507. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  14508. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  14509. @param target The target to be searched for all related listeners
  14510. */
  14511. targetOff(target: any): void;
  14512. /**
  14513. !#en
  14514. Register an callback of a specific event type on the EventTarget,
  14515. the callback will remove itself after the first time it is triggered.
  14516. !#zh
  14517. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  14518. @param type A string representing the event type to listen for.
  14519. @param callback The callback that will be invoked when the event is dispatched.
  14520. The callback is ignored if it is a duplicate (the callbacks are unique).
  14521. @param target The target (this object) to invoke the callback, can be null
  14522. @example
  14523. ```js
  14524. eventTarget.once('fire', function () {
  14525. cc.log("this is the callback and will be invoked only once");
  14526. }, node);
  14527. ```
  14528. */
  14529. once(type: string, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void;
  14530. /**
  14531. !#en
  14532. Send an event with the event object.
  14533. !#zh
  14534. 通过事件对象派发事件
  14535. @param event event
  14536. */
  14537. dispatchEvent(event: Event): void;
  14538. /**
  14539. !#en
  14540. Destroy all callbackInfos.
  14541. !#zh
  14542. 销毁记录的事件
  14543. */
  14544. clear(): void;
  14545. }
  14546. /** !#en
  14547. Helper class for setting material blend function.
  14548. !#zh
  14549. 设置材质混合模式的辅助类。 */
  14550. export class BlendFunc {
  14551. /** !#en specify the source Blend Factor, this will generate a custom material object, please pay attention to the memory cost.
  14552. !#zh 指定原图的混合模式,这会克隆一个新的材质对象,注意这带来的开销 */
  14553. srcBlendFactor: macro.BlendFactor;
  14554. /** !#en specify the destination Blend Factor.
  14555. !#zh 指定目标的混合模式 */
  14556. dstBlendFactor: macro.BlendFactor;
  14557. }
  14558. /** An internal helper class for switching render component's material between normal sprite material and gray sprite material. */
  14559. export class GraySpriteState {
  14560. /** !#en The normal material.
  14561. !#zh 正常状态的材质。 */
  14562. normalMaterial: Material;
  14563. /** !#en The gray material.
  14564. !#zh 置灰状态的材质。 */
  14565. grayMaterial: Material;
  14566. }
  14567. /** misc utilities */
  14568. export class misc {
  14569. /**
  14570. !#en Clamp a value between from and to.
  14571. !#zh
  14572. 限定浮点数的最大最小值。<br/>
  14573. 数值大于 max_inclusive 则返回 max_inclusive。<br/>
  14574. 数值小于 min_inclusive 则返回 min_inclusive。<br/>
  14575. 否则返回自身。
  14576. @param value value
  14577. @param min_inclusive min_inclusive
  14578. @param max_inclusive max_inclusive
  14579. @example
  14580. ```js
  14581. var v1 = cc.misc.clampf(20, 0, 20); // 20;
  14582. var v2 = cc.misc.clampf(-1, 0, 20); // 0;
  14583. var v3 = cc.misc.clampf(10, 0, 20); // 10;
  14584. ```
  14585. */
  14586. static clampf(value: number, min_inclusive: number, max_inclusive: number): number;
  14587. /**
  14588. !#en Clamp a value between 0 and 1.
  14589. !#zh 限定浮点数的取值范围为 0 ~ 1 之间。
  14590. @param value value
  14591. @example
  14592. ```js
  14593. var v1 = cc.misc.clamp01(20); // 1;
  14594. var v2 = cc.misc.clamp01(-1); // 0;
  14595. var v3 = cc.misc.clamp01(0.5); // 0.5;
  14596. ```
  14597. */
  14598. static clamp01(value: number): number;
  14599. /**
  14600. Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end
  14601. @param a number A
  14602. @param b number B
  14603. @param r ratio between 0 and 1
  14604. @example
  14605. ```js
  14606. ----
  14607. lerp
  14608. cc.misc.lerp(2,10,0.5)//returns 6
  14609. cc.misc.lerp(2,10,0.2)//returns 3.6
  14610. ```
  14611. */
  14612. static lerp(a: number, b: number, r: number): number;
  14613. /**
  14614. converts degrees to radians
  14615. @param angle angle
  14616. */
  14617. static degreesToRadians(angle: number): number;
  14618. /**
  14619. converts radians to degrees
  14620. @param angle angle
  14621. */
  14622. static radiansToDegrees(angle: number): number;
  14623. }
  14624. /** !#en The renderer object which provide access to render system APIs,
  14625. detailed APIs will be available progressively.
  14626. !#zh 提供基础渲染接口的渲染器对象,渲染层的基础接口将逐步开放给用户 */
  14627. export class renderer {
  14628. /** !#en The render engine is available only after cc.game.EVENT_ENGINE_INITED event.<br/>
  14629. Normally it will be inited as the webgl render engine, but in wechat open context domain,
  14630. it will be inited as the canvas render engine. Canvas render engine is no longer available for other use case since v2.0.
  14631. !#zh 基础渲染引擎对象只在 cc.game.EVENT_ENGINE_INITED 事件触发后才可获取。<br/>
  14632. 大多数情况下,它都会是 WebGL 渲染引擎实例,但是在微信开放数据域当中,它会是 Canvas 渲染引擎实例。请注意,从 2.0 开始,我们在其他平台和环境下都废弃了 Canvas 渲染器。 */
  14633. static renderEngine: any;
  14634. /** !#en The total draw call count in last rendered frame.
  14635. !#zh 上一次渲染帧所提交的渲染批次总数。 */
  14636. static drawCalls: number;
  14637. }
  14638. /** !#en The burst of 3d particle.
  14639. !#zh 3D 粒子发射时的爆发个数 */
  14640. export class Burst {
  14641. /** !#en Time between the start of the particle system and the trigger of this Brust
  14642. !#zh 粒子系统开始运行到触发此次 Brust 的时间 */
  14643. time: number;
  14644. /** !#en Minimum number of emitted particles
  14645. !#zh 发射粒子的最小数量 */
  14646. minCount: number;
  14647. /** !#en Maximum number of emitted particles
  14648. !#zh 发射粒子的最大数量 */
  14649. maxCount: number;
  14650. /** !#en The number of times Burst was triggered.
  14651. !#zh Burst 的触发次数 */
  14652. repeatCount: number;
  14653. /** !#en Interval of each trigger
  14654. !#zh 每次触发的间隔时间 */
  14655. repeatInterval: number;
  14656. /** !#en Number of particles emitted
  14657. !#zh 发射的粒子的数量 */
  14658. count: CurveRange;
  14659. }
  14660. /** !#en The animation curve of 3d particle.
  14661. !#zh 3D 粒子动画曲线 */
  14662. export class AnimationCurve {
  14663. /** !#en Array of key value.
  14664. !#zh 关键值列表。 */
  14665. keyFrames: Keyframe[];
  14666. /** !#en Pre-wrap mode.
  14667. !#zh 前置循环模式。 */
  14668. preWrapMode: WrapMode;
  14669. /** !#en Post-wrap mode.
  14670. !#zh 后置循环模式。 */
  14671. postWrapMode: WrapMode;
  14672. }
  14673. /** !#en The ParticleSystem3D Component.
  14674. !#zh 3D 粒子组件 */
  14675. export class ParticleSystem3D extends RenderComponent {
  14676. /** !#en The run time of particle.
  14677. !#zh 粒子系统运行时间 */
  14678. duration: number;
  14679. /** !#en The maximum number of particles that a particle system can generate.
  14680. !#zh 粒子系统能生成的最大粒子数量 */
  14681. capacity: number;
  14682. /** !#en Whether the particle system loops.
  14683. !#zh 粒子系统是否循环播放 */
  14684. loop: boolean;
  14685. /** !#en Whether the particles start playing automatically after loaded.
  14686. !#zh 粒子系统加载后是否自动开始播放 */
  14687. playOnAwake: boolean;
  14688. /** !#en When selected, the particle system will start playing after one round has been played (only effective when loop is enabled).
  14689. !#zh 选中之后,粒子系统会以已播放完一轮之后的状态开始播放(仅当循环播放启用时有效) */
  14690. prewarm: boolean;
  14691. /** !#en The coordinate system in which the particle system is located.<br>
  14692. World coordinates (does not change when the position of other objects changes)<br>
  14693. Local coordinates (moving as the position of the parent node changes)<br>
  14694. Custom coordinates (moving with the position of a custom node)
  14695. !#zh 选择粒子系统所在的坐标系<br>
  14696. 世界坐标(不随其他物体位置改变而变换)<br>
  14697. 局部坐标(跟随父节点位置改变而移动)<br>
  14698. 自定坐标(跟随自定义节点的位置改变而移动) */
  14699. simulationSpace: ParticleSystem3DAssembler.Space;
  14700. /** !#en Controlling the update speed of the entire particle system.
  14701. !#zh 控制整个粒子系统的更新速度。 */
  14702. simulationSpeed: number;
  14703. /** !#en Delay particle emission time after particle system starts running.
  14704. !#zh 粒子系统开始运行后,延迟粒子发射的时间。 */
  14705. startDelay: CurveRange;
  14706. /** !#en Particle life cycle。
  14707. !#zh 粒子生命周期。 */
  14708. startLifetime: CurveRange;
  14709. /** !#en Particle initial color
  14710. !#zh 粒子初始颜色 */
  14711. startColor: GradientRange;
  14712. /** !#en Particle scale space
  14713. !#zh 缩放空间 */
  14714. scaleSpace: ParticleSystem3DAssembler.Space;
  14715. /** !#en Initial particle size
  14716. !#zh 粒子初始大小 */
  14717. startSize: CurveRange;
  14718. /** !#en Initial particle speed
  14719. !#zh 粒子初始速度 */
  14720. startSpeed: CurveRange;
  14721. /** !#en Particle initial rotation angle
  14722. !#zh 粒子初始旋转角度 */
  14723. startRotation: CurveRange;
  14724. /** !#en Gravity coefficient of particles affected by gravity
  14725. !#zh 粒子受重力影响的重力系数 */
  14726. gravityModifier: CurveRange;
  14727. /** !#en Particles emitted per second
  14728. !#zh 每秒发射的粒子数 */
  14729. rateOverTime: CurveRange;
  14730. /** !#en Number of particles emitted per unit distance moved
  14731. !#zh 每移动单位距离发射的粒子数 */
  14732. rateOverDistance: CurveRange;
  14733. /** !#en The number of Brusts that emit a specified number of particles at a specified time
  14734. !#zh 设定在指定时间发射指定数量的粒子的 Brust 的数量 */
  14735. bursts: Burst[];
  14736. /** !#en Particle emitter module
  14737. !#zh 粒子发射器模块 */
  14738. shapeModule: ShapeModule;
  14739. /** !#en Color control module
  14740. !#zh 颜色控制模块 */
  14741. colorOverLifetimeModule: ColorOverLifetimeModule;
  14742. /** !#en Particle size module
  14743. !#zh 粒子大小模块 */
  14744. sizeOvertimeModule: SizeOvertimeModule;
  14745. /** !#en Particle speed module
  14746. !#zh 粒子速度模块 */
  14747. velocityOvertimeModule: VelocityOvertimeModule;
  14748. /** !#en Particle acceleration module
  14749. !#zh 粒子加速度模块 */
  14750. forceOvertimeModule: ForceOvertimeModule;
  14751. /** !#en Particle limit speed module (only CPU particles are supported)
  14752. !#zh 粒子限制速度模块(只支持 CPU 粒子) */
  14753. limitVelocityOvertimeModule: LimitVelocityOvertimeModule;
  14754. /** !#en Particle rotation module
  14755. !#zh 粒子旋转模块 */
  14756. rotationOvertimeModule: RotationOvertimeModule;
  14757. /** !#en Texture Animation Module
  14758. !#zh 贴图动画模块 */
  14759. textureAnimationModule: TextureAnimationModule;
  14760. /** !#en Particle Trajectory Module
  14761. !#zh 粒子轨迹模块 */
  14762. trailModule: TrailModule;
  14763. /** !#en Particle generation mode
  14764. !#zh 设定粒子生成模式 */
  14765. renderMode: ParticleSystem3DAssembler.RenderMode;
  14766. /** !#en When the particle generation mode is StrecthedBillboard, in the direction of movement of the particles is stretched by velocity magnitude
  14767. !#zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按速度大小进行拉伸 */
  14768. velocityScale: number;
  14769. /** !#en When the particle generation method is StrecthedBillboard, the particles are stretched according to the particle size in the direction of motion
  14770. !#zh 在粒子生成方式为 StrecthedBillboard 时,对粒子在运动方向上按粒子大小进行拉伸 */
  14771. lengthScale: number;
  14772. /** !#en Particle model
  14773. !#zh 粒子模型 */
  14774. mesh: Mesh;
  14775. /** !#en Particle material
  14776. !#zh 粒子材质 */
  14777. particleMaterial: Material;
  14778. /** !#en Particle trail material
  14779. !#zh 粒子轨迹材质 */
  14780. trailMaterial: Material;
  14781. /**
  14782. !#en Playing particle effects
  14783. !#zh 播放粒子效果
  14784. */
  14785. play(): void;
  14786. /**
  14787. !#en Pause particle effect
  14788. !#zh 暂停播放粒子效果
  14789. */
  14790. pause(): void;
  14791. /**
  14792. !#en Stop particle effect
  14793. !#zh 停止播放粒子效果
  14794. */
  14795. stop(): void;
  14796. /**
  14797. !#en Remove all particle effect
  14798. !#zh 将所有粒子从粒子系统中清除
  14799. */
  14800. clear(): void;
  14801. }
  14802. /** !#en
  14803. Helper class for ES5 Map.
  14804. !#zh
  14805. ES5 Map 辅助类。 */
  14806. export class MapUtils {
  14807. }
  14808. /** !#en .
  14809. !#zh 。 */
  14810. export class SkeletonAnimation extends Animation {
  14811. }
  14812. /** !#en
  14813. Skinned Mesh Renderer
  14814. !#zh
  14815. 蒙皮渲染组件 */
  14816. export class SkinnedMeshRenderer extends MeshRenderer {
  14817. /** !#en
  14818. Skeleton Asset
  14819. !#zh
  14820. 骨骼资源 */
  14821. skeleton: sp.Skeleton;
  14822. /** !#en
  14823. Root Bone
  14824. !#zh
  14825. 骨骼根节点 */
  14826. rootBone: Node;
  14827. }
  14828. /** !#en SkeletonAnimationClip Asset.
  14829. !#zh 骨骼动画剪辑。 */
  14830. export class SkeletonAnimationClip extends AnimationClip {
  14831. }
  14832. /** !#en Effect Asset.
  14833. !#zh Effect 资源类型。 */
  14834. export class EffectAsset extends Asset {
  14835. }
  14836. /** !#en Material Asset.
  14837. !#zh 材质资源类。 */
  14838. export class Material extends Asset {
  14839. /**
  14840. !#en Get built-in materials
  14841. !#zh 获取内置材质
  14842. @param name name
  14843. */
  14844. static getBuiltinMaterial(name: string): Material;
  14845. /**
  14846. !#en Creates a Material with builtin Effect.
  14847. !#zh 使用内建 Effect 创建一个材质。
  14848. @param effectName effectName
  14849. @param techniqueIndex techniqueIndex
  14850. */
  14851. static createWithBuiltin(effectName: string, techniqueIndex?: number): Material;
  14852. /**
  14853. !#en Creates a Material.
  14854. !#zh 创建一个材质。
  14855. @param effectAsset effectAsset
  14856. @param techniqueIndex techniqueIndex
  14857. */
  14858. static create(effectAsset: EffectAsset, techniqueIndex?: number): Material;
  14859. /**
  14860. !#en Sets the Material property
  14861. !#zh 设置材质的属性
  14862. @param name name
  14863. @param val val
  14864. @param passIdx passIdx
  14865. @param directly directly
  14866. */
  14867. setProperty(name: string, val: any, passIdx?: number, directly?: boolean): void;
  14868. /**
  14869. !#en Gets the Material property.
  14870. !#zh 获取材质的属性。
  14871. @param name name
  14872. @param passIdx passIdx
  14873. */
  14874. getProperty(name: string, passIdx: number): any;
  14875. /**
  14876. !#en Sets the Material define.
  14877. !#zh 设置材质的宏定义。
  14878. @param name name
  14879. @param val val
  14880. @param passIdx passIdx
  14881. @param force force
  14882. */
  14883. define(name: string, val: boolean|number, passIdx?: number, force?: boolean): void;
  14884. /**
  14885. !#en Gets the Material define.
  14886. !#zh 获取材质的宏定义。
  14887. @param name name
  14888. @param passIdx passIdx
  14889. */
  14890. getDefine(name: string, passIdx?: number): boolean;
  14891. /**
  14892. !#en Sets the Material cull mode.
  14893. !#zh 设置材质的裁减模式。
  14894. @param cullMode cullMode
  14895. @param passIdx passIdx
  14896. */
  14897. setCullMode(cullMode: number, passIdx: number): void;
  14898. /**
  14899. !#en Sets the Material depth states.
  14900. !#zh 设置材质的深度渲染状态。
  14901. @param depthTest depthTest
  14902. @param depthWrite depthWrite
  14903. @param depthFunc depthFunc
  14904. @param passIdx passIdx
  14905. */
  14906. setDepth(depthTest: boolean, depthWrite: boolean, depthFunc: number, passIdx: number): void;
  14907. /**
  14908. !#en Sets the Material blend states.
  14909. !#zh 设置材质的混合渲染状态。
  14910. @param enabled enabled
  14911. @param blendEq blendEq
  14912. @param blendSrc blendSrc
  14913. @param blendDst blendDst
  14914. @param blendAlphaEq blendAlphaEq
  14915. @param blendSrcAlpha blendSrcAlpha
  14916. @param blendDstAlpha blendDstAlpha
  14917. @param blendColor blendColor
  14918. @param passIdx passIdx
  14919. */
  14920. setBlend(enabled: boolean, blendEq: number, blendSrc: number, blendDst: number, blendAlphaEq: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: number, passIdx: number): void;
  14921. /**
  14922. !#en Sets whether enable the stencil test.
  14923. !#zh 设置是否开启模板测试。
  14924. @param stencilTest stencilTest
  14925. @param passIdx passIdx
  14926. */
  14927. setStencilEnabled(stencilTest: number, passIdx: number): void;
  14928. /**
  14929. !#en Sets the Material stencil render states.
  14930. !#zh 设置材质的模板测试渲染参数。
  14931. @param stencilTest stencilTest
  14932. @param stencilFunc stencilFunc
  14933. @param stencilRef stencilRef
  14934. @param stencilMask stencilMask
  14935. @param stencilFailOp stencilFailOp
  14936. @param stencilZFailOp stencilZFailOp
  14937. @param stencilZPassOp stencilZPassOp
  14938. @param stencilWriteMask stencilWriteMask
  14939. @param passIdx passIdx
  14940. */
  14941. setStencil(stencilTest: number, stencilFunc: number, stencilRef: number, stencilMask: number, stencilFailOp: number, stencilZFailOp: number, stencilZPassOp: number, stencilWriteMask: number, passIdx: number): void;
  14942. }
  14943. /** !#en
  14944. Material Variant is an extension of the Material Asset.
  14945. Changes to Material Variant do not affect other Material Variant or Material Asset,
  14946. and changes to Material Asset are synchronized to the Material Variant.
  14947. However, when a Material Variant had already modifies a state, the Material Asset state is not synchronized to the Material Variant.
  14948. !#zh
  14949. 材质变体是材质资源的一个延伸。
  14950. 材质变体的修改不会影响到其他的材质变体或者材质资源,而材质资源的修改会同步体现到材质变体上,
  14951. 但是当材质变体对一个状态修改后,材质资源再对这个状态修改是不会同步到材质变体上的。 */
  14952. export class MaterialVariant extends Material {
  14953. /**
  14954. @param materialName materialName
  14955. @param owner owner
  14956. */
  14957. static createWithBuiltin (materialName: string, owner: cc.RenderComponent): MaterialVariant | null;
  14958. /**
  14959. @param material material
  14960. @param owner owner
  14961. */
  14962. static create (material: Material, owner: cc.RenderComponent): MaterialVariant | null;
  14963. }
  14964. /** !#en cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.
  14965. !#zh EditBox 组件,用于获取用户的输入文本。 */
  14966. export class EditBox extends Component {
  14967. /** !#en Input string of EditBox.
  14968. !#zh 输入框的初始输入内容,如果为空则会显示占位符的文本。 */
  14969. string: string;
  14970. /** !#en The Label component attached to the node for EditBox's input text label
  14971. !#zh 输入框输入文本节点上挂载的 Label 组件对象 */
  14972. textLabel: Label;
  14973. /** !#en The Label component attached to the node for EditBox's placeholder text label
  14974. !#zh 输入框占位符节点上挂载的 Label 组件对象 */
  14975. placeholderLabel: Label;
  14976. /** !#en The Sprite component attached to the node for EditBox's background
  14977. !#zh 输入框背景节点上挂载的 Sprite 组件对象 */
  14978. background: Sprite;
  14979. /** !#en The background image of EditBox. This property will be removed in the future, use editBox.background instead please.
  14980. !#zh 输入框的背景图片。 该属性会在将来的版本中移除,请用 editBox.background */
  14981. backgroundImage: SpriteFrame;
  14982. /** !#en
  14983. The return key type of EditBox.
  14984. Note: it is meaningless for web platforms and desktop platforms.
  14985. !#zh
  14986. 指定移动设备上面回车按钮的样式。
  14987. 注意:这个选项对 web 平台与 desktop 平台无效。 */
  14988. returnType: EditBox.KeyboardReturnType;
  14989. /** !#en Set the input flags that are to be applied to the EditBox.
  14990. !#zh 指定输入标志位,可以指定输入方式为密码或者单词首字母大写。 */
  14991. inputFlag: EditBox.InputFlag;
  14992. /** !#en
  14993. Set the input mode of the edit box.
  14994. If you pass ANY, it will create a multiline EditBox.
  14995. !#zh
  14996. 指定输入模式: ANY表示多行输入,其它都是单行输入,移动平台上还可以指定键盘样式。 */
  14997. inputMode: EditBox.InputMode;
  14998. /** !#en Font size of the input text. This property will be removed in the future, use editBox.textLabel.fontSize instead please.
  14999. !#zh 输入框文本的字体大小。 该属性会在将来的版本中移除,请使用 editBox.textLabel.fontSize。 */
  15000. fontSize: number;
  15001. /** !#en Change the lineHeight of displayed text. This property will be removed in the future, use editBox.textLabel.lineHeight instead.
  15002. !#zh 输入框文本的行高。该属性会在将来的版本中移除,请使用 editBox.textLabel.lineHeight */
  15003. lineHeight: number;
  15004. /** !#en Font color of the input text. This property will be removed in the future, use editBox.textLabel.node.color instead.
  15005. !#zh 输入框文本的颜色。该属性会在将来的版本中移除,请使用 editBox.textLabel.node.color */
  15006. fontColor: Color;
  15007. /** !#en The display text of placeholder.
  15008. !#zh 输入框占位符的文本内容。 */
  15009. placeholder: string;
  15010. /** !#en The font size of placeholder. This property will be removed in the future, use editBox.placeholderLabel.fontSize instead.
  15011. !#zh 输入框占位符的字体大小。该属性会在将来的版本中移除,请使用 editBox.placeholderLabel.fontSize */
  15012. placeholderFontSize: number;
  15013. /** !#en The font color of placeholder. This property will be removed in the future, use editBox.placeholderLabel.node.color instead.
  15014. !#zh 输入框占位符的字体颜色。该属性会在将来的版本中移除,请使用 editBox.placeholderLabel.node.color */
  15015. placeholderFontColor: Color;
  15016. /** !#en The maximize input length of EditBox.
  15017. - If pass a value less than 0, it won't limit the input number of characters.
  15018. - If pass 0, it doesn't allow input any characters.
  15019. !#zh 输入框最大允许输入的字符个数。
  15020. - 如果值为小于 0 的值,则不会限制输入字符个数。
  15021. - 如果值为 0,则不允许用户进行任何输入。 */
  15022. maxLength: number;
  15023. /** !#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
  15024. !zh 输入框总是可见,并且永远在游戏视图的上面(这个属性只有在 Web 上面修改有意义),该属性会在 v2.1 中移除
  15025. Note: only available on Web at the moment. */
  15026. stayOnTop: boolean;
  15027. /** !#en Set the tabIndex of the DOM input element (only useful on Web).
  15028. !#zh 修改 DOM 输入元素的 tabIndex(这个属性只有在 Web 上面修改有意义)。 */
  15029. tabIndex: number;
  15030. /** !#en The event handler to be called when EditBox began to edit text.
  15031. !#zh 开始编辑文本输入框触发的事件回调。 */
  15032. editingDidBegan: Component.EventHandler[];
  15033. /** !#en The event handler to be called when EditBox text changes.
  15034. !#zh 编辑文本输入框时触发的事件回调。 */
  15035. textChanged: Component.EventHandler[];
  15036. /** !#en The event handler to be called when EditBox edit ends.
  15037. !#zh 结束编辑文本输入框时触发的事件回调。 */
  15038. editingDidEnded: Component.EventHandler[];
  15039. /** !#en The event handler to be called when return key is pressed. Windows is not supported.
  15040. !#zh 当用户按下回车按键时的事件回调,目前不支持 windows 平台 */
  15041. editingReturn: Component.EventHandler[];
  15042. /**
  15043. !#en Let the EditBox get focus, this method will be removed on v2.1
  15044. !#zh 让当前 EditBox 获得焦点, 这个方法会在 v2.1 中移除
  15045. */
  15046. setFocus(): void;
  15047. /**
  15048. !#en Let the EditBox get focus
  15049. !#zh 让当前 EditBox 获得焦点
  15050. */
  15051. focus(): void;
  15052. /**
  15053. !#en Let the EditBox lose focus
  15054. !#zh 让当前 EditBox 失去焦点
  15055. */
  15056. blur(): void;
  15057. /**
  15058. !#en Determine whether EditBox is getting focus or not.
  15059. !#zh 判断 EditBox 是否获得了焦点
  15060. */
  15061. isFocused(): void;
  15062. /**
  15063. !#en if you don't need the EditBox and it isn't in any running Scene, you should
  15064. call the destroy method on this component or the associated node explicitly.
  15065. Otherwise, the created DOM element won't be removed from web page.
  15066. !#zh
  15067. 如果你不再使用 EditBox,并且组件未添加到场景中,那么你必须手动对组件或所在节点调用 destroy。
  15068. 这样才能移除网页上的 DOM 节点,避免 Web 平台内存泄露。
  15069. @example
  15070. ```js
  15071. editbox.node.parent = null; // or editbox.node.removeFromParent(false);
  15072. // when you don't need editbox anymore
  15073. editbox.node.destroy();
  15074. ```
  15075. */
  15076. destroy(): boolean;
  15077. }
  15078. /** undefined */
  15079. export class PhysicsBoxCollider extends PhysicsCollider implements Collider.Box {
  15080. /** !#en Position offset
  15081. !#zh 位置偏移量 */
  15082. offset: Vec2;
  15083. /** !#en Box size
  15084. !#zh 包围盒大小 */
  15085. size: Size;
  15086. }
  15087. /** undefined */
  15088. export class PhysicsChainCollider extends PolygonCollider {
  15089. /** !#en Whether the chain is loop
  15090. !#zh 链条是否首尾相连 */
  15091. loop: boolean;
  15092. /** !#en Chain points
  15093. !#zh 链条顶点数组 */
  15094. points: Vec2[];
  15095. }
  15096. /** undefined */
  15097. export class PhysicsCircleCollider extends PhysicsCollider implements Collider.Circle {
  15098. /** !#en Position offset
  15099. !#zh 位置偏移量 */
  15100. offset: Vec2;
  15101. /** !#en Circle radius
  15102. !#zh 圆形半径 */
  15103. radius: number;
  15104. }
  15105. /** undefined */
  15106. export class PhysicsCollider extends Collider {
  15107. /** !#en
  15108. The density.
  15109. !#zh
  15110. 密度 */
  15111. density: number;
  15112. /** !#en
  15113. A sensor collider collects contact information but never generates a collision response
  15114. !#zh
  15115. 一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。 */
  15116. sensor: boolean;
  15117. /** !#en
  15118. The friction coefficient, usually in the range [0,1].
  15119. !#zh
  15120. 摩擦系数,取值一般在 [0, 1] 之间 */
  15121. friction: number;
  15122. /** !#en
  15123. The restitution (elasticity) usually in the range [0,1].
  15124. !#zh
  15125. 弹性系数,取值一般在 [0, 1]之间 */
  15126. restitution: number;
  15127. /** !#en
  15128. Physics collider will find the rigidbody component on the node and set to this property.
  15129. !#zh
  15130. 碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。 */
  15131. body: RigidBody;
  15132. /**
  15133. !#en
  15134. Apply current changes to collider, this will regenerate inner box2d fixtures.
  15135. !#zh
  15136. 应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
  15137. */
  15138. apply(): void;
  15139. /**
  15140. !#en
  15141. Get the world aabb of the collider
  15142. !#zh
  15143. 获取碰撞体的世界坐标系下的包围盒
  15144. */
  15145. getAABB(): void;
  15146. }
  15147. /** undefined */
  15148. export class PhysicsPolygonCollider extends PhysicsCollider implements Collider.Polygon {
  15149. /** !#en Position offset
  15150. !#zh 位置偏移量 */
  15151. offset: Vec2;
  15152. /** !#en Polygon points
  15153. !#zh 多边形顶点数组 */
  15154. points: Vec2[];
  15155. }
  15156. /** !#en
  15157. A distance joint constrains two points on two bodies
  15158. to remain at a fixed distance from each other. You can view
  15159. this as a massless, rigid rod.
  15160. !#zh
  15161. 距离关节通过一个固定的长度来约束关节链接的两个刚体。你可以将它想象成一个无质量,坚固的木棍。 */
  15162. export class DistanceJoint extends Joint {
  15163. /** !#en
  15164. The distance separating the two ends of the joint.
  15165. !#zh
  15166. 关节两端的距离 */
  15167. distance: number;
  15168. /** !#en
  15169. The spring frequency.
  15170. !#zh
  15171. 弹性系数。 */
  15172. frequency: number;
  15173. /** !#en
  15174. The damping ratio.
  15175. !#zh
  15176. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15177. dampingRatio: number;
  15178. }
  15179. /** !#en
  15180. Base class for joints to connect rigidbody.
  15181. !#zh
  15182. 关节类的基类 */
  15183. export class Joint extends Component {
  15184. /** !#en
  15185. The anchor of the rigidbody.
  15186. !#zh
  15187. 刚体的锚点。 */
  15188. anchor: Vec2;
  15189. /** !#en
  15190. The anchor of the connected rigidbody.
  15191. !#zh
  15192. 关节另一端刚体的锚点。 */
  15193. connectedAnchor: Vec2;
  15194. /** !#en
  15195. The rigidbody to which the other end of the joint is attached.
  15196. !#zh
  15197. 关节另一端链接的刚体 */
  15198. connectedBody: RigidBody;
  15199. /** !#en
  15200. Should the two rigid bodies connected with this joint collide with each other?
  15201. !#zh
  15202. 链接到关节上的两个刚体是否应该相互碰撞? */
  15203. collideConnected: boolean;
  15204. /**
  15205. !#en
  15206. Apply current changes to joint, this will regenerate inner box2d joint.
  15207. !#zh
  15208. 应用当前关节中的修改,调用此函数会重新生成内部 box2d 的关节。
  15209. */
  15210. apply(): void;
  15211. /**
  15212. !#en
  15213. Get the anchor point on rigidbody in world coordinates.
  15214. !#zh
  15215. 获取刚体世界坐标系下的锚点。
  15216. */
  15217. getWorldAnchor(): Vec2;
  15218. /**
  15219. !#en
  15220. Get the anchor point on connected rigidbody in world coordinates.
  15221. !#zh
  15222. 获取链接刚体世界坐标系下的锚点。
  15223. */
  15224. getWorldConnectedAnchor(): Vec2;
  15225. /**
  15226. !#en
  15227. Gets the reaction force of the joint.
  15228. !#zh
  15229. 获取关节的反作用力。
  15230. @param timeStep The time to calculate the reaction force for.
  15231. */
  15232. getReactionForce(timeStep: number): Vec2;
  15233. /**
  15234. !#en
  15235. Gets the reaction torque of the joint.
  15236. !#zh
  15237. 获取关节的反扭矩。
  15238. @param timeStep The time to calculate the reaction torque for.
  15239. */
  15240. getReactionTorque(timeStep: number): number;
  15241. }
  15242. /** !#en
  15243. A motor joint is used to control the relative motion
  15244. between two bodies. A typical usage is to control the movement
  15245. of a dynamic body with respect to the ground.
  15246. !#zh
  15247. 马达关节被用来控制两个刚体间的相对运动。
  15248. 一个典型的例子是用来控制一个动态刚体相对于地面的运动。 */
  15249. export class MotorJoint extends Joint {
  15250. /** !#en
  15251. The anchor of the rigidbody.
  15252. !#zh
  15253. 刚体的锚点。 */
  15254. anchor: Vec2;
  15255. /** !#en
  15256. The anchor of the connected rigidbody.
  15257. !#zh
  15258. 关节另一端刚体的锚点。 */
  15259. connectedAnchor: Vec2;
  15260. /** !#en
  15261. The linear offset from connected rigidbody to rigidbody.
  15262. !#zh
  15263. 关节另一端的刚体相对于起始端刚体的位置偏移量 */
  15264. linearOffset: Vec2;
  15265. /** !#en
  15266. The angular offset from connected rigidbody to rigidbody.
  15267. !#zh
  15268. 关节另一端的刚体相对于起始端刚体的角度偏移量 */
  15269. angularOffset: number;
  15270. /** !#en
  15271. The maximum force can be applied to rigidbody.
  15272. !#zh
  15273. 可以应用于刚体的最大的力值 */
  15274. maxForce: number;
  15275. /** !#en
  15276. The maximum torque can be applied to rigidbody.
  15277. !#zh
  15278. 可以应用于刚体的最大扭矩值 */
  15279. maxTorque: number;
  15280. /** !#en
  15281. The position correction factor in the range [0,1].
  15282. !#zh
  15283. 位置矫正系数,范围为 [0, 1] */
  15284. correctionFactor: number;
  15285. }
  15286. /** !#en
  15287. A mouse joint is used to make a point on a body track a
  15288. specified world point. This a soft constraint with a maximum
  15289. force. This allows the constraint to stretch and without
  15290. applying huge forces.
  15291. Mouse Joint will auto register the touch event with the mouse region node,
  15292. and move the choosed rigidbody in touch move event.
  15293. Note : generally mouse joint only used in test bed.
  15294. !#zh
  15295. 鼠标关节用于使刚体上的一个点追踪一个指定的世界坐标系下的位置。
  15296. 鼠标关节可以指定一个最大的力来施加一个柔和的约束。
  15297. 鼠标关节会自动使用 mouse region 节点来注册鼠标事件,并且在触摸移动事件中移动选中的刚体。
  15298. 注意:一般鼠标关节只在测试环境中使用。 */
  15299. export class MouseJoint extends Joint {
  15300. /** !#en
  15301. The anchor of the rigidbody.
  15302. !#zh
  15303. 刚体的锚点。 */
  15304. anchor: Vec2;
  15305. /** !#en
  15306. The anchor of the connected rigidbody.
  15307. !#zh
  15308. 关节另一端刚体的锚点。 */
  15309. connectedAnchor: Vec2;
  15310. /** !#en
  15311. The node used to register touch evnet.
  15312. If this is null, it will be the joint's node.
  15313. !#zh
  15314. 用于注册触摸事件的节点。
  15315. 如果没有设置这个值,那么将会使用关节的节点来注册事件。 */
  15316. mouseRegion: Node;
  15317. /** !#en
  15318. The target point.
  15319. The mouse joint will move choosed rigidbody to target point.
  15320. !#zh
  15321. 目标点,鼠标关节将会移动选中的刚体到指定的目标点 */
  15322. target: Vec2;
  15323. /** !#en
  15324. The spring frequency.
  15325. !#zh
  15326. 弹簧系数。 */
  15327. frequency: number;
  15328. /** !#en
  15329. The damping ratio.
  15330. !#zh
  15331. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15332. 0: number;
  15333. /** !#en
  15334. The maximum force
  15335. !#zh
  15336. 最大阻力值 */
  15337. maxForce: number;
  15338. }
  15339. /** !#en
  15340. A prismatic joint. This joint provides one degree of freedom: translation
  15341. along an axis fixed in rigidbody. Relative rotation is prevented. You can
  15342. use a joint limit to restrict the range of motion and a joint motor to
  15343. drive the motion or to model joint friction.
  15344. !#zh
  15345. 移动关节指定了只能在一个方向上移动刚体。
  15346. 你可以开启关节限制来设置刚体运行移动的间距,也可以开启马达来使用关节马达驱动刚体的运行。 */
  15347. export class PrismaticJoint extends Joint {
  15348. /** !#en
  15349. The local joint axis relative to rigidbody.
  15350. !#zh
  15351. 指定刚体可以移动的方向。 */
  15352. localAxisA: Vec2;
  15353. /** !#en
  15354. The reference angle.
  15355. !#zh
  15356. 相对角度 */
  15357. referenceAngle: number;
  15358. /** !#en
  15359. Enable joint distance limit?
  15360. !#zh
  15361. 是否开启关节的距离限制? */
  15362. enableLimit: boolean;
  15363. /** !#en
  15364. Enable joint motor?
  15365. !#zh
  15366. 是否开启关节马达? */
  15367. enableMotor: boolean;
  15368. /** !#en
  15369. The lower joint limit.
  15370. !#zh
  15371. 刚体能够移动的最小值 */
  15372. lowerLimit: number;
  15373. /** !#en
  15374. The upper joint limit.
  15375. !#zh
  15376. 刚体能够移动的最大值 */
  15377. upperLimit: number;
  15378. /** !#en
  15379. The maxium force can be applied to rigidbody to rearch the target motor speed.
  15380. !#zh
  15381. 可以施加到刚体的最大力。 */
  15382. maxMotorForce: number;
  15383. /** !#en
  15384. The expected motor speed.
  15385. !#zh
  15386. 期望的马达速度。 */
  15387. motorSpeed: number;
  15388. }
  15389. /** !#en
  15390. A rope joint enforces a maximum distance between two points
  15391. on two bodies. It has no other effect.
  15392. Warning: if you attempt to change the maximum length during
  15393. the simulation you will get some non-physical behavior.
  15394. !#zh
  15395. 绳子关节只指定两个刚体间的最大距离,没有其他的效果。
  15396. 注意:如果你试图动态修改关节的长度,这有可能会得到一些意外的效果。 */
  15397. export class RopeJoint extends Joint {
  15398. /** !#en
  15399. The max length.
  15400. !#zh
  15401. 最大长度。 */
  15402. maxLength: number;
  15403. }
  15404. /** !#en
  15405. A revolute joint constrains two bodies to share a common point while they
  15406. are free to rotate about the point. The relative rotation about the shared
  15407. point is the joint angle. You can limit the relative rotation with
  15408. a joint limit that specifies a lower and upper angle. You can use a motor
  15409. to drive the relative rotation about the shared point. A maximum motor torque
  15410. is provided so that infinite forces are not generated.
  15411. !#zh
  15412. 旋转关节可以约束两个刚体围绕一个点来进行旋转。
  15413. 你可以通过开启关节限制来限制旋转的最大角度和最小角度。
  15414. 你可以通过开启马达来施加一个扭矩力来驱动这两个刚体在这一点上的相对速度。 */
  15415. export class RevoluteJoint extends Joint {
  15416. /** !#en
  15417. The reference angle.
  15418. An angle between bodies considered to be zero for the joint angle.
  15419. !#zh
  15420. 相对角度。
  15421. 两个物体之间角度为零时可以看作相等于关节角度 */
  15422. referenceAngle: number;
  15423. /** !#en
  15424. The lower angle.
  15425. !#zh
  15426. 角度的最低限制。 */
  15427. lowerAngle: number;
  15428. /** !#en
  15429. The upper angle.
  15430. !#zh
  15431. 角度的最高限制。 */
  15432. upperAngle: number;
  15433. /** !#en
  15434. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  15435. !#zh
  15436. 可以施加到刚体的最大扭矩。 */
  15437. maxMotorTorque: number;
  15438. /** !#en
  15439. The expected motor speed.
  15440. !#zh
  15441. 期望的马达速度。 */
  15442. motorSpeed: number;
  15443. /** !#en
  15444. Enable joint limit?
  15445. !#zh
  15446. 是否开启关节的限制? */
  15447. enableLimit: boolean;
  15448. /** !#en
  15449. Enable joint motor?
  15450. !#zh
  15451. 是否开启关节马达? */
  15452. enableMotor: boolean;
  15453. /**
  15454. !#en
  15455. Get the joint angle.
  15456. !#zh
  15457. 获取关节角度。
  15458. */
  15459. getJointAngle(): number;
  15460. }
  15461. /** !#en
  15462. A weld joint essentially glues two bodies together. A weld joint may
  15463. distort somewhat because the island constraint solver is approximate.
  15464. !#zh
  15465. 熔接关节相当于将两个刚体粘在了一起。
  15466. 熔接关节可能会使某些东西失真,因为约束求解器算出的都是近似值。 */
  15467. export class WeldJoint extends Joint {
  15468. /** !#en
  15469. The reference angle.
  15470. !#zh
  15471. 相对角度。 */
  15472. referenceAngle: number;
  15473. /** !#en
  15474. The frequency.
  15475. !#zh
  15476. 弹性系数。 */
  15477. frequency: number;
  15478. /** !#en
  15479. The damping ratio.
  15480. !#zh
  15481. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15482. 0: number;
  15483. }
  15484. /** !#en
  15485. A wheel joint. This joint provides two degrees of freedom: translation
  15486. along an axis fixed in bodyA and rotation in the plane. You can use a joint motor to drive
  15487. the rotation or to model rotational friction.
  15488. This joint is designed for vehicle suspensions.
  15489. !#zh
  15490. 轮子关节提供两个维度的自由度:旋转和沿着指定方向上位置的移动。
  15491. 你可以通过开启关节马达来使用马达驱动刚体的旋转。
  15492. 轮组关节是专门为机动车类型设计的。 */
  15493. export class WheelJoint extends Joint {
  15494. /** !#en
  15495. The local joint axis relative to rigidbody.
  15496. !#zh
  15497. 指定刚体可以移动的方向。 */
  15498. localAxisA: Vec2;
  15499. /** !#en
  15500. The maxium torque can be applied to rigidbody to rearch the target motor speed.
  15501. !#zh
  15502. 可以施加到刚体的最大扭矩。 */
  15503. maxMotorTorque: number;
  15504. /** !#en
  15505. The expected motor speed.
  15506. !#zh
  15507. 期望的马达速度。 */
  15508. motorSpeed: number;
  15509. /** !#en
  15510. Enable joint motor?
  15511. !#zh
  15512. 是否开启关节马达? */
  15513. enableMotor: boolean;
  15514. /** !#en
  15515. The spring frequency.
  15516. !#zh
  15517. 弹性系数。 */
  15518. frequency: number;
  15519. /** !#en
  15520. The damping ratio.
  15521. !#zh
  15522. 阻尼,表示关节变形后,恢复到初始状态受到的阻力。 */
  15523. dampingRatio: number;
  15524. }
  15525. /** !#en The color over time module of 3d particle.
  15526. !#zh 3D 粒子颜色变化模块 */
  15527. export class ColorOvertimeModule {
  15528. /** !#en The enable of ColorOvertimeModule.
  15529. !#zh 是否启用 */
  15530. enable: boolean;
  15531. }
  15532. /** !#en The curve range of target value.
  15533. !#zh 目标值的曲线范围 */
  15534. export class CurveRange {
  15535. /** !#en Curve type.
  15536. !#zh 曲线类型。 */
  15537. mode: debug.DebugMode;
  15538. /** !#en The curve to use when mode is Curve.
  15539. !#zh 当 mode 为 Curve 时,使用的曲线。 */
  15540. curve: AnimationCurve;
  15541. /** !#en The lower limit of the curve to use when mode is TwoCurves
  15542. !#zh 当 mode 为 TwoCurves 时,使用的曲线下限。 */
  15543. curveMin: AnimationCurve;
  15544. /** !#en The upper limit of the curve to use when mode is TwoCurves
  15545. !#zh 当 mode 为 TwoCurves 时,使用的曲线上限。 */
  15546. curveMax: AnimationCurve;
  15547. /** !#en When mode is Constant, the value of the curve.
  15548. !#zh 当 mode 为 Constant 时,曲线的值。 */
  15549. constant: number;
  15550. /** !#en The lower limit of the curve to use when mode is TwoConstants
  15551. !#zh 当 mode 为 TwoConstants 时,曲线的下限。 */
  15552. constantMin: number;
  15553. /** !#en The upper limit of the curve to use when mode is TwoConstants
  15554. !#zh 当 mode 为 TwoConstants 时,曲线的上限。 */
  15555. constantMax: number;
  15556. /** !#en Coefficients applied to curve interpolation.
  15557. !#zh 应用于曲线插值的系数。 */
  15558. multiplier: number;
  15559. }
  15560. /** !#en The force over time module of 3d particle.
  15561. !#zh 3D 粒子的加速度模块 */
  15562. export class ForceOvertimeModule {
  15563. /** !#en The enable of ColorOvertimeModule.
  15564. !#zh 是否启用 */
  15565. enable: boolean;
  15566. /** !#en Coordinate system used in acceleration calculation.
  15567. !#zh 加速度计算时采用的坐标系。 */
  15568. space: ParticleSystem3DAssembler.Space;
  15569. /** !#en X-axis acceleration component.
  15570. !#zh X 轴方向上的加速度分量。 */
  15571. x: CurveRange;
  15572. /** !#en Y-axis acceleration component.
  15573. !#zh Y 轴方向上的加速度分量。 */
  15574. y: CurveRange;
  15575. /** !#en Z-axis acceleration component.
  15576. !#zh Z 轴方向上的加速度分量。 */
  15577. z: CurveRange;
  15578. }
  15579. /** !#en The gradient range of color.
  15580. !#zh 颜色值的渐变范围 */
  15581. export class GradientRange {
  15582. /** !#en Gradient type.
  15583. !#zh 渐变色类型。 */
  15584. mode: debug.DebugMode;
  15585. /** !#en The color when mode is Color.
  15586. !#zh 当 mode 为 Color 时的颜色。 */
  15587. color: Color;
  15588. /** !#en Lower color limit when mode is TwoColors.
  15589. !#zh 当 mode 为 TwoColors 时的颜色下限。 */
  15590. colorMin: Color;
  15591. /** !#en Upper color limit when mode is TwoColors.
  15592. !#zh 当 mode 为 TwoColors 时的颜色上限。 */
  15593. colorMax: Color;
  15594. /** !#en Color gradient when mode is Gradient
  15595. !#zh 当 mode 为 Gradient 时的颜色渐变。 */
  15596. gradient: Gradient;
  15597. /** !#en Lower color gradient limit when mode is TwoGradients.
  15598. !#zh 当 mode 为 TwoGradients 时的颜色渐变下限。 */
  15599. gradientMin: Gradient;
  15600. /** !#en Upper color gradient limit when mode is TwoGradients.
  15601. !#zh 当 mode 为 TwoGradients 时的颜色渐变上限。 */
  15602. gradientMax: Gradient;
  15603. }
  15604. /** !#en The color key of gradient.
  15605. !#zh color 关键帧 */
  15606. export class ColorKey {
  15607. /** !#en Color value.
  15608. !#zh 颜色值。 */
  15609. color: Color;
  15610. /** !#en Time value.
  15611. !#zh 时间值。 */
  15612. time: number;
  15613. }
  15614. /** !#en The alpha key of gradient.
  15615. !#zh alpha 关键帧 */
  15616. export class AlphaKey {
  15617. /** !#en Alpha value.
  15618. !#zh 透明度。 */
  15619. alpha: number;
  15620. /** !#en Time.
  15621. !#zh 时间帧。 */
  15622. time: number;
  15623. }
  15624. /** !#en The gradient data of color.
  15625. !#zh 颜色渐变数据 */
  15626. export class Gradient {
  15627. /** !#en Array of color key.
  15628. !#zh 颜色关键帧列表。 */
  15629. colorKeys: ColorKey[];
  15630. /** !#en Array of alpha key.
  15631. !#zh 透明度关键帧列表。 */
  15632. alphaKeys: AlphaKey[];
  15633. /** !#en Blend mode.
  15634. !#zh 混合模式。 */
  15635. mode: debug.DebugMode;
  15636. }
  15637. /** !#en The limit velocity module of 3d particle.
  15638. !#zh 3D 粒子的限速模块 */
  15639. export class LimitVelocityOvertimeModule {
  15640. /** !#en The enable of LimitVelocityOvertimeModule.
  15641. !#zh 是否启用 */
  15642. enable: boolean;
  15643. /** !#en The coordinate system used when calculating the lower speed limit.
  15644. !#zh 计算速度下限时采用的坐标系。 */
  15645. space: ParticleSystem3DAssembler.Space;
  15646. /** !#en Whether to limit the three axes separately.
  15647. !#zh 是否三个轴分开限制。 */
  15648. separateAxes: boolean;
  15649. /** !#en Lower speed limit
  15650. !#zh 速度下限。 */
  15651. limit: CurveRange;
  15652. /** !#en Lower speed limit in X direction.
  15653. !#zh X 轴方向上的速度下限。 */
  15654. limitX: CurveRange;
  15655. /** !#en Lower speed limit in Y direction.
  15656. !#zh Y 轴方向上的速度下限。 */
  15657. limitY: CurveRange;
  15658. /** !#en Lower speed limit in Z direction.
  15659. !#zh Z 轴方向上的速度下限。 */
  15660. limitZ: CurveRange;
  15661. /** !#en Interpolation of current speed and lower speed limit.
  15662. !#zh 当前速度与速度下限的插值。 */
  15663. dampen: number;
  15664. }
  15665. /** !#en The optimized curve.
  15666. !#zh 优化曲线 */
  15667. export class OptimizedCurve {
  15668. }
  15669. /** !#en The rotation module of 3d particle.
  15670. !#zh 3D 粒子的旋转模块 */
  15671. export class RotationOvertimeModule {
  15672. /** !#en The enable of RotationOvertimeModule.
  15673. !#zh 是否启用 */
  15674. enable: boolean;
  15675. /** !#en Whether to set the rotation of three axes separately (not currently supported)
  15676. !#zh 是否三个轴分开设定旋转(暂不支持)。 */
  15677. separateAxes: boolean;
  15678. /** !#en Set rotation around X axis.
  15679. !#zh 绕 X 轴设定旋转。 */
  15680. x: CurveRange;
  15681. /** !#en Set rotation around Y axis.
  15682. !#zh 绕 Y 轴设定旋转。 */
  15683. y: CurveRange;
  15684. /** !#en Set rotation around Z axis.
  15685. !#zh 绕 Z 轴设定旋转。 */
  15686. z: CurveRange;
  15687. }
  15688. /** !#en The size module of 3d particle.
  15689. !#zh 3D 粒子的大小模块 */
  15690. export class SizeOvertimeModule {
  15691. /** !#en The enable of SizeOvertimeModule.
  15692. !#zh 是否启用 */
  15693. enable: boolean;
  15694. /** !#en Decide whether to control particle size independently on each axis.
  15695. !#zh 决定是否在每个轴上独立控制粒子大小。 */
  15696. separateAxes: boolean;
  15697. /** !#en Define a curve to determine the size change of particles during their life cycle.
  15698. !#zh 定义一条曲线来决定粒子在其生命周期中的大小变化。 */
  15699. size: CurveRange;
  15700. /** !#en Defines a curve to determine the size change of particles in the X-axis direction during their life cycle.
  15701. !#zh 定义一条曲线来决定粒子在其生命周期中 X 轴方向上的大小变化。 */
  15702. x: CurveRange;
  15703. /** !#en Defines a curve to determine the size change of particles in the Y-axis direction during their life cycle.
  15704. !#zh 定义一条曲线来决定粒子在其生命周期中 Y 轴方向上的大小变化。 */
  15705. y: CurveRange;
  15706. /** !#en Defines a curve to determine the size change of particles in the Z-axis direction during their life cycle.
  15707. !#zh 定义一条曲线来决定粒子在其生命周期中 Z 轴方向上的大小变化。 */
  15708. z: CurveRange;
  15709. }
  15710. /** !#en The texture animation module of 3d particle.
  15711. !#zh 3D 粒子的贴图动画模块 */
  15712. export class TextureAnimationModule {
  15713. /** !#en The enable of TextureAnimationModule.
  15714. !#zh 是否启用 */
  15715. enable: boolean;
  15716. /** !#en Set the type of particle map animation (only supports Grid mode for the time being)
  15717. !#zh 设定粒子贴图动画的类型(暂只支持 Grid 模式。 */
  15718. mode: debug.DebugMode;
  15719. /** !#en Animation frames in X direction.
  15720. !#zh X 方向动画帧数。 */
  15721. numTilesX: number;
  15722. /** !#en Animation frames in Y direction.
  15723. !#zh Y 方向动画帧数。 */
  15724. numTilesY: number;
  15725. /** !#en The way of the animation plays.
  15726. !#zh 动画播放方式。 */
  15727. animation: Animation;
  15728. /** !#en Randomly select a line from the animated map to generate the animation. <br>
  15729. This option only takes effect when the animation playback mode is SingleRow.
  15730. !#zh 随机从动画贴图中选择一行以生成动画。<br>
  15731. 此选项仅在动画播放方式为 SingleRow 时生效。 */
  15732. randomRow: boolean;
  15733. /** !#en Select specific lines from the animation map to generate the animation. <br>
  15734. This option is only available when the animation playback mode is SingleRow and randomRow is disabled.
  15735. !#zh 从动画贴图中选择特定行以生成动画。<br>
  15736. 此选项仅在动画播放方式为 SingleRow 时且禁用 randomRow 时可用。 */
  15737. rowIndex: number;
  15738. /** !#en Frame and time curve of animation playback in one cycle.
  15739. !#zh 一个周期内动画播放的帧与时间变化曲线。 */
  15740. frameOverTime: CurveRange;
  15741. /** !#en Play from which frames, the time is the life cycle of the entire particle system.
  15742. !#zh 从第几帧开始播放,时间为整个粒子系统的生命周期。 */
  15743. startFrame: CurveRange;
  15744. /** !#en Number of playback loops in a life cycle.
  15745. !#zh 一个生命周期内播放循环的次数。 */
  15746. cycleCount: number;
  15747. }
  15748. /** !#en The velocity module of 3d particle.
  15749. !#zh 3D 粒子的速度模块 */
  15750. export class VelocityOvertimeModule {
  15751. /** !#en The enable of VelocityOvertimeModule.
  15752. !#zh 是否启用 */
  15753. enable: boolean;
  15754. /** !#en Coordinate system used in speed calculation.
  15755. !#zh 速度计算时采用的坐标系。 */
  15756. space: ParticleSystem3DAssembler.Space;
  15757. /** !#en Velocity component in X axis direction
  15758. !#zh X 轴方向上的速度分量。 */
  15759. x: CurveRange;
  15760. /** !#en Velocity component in Y axis direction
  15761. !#zh Y 轴方向上的速度分量。 */
  15762. y: CurveRange;
  15763. /** !#en Velocity component in Z axis direction
  15764. !#zh Z 轴方向上的速度分量。 */
  15765. z: CurveRange;
  15766. /** !#en Speed correction factor (only supports CPU particles).
  15767. !#zh 速度修正系数(只支持 CPU 粒子)。 */
  15768. speedModifier: CurveRange;
  15769. }
  15770. /** !#en The shape module of 3d particle.
  15771. !#zh 3D 粒子的发射形状模块 */
  15772. export class ShapeModule {
  15773. /** !#en The enable of shapeModule.
  15774. !#zh 是否启用 */
  15775. enable: boolean;
  15776. /** !#en Particle emitter type.
  15777. !#zh 粒子发射器类型。 */
  15778. shapeType: shapeModule.ShapeType;
  15779. /** !#en The emission site of the particle.
  15780. !#zh 粒子从发射器哪个部位发射。 */
  15781. emitFrom: shapeModule.EmitLocation;
  15782. /** !#en Particle emitter radius.
  15783. !#zh 粒子发射器半径。 */
  15784. radius: number;
  15785. /** !#en Particle emitter emission position (not valid for Box type emitters):<bg>
  15786. - 0 means emitted from the surface;
  15787. - 1 means launch from the center;
  15788. - 0 ~ 1 indicates emission from the center to the surface.
  15789. !#zh 粒子发射器发射位置(对 Box 类型的发射器无效):<bg>
  15790. - 0 表示从表面发射;
  15791. - 1 表示从中心发射;
  15792. - 0 ~ 1 之间表示在中心到表面之间发射。 */
  15793. radiusThickness: number;
  15794. /** !#en The angle between the axis of the cone and the generatrix<bg>
  15795. Determines the opening and closing of the cone launcher
  15796. !#zh 圆锥的轴与母线的夹角<bg>。
  15797. 决定圆锥发射器的开合程度。 */
  15798. angle: number;
  15799. /** !#en Particle emitters emit in a fan-shaped range.
  15800. !#zh 粒子发射器在一个扇形范围内发射。 */
  15801. arc: number;
  15802. /** !#en How particles are emitted in the sector range.
  15803. !#zh 粒子在扇形范围内的发射方式。 */
  15804. arcMode: shapeModule.ArcMode;
  15805. /** !#en Controls the discrete intervals around the arcs where particles might be generated.
  15806. !#zh 控制可能产生粒子的弧周围的离散间隔。 */
  15807. arcSpread: number;
  15808. /** !#en The speed at which particles are emitted around the circumference.
  15809. !#zh 粒子沿圆周发射的速度。 */
  15810. arcSpeed: CurveRange;
  15811. /** !#en Axis length from top of cone to bottom of cone <bg>.
  15812. Determines the height of the cone emitter.
  15813. !#zh 圆锥顶部截面距离底部的轴长<bg>。
  15814. 决定圆锥发射器的高度。 */
  15815. length: number;
  15816. /** !#en Particle emitter emission location (for box-type particle emitters).
  15817. !#zh 粒子发射器发射位置(针对 Box 类型的粒子发射器。 */
  15818. boxThickness: Vec3;
  15819. /** !#en Particle Emitter Position
  15820. !#zh 粒子发射器位置。 */
  15821. position: Vec3;
  15822. /** !#en Particle emitter rotation angle.
  15823. !#zh 粒子发射器旋转角度。 */
  15824. rotation: Vec3;
  15825. /** !#en Particle emitter scaling
  15826. !#zh 粒子发射器缩放比例。 */
  15827. scale: Vec3;
  15828. /** !#en The direction of particle movement is determined based on the initial direction of the particles.
  15829. !#zh 根据粒子的初始方向决定粒子的移动方向。 */
  15830. alignToDirection: boolean;
  15831. /** !#en Set particle generation direction randomly.
  15832. !#zh 粒子生成方向随机设定。 */
  15833. randomDirectionAmount: number;
  15834. /** !#en Interpolation between the current emission direction and the direction from the current position to the center of the node.
  15835. !#zh 表示当前发射方向与当前位置到结点中心连线方向的插值。 */
  15836. sphericalDirectionAmount: number;
  15837. }
  15838. /** !#en The trail module of 3d particle.
  15839. !#zh 3D 粒子拖尾模块 */
  15840. export class TrailModule {
  15841. /** !#en The enable of trailModule.
  15842. !#zh 是否启用 */
  15843. enable: boolean;
  15844. /** !#en Sets how particles generate trajectories.
  15845. !#zh 设定粒子生成轨迹的方式。 */
  15846. mode: trailModule.TrailMode;
  15847. /** !#en Life cycle of trajectory.
  15848. !#zh 轨迹存在的生命周期。 */
  15849. lifeTime: CurveRange;
  15850. /** !#en Minimum spacing between each track particle
  15851. !#zh 每个轨迹粒子之间的最小间距。 */
  15852. minParticleDistance: number;
  15853. /** !#en The coordinate system of trajectories.
  15854. !#zh 轨迹设定时的坐标系。 */
  15855. space: ParticleSystem3DAssembler.Space;
  15856. /** !#en Whether the particle itself exists.
  15857. !#zh 粒子本身是否存在。 */
  15858. existWithParticles: boolean;
  15859. /** !#en Set the texture fill method
  15860. !#zh 设定纹理填充方式。 */
  15861. textureMode: trailModule.TextureMode;
  15862. /** !#en Whether to use particle width
  15863. !#zh 是否使用粒子的宽度。 */
  15864. widthFromParticle: boolean;
  15865. /** !#en Curves that control track length
  15866. !#zh 控制轨迹长度的曲线。 */
  15867. widthRatio: CurveRange;
  15868. /** !#en Whether to use particle color
  15869. !#zh 是否使用粒子的颜色。 */
  15870. colorFromParticle: boolean;
  15871. /** !#en The color of trajectories.
  15872. !#zh 轨迹的颜色。 */
  15873. colorOverTrail: GradientRange;
  15874. /** !#en Trajectories color over time.
  15875. !#zh 轨迹随时间变化的颜色。 */
  15876. colorOvertime: GradientRange;
  15877. }
  15878. /** !#en
  15879. Trigger event
  15880. !#zh
  15881. 触发事件。 */
  15882. export class ITriggerEvent {
  15883. /** !#en
  15884. The type of event fired
  15885. !#zh
  15886. 触发的事件类型 */
  15887. type: string;
  15888. /** !#en
  15889. Triggers its own collider in the event
  15890. !#zh
  15891. 触发事件中的自己的碰撞器 */
  15892. selfCollider: Collider3D;
  15893. /** !#en
  15894. Triggers another collider in the event
  15895. !#zh
  15896. 触发事件中的另一个碰撞器 */
  15897. otherCollider: Collider3D;
  15898. }
  15899. /** !#en
  15900. Collision information for collision events.
  15901. !#zh
  15902. 碰撞事件的碰撞信息。 */
  15903. export class IContactEquation {
  15904. /** !#en
  15905. The collision point A in the collision information.
  15906. !#zh
  15907. 碰撞信息中的碰撞点 A。 */
  15908. contactA: Vec3;
  15909. /** !#en
  15910. Collision point B in collision information.
  15911. !#zh
  15912. 碰撞信息中的碰撞点 B。 */
  15913. contactB: Vec3;
  15914. /** !#en
  15915. Normals in collision information.
  15916. !#zh
  15917. 碰撞信息中的法线。 */
  15918. normal: Vec3;
  15919. }
  15920. /** !#en
  15921. Collision events.
  15922. !#zh
  15923. 碰撞事件。 */
  15924. export class ICollisionEvent {
  15925. /** !#en
  15926. Event type of collision.
  15927. !#zh
  15928. 碰撞的事件类型。 */
  15929. type: string;
  15930. /** !#en
  15931. Collider of its own in collision.
  15932. !#zh
  15933. 碰撞中的自己的碰撞器。 */
  15934. selfCollider: Collider3D;
  15935. /** !#en
  15936. Another collider in the collision.
  15937. !#zh
  15938. 碰撞中的另一个碰撞器。 */
  15939. otherCollider: Collider3D;
  15940. /** !#en
  15941. Information about all the points of impact in the collision.
  15942. !#zh
  15943. 碰撞中的所有碰撞点的信息。 */
  15944. contacts: IContactEquation[];
  15945. }
  15946. /** !#en The rigid body type
  15947. !#zh 刚体类型 */
  15948. export enum ERigidBodyType {
  15949. DYNAMIC = 0,
  15950. STATIC = 0,
  15951. KINEMATIC = 0,
  15952. }
  15953. /** !#en
  15954. Physical systems manager.
  15955. !#zh
  15956. 物理系统管理器。 */
  15957. export class Physics3DManager {
  15958. /** !#en
  15959. Whether to enable the physics system, default is false.
  15960. !#zh
  15961. 是否启用物理系统,默认不启用。 */
  15962. enabled: boolean;
  15963. /** !#en
  15964. Whether to allow the physics system to automatically hibernate, default is true.
  15965. !#zh
  15966. 物理系统是否允许自动休眠,默认为 true。 */
  15967. allowSleep: boolean;
  15968. /** !#en
  15969. The maximum number of sub-steps a full step is permitted to be broken into, default is 2.
  15970. !#zh
  15971. 物理每帧模拟的最大子步数,默认为 2。 */
  15972. maxSubStep: number;
  15973. /** !#en
  15974. Time spent in each simulation of physics, default is 1/60s.
  15975. !#zh
  15976. 物理每步模拟消耗的固定时间,默认为 1/60 秒。 */
  15977. deltaTime: number;
  15978. /** !#en
  15979. Whether to use a fixed time step.
  15980. !#zh
  15981. 是否使用固定的时间步长。 */
  15982. useFixedTime: boolean;
  15983. /** !#en
  15984. Gravity value of the physics simulation, default is (0, -10, 0).
  15985. !#zh
  15986. 物理世界的重力数值,默认为 (0, -10, 0)。 */
  15987. gravity: Vec3;
  15988. /** !#en
  15989. Gets the global default physical material. Note that builtin is null.
  15990. !#zh
  15991. 获取全局的默认物理材质,注意:builtin 时为 null。 */
  15992. defaultMaterial: PhysicsMaterial|void;
  15993. /**
  15994. !#en
  15995. A physical system simulation is performed once and will now be performed automatically once per frame.
  15996. !#zh
  15997. 执行一次物理系统的模拟,目前将在每帧自动执行一次。
  15998. @param deltaTime The time difference from the last execution is currently elapsed per frame
  15999. */
  16000. update(deltaTime: number): void;
  16001. /**
  16002. !#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.
  16003. !#zh 检测所有的碰撞盒,并返回所有被检测到的结果,若没有检测到,则返回空值。注意返回值是从对象池中取的,所以请不要保存结果引用或者修改结果。
  16004. @param worldRay A ray in world space
  16005. @param groupIndexOrName Collision group index or group name
  16006. @param maxDistance Maximum detection distance
  16007. @param queryTrigger Detect trigger or not
  16008. */
  16009. raycast(worldRay: geomUtils.Ray, groupIndexOrName: number|string, maxDistance: number, queryTrigger: boolean): PhysicsRayResult[];
  16010. /**
  16011. !#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.
  16012. !#zh 检测所有的碰撞盒,并返回射线距离最短的检测结果,若没有,则返回空值。注意返回值是从对象池中取的,所以请不要保存结果引用或者修改结果。
  16013. @param worldRay A ray in world space
  16014. @param groupIndexOrName Collision group index or group name
  16015. @param maxDistance Maximum detection distance
  16016. @param queryTrigger Detect trigger or not
  16017. */
  16018. raycastClosest(worldRay: geomUtils.Ray, groupIndexOrName: number|string, maxDistance: number, queryTrigger: boolean): PhysicsRayResult;
  16019. }
  16020. /** !#en
  16021. Used to store physical ray detection results
  16022. !#zh
  16023. 用于保存物理射线检测结果 */
  16024. export class PhysicsRayResult {
  16025. /** !#en
  16026. Hit the point
  16027. !#zh
  16028. 击中点 */
  16029. hitPoint: Vec3;
  16030. /** !#en
  16031. Distance
  16032. !#zh
  16033. 距离 */
  16034. distance: number;
  16035. /** !#en
  16036. Hit the collision box
  16037. !#zh
  16038. 击中的碰撞盒 */
  16039. collider: Collider3D;
  16040. /**
  16041. !#en
  16042. Set up ray. This method is used internally by the engine. Do not call it from an external script
  16043. !#zh
  16044. 设置射线,此方法由引擎内部使用,请勿在外部脚本调用
  16045. @param hitPoint hitPoint
  16046. @param distance distance
  16047. @param collider collider
  16048. */
  16049. _assign(hitPoint: Vec3, distance: number, collider: Collider3D): void;
  16050. /**
  16051. !#en
  16052. Clone
  16053. !#zh
  16054. 克隆
  16055. */
  16056. clone(): void;
  16057. }
  16058. /** Rigid body interface */
  16059. export class IRigidBody {
  16060. rigidBody: RigidBody3D;
  16061. mass: number;
  16062. linearDamping: number;
  16063. angularDamping: number;
  16064. isKinematic: boolean;
  16065. useGravity: boolean;
  16066. fixedRotation: boolean;
  16067. linearFactor: IVec3Like;
  16068. angularFactor: IVec3Like;
  16069. allowSleep: boolean;
  16070. isAwake: boolean;
  16071. isSleepy: boolean;
  16072. isSleeping: boolean;
  16073. wakeUp(): void;
  16074. sleep(): void;
  16075. /**
  16076. @param out out
  16077. */
  16078. getLinearVelocity(out: IVec3Like): void;
  16079. /**
  16080. @param out out
  16081. */
  16082. setLinearVelocity(out: IVec3Like): void;
  16083. /**
  16084. @param out out
  16085. */
  16086. getAngularVelocity(out: IVec3Like): void;
  16087. /**
  16088. @param out out
  16089. */
  16090. setAngularVelocity(out: IVec3Like): void;
  16091. /**
  16092. @param force force
  16093. @param relativePoint relativePoint
  16094. */
  16095. applyForce(force: IVec3Like, relativePoint: IVec3Like): void;
  16096. /**
  16097. @param force force
  16098. @param relativePoint relativePoint
  16099. */
  16100. applyLocalForce(force: IVec3Like, relativePoint: IVec3Like): void;
  16101. /**
  16102. @param force force
  16103. @param relativePoint relativePoint
  16104. */
  16105. applyImpulse(force: IVec3Like, relativePoint: IVec3Like): void;
  16106. /**
  16107. @param force force
  16108. @param relativePoint relativePoint
  16109. */
  16110. applyLocalImpulse(force: IVec3Like, relativePoint: IVec3Like): void;
  16111. /**
  16112. @param torque torque
  16113. */
  16114. applyTorque(torque: IVec3Like): void;
  16115. /**
  16116. @param torque torque
  16117. */
  16118. applyLocalTorque(torque: IVec3Like): void;
  16119. }
  16120. /** Class has x y z properties */
  16121. export class IVec3Like {
  16122. x: number;
  16123. y: number;
  16124. z: number;
  16125. }
  16126. /** Class has x y z w properties */
  16127. export class IQuatLike {
  16128. x: number;
  16129. y: number;
  16130. z: number;
  16131. w: number;
  16132. }
  16133. /** !#en Base shape interface. */
  16134. export class IBaseShape {
  16135. collider: Collider3D;
  16136. attachedRigidBody: RigidBody3D|void;
  16137. material: any;
  16138. isTrigger: boolean;
  16139. center: IVec3Like;
  16140. }
  16141. /** !#en box shape interface */
  16142. export class IBoxShape {
  16143. size: IVec3Like;
  16144. }
  16145. /** !#en Sphere shape interface */
  16146. export class ISphereShape {
  16147. radius: number;
  16148. }
  16149. /** Ray cast options */
  16150. export class IRaycastOptions {
  16151. groupIndex: number;
  16152. queryTrigger: boolean;
  16153. maxDistance: number;
  16154. }
  16155. /** Collision detect */
  16156. export class ICollisionDetect {
  16157. /**
  16158. Ray cast, and return information of the closest hit.
  16159. @param worldRay worldRay
  16160. @param options options
  16161. @param out out
  16162. */
  16163. raycastClosest(worldRay: geomUtils.Ray, options: IRaycastOptions, out: PhysicsRayResult): boolean;
  16164. /**
  16165. Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.
  16166. @param worldRay worldRay
  16167. @param options options
  16168. @param pool pool
  16169. @param resultes resultes
  16170. */
  16171. raycast(worldRay: geomUtils.Ray, options: IRaycastOptions, pool: RecyclePool, resultes: PhysicsRayResult[]): boolean;
  16172. }
  16173. /** Physics world interface */
  16174. export class IPhysicsWorld {
  16175. }
  16176. /** !#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.
  16177. !#zh 管理动态图集。动态图集用于在运行时对贴图进行合并,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 */
  16178. export class DynamicAtlasManager {
  16179. /** !#en Enable or disable the dynamic atlas, see [Dynamic Atlas](https://docs.cocos.com/creator/manual/en/advanced-topics/dynamic-atlas.html) for details.
  16180. !#zh 开启或者关闭动态图集,详见 [动态合图](https://docs.cocos.com/creator/manual/zh/advanced-topics/dynamic-atlas.html)。 */
  16181. enabled: boolean;
  16182. /** !#en The maximum number of atlas that can be created.
  16183. !#zh 可以创建的最大图集数量。 */
  16184. maxAtlasCount: number;
  16185. /** !#en Get the current created atlas count.
  16186. !#zh 获取当前已经创建的图集数量。 */
  16187. atlasCount: number;
  16188. /** !#en Is enable textureBleeding.
  16189. !#zh 是否开启 textureBleeding */
  16190. textureBleeding: boolean;
  16191. /** !#en The size of the atlas that was created
  16192. !#zh 创建的图集的宽高 */
  16193. textureSize: number;
  16194. /** !#en The maximum size of the picture that can be added to the atlas.
  16195. !#zh 可以添加进图集的图片的最大尺寸。 */
  16196. maxFrameSize: number;
  16197. /** !#en The minimum size of the picture that can be added to the atlas.
  16198. !#zh 可以添加进图集的图片的最小尺寸。 */
  16199. minFrameSize: number;
  16200. /**
  16201. !#en Append a sprite frame into the dynamic atlas.
  16202. !#zh 添加碎图进入动态图集。
  16203. @param spriteFrame spriteFrame
  16204. */
  16205. insertSpriteFrame(spriteFrame: SpriteFrame): void;
  16206. /**
  16207. !#en Resets all dynamic atlas, and the existing ones will be destroyed.
  16208. !#zh 重置所有动态图集,已有的动态图集会被销毁。
  16209. */
  16210. reset(): void;
  16211. /**
  16212. !#en Displays all the dynamic atlas in the current scene, which you can use to view the current atlas state.
  16213. !#zh 在当前场景中显示所有动态图集,可以用来查看当前的合图状态。
  16214. @param show show
  16215. */
  16216. showDebug(show: boolean): Node;
  16217. }
  16218. /** !#en
  16219. Each frame applies a constant force to a rigid body, depending on the RigidBody3D
  16220. !#zh
  16221. 在每帧对一个刚体施加持续的力,依赖 RigidBody3D 组件 */
  16222. export class ConstantForce extends Component {
  16223. /** !#en
  16224. Set the force used in the world coordinate system, use `this.force = otherVec3`.
  16225. !#zh
  16226. 设置世界坐标系中使用的力,设置时请用 `this.force = otherVec3` 的方式。 */
  16227. force: Vec3;
  16228. /** !#en
  16229. Set the force used in the local coordinate system, using `this.localforce = otherVec3`.
  16230. !#zh
  16231. 获取和设置本地坐标系中使用的力,设置时请用 `this.localForce = otherVec3` 的方式。 */
  16232. localForce: Vec3;
  16233. /** !#en
  16234. Torque applied to the world orientation
  16235. !#zh
  16236. 对世界朝向施加的扭矩 */
  16237. torque: Vec3;
  16238. /** !#en
  16239. Torque applied to local orientation, using `this.localtorque = otherVec3`.
  16240. !#zh
  16241. 对本地朝向施加的扭矩,设置时请用 `this.localTorque = otherVec3` 的方式。 */
  16242. localTorque: Vec3;
  16243. }
  16244. /** !#en
  16245. RigidBody is the basic object that make up the physical world, and it can make a node physically affected and react.
  16246. !#zh
  16247. 刚体是组成物理世界的基本对象,可以让一个节点受到物理影响并产生反应。该组件在使用 Builtin 物理引擎时无效。 */
  16248. export class RigidBody3D extends Component {
  16249. /** !#en
  16250. Whether sleep is allowed.
  16251. !#zh
  16252. 是否允许休眠。 */
  16253. allowSleep: boolean;
  16254. /** !#en
  16255. The mass of the rigidbody.
  16256. !#zh
  16257. 刚体的质量。 */
  16258. mass: number;
  16259. /** !#en
  16260. Used to reduce the linear rate of rigidbody. The larger the value, the slower the rigidbody moves.
  16261. !#zh
  16262. 线性阻尼,用于减小刚体的线性速率,值越大物体移动越慢。 */
  16263. linearDamping: number;
  16264. /** !#en
  16265. Used to reduce the rotation rate of rigidbody. The larger the value, the slower the rigidbody rotates.
  16266. !#zh
  16267. 角阻尼,用于减小刚体的旋转速率,值越大刚体旋转越慢。 */
  16268. angularDamping: number;
  16269. /** !#en
  16270. If enabled, the developer controls the displacement and rotation of the rigidbody, not the physics engine.
  16271. !#zh
  16272. 是否由开发者来控制刚体的位移和旋转,而不是受物理引擎的影响。 */
  16273. isKinematic: boolean;
  16274. /** !#en
  16275. If enabled, the rigidbody is affected by gravity.
  16276. !#zh
  16277. 如果开启,刚体会受到重力影响。 */
  16278. useGravity: boolean;
  16279. /** !#en
  16280. If enabled, the rigidbody will be fixed without rotation during a collision.
  16281. !#zh
  16282. 如果开启,发生碰撞时会固定刚体不产生旋转。 */
  16283. fixedRotation: boolean;
  16284. /** !#en
  16285. It can affect the linear velocity change of the rigidbody in each axis. The larger the value, the faster the rigidbody moves.
  16286. !#zh
  16287. 线性因子,可影响刚体在每个轴向的线性速度变化,值越大刚体移动越快。 */
  16288. linearFactor: Vec3;
  16289. /** !#en
  16290. It can affect the rotation speed change of the rigidbody in each axis. The larger the value, the faster the rigidbody rotates.
  16291. !#zh
  16292. 旋转因子,可影响刚体在每个轴向的旋转速度变化,值越大刚体旋转越快。 */
  16293. angularFactor: Vec3;
  16294. /** !#en
  16295. The rigidbody is awake.
  16296. !#zh
  16297. 刚体是否为唤醒的状态。 */
  16298. isAwake: boolean;
  16299. /** !#en
  16300. The rigidbody can enter hibernation.
  16301. !#zh
  16302. 刚体是否为可进入休眠的状态。 */
  16303. isSleepy: boolean;
  16304. /** !#en
  16305. The rigidbody is sleeping.
  16306. !#zh
  16307. 刚体是否为正在休眠的状态。 */
  16308. isSleeping: boolean;
  16309. /** !#en
  16310. Get the rigidbody object inside the physics engine.
  16311. !#zh
  16312. 获得物理引擎内部刚体对象。 */
  16313. rigidBody: IRigidBody;
  16314. /**
  16315. !#en
  16316. A force is applied to a rigid body at a point in world space.
  16317. !#zh
  16318. 在世界空间中的某点上对刚体施加一个作用力。
  16319. @param force force
  16320. @param relativePoint The point of action, relative to the center of the rigid body.
  16321. */
  16322. applyForce(force: Vec3, relativePoint: Vec3): void;
  16323. /**
  16324. !#en
  16325. Apply a force on the rigid body at a point in local space.
  16326. !#zh
  16327. 在本地空间中的某点上对刚体施加一个作用力。
  16328. @param force force
  16329. @param localPoint Point of application
  16330. */
  16331. applyLocalForce(force: Vec3, localPoint: Vec3): void;
  16332. /**
  16333. !#en
  16334. Apply an impulse to a rigid body at a point in world space.
  16335. !#zh
  16336. 在世界空间的某点上对刚体施加一个冲量。
  16337. @param impulse impulse
  16338. @param relativePoint The point of action, relative to the center of the rigid body.
  16339. */
  16340. applyImpulse(impulse: Vec3, relativePoint: Vec3): void;
  16341. /**
  16342. !#en
  16343. Apply an impulse to the rigid body at a point in local space.
  16344. !#zh
  16345. 在本地空间的某点上对刚体施加一个冲量。
  16346. @param impulse impulse
  16347. @param localPoint Point of application
  16348. */
  16349. applyLocalImpulse(impulse: Vec3, localPoint: Vec3): void;
  16350. /**
  16351. !#en
  16352. Apply a torque to the rigid body.
  16353. !#zh
  16354. 对刚体施加扭转力。
  16355. @param torque torque
  16356. */
  16357. applyTorque(torque: Vec3): void;
  16358. /**
  16359. !#en
  16360. Apply a local torque to the rigid body.
  16361. !#zh
  16362. 对刚体施加本地扭转力。
  16363. @param torque torque
  16364. */
  16365. applyLocalTorque(torque: Vec3): void;
  16366. /**
  16367. !#en
  16368. Awaken the rigid body.
  16369. !#zh
  16370. 唤醒刚体。
  16371. */
  16372. wakeUp(): void;
  16373. /**
  16374. !#en
  16375. Dormant rigid body.
  16376. !#zh
  16377. 休眠刚体。
  16378. */
  16379. sleep(): void;
  16380. /**
  16381. !#en
  16382. Get linear velocity.
  16383. !#zh
  16384. 获取线性速度。
  16385. @param out out
  16386. */
  16387. getLinearVelocity(out: Vec3): void;
  16388. /**
  16389. !#en
  16390. Set linear speed.
  16391. !#zh
  16392. 设置线性速度。
  16393. @param value value
  16394. */
  16395. setLinearVelocity(value: Vec3): void;
  16396. /**
  16397. !#en
  16398. Gets the rotation speed.
  16399. !#zh
  16400. 获取旋转速度。
  16401. @param out out
  16402. */
  16403. getAngularVelocity(out: Vec3): void;
  16404. /**
  16405. !#en
  16406. Set rotation speed.
  16407. !#zh
  16408. 设置旋转速度。
  16409. @param value value
  16410. */
  16411. setAngularVelocity(value: Vec3): void;
  16412. }
  16413. /** !#en
  16414. Physics material.
  16415. !#zh
  16416. 物理材质。 */
  16417. export class PhysicsMaterial extends Asset {
  16418. /** !#en
  16419. Friction for this material.
  16420. !#zh
  16421. 物理材质的摩擦力。 */
  16422. friction: number;
  16423. /** !#en
  16424. Restitution for this material.
  16425. !#zh
  16426. 物理材质的弹力。 */
  16427. restitution: number;
  16428. }
  16429. /** !#en
  16430. Physics box collider
  16431. !#zh
  16432. 物理盒子碰撞器 */
  16433. export class BoxCollider3D extends Collider3D {
  16434. /** !#en
  16435. Get or set the size of the box, in local space.
  16436. !#zh
  16437. 获取或设置盒的大小。 */
  16438. size: Vec3;
  16439. boxShape: IBoxShape;
  16440. }
  16441. /** !#en
  16442. The base class of the collider.
  16443. !#zh
  16444. 碰撞器的基类。 */
  16445. export class Collider3D extends Component implements EventTarget {
  16446. sharedMaterial: PhysicsMaterial;
  16447. /** !#en
  16448. get or set the collider is trigger, this will be always trigger if using builtin.
  16449. !#zh
  16450. 获取或设置碰撞器是否为触发器。 */
  16451. isTrigger: boolean;
  16452. /** !#en
  16453. get or set the center of the collider, in local space.
  16454. !#zh
  16455. 获取或设置碰撞器的中心点。 */
  16456. center: Vec3;
  16457. /** !#en
  16458. get the collider attached rigidbody, this may be null.
  16459. !#zh
  16460. 获取碰撞器所绑定的刚体组件,可能为 null。 */
  16461. attachedRigidbody: RigidBody3D|void;
  16462. /** !#en
  16463. get collider shape.
  16464. !#zh
  16465. 获取碰撞器形状。 */
  16466. shape: IBaseShape;
  16467. /**
  16468. !#en
  16469. Register an callback of a specific event type on the EventTarget.
  16470. This type of event should be triggered via `emit`.
  16471. !#zh
  16472. 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。
  16473. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16474. @param callback The callback that will be invoked when the event is dispatched.
  16475. The callback is ignored if it is a duplicate (the callbacks are unique).
  16476. @param target The target (this object) to invoke the callback, can be null.
  16477. @example
  16478. ```js
  16479. eventTarget.on('fire', function (event) {
  16480. // event is ITriggerEvent or ICollisionEvent
  16481. }, node);
  16482. ```
  16483. */
  16484. on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T;
  16485. /**
  16486. !#en
  16487. Removes the listeners previously registered with the same type, callback, target and or useCapture,
  16488. if only type is passed as parameter, all listeners registered with that type will be removed.
  16489. !#zh
  16490. 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。
  16491. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16492. @param callback The callback to remove.
  16493. @param target The target (this object) to invoke the callback, if it's not given, only callback without target will be removed.
  16494. @example
  16495. ```js
  16496. // register fire eventListener
  16497. var callback = eventTarget.on('fire', function () {
  16498. cc.log("fire in the hole");
  16499. }, target);
  16500. // remove fire event listener
  16501. eventTarget.off('fire', callback, target);
  16502. // remove all fire event listeners
  16503. eventTarget.off('fire');
  16504. ```
  16505. */
  16506. off(type: string, callback?: Function, target?: any): void;
  16507. /**
  16508. !#en
  16509. Register an callback of a specific event type on the EventTarget,
  16510. the callback will remove itself after the first time it is triggered.
  16511. !#zh
  16512. 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。
  16513. @param type The type of collider event can be `trigger-enter`, `trigger-stay`, `trigger-exit` or `collision-enter`, `collision-stay`, `collision-exit`.
  16514. @param callback The callback that will be invoked when the event is dispatched.
  16515. The callback is ignored if it is a duplicate (the callbacks are unique).
  16516. @param target The target (this object) to invoke the callback, can be null.
  16517. @example
  16518. ```js
  16519. eventTarget.once('fire', function (event) {
  16520. // event is ITriggerEvent or ICollisionEvent
  16521. }, node);
  16522. ```
  16523. */
  16524. once(type: string, callback: (event: ITriggerEvent|ICollisionEvent) => void, target?: any): void;
  16525. /**
  16526. !#en Checks whether the EventTarget object has any callback registered for a specific type of event.
  16527. !#zh 检查事件目标对象是否有为特定类型的事件注册的回调。
  16528. @param type The type of event.
  16529. */
  16530. hasEventListener(type: string): boolean;
  16531. /**
  16532. !#en Removes all callbacks previously registered with the same target (passed as parameter).
  16533. This is not for removing all listeners in the current event target,
  16534. and this is not for removing all listeners the target parameter have registered.
  16535. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
  16536. !#zh 在当前 EventTarget 上删除指定目标(target 参数)注册的所有事件监听器。
  16537. 这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。
  16538. 这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。
  16539. @param target The target to be searched for all related listeners
  16540. */
  16541. targetOff(target: any): void;
  16542. /**
  16543. !#en
  16544. Send an event with the event object.
  16545. !#zh
  16546. 通过事件对象派发事件
  16547. @param event event
  16548. */
  16549. dispatchEvent(event: Event): void;
  16550. /**
  16551. !#en
  16552. Destroy all callbackInfos.
  16553. !#zh
  16554. 销毁记录的事件
  16555. */
  16556. clear(): void;
  16557. }
  16558. /** !#en
  16559. Physics sphere collider
  16560. !#zh
  16561. 物理球碰撞器 */
  16562. export class SphereCollider3D extends Collider3D {
  16563. /** !#en
  16564. Get or set the radius of the sphere.
  16565. !#zh
  16566. 获取或设置球的半径。 */
  16567. radius: number;
  16568. sphereShape: ISphereShape;
  16569. }
  16570. /****************************************************
  16571. * audioEngine
  16572. *****************************************************/
  16573. export namespace audioEngine {
  16574. /** !#en Audio state.
  16575. !#zh 声音播放状态 */
  16576. export enum AudioState {
  16577. ERROR = 0,
  16578. INITIALZING = 0,
  16579. PLAYING = 0,
  16580. PAUSED = 0,
  16581. STOPPED = 0,
  16582. }
  16583. }
  16584. /****************************************************
  16585. * debug
  16586. *****************************************************/
  16587. export namespace debug {
  16588. /** !#en Enum for debug modes.
  16589. !#zh 调试模式 */
  16590. export enum DebugMode {
  16591. NONE = 0,
  16592. INFO = 0,
  16593. WARN = 0,
  16594. ERROR = 0,
  16595. INFO_FOR_WEB_PAGE = 0,
  16596. WARN_FOR_WEB_PAGE = 0,
  16597. ERROR_FOR_WEB_PAGE = 0,
  16598. }
  16599. }
  16600. /****************************************************
  16601. * Node
  16602. *****************************************************/
  16603. export namespace Node {
  16604. /** !#en Node's local dirty properties flag
  16605. !#zh Node 的本地属性 dirty 状态位 */
  16606. export enum _LocalDirtyFlag {
  16607. POSITION = 0,
  16608. SCALE = 0,
  16609. ROTATION = 0,
  16610. SKEW = 0,
  16611. TRS = 0,
  16612. RS = 0,
  16613. TRS = 0,
  16614. PHYSICS_POSITION = 0,
  16615. PHYSICS_SCALE = 0,
  16616. PHYSICS_ROTATION = 0,
  16617. PHYSICS_TRS = 0,
  16618. PHYSICS_RS = 0,
  16619. ALL_POSITION = 0,
  16620. ALL_SCALE = 0,
  16621. ALL_ROTATION = 0,
  16622. ALL_TRS = 0,
  16623. ALL = 0,
  16624. }
  16625. }
  16626. /****************************************************
  16627. * Node
  16628. *****************************************************/
  16629. export namespace Node {
  16630. /** !#en The event type supported by Node
  16631. !#zh Node 支持的事件类型 */
  16632. export class EventType {
  16633. /** !#en The event type for touch start event, you can use its value directly: 'touchstart'
  16634. !#zh 当手指触摸到屏幕时。 */
  16635. static TOUCH_START: string;
  16636. /** !#en The event type for touch move event, you can use its value directly: 'touchmove'
  16637. !#zh 当手指在屏幕上移动时。 */
  16638. static TOUCH_MOVE: string;
  16639. /** !#en The event type for touch end event, you can use its value directly: 'touchend'
  16640. !#zh 当手指在目标节点区域内离开屏幕时。 */
  16641. static TOUCH_END: string;
  16642. /** !#en The event type for touch end event, you can use its value directly: 'touchcancel'
  16643. !#zh 当手指在目标节点区域外离开屏幕时。 */
  16644. static TOUCH_CANCEL: string;
  16645. /** !#en The event type for mouse down events, you can use its value directly: 'mousedown'
  16646. !#zh 当鼠标按下时触发一次。 */
  16647. static MOUSE_DOWN: string;
  16648. /** !#en The event type for mouse move events, you can use its value directly: 'mousemove'
  16649. !#zh 当鼠标在目标节点在目标节点区域中移动时,不论是否按下。 */
  16650. static MOUSE_MOVE: string;
  16651. /** !#en The event type for mouse enter target events, you can use its value directly: 'mouseenter'
  16652. !#zh 当鼠标移入目标节点区域时,不论是否按下。 */
  16653. static MOUSE_ENTER: string;
  16654. /** !#en The event type for mouse leave target events, you can use its value directly: 'mouseleave'
  16655. !#zh 当鼠标移出目标节点区域时,不论是否按下。 */
  16656. static MOUSE_LEAVE: string;
  16657. /** !#en The event type for mouse up events, you can use its value directly: 'mouseup'
  16658. !#zh 当鼠标从按下状态松开时触发一次。 */
  16659. static MOUSE_UP: string;
  16660. /** !#en The event type for mouse wheel events, you can use its value directly: 'mousewheel'
  16661. !#zh 当鼠标滚轮滚动时。 */
  16662. static MOUSE_WHEEL: string;
  16663. /** !#en The event type for position change events.
  16664. Performance note, this event will be triggered every time corresponding properties being changed,
  16665. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16666. !#zh 当节点位置改变时触发的事件。
  16667. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16668. static POSITION_CHANGED: string;
  16669. /** !#en The event type for rotation change events.
  16670. Performance note, this event will be triggered every time corresponding properties being changed,
  16671. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16672. !#zh 当节点旋转改变时触发的事件。
  16673. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16674. static ROTATION_CHANGED: string;
  16675. /** !#en The event type for scale change events.
  16676. Performance note, this event will be triggered every time corresponding properties being changed,
  16677. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16678. !#zh 当节点缩放改变时触发的事件。
  16679. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16680. static SCALE_CHANGED: string;
  16681. /** !#en The event type for size change events.
  16682. Performance note, this event will be triggered every time corresponding properties being changed,
  16683. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16684. !#zh 当节点尺寸改变时触发的事件。
  16685. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16686. static SIZE_CHANGED: string;
  16687. /** !#en The event type for anchor point change events.
  16688. Performance note, this event will be triggered every time corresponding properties being changed,
  16689. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16690. !#zh 当节点锚点改变时触发的事件。
  16691. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16692. static ANCHOR_CHANGED: string;
  16693. /** !#en The event type for color change events.
  16694. Performance note, this event will be triggered every time corresponding properties being changed,
  16695. if the event callback have heavy logic it may have great performance impact, try to avoid such scenario.
  16696. !#zh 当节点颜色改变时触发的事件。
  16697. 性能警告:这个事件会在每次对应的属性被修改时触发,如果事件回调损耗较高,有可能对性能有很大的负面影响,请尽量避免这种情况。 */
  16698. static COLOR_CHANGED: string;
  16699. /** !#en The event type for new child added events.
  16700. !#zh 当新的子节点被添加时触发的事件。 */
  16701. static CHILD_ADDED: string;
  16702. /** !#en The event type for child removed events.
  16703. !#zh 当子节点被移除时触发的事件。 */
  16704. static CHILD_REMOVED: string;
  16705. /** !#en The event type for children reorder events.
  16706. !#zh 当子节点顺序改变时触发的事件。 */
  16707. static CHILD_REORDER: string;
  16708. /** !#en The event type for node group changed events.
  16709. !#zh 当节点归属群组发生变化时触发的事件。 */
  16710. static GROUP_CHANGED: string;
  16711. /** !#en The event type for node's sibling order changed.
  16712. !#zh 当节点在兄弟节点中的顺序发生变化时触发的事件。 */
  16713. static SIBLING_ORDER_CHANGED: string;
  16714. }
  16715. }
  16716. /****************************************************
  16717. * ParticleSystem
  16718. *****************************************************/
  16719. export namespace ParticleSystem {
  16720. /** !#en Enum for emitter modes
  16721. !#zh 发射模式 */
  16722. export enum EmitterMode {
  16723. GRAVITY = 0,
  16724. RADIUS = 0,
  16725. }
  16726. }
  16727. /****************************************************
  16728. * ParticleSystem
  16729. *****************************************************/
  16730. export namespace ParticleSystem {
  16731. /** !#en Enum for particles movement type.
  16732. !#zh 粒子位置类型 */
  16733. export enum PositionType {
  16734. FREE = 0,
  16735. RELATIVE = 0,
  16736. GROUPED = 0,
  16737. }
  16738. }
  16739. /****************************************************
  16740. * WebView
  16741. *****************************************************/
  16742. export namespace WebView {
  16743. /** !#en WebView event type
  16744. !#zh 网页视图事件类型 */
  16745. export enum EventType {
  16746. LOADED = 0,
  16747. LOADING = 0,
  16748. ERROR = 0,
  16749. }
  16750. }
  16751. /****************************************************
  16752. * TiledMap
  16753. *****************************************************/
  16754. export namespace TiledMap {
  16755. /** !#en The orientation of tiled map.
  16756. !#zh Tiled Map 地图方向。 */
  16757. export enum Orientation {
  16758. ORTHO = 0,
  16759. HEX = 0,
  16760. ISO = 0,
  16761. }
  16762. }
  16763. /****************************************************
  16764. * TiledMap
  16765. *****************************************************/
  16766. export namespace TiledMap {
  16767. /** The property type of tiled map. */
  16768. export enum Property {
  16769. NONE = 0,
  16770. MAP = 0,
  16771. LAYER = 0,
  16772. OBJECTGROUP = 0,
  16773. OBJECT = 0,
  16774. TILE = 0,
  16775. }
  16776. }
  16777. /****************************************************
  16778. * TiledMap
  16779. *****************************************************/
  16780. export namespace TiledMap {
  16781. /** The tile flags of tiled map. */
  16782. export enum TileFlag {
  16783. HORIZONTAL = 0,
  16784. VERTICAL = 0,
  16785. DIAGONAL = 0,
  16786. FLIPPED_ALL = 0,
  16787. FLIPPED_MASK = 0,
  16788. }
  16789. }
  16790. /****************************************************
  16791. * TiledMap
  16792. *****************************************************/
  16793. export namespace TiledMap {
  16794. /** !#en The stagger axis of Hex tiled map.
  16795. !#zh 六边形地图的 stagger axis 值 */
  16796. export enum StaggerAxis {
  16797. STAGGERAXIS_X = 0,
  16798. STAGGERAXIS_Y = 0,
  16799. }
  16800. }
  16801. /****************************************************
  16802. * TiledMap
  16803. *****************************************************/
  16804. export namespace TiledMap {
  16805. /** !#en The render order of tiled map.
  16806. !#zh 地图的渲染顺序 */
  16807. export enum RenderOrder {
  16808. STAGGERINDEX_ODD = 0,
  16809. STAGGERINDEX_EVEN = 0,
  16810. RightDown = 0,
  16811. RightUp = 0,
  16812. LeftDown = 0,
  16813. LeftUp = 0,
  16814. }
  16815. }
  16816. /****************************************************
  16817. * TiledMap
  16818. *****************************************************/
  16819. export namespace TiledMap {
  16820. /** !#en TiledMap Object Type
  16821. !#zh 地图物体类型 */
  16822. export enum TMXObjectType {
  16823. RECT = 0,
  16824. ELLIPSE = 0,
  16825. POLYGON = 0,
  16826. POLYLINE = 0,
  16827. IMAGE = 0,
  16828. TEXT = 0,
  16829. }
  16830. }
  16831. /****************************************************
  16832. * VideoPlayer
  16833. *****************************************************/
  16834. export namespace VideoPlayer {
  16835. /** !#en Video event type
  16836. !#zh 视频事件类型 */
  16837. export enum EventType {
  16838. PLAYING = 0,
  16839. PAUSED = 0,
  16840. STOPPED = 0,
  16841. COMPLETED = 0,
  16842. META_LOADED = 0,
  16843. CLICKED = 0,
  16844. READY_TO_PLAY = 0,
  16845. }
  16846. }
  16847. /****************************************************
  16848. * VideoPlayer
  16849. *****************************************************/
  16850. export namespace VideoPlayer {
  16851. /** !#en Enum for video resouce type type.
  16852. !#zh 视频来源 */
  16853. export enum ResourceType {
  16854. REMOTE = 0,
  16855. LOCAL = 0,
  16856. }
  16857. }
  16858. /****************************************************
  16859. * Collider
  16860. *****************************************************/
  16861. export namespace Collider {
  16862. /** !#en Defines a Box Collider .
  16863. !#zh 用来定义包围盒碰撞体 */
  16864. export class Box {
  16865. /** !#en Position offset
  16866. !#zh 位置偏移量 */
  16867. offset: Vec2;
  16868. /** !#en Box size
  16869. !#zh 包围盒大小 */
  16870. size: Size;
  16871. }
  16872. }
  16873. /****************************************************
  16874. * Collider
  16875. *****************************************************/
  16876. export namespace Collider {
  16877. /** !#en Defines a Circle Collider .
  16878. !#zh 用来定义圆形碰撞体 */
  16879. export class Circle {
  16880. /** !#en Position offset
  16881. !#zh 位置偏移量 */
  16882. offset: Vec2;
  16883. /** !#en Circle radius
  16884. !#zh 圆形半径 */
  16885. radius: number;
  16886. }
  16887. }
  16888. /****************************************************
  16889. * Collider
  16890. *****************************************************/
  16891. export namespace Collider {
  16892. /** !#en Defines a Polygon Collider .
  16893. !#zh 用来定义多边形碰撞体 */
  16894. export class Polygon {
  16895. /** !#en Position offset
  16896. !#zh 位置偏移量 */
  16897. offset: Vec2;
  16898. /** !#en Polygon points
  16899. !#zh 多边形顶点数组 */
  16900. points: Vec2[];
  16901. }
  16902. }
  16903. /****************************************************
  16904. * Light
  16905. *****************************************************/
  16906. export namespace Light {
  16907. /** !#en The light source type
  16908. !#zh 光源类型 */
  16909. export enum Type {
  16910. DIRECTIONAL = 0,
  16911. POINT = 0,
  16912. SPOT = 0,
  16913. AMBIENT = 0,
  16914. }
  16915. }
  16916. /****************************************************
  16917. * Light
  16918. *****************************************************/
  16919. export namespace Light {
  16920. /** !#en The shadow type
  16921. !#zh 阴影类型 */
  16922. export enum ShadowType {
  16923. NONE = 0,
  16924. HARD = 0,
  16925. SOFT_PCF3X3 = 0,
  16926. SOFT_PCF5X5 = 0,
  16927. }
  16928. }
  16929. /****************************************************
  16930. * Prefab
  16931. *****************************************************/
  16932. export namespace Prefab {
  16933. /** !#zh
  16934. Prefab 创建实例所用的优化策略,配合 {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}} 使用。
  16935. !#en
  16936. An enumeration used with the {{#crossLink "Prefab.optimizationPolicy"}}cc.Prefab#optimizationPolicy{{/crossLink}}
  16937. to specify how to optimize the instantiate operation. */
  16938. export enum OptimizationPolicy {
  16939. AUTO = 0,
  16940. SINGLE_INSTANCE = 0,
  16941. MULTI_INSTANCE = 0,
  16942. }
  16943. }
  16944. /****************************************************
  16945. * RenderTexture
  16946. *****************************************************/
  16947. export namespace RenderTexture {
  16948. /** !#en The depth buffer and stencil buffer format for RenderTexture.
  16949. !#zh RenderTexture 的深度缓冲以及模板缓冲格式。 */
  16950. export enum DepthStencilFormat {
  16951. RB_FMT_D24S8 = 0,
  16952. RB_FMT_S8 = 0,
  16953. RB_FMT_D16 = 0,
  16954. }
  16955. }
  16956. /****************************************************
  16957. * Texture2D
  16958. *****************************************************/
  16959. export namespace Texture2D {
  16960. /** The texture pixel format, default value is RGBA8888,
  16961. you should note that textures loaded by normal image files (png, jpg) can only support RGBA8888 format,
  16962. other formats are supported by compressed file types or raw data. */
  16963. export enum PixelFormat {
  16964. RGB565 = 0,
  16965. RGB5A1 = 0,
  16966. RGBA4444 = 0,
  16967. RGB888 = 0,
  16968. RGBA8888 = 0,
  16969. RGBA32F = 0,
  16970. A8 = 0,
  16971. I8 = 0,
  16972. AI88 = 0,
  16973. RGB_PVRTC_2BPPV1 = 0,
  16974. RGBA_PVRTC_2BPPV1 = 0,
  16975. RGB_A_PVRTC_2BPPV1 = 0,
  16976. RGB_PVRTC_4BPPV1 = 0,
  16977. RGBA_PVRTC_4BPPV1 = 0,
  16978. RGB_A_PVRTC_4BPPV1 = 0,
  16979. RGB_ETC1 = 0,
  16980. RGBA_ETC1 = 0,
  16981. RGB_ETC2 = 0,
  16982. RGBA_ETC2 = 0,
  16983. }
  16984. }
  16985. /****************************************************
  16986. * Texture2D
  16987. *****************************************************/
  16988. export namespace Texture2D {
  16989. /** The texture wrap mode */
  16990. export enum WrapMode {
  16991. REPEAT = 0,
  16992. CLAMP_TO_EDGE = 0,
  16993. MIRRORED_REPEAT = 0,
  16994. }
  16995. }
  16996. /****************************************************
  16997. * Texture2D
  16998. *****************************************************/
  16999. export namespace Texture2D {
  17000. /** The texture filter mode */
  17001. export enum Filter {
  17002. LINEAR = 0,
  17003. NEAREST = 0,
  17004. }
  17005. }
  17006. /****************************************************
  17007. * Event
  17008. *****************************************************/
  17009. export namespace Event {
  17010. /** !#en The Custom event
  17011. !#zh 自定义事件 */
  17012. export class EventCustom extends Event {
  17013. /**
  17014. @param type The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  17015. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  17016. */
  17017. constructor(type: string, bubbles: boolean);
  17018. /** !#en A reference to the detailed data of the event
  17019. !#zh 事件的详细数据 */
  17020. detail: any;
  17021. /**
  17022. !#en Sets user data
  17023. !#zh 设置用户数据
  17024. @param data data
  17025. */
  17026. setUserData(data: any): void;
  17027. /**
  17028. !#en Gets user data
  17029. !#zh 获取用户数据
  17030. */
  17031. getUserData(): any;
  17032. /**
  17033. !#en Gets event name
  17034. !#zh 获取事件名称
  17035. */
  17036. getEventName(): string;
  17037. }
  17038. }
  17039. /****************************************************
  17040. * SystemEvent
  17041. *****************************************************/
  17042. export namespace SystemEvent {
  17043. /** !#en The event type supported by SystemEvent
  17044. !#zh SystemEvent 支持的事件类型 */
  17045. export class EventType {
  17046. /** !#en The event type for press the key down event, you can use its value directly: 'keydown'
  17047. !#zh 当按下按键时触发的事件 */
  17048. static KEY_DOWN: string;
  17049. /** !#en The event type for press the key up event, you can use its value directly: 'keyup'
  17050. !#zh 当松开按键时触发的事件 */
  17051. static KEY_UP: string;
  17052. /** !#en The event type for press the devicemotion event, you can use its value directly: 'devicemotion'
  17053. !#zh 重力感应 */
  17054. static DEVICEMOTION: string;
  17055. }
  17056. }
  17057. /****************************************************
  17058. * Animation
  17059. *****************************************************/
  17060. export namespace Animation {
  17061. /** !#en The event type supported by Animation
  17062. !#zh Animation 支持的事件类型 */
  17063. export class EventType {
  17064. /** !#en Emit when begin playing animation
  17065. !#zh 开始播放时触发 */
  17066. static PLAY: string;
  17067. /** !#en Emit when stop playing animation
  17068. !#zh 停止播放时触发 */
  17069. static STOP: string;
  17070. /** !#en Emit when pause animation
  17071. !#zh 暂停播放时触发 */
  17072. static PAUSE: string;
  17073. /** !#en Emit when resume animation
  17074. !#zh 恢复播放时触发 */
  17075. static RESUME: string;
  17076. /** !#en If animation repeat count is larger than 1, emit when animation play to the last frame
  17077. !#zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发 */
  17078. static LASTFRAME: string;
  17079. /** !#en Emit when finish playing animation
  17080. !#zh 动画播放完成时触发 */
  17081. static FINISHED: string;
  17082. }
  17083. }
  17084. /****************************************************
  17085. * Button
  17086. *****************************************************/
  17087. export namespace Button {
  17088. /** !#en Enum for transition type.
  17089. !#zh 过渡类型 */
  17090. export enum Transition {
  17091. NONE = 0,
  17092. COLOR = 0,
  17093. SPRITE = 0,
  17094. SCALE = 0,
  17095. }
  17096. }
  17097. /****************************************************
  17098. * Component
  17099. *****************************************************/
  17100. export namespace Component {
  17101. /** !#en
  17102. Component will register a event to target component's handler.
  17103. And it will trigger the handler when a certain event occurs.
  17104. !@zh
  17105. “EventHandler” 类用来设置场景中的事件回调,
  17106. 该类允许用户设置回调目标节点,目标组件名,组件方法名,
  17107. 并可通过 emit 方法调用目标函数。 */
  17108. export class EventHandler {
  17109. /** !#en the node that contains target callback, such as the node example script belongs to
  17110. !#zh 事件响应函数所在节点 ,比如例子中脚本归属的节点本身 */
  17111. target: Node;
  17112. /** !#en name of the component(script) that contains target callback, such as the name 'MainMenu' of script in example
  17113. !#zh 事件响应函数所在组件名(脚本名), 比如例子中的脚本名 'MainMenu' */
  17114. component: string;
  17115. /** !#en Event handler, such as function's name 'onClick' in example
  17116. !#zh 响应事件函数名,比如例子中的 'onClick' */
  17117. handler: string;
  17118. /** !#en Custom Event Data, such as 'eventType' in example
  17119. !#zh 自定义事件数据,比如例子中的 eventType */
  17120. customEventData: string;
  17121. /**
  17122. @param events events
  17123. @param params params
  17124. */
  17125. static emitEvents(events: EventHandler[], ...params: any[]): void;
  17126. /**
  17127. !#en Emit event with params
  17128. !#zh 触发目标组件上的指定 handler 函数,该参数是回调函数的参数值(可不填)。
  17129. @param params params
  17130. @example
  17131. ```js
  17132. // Call Function
  17133. var eventHandler = new cc.Component.EventHandler();
  17134. eventHandler.target = newTarget;
  17135. eventHandler.component = "MainMenu";
  17136. eventHandler.handler = "OnClick"
  17137. eventHandler.emit(["param1", "param2", ....]);
  17138. ```
  17139. */
  17140. emit(params: any[]): void;
  17141. }
  17142. }
  17143. /****************************************************
  17144. * Label
  17145. *****************************************************/
  17146. export namespace Label {
  17147. /** !#en Enum for text alignment.
  17148. !#zh 文本横向对齐类型 */
  17149. export enum HorizontalAlign {
  17150. LEFT = 0,
  17151. CENTER = 0,
  17152. RIGHT = 0,
  17153. }
  17154. }
  17155. /****************************************************
  17156. * Label
  17157. *****************************************************/
  17158. export namespace Label {
  17159. /** !#en Enum for vertical text alignment.
  17160. !#zh 文本垂直对齐类型 */
  17161. export enum VerticalAlign {
  17162. TOP = 0,
  17163. CENTER = 0,
  17164. BOTTOM = 0,
  17165. }
  17166. }
  17167. /****************************************************
  17168. * Label
  17169. *****************************************************/
  17170. export namespace Label {
  17171. /** !#en Enum for Overflow.
  17172. !#zh Overflow 类型 */
  17173. export enum Overflow {
  17174. NONE = 0,
  17175. CLAMP = 0,
  17176. SHRINK = 0,
  17177. RESIZE_HEIGHT = 0,
  17178. }
  17179. }
  17180. /****************************************************
  17181. * Label
  17182. *****************************************************/
  17183. export namespace Label {
  17184. /** !#en Enum for font type.
  17185. !#zh Type 类型 */
  17186. export enum Type {
  17187. TTF = 0,
  17188. BMFont = 0,
  17189. SystemFont = 0,
  17190. }
  17191. }
  17192. /****************************************************
  17193. * Label
  17194. *****************************************************/
  17195. export namespace Label {
  17196. /** !#en Enum for cache mode.
  17197. !#zh CacheMode 类型 */
  17198. export enum CacheMode {
  17199. NONE = 0,
  17200. BITMAP = 0,
  17201. CHAR = 0,
  17202. }
  17203. }
  17204. /****************************************************
  17205. * Layout
  17206. *****************************************************/
  17207. export namespace Layout {
  17208. /** !#en Enum for Layout type
  17209. !#zh 布局类型 */
  17210. export enum Type {
  17211. NONE = 0,
  17212. HORIZONTAL = 0,
  17213. VERTICAL = 0,
  17214. GRID = 0,
  17215. }
  17216. }
  17217. /****************************************************
  17218. * Layout
  17219. *****************************************************/
  17220. export namespace Layout {
  17221. /** !#en Enum for Layout Resize Mode
  17222. !#zh 缩放模式 */
  17223. export enum ResizeMode {
  17224. NONE = 0,
  17225. CONTAINER = 0,
  17226. CHILDREN = 0,
  17227. }
  17228. }
  17229. /****************************************************
  17230. * Layout
  17231. *****************************************************/
  17232. export namespace Layout {
  17233. /** !#en Enum for Grid Layout start axis direction.
  17234. The items in grid layout will be arranged in each axis at first.;
  17235. !#zh 布局轴向,只用于 GRID 布局。 */
  17236. export enum AxisDirection {
  17237. HORIZONTAL = 0,
  17238. VERTICAL = 0,
  17239. }
  17240. }
  17241. /****************************************************
  17242. * Layout
  17243. *****************************************************/
  17244. export namespace Layout {
  17245. /** !#en Enum for vertical layout direction.
  17246. Used in Grid Layout together with AxisDirection is VERTICAL
  17247. !#zh 垂直方向布局方式 */
  17248. export enum VerticalDirection {
  17249. BOTTOM_TO_TOP = 0,
  17250. TOP_TO_BOTTOM = 0,
  17251. }
  17252. }
  17253. /****************************************************
  17254. * Layout
  17255. *****************************************************/
  17256. export namespace Layout {
  17257. /** !#en Enum for horizontal layout direction.
  17258. Used in Grid Layout together with AxisDirection is HORIZONTAL
  17259. !#zh 水平方向布局方式 */
  17260. export enum HorizontalDirection {
  17261. LEFT_TO_RIGHT = 0,
  17262. RIGHT_TO_LEFT = 0,
  17263. }
  17264. }
  17265. /****************************************************
  17266. * Mask
  17267. *****************************************************/
  17268. export namespace Mask {
  17269. /** !#en the type for mask.
  17270. !#zh 遮罩组件类型 */
  17271. export enum Type {
  17272. RECT = 0,
  17273. ELLIPSE = 0,
  17274. IMAGE_STENCIL = 0,
  17275. }
  17276. }
  17277. /****************************************************
  17278. * PageView
  17279. *****************************************************/
  17280. export namespace PageView {
  17281. /** !#en The Page View Size Mode
  17282. !#zh 页面视图每个页面统一的大小类型 */
  17283. export enum SizeMode {
  17284. Unified = 0,
  17285. Free = 0,
  17286. }
  17287. }
  17288. /****************************************************
  17289. * PageView
  17290. *****************************************************/
  17291. export namespace PageView {
  17292. /** !#en The Page View Direction
  17293. !#zh 页面视图滚动类型 */
  17294. export enum Direction {
  17295. Horizontal = 0,
  17296. Vertical = 0,
  17297. }
  17298. }
  17299. /****************************************************
  17300. * PageView
  17301. *****************************************************/
  17302. export namespace PageView {
  17303. /** !#en Enum for ScrollView event type.
  17304. !#zh 滚动视图事件类型 */
  17305. export enum EventType {
  17306. PAGE_TURNING = 0,
  17307. }
  17308. }
  17309. /****************************************************
  17310. * ProgressBar
  17311. *****************************************************/
  17312. export namespace ProgressBar {
  17313. /** !#en Enum for ProgressBar mode
  17314. !#zh 进度条模式 */
  17315. export enum Mode {
  17316. HORIZONTAL = 0,
  17317. VERTICAL = 0,
  17318. FILLED = 0,
  17319. }
  17320. }
  17321. /****************************************************
  17322. * PageViewIndicator
  17323. *****************************************************/
  17324. export namespace PageViewIndicator {
  17325. /** !#en Enum for PageView Indicator direction
  17326. !#zh 页面视图指示器的摆放方向 */
  17327. export enum Direction {
  17328. HORIZONTAL = 0,
  17329. VERTICAL = 0,
  17330. }
  17331. }
  17332. /****************************************************
  17333. * Scrollbar
  17334. *****************************************************/
  17335. export namespace Scrollbar {
  17336. /** Enum for Scrollbar direction */
  17337. export enum Direction {
  17338. HORIZONTAL = 0,
  17339. VERTICAL = 0,
  17340. }
  17341. }
  17342. /****************************************************
  17343. * ScrollView
  17344. *****************************************************/
  17345. export namespace ScrollView {
  17346. /** !#en Enum for ScrollView event type.
  17347. !#zh 滚动视图事件类型 */
  17348. export enum EventType {
  17349. SCROLL_TO_TOP = 0,
  17350. SCROLL_TO_BOTTOM = 0,
  17351. SCROLL_TO_LEFT = 0,
  17352. SCROLL_TO_RIGHT = 0,
  17353. SCROLLING = 0,
  17354. BOUNCE_TOP = 0,
  17355. BOUNCE_BOTTOM = 0,
  17356. BOUNCE_LEFT = 0,
  17357. BOUNCE_RIGHT = 0,
  17358. SCROLL_ENDED = 0,
  17359. TOUCH_UP = 0,
  17360. AUTOSCROLL_ENDED_WITH_THRESHOLD = 0,
  17361. SCROLL_BEGAN = 0,
  17362. }
  17363. }
  17364. /****************************************************
  17365. * Slider
  17366. *****************************************************/
  17367. export namespace Slider {
  17368. /** !#en The Slider Direction
  17369. !#zh 滑动器方向 */
  17370. export enum Direction {
  17371. Horizontal = 0,
  17372. Vertical = 0,
  17373. }
  17374. }
  17375. /****************************************************
  17376. * Sprite
  17377. *****************************************************/
  17378. export namespace Sprite {
  17379. /** !#en Enum for sprite type.
  17380. !#zh Sprite 类型 */
  17381. export enum Type {
  17382. SIMPLE = 0,
  17383. SLICED = 0,
  17384. TILED = 0,
  17385. FILLED = 0,
  17386. MESH = 0,
  17387. }
  17388. }
  17389. /****************************************************
  17390. * Sprite
  17391. *****************************************************/
  17392. export namespace Sprite {
  17393. /** !#en Enum for fill type.
  17394. !#zh 填充类型 */
  17395. export enum FillType {
  17396. HORIZONTAL = 0,
  17397. VERTICAL = 0,
  17398. RADIAL = 0,
  17399. }
  17400. }
  17401. /****************************************************
  17402. * Sprite
  17403. *****************************************************/
  17404. export namespace Sprite {
  17405. /** !#en Sprite Size can track trimmed size, raw size or none.
  17406. !#zh 精灵尺寸调整模式 */
  17407. export enum SizeMode {
  17408. CUSTOM = 0,
  17409. TRIMMED = 0,
  17410. RAW = 0,
  17411. }
  17412. }
  17413. /****************************************************
  17414. * Sprite
  17415. *****************************************************/
  17416. export namespace Sprite {
  17417. /** !#en Sprite state can choice the normal or grayscale.
  17418. !#zh 精灵颜色通道模式。 */
  17419. export enum State {
  17420. NORMAL = 0,
  17421. GRAY = 0,
  17422. }
  17423. }
  17424. /****************************************************
  17425. * Widget
  17426. *****************************************************/
  17427. export namespace Widget {
  17428. /** !#en Enum for Widget's alignment mode, indicating when the widget should refresh.
  17429. !#zh Widget 的对齐模式,表示 Widget 应该何时刷新。 */
  17430. export enum AlignMode {
  17431. ONCE = 0,
  17432. ON_WINDOW_RESIZE = 0,
  17433. ALWAYS = 0,
  17434. }
  17435. }
  17436. /****************************************************
  17437. * Event
  17438. *****************************************************/
  17439. export namespace Event {
  17440. /** !#en The mouse event
  17441. !#zh 鼠标事件类型 */
  17442. export class EventMouse extends Event {
  17443. /**
  17444. !#en Sets scroll data.
  17445. !#zh 设置鼠标的滚动数据。
  17446. @param scrollX scrollX
  17447. @param scrollY scrollY
  17448. */
  17449. setScrollData(scrollX: number, scrollY: number): void;
  17450. /**
  17451. !#en Returns the x axis scroll value.
  17452. !#zh 获取鼠标滚动的X轴距离,只有滚动时才有效。
  17453. */
  17454. getScrollX(): number;
  17455. /**
  17456. !#en Returns the y axis scroll value.
  17457. !#zh 获取滚轮滚动的 Y 轴距离,只有滚动时才有效。
  17458. */
  17459. getScrollY(): number;
  17460. /**
  17461. !#en Sets cursor location.
  17462. !#zh 设置当前鼠标位置。
  17463. @param x x
  17464. @param y y
  17465. */
  17466. setLocation(x: number, y: number): void;
  17467. /**
  17468. !#en Returns cursor location.
  17469. !#zh 获取鼠标位置对象,对象包含 x 和 y 属性。
  17470. */
  17471. getLocation(): Vec2;
  17472. /**
  17473. !#en Returns the current cursor location in screen coordinates.
  17474. !#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
  17475. */
  17476. getLocationInView(): Vec2;
  17477. /**
  17478. !#en Returns the previous touch location.
  17479. !#zh 获取鼠标点击在上一次事件时的位置对象,对象包含 x 和 y 属性。
  17480. */
  17481. getPreviousLocation(): Vec2;
  17482. /**
  17483. !#en Returns the delta distance from the previous location to current location.
  17484. !#zh 获取鼠标距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  17485. */
  17486. getDelta(): Vec2;
  17487. /**
  17488. !#en Returns the X axis delta distance from the previous location to current location.
  17489. !#zh 获取鼠标距离上一次事件移动的 X 轴距离。
  17490. */
  17491. getDeltaX(): number;
  17492. /**
  17493. !#en Returns the Y axis delta distance from the previous location to current location.
  17494. !#zh 获取鼠标距离上一次事件移动的 Y 轴距离。
  17495. */
  17496. getDeltaY(): number;
  17497. /**
  17498. !#en Sets mouse button.
  17499. !#zh 设置鼠标按键。
  17500. @param button button
  17501. */
  17502. setButton(button: number): void;
  17503. /**
  17504. !#en Returns mouse button.
  17505. !#zh 获取鼠标按键。
  17506. */
  17507. getButton(): number;
  17508. /**
  17509. !#en Returns location X axis data.
  17510. !#zh 获取鼠标当前位置 X 轴。
  17511. */
  17512. getLocationX(): number;
  17513. /**
  17514. !#en Returns location Y axis data.
  17515. !#zh 获取鼠标当前位置 Y 轴。
  17516. */
  17517. getLocationY(): number;
  17518. /** !#en The none event code of mouse event.
  17519. !#zh 无。 */
  17520. static NONE: number;
  17521. /** !#en The event type code of mouse down event.
  17522. !#zh 鼠标按下事件。 */
  17523. static DOWN: number;
  17524. /** !#en The event type code of mouse up event.
  17525. !#zh 鼠标按下后释放事件。 */
  17526. static UP: number;
  17527. /** !#en The event type code of mouse move event.
  17528. !#zh 鼠标移动事件。 */
  17529. static MOVE: number;
  17530. /** !#en The event type code of mouse scroll event.
  17531. !#zh 鼠标滚轮事件。 */
  17532. static SCROLL: number;
  17533. /** !#en The tag of Mouse left button.
  17534. !#zh 鼠标左键的标签。 */
  17535. static BUTTON_LEFT: number;
  17536. /** !#en The tag of Mouse right button (The right button number is 2 on browser).
  17537. !#zh 鼠标右键的标签。 */
  17538. static BUTTON_RIGHT: number;
  17539. /** !#en The tag of Mouse middle button (The right button number is 1 on browser).
  17540. !#zh 鼠标中键的标签。 */
  17541. static BUTTON_MIDDLE: number;
  17542. /** !#en The tag of Mouse button 4.
  17543. !#zh 鼠标按键 4 的标签。 */
  17544. static BUTTON_4: number;
  17545. /** !#en The tag of Mouse button 5.
  17546. !#zh 鼠标按键 5 的标签。 */
  17547. static BUTTON_5: number;
  17548. /** !#en The tag of Mouse button 6.
  17549. !#zh 鼠标按键 6 的标签。 */
  17550. static BUTTON_6: number;
  17551. /** !#en The tag of Mouse button 7.
  17552. !#zh 鼠标按键 7 的标签。 */
  17553. static BUTTON_7: number;
  17554. /** !#en The tag of Mouse button 8.
  17555. !#zh 鼠标按键 8 的标签。 */
  17556. static BUTTON_8: number;
  17557. }
  17558. }
  17559. /****************************************************
  17560. * Event
  17561. *****************************************************/
  17562. export namespace Event {
  17563. /** !#en The touch event
  17564. !#zh 触摸事件 */
  17565. export class EventTouch extends Event {
  17566. /**
  17567. @param touchArr The array of the touches
  17568. @param bubbles A boolean indicating whether the event bubbles up through the tree or not
  17569. */
  17570. constructor(touchArr: any[], bubbles: boolean);
  17571. /** !#en The current touch object
  17572. !#zh 当前触点对象 */
  17573. touch: Touch;
  17574. /**
  17575. !#en Returns event code.
  17576. !#zh 获取事件类型。
  17577. */
  17578. getEventCode(): number;
  17579. /**
  17580. !#en Returns touches of event.
  17581. !#zh 获取触摸点的列表。
  17582. */
  17583. getTouches(): any[];
  17584. /**
  17585. !#en Sets touch location.
  17586. !#zh 设置当前触点位置
  17587. @param x x
  17588. @param y y
  17589. */
  17590. setLocation(x: number, y: number): void;
  17591. /**
  17592. !#en Returns touch location.
  17593. !#zh 获取触点位置。
  17594. */
  17595. getLocation(): Vec2;
  17596. /**
  17597. !#en Returns the current touch location in screen coordinates.
  17598. !#zh 获取当前触点在游戏窗口中的位置。
  17599. */
  17600. getLocationInView(): Vec2;
  17601. /**
  17602. !#en Returns the previous touch location.
  17603. !#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
  17604. */
  17605. getPreviousLocation(): Vec2;
  17606. /**
  17607. !#en Returns the start touch location.
  17608. !#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
  17609. */
  17610. getStartLocation(): Vec2;
  17611. /**
  17612. !#en Returns the id of cc.Touch.
  17613. !#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
  17614. */
  17615. getID(): number;
  17616. /**
  17617. !#en Returns the delta distance from the previous location to current location.
  17618. !#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
  17619. */
  17620. getDelta(): Vec2;
  17621. /**
  17622. !#en Returns the X axis delta distance from the previous location to current location.
  17623. !#zh 获取触点距离上一次事件移动的 x 轴距离。
  17624. */
  17625. getDeltaX(): number;
  17626. /**
  17627. !#en Returns the Y axis delta distance from the previous location to current location.
  17628. !#zh 获取触点距离上一次事件移动的 y 轴距离。
  17629. */
  17630. getDeltaY(): number;
  17631. /**
  17632. !#en Returns location X axis data.
  17633. !#zh 获取当前触点 X 轴位置。
  17634. */
  17635. getLocationX(): number;
  17636. /**
  17637. !#en Returns location Y axis data.
  17638. !#zh 获取当前触点 Y 轴位置。
  17639. */
  17640. getLocationY(): number;
  17641. }
  17642. }
  17643. /****************************************************
  17644. * Event
  17645. *****************************************************/
  17646. export namespace Event {
  17647. /** !#en The acceleration event
  17648. !#zh 加速度事件 */
  17649. export class EventAcceleration extends Event {
  17650. }
  17651. }
  17652. /****************************************************
  17653. * Event
  17654. *****************************************************/
  17655. export namespace Event {
  17656. /** !#en The keyboard event
  17657. !#zh 键盘事件 */
  17658. export class EventKeyboard extends Event {
  17659. /** !#en
  17660. The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
  17661. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.
  17662. If the key can't be identified, this value is 0.
  17663. !#zh
  17664. keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。
  17665. 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。
  17666. 如果无法识别该键,则该值为 0。 */
  17667. keyCode: number;
  17668. }
  17669. }
  17670. /****************************************************
  17671. * Graphics
  17672. *****************************************************/
  17673. export namespace Graphics {
  17674. /** !#en Enum for LineCap.
  17675. !#zh 线段末端属性 */
  17676. export enum LineCap {
  17677. BUTT = 0,
  17678. ROUND = 0,
  17679. SQUARE = 0,
  17680. }
  17681. }
  17682. /****************************************************
  17683. * Graphics
  17684. *****************************************************/
  17685. export namespace Graphics {
  17686. /** !#en Enum for LineJoin.
  17687. !#zh 线段拐角属性 */
  17688. export enum LineJoin {
  17689. BEVEL = 0,
  17690. ROUND = 0,
  17691. MITER = 0,
  17692. }
  17693. }
  17694. /****************************************************
  17695. * geomUtils
  17696. *****************************************************/
  17697. export namespace geomUtils {
  17698. /** Aabb */
  17699. export class Aabb {
  17700. /**
  17701. create a new aabb
  17702. @param px X coordinates for aabb's original point
  17703. @param py Y coordinates for aabb's original point
  17704. @param pz Z coordinates for aabb's original point
  17705. @param w the half of aabb width
  17706. @param h the half of aabb height
  17707. @param l the half of aabb length
  17708. */
  17709. create(px: number, py: number, pz: number, w: number, h: number, l: number): Aabb;
  17710. /**
  17711. clone a new aabb
  17712. @param a the source aabb
  17713. */
  17714. clone(a: Aabb): Aabb;
  17715. /**
  17716. copy the values from one aabb to another
  17717. @param out the receiving aabb
  17718. @param a the source aabb
  17719. */
  17720. copy(out: Aabb, a: Aabb): Aabb;
  17721. /**
  17722. create a new aabb from two corner points
  17723. @param out the receiving aabb
  17724. @param minPos lower corner position of the aabb
  17725. @param maxPos upper corner position of the aabb
  17726. */
  17727. fromPoints(out: Aabb, minPos: Vec3, maxPos: Vec3): Aabb;
  17728. /**
  17729. Set the components of a aabb to the given values
  17730. @param out the receiving aabb
  17731. @param px X coordinates for aabb's original point
  17732. @param py Y coordinates for aabb's original point
  17733. @param pz Z coordinates for aabb's original point
  17734. @param w the half of aabb width
  17735. @param h the half of aabb height
  17736. @param l the half of aabb length
  17737. */
  17738. set(out: Aabb, px: number, py: number, pz: number, w: number, h: number, l: number): Aabb;
  17739. center: Vec3;
  17740. halfExtents: Vec3;
  17741. _type: number;
  17742. /**
  17743. Get the bounding points of this shape
  17744. @param minPos minPos
  17745. @param maxPos maxPos
  17746. */
  17747. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  17748. /**
  17749. Transform this shape
  17750. @param m the transform matrix
  17751. @param pos the position part of the transform
  17752. @param rot the rotation part of the transform
  17753. @param scale the scale part of the transform
  17754. @param out the target shape
  17755. */
  17756. transform(m: Mat4, pos: Vec3, rot: Quat, scale: Vec3, out?: Aabb): void;
  17757. }
  17758. }
  17759. /****************************************************
  17760. * geomUtils
  17761. *****************************************************/
  17762. export namespace geomUtils {
  17763. /** !#en Shape type. */
  17764. export enum enums {
  17765. SHAPE_RAY = 0,
  17766. SHAPE_LINE = 0,
  17767. SHAPE_SPHERE = 0,
  17768. SHAPE_AABB = 0,
  17769. SHAPE_OBB = 0,
  17770. SHAPE_PLANE = 0,
  17771. SHAPE_TRIANGLE = 0,
  17772. SHAPE_FRUSTUM = 0,
  17773. SHAPE_FRUSTUM_ACCURATE = 0,
  17774. }
  17775. }
  17776. /****************************************************
  17777. * geomUtils
  17778. *****************************************************/
  17779. export namespace geomUtils {
  17780. /** !#en frustum
  17781. !#zh 平截头体 */
  17782. export class Frustum {
  17783. /** Set whether to use accurate intersection testing function on this frustum */
  17784. accurate: boolean;
  17785. /**
  17786. create a new frustum
  17787. */
  17788. static create(): Frustum;
  17789. /**
  17790. Clone a frustum
  17791. @param f f
  17792. */
  17793. static clone(f: Frustum): Frustum;
  17794. /**
  17795. Copy the values from one frustum to another
  17796. @param out out
  17797. @param f f
  17798. */
  17799. copy(out: Frustum, f: Frustum): Frustum;
  17800. planes: geomUtils.Plane[];
  17801. planes: Vec3[];
  17802. /**
  17803. !#en Update the frustum information according to the given transform matrix.
  17804. Note that the resulting planes are not normalized under normal mode.
  17805. @param m the view-projection matrix
  17806. @param inv the inverse view-projection matrix
  17807. */
  17808. update(m: Mat4, inv: Mat4): void;
  17809. /**
  17810. !#en transform by matrix
  17811. @param mat mat
  17812. */
  17813. transform(mat: Mat4): void;
  17814. }
  17815. }
  17816. /****************************************************
  17817. * geomUtils
  17818. *****************************************************/
  17819. export namespace geomUtils {
  17820. /** undefined */
  17821. export class intersect {
  17822. /**
  17823. !#en
  17824. Check whether ray intersect with nodes
  17825. !#zh
  17826. 检测射线是否与物体有交集
  17827. @param root If root is null, then traversal nodes from scene node
  17828. @param worldRay worldRay
  17829. @param handler handler
  17830. @param filter filter
  17831. */
  17832. static ray_cast(root: Node, worldRay: geomUtils.Ray, handler: Function, filter: Function): any[];
  17833. /**
  17834. !#en ray-plane intersect<br/>
  17835. !#zh 射线与平面的相交性检测。
  17836. @param ray ray
  17837. @param plane plane
  17838. */
  17839. static ray_plane(ray: geomUtils.Ray, plane: geomUtils.Plane): number;
  17840. /**
  17841. !#en line-plane intersect<br/>
  17842. !#zh 线段与平面的相交性检测。
  17843. @param line line
  17844. @param plane plane
  17845. */
  17846. static line_plane(line: geomUtils.Line, plane: geomUtils.Plane): number;
  17847. /**
  17848. !#en ray-triangle intersect<br/>
  17849. !#zh 射线与三角形的相交性检测。
  17850. @param ray ray
  17851. @param triangle triangle
  17852. @param doubleSided doubleSided
  17853. */
  17854. static ray_triangle(ray: geomUtils.Ray, triangle: geomUtils.Triangle, doubleSided: boolean): number;
  17855. /**
  17856. !#en line-triangle intersect<br/>
  17857. !#zh 线段与三角形的相交性检测。
  17858. @param line line
  17859. @param triangle triangle
  17860. @param outPt optional, The intersection point
  17861. */
  17862. static line_triangle(line: geomUtils.Line, triangle: geomUtils.Triangle, outPt: Vec3): number;
  17863. /**
  17864. !#en line-quad intersect<br/>
  17865. !#zh 线段与四边形的相交性检测。
  17866. @param p A point on a line segment
  17867. @param q Another point on the line segment
  17868. @param a Quadrilateral point a
  17869. @param b Quadrilateral point b
  17870. @param c Quadrilateral point c
  17871. @param d Quadrilateral point d
  17872. @param outPt optional, The intersection point
  17873. */
  17874. static line_quad(p: Vec3, q: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, outPt: Vec3): number;
  17875. /**
  17876. !#en ray-sphere intersect<br/>
  17877. !#zh 射线和球的相交性检测。
  17878. @param ray ray
  17879. @param sphere sphere
  17880. */
  17881. static ray_sphere(ray: geomUtils.Ray, sphere: geomUtils.Sphere): number;
  17882. /**
  17883. !#en ray-aabb intersect<br/>
  17884. !#zh 射线和轴对齐包围盒的相交性检测。
  17885. @param ray ray
  17886. @param aabb Align the axis around the box
  17887. */
  17888. static ray_aabb(ray: geomUtils.Ray, aabb: Aabb): number;
  17889. /**
  17890. !#en ray-obb intersect<br/>
  17891. !#zh 射线和方向包围盒的相交性检测。
  17892. @param ray ray
  17893. @param obb Direction box
  17894. */
  17895. static ray_obb(ray: geomUtils.Ray, obb: geomUtils.Obb): number;
  17896. /**
  17897. !#en aabb-aabb intersect<br/>
  17898. !#zh 轴对齐包围盒和轴对齐包围盒的相交性检测。
  17899. @param aabb1 Axis alignment surrounds box 1
  17900. @param aabb2 Axis alignment surrounds box 2
  17901. */
  17902. static aabb_aabb(aabb1: Aabb, aabb2: Aabb): number;
  17903. /**
  17904. !#en aabb-obb intersect<br/>
  17905. !#zh 轴对齐包围盒和方向包围盒的相交性检测。
  17906. @param aabb Align the axis around the box
  17907. @param obb Direction box
  17908. */
  17909. static aabb_obb(aabb: Aabb, obb: geomUtils.Obb): number;
  17910. /**
  17911. !#en aabb-plane intersect<br/>
  17912. !#zh 轴对齐包围盒和平面的相交性检测。
  17913. @param aabb Align the axis around the box
  17914. @param plane plane
  17915. */
  17916. static aabb_plane(aabb: Aabb, plane: geomUtils.Plane): number;
  17917. /**
  17918. !#en aabb-frustum intersect, faster but has false positive corner cases<br/>
  17919. !#zh 轴对齐包围盒和锥台相交性检测,速度快,但有错误情况。
  17920. @param aabb Align the axis around the box
  17921. @param frustum frustum
  17922. */
  17923. static aabb_frustum(aabb: Aabb, frustum: Frustum): number;
  17924. /**
  17925. !#en aabb-frustum intersect, handles most of the false positives correctly<br/>
  17926. !#zh 轴对齐包围盒和锥台相交性检测,正确处理大多数错误情况。
  17927. @param aabb Align the axis around the box
  17928. @param frustum frustum
  17929. */
  17930. static aabb_frustum_accurate(aabb: Aabb, frustum: Frustum): number;
  17931. /**
  17932. !#en obb-point intersect<br/>
  17933. !#zh 方向包围盒和点的相交性检测。
  17934. @param obb Direction box
  17935. @param point point
  17936. */
  17937. static obb_point(obb: geomUtils.Obb, point: geomUtils.Vec3): boolean;
  17938. /**
  17939. !#en obb-plane intersect<br/>
  17940. !#zh 方向包围盒和平面的相交性检测。
  17941. @param obb Direction box
  17942. @param plane plane
  17943. */
  17944. static obb_plane(obb: geomUtils.Obb, plane: geomUtils.Plane): number;
  17945. /**
  17946. !#en obb-frustum intersect, faster but has false positive corner cases<br/>
  17947. !#zh 方向包围盒和锥台相交性检测,速度快,但有错误情况。
  17948. @param obb Direction box
  17949. @param frustum frustum
  17950. */
  17951. static obb_frustum(obb: geomUtils.Obb, frustum: Frustum): number;
  17952. /**
  17953. !#en obb-frustum intersect, handles most of the false positives correctly<br/>
  17954. !#zh 方向包围盒和锥台相交性检测,正确处理大多数错误情况。
  17955. @param obb Direction box
  17956. @param frustum frustum
  17957. */
  17958. static obb_frustum_accurate(obb: geomUtils.Obb, frustum: Frustum): number;
  17959. /**
  17960. !#en obb-obb intersect<br/>
  17961. !#zh 方向包围盒和方向包围盒的相交性检测。
  17962. @param obb1 Direction box1
  17963. @param obb2 Direction box2
  17964. */
  17965. static obb_obb(obb1: geomUtils.Obb, obb2: geomUtils.Obb): number;
  17966. /**
  17967. !#en phere-plane intersect, not necessarily faster than obb-plane<br/>
  17968. due to the length calculation of the plane normal to factor out<br/>
  17969. the unnomalized plane distance<br/>
  17970. !#zh 球与平面的相交性检测。
  17971. @param sphere sphere
  17972. @param plane plane
  17973. */
  17974. static sphere_plane(sphere: geomUtils.Sphere, plane: geomUtils.Plane): number;
  17975. /**
  17976. !#en sphere-frustum intersect, faster but has false positive corner cases<br/>
  17977. !#zh 球和锥台的相交性检测,速度快,但有错误情况。
  17978. @param sphere sphere
  17979. @param frustum frustum
  17980. */
  17981. static sphere_frustum(sphere: geomUtils.Sphere, frustum: Frustum): number;
  17982. /**
  17983. !#en sphere-frustum intersect, handles the false positives correctly<br/>
  17984. !#zh 球和锥台的相交性检测,正确处理大多数错误情况。
  17985. @param sphere sphere
  17986. @param frustum frustum
  17987. */
  17988. static sphere_frustum_accurate(sphere: geomUtils.Sphere, frustum: Frustum): number;
  17989. /**
  17990. !#en sphere-sphere intersect<br/>
  17991. !#zh 球和球的相交性检测。
  17992. @param sphere0 sphere0
  17993. @param sphere1 sphere1
  17994. */
  17995. static sphere_sphere(sphere0: geomUtils.Sphere, sphere1: geomUtils.Sphere): boolean;
  17996. /**
  17997. !#en sphere-aabb intersect<br/>
  17998. !#zh 球和轴对齐包围盒的相交性检测。
  17999. @param sphere sphere
  18000. @param aabb aabb
  18001. */
  18002. static sphere_aabb(sphere: geomUtils.Sphere, aabb: Aabb): boolean;
  18003. /**
  18004. !#en sphere-obb intersect<br/>
  18005. !#zh 球和方向包围盒的相交性检测。
  18006. @param sphere sphere
  18007. @param obb obb
  18008. */
  18009. static sphere_obb(sphere: geomUtils.Sphere, obb: geomUtils.Obb): boolean;
  18010. /**
  18011. !#en
  18012. The intersection detection of g1 and g2 can fill in the shape in the basic geometry.
  18013. !#zh
  18014. g1 和 g2 的相交性检测,可填入基础几何中的形状。
  18015. @param g1 Geometry 1
  18016. @param g2 Geometry 2
  18017. @param outPt optional, Intersection point. (note: only partial shape detection with this return value)
  18018. */
  18019. static resolve(g1: any, g2: any, outPt: any): void;
  18020. }
  18021. }
  18022. /****************************************************
  18023. * geomUtils
  18024. *****************************************************/
  18025. export namespace geomUtils {
  18026. /** !#en
  18027. line
  18028. !#zh
  18029. 直线 */
  18030. export class Line {
  18031. /**
  18032. !#en
  18033. create a new line
  18034. !#zh
  18035. 创建一个新的 line。
  18036. @param sx The x part of the starting point.
  18037. @param sy The y part of the starting point.
  18038. @param sz The z part of the starting point.
  18039. @param ex The x part of the end point.
  18040. @param ey The y part of the end point.
  18041. @param ez The z part of the end point.
  18042. */
  18043. create(sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  18044. /**
  18045. !#en
  18046. Creates a new line initialized with values from an existing line
  18047. !#zh
  18048. 克隆一个新的 line。
  18049. @param a The source of cloning.
  18050. */
  18051. clone(a: Line): Line;
  18052. /**
  18053. !#en
  18054. Copy the values from one line to another
  18055. !#zh
  18056. 复制一个线的值到另一个。
  18057. @param out The object that accepts the action.
  18058. @param a The source of the copy.
  18059. */
  18060. copy(out: Line, a: Line): Line;
  18061. /**
  18062. !#en
  18063. create a line from two points
  18064. !#zh
  18065. 用两个点创建一个线。
  18066. @param out The object that accepts the action.
  18067. @param start The starting point.
  18068. @param end At the end.
  18069. */
  18070. fromPoints(out: Line, start: Vec3, end: Vec3): Line;
  18071. /**
  18072. !#en
  18073. Set the components of a Vec3 to the given values
  18074. !#zh
  18075. 将给定线的属性设置为给定值。
  18076. @param out The object that accepts the action.
  18077. @param sx The x part of the starting point.
  18078. @param sy The y part of the starting point.
  18079. @param sz The z part of the starting point.
  18080. @param ex The x part of the end point.
  18081. @param ey The y part of the end point.
  18082. @param ez The z part of the end point.
  18083. */
  18084. set(out: Line, sx: number, sy: number, sz: number, ex: number, ey: number, ez: number): Line;
  18085. /**
  18086. !#en
  18087. Calculate the length of the line.
  18088. !#zh
  18089. 计算线的长度。
  18090. @param a The line to calculate.
  18091. */
  18092. len(a: Line): number;
  18093. /** !#en
  18094. Start points.
  18095. !#zh
  18096. 起点。 */
  18097. s: Vec3;
  18098. /** !#en
  18099. End points.
  18100. !#zh
  18101. 终点。 */
  18102. e: Vec3;
  18103. /**
  18104. !#en
  18105. Calculate the length of the line.
  18106. !#zh
  18107. 计算线的长度。
  18108. */
  18109. length(): number;
  18110. }
  18111. }
  18112. /****************************************************
  18113. * geomUtils
  18114. *****************************************************/
  18115. export namespace geomUtils {
  18116. /** !#en obb
  18117. !#zh
  18118. 基础几何 方向包围盒。 */
  18119. export class Obb {
  18120. /** !#zh
  18121. 获取形状的类型。 */
  18122. type: number;
  18123. /**
  18124. !#en
  18125. create a new obb
  18126. !#zh
  18127. 创建一个新的 obb 实例。
  18128. @param cx X coordinates of the shape relative to the origin.
  18129. @param cy Y coordinates of the shape relative to the origin.
  18130. @param cz Z coordinates of the shape relative to the origin.
  18131. @param hw Obb is half the width.
  18132. @param hh Obb is half the height.
  18133. @param hl Obb is half the Length.
  18134. @param ox_1 Direction matrix parameter.
  18135. @param ox_2 Direction matrix parameter.
  18136. @param ox_3 Direction matrix parameter.
  18137. @param oy_1 Direction matrix parameter.
  18138. @param oy_2 Direction matrix parameter.
  18139. @param oy_3 Direction matrix parameter.
  18140. @param oz_1 Direction matrix parameter.
  18141. @param oz_2 Direction matrix parameter.
  18142. @param oz_3 Direction matrix parameter.
  18143. */
  18144. 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;
  18145. /**
  18146. !#en
  18147. clone a new obb
  18148. !#zh
  18149. 克隆一个 obb。
  18150. @param a The target of cloning.
  18151. */
  18152. clone(a: Obb): Obb;
  18153. /**
  18154. !#en
  18155. copy the values from one obb to another
  18156. !#zh
  18157. 将从一个 obb 的值复制到另一个 obb。
  18158. @param out Obb that accepts the operation.
  18159. @param a Obb being copied.
  18160. */
  18161. copy(out: Obb, a: Obb): Obb;
  18162. /**
  18163. !#en
  18164. create a new obb from two corner points
  18165. !#zh
  18166. 用两个点创建一个新的 obb。
  18167. @param out Obb that accepts the operation.
  18168. @param minPos The smallest point of obb.
  18169. @param maxPos Obb's maximum point.
  18170. */
  18171. fromPoints(out: Obb, minPos: Vec3, maxPos: Vec3): Obb;
  18172. /**
  18173. !#en
  18174. Set the components of a obb to the given values
  18175. !#zh
  18176. 将给定 obb 的属性设置为给定的值。
  18177. @param cx X coordinates of the shape relative to the origin.
  18178. @param cy Y coordinates of the shape relative to the origin.
  18179. @param cz Z coordinates of the shape relative to the origin.
  18180. @param hw Obb is half the width.
  18181. @param hh Obb is half the height.
  18182. @param hl Obb is half the Length.
  18183. @param ox_1 Direction matrix parameter.
  18184. @param ox_2 Direction matrix parameter.
  18185. @param ox_3 Direction matrix parameter.
  18186. @param oy_1 Direction matrix parameter.
  18187. @param oy_2 Direction matrix parameter.
  18188. @param oy_3 Direction matrix parameter.
  18189. @param oz_1 Direction matrix parameter.
  18190. @param oz_2 Direction matrix parameter.
  18191. @param oz_3 Direction matrix parameter.
  18192. */
  18193. 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;
  18194. /** !#en
  18195. The center of the local coordinate.
  18196. !#zh
  18197. 本地坐标的中心点。 */
  18198. center: Vec3;
  18199. /** !#en
  18200. Half the length, width, and height.
  18201. !#zh
  18202. 长宽高的一半。 */
  18203. halfExtents: Vec3;
  18204. /** !#en
  18205. Direction matrix.
  18206. !#zh
  18207. 方向矩阵。 */
  18208. orientation: Mat3;
  18209. /**
  18210. !#en
  18211. Get the bounding points of this shape
  18212. !#zh
  18213. 获取 obb 的最小点和最大点。
  18214. @param minPos minPos
  18215. @param maxPos maxPos
  18216. */
  18217. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  18218. /**
  18219. !#en Transform this shape
  18220. !#zh
  18221. 将 out 根据这个 obb 的数据进行变换。
  18222. @param m The transformation matrix.
  18223. @param pos The position part of the transformation.
  18224. @param rot The rotating part of the transformation.
  18225. @param scale The scaling part of the transformation.
  18226. @param out Target of transformation.
  18227. */
  18228. transform(m: Mat4, pos: Vec3, rot: Quat, scale: Vec3, out: Obb): void;
  18229. /**
  18230. !#en
  18231. Transform out based on this obb data.
  18232. !#zh
  18233. 将 out 根据这个 obb 的数据进行变换。
  18234. @param m The transformation matrix.
  18235. @param rot The rotating part of the transformation.
  18236. @param out Target of transformation.
  18237. */
  18238. translateAndRotate(m: Mat4, rot: Quat, out: Obb): void;
  18239. /**
  18240. !#en
  18241. Scale out based on this obb data.
  18242. !#zh
  18243. 将 out 根据这个 obb 的数据进行缩放。
  18244. @param scale Scale value.
  18245. @param out Scaled target.
  18246. */
  18247. setScale(scale: Vec3, out: Obb): void;
  18248. }
  18249. }
  18250. /****************************************************
  18251. * geomUtils
  18252. *****************************************************/
  18253. export namespace geomUtils {
  18254. /** !#en
  18255. plane。
  18256. !#zh
  18257. 平面。 */
  18258. export class Plane {
  18259. /**
  18260. !#en
  18261. create a new plane
  18262. !#zh
  18263. 创建一个新的 plane。
  18264. @param nx The x part of the normal component.
  18265. @param ny The y part of the normal component.
  18266. @param nz The z part of the normal component.
  18267. @param d Distance from the origin.
  18268. */
  18269. create(nx: number, ny: number, nz: number, d: number): Plane;
  18270. /**
  18271. !#en
  18272. clone a new plane
  18273. !#zh
  18274. 克隆一个新的 plane。
  18275. @param p The source of cloning.
  18276. */
  18277. clone(p: Plane): Plane;
  18278. /**
  18279. !#en
  18280. copy the values from one plane to another
  18281. !#zh
  18282. 复制一个平面的值到另一个。
  18283. @param out The object that accepts the action.
  18284. @param p The source of the copy.
  18285. */
  18286. copy(out: Plane, p: Plane): Plane;
  18287. /**
  18288. !#en
  18289. create a plane from three points
  18290. !#zh
  18291. 用三个点创建一个平面。
  18292. @param out The object that accepts the action.
  18293. @param a Point a。
  18294. @param b Point b。
  18295. @param c Point c。
  18296. */
  18297. fromPoints(out: Plane, a: Vec3, b: Vec3, c: Vec3): Plane;
  18298. /**
  18299. !#en
  18300. Set the components of a plane to the given values
  18301. !#zh
  18302. 将给定平面的属性设置为给定值。
  18303. @param out The object that accepts the action.
  18304. @param nx The x part of the normal component.
  18305. @param ny The y part of the normal component.
  18306. @param nz The z part of the normal component.
  18307. @param d Distance from the origin.
  18308. */
  18309. set(out: Plane, nx: number, ny: number, nz: number, d: number): Plane;
  18310. /**
  18311. !#en
  18312. create plane from normal and point
  18313. !#zh
  18314. 用一条法线和一个点创建平面。
  18315. @param out The object that accepts the action.
  18316. @param normal The normal of a plane.
  18317. @param point A point on the plane.
  18318. */
  18319. fromNormalAndPoint(out: Plane, normal: Vec3, point: Vec3): Plane;
  18320. /**
  18321. !#en
  18322. normalize a plane
  18323. !#zh
  18324. 归一化一个平面。
  18325. @param out The object that accepts the action.
  18326. @param a Source data for operations.
  18327. */
  18328. normalize(out: Plane, a: Plane): Plane;
  18329. /** !#en
  18330. A normal vector.
  18331. !#zh
  18332. 法线向量。 */
  18333. n: Vec3;
  18334. /** !#en
  18335. The distance from the origin to the plane.
  18336. !#zh
  18337. 原点到平面的距离。 */
  18338. d: number;
  18339. /**
  18340. !#en
  18341. Transform a plane.
  18342. !#zh
  18343. 变换一个平面。
  18344. @param mat mat
  18345. */
  18346. transform(mat: Mat4): void;
  18347. }
  18348. }
  18349. /****************************************************
  18350. * geomUtils
  18351. *****************************************************/
  18352. export namespace geomUtils {
  18353. /** !#en
  18354. ray
  18355. !#zh
  18356. 射线。 */
  18357. export class Ray {
  18358. /**
  18359. !#en
  18360. create a new ray
  18361. !#zh
  18362. 创建一条射线。
  18363. @param ox The x part of the starting point.
  18364. @param oy The y part of the starting point.
  18365. @param oz The z part of the starting point.
  18366. @param dx X in the direction.
  18367. @param dy Y in the direction.
  18368. @param dz Z in the direction.
  18369. */
  18370. create(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18371. /**
  18372. !#en
  18373. Creates a new ray initialized with values from an existing ray
  18374. !#zh
  18375. 从一条射线克隆出一条新的射线。
  18376. @param a Clone target
  18377. */
  18378. clone(a: Ray): Ray;
  18379. /**
  18380. !#en
  18381. Copy the values from one ray to another
  18382. !#zh
  18383. 将从一个 ray 的值复制到另一个 ray。
  18384. @param out Accept the ray of the operation.
  18385. @param a Copied ray.
  18386. */
  18387. copy(out: Ray, a: Ray): Ray;
  18388. /**
  18389. !#en
  18390. create a ray from two points
  18391. !#zh
  18392. 用两个点创建一条射线。
  18393. @param out Receive the operating ray.
  18394. @param origin Origin of ray
  18395. @param target A point on a ray.
  18396. */
  18397. fromPoints(out: Ray, origin: Vec3, target: Vec3): Ray;
  18398. /**
  18399. !#en
  18400. Set the components of a ray to the given values
  18401. !#zh
  18402. 将给定射线的属性设置为给定的值。
  18403. @param out Receive the operating ray.
  18404. @param ox The x part of the starting point.
  18405. @param oy The y part of the starting point.
  18406. @param oz The z part of the starting point.
  18407. @param dx X in the direction.
  18408. @param dy Y in the direction.
  18409. @param dz Z in the direction.
  18410. */
  18411. set(out: Ray, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Ray;
  18412. /** !#en
  18413. Start point.
  18414. !#zh
  18415. 起点。 */
  18416. o: Vec3;
  18417. /** !#e
  18418. Direction
  18419. !#zh
  18420. 方向。 */
  18421. d: Vec3;
  18422. /**
  18423. !#en Compute hit.
  18424. @param out out
  18425. @param distance distance
  18426. */
  18427. computeHit(out: IVec3Like, distance: number): void;
  18428. }
  18429. }
  18430. /****************************************************
  18431. * geomUtils
  18432. *****************************************************/
  18433. export namespace geomUtils {
  18434. /** !#en
  18435. Sphere.
  18436. !#zh
  18437. 轴对齐球。 */
  18438. export class Sphere {
  18439. /**
  18440. !#en
  18441. create a new sphere
  18442. !#zh
  18443. 创建一个新的 sphere 实例。
  18444. @param cx X coordinates of the shape relative to the origin.
  18445. @param cy Y coordinates of the shape relative to the origin.
  18446. @param cz Z coordinates of the shape relative to the origin.
  18447. @param r Radius of sphere
  18448. */
  18449. create(cx: any, cy: any, cz: any, r: any): Sphere;
  18450. /**
  18451. !#en
  18452. clone a new sphere
  18453. !#zh
  18454. 克隆一个新的 sphere 实例。
  18455. @param p The target of cloning.
  18456. */
  18457. clone(p: Sphere): Sphere;
  18458. /**
  18459. !#en
  18460. copy the values from one sphere to another
  18461. !#zh
  18462. 将从一个 sphere 的值复制到另一个 sphere。
  18463. @param out Accept the sphere of operations.
  18464. @param a Sphere being copied.
  18465. */
  18466. copy(out: Sphere, a: Sphere): Sphere;
  18467. /**
  18468. !#en
  18469. create a new bounding sphere from two corner points
  18470. !#zh
  18471. 从两个点创建一个新的 sphere。
  18472. @param out Accept the sphere of operations.
  18473. @param minPos The smallest point of sphere.
  18474. @param maxPos The maximum point of sphere.
  18475. */
  18476. fromPoints(out: any, minPos: any, maxPos: any): Sphere;
  18477. /**
  18478. !#en Set the components of a sphere to the given values
  18479. !#zh 将球体的属性设置为给定的值。
  18480. @param out Accept the sphere of operations.
  18481. @param cx X coordinates of the shape relative to the origin.
  18482. @param cy Y coordinates of the shape relative to the origin.
  18483. @param cz Z coordinates of the shape relative to the origin.
  18484. @param r Radius.
  18485. */
  18486. set(out: Sphere, cx: any, cy: any, cz: any, r: number): Sphere;
  18487. /** !#en
  18488. The center of the local coordinate.
  18489. !#zh
  18490. 本地坐标的中心点。 */
  18491. center: Vec3;
  18492. /** !#zh
  18493. 半径。 */
  18494. radius: number;
  18495. /**
  18496. !#en
  18497. Clone.
  18498. !#zh
  18499. 获得克隆。
  18500. */
  18501. clone(): void;
  18502. /**
  18503. !#en
  18504. Copy sphere
  18505. !#zh
  18506. 拷贝对象。
  18507. @param a Copy target.
  18508. */
  18509. copy(a: any): void;
  18510. /**
  18511. !#en
  18512. Get the bounding points of this shape
  18513. !#zh
  18514. 获取此形状的边界点。
  18515. @param minPos minPos
  18516. @param maxPos maxPos
  18517. */
  18518. getBoundary(minPos: Vec3, maxPos: Vec3): void;
  18519. /**
  18520. !#en
  18521. Transform this shape
  18522. !#zh
  18523. 将 out 根据这个 sphere 的数据进行变换。
  18524. @param m The transformation matrix.
  18525. @param pos The position part of the transformation.
  18526. @param rot The rotating part of the transformation.
  18527. @param scale The scaling part of the transformation.
  18528. @param out The target of the transformation.
  18529. */
  18530. transform(m: any, pos: any, rot: any, scale: any, out: any): void;
  18531. /**
  18532. !#en
  18533. Scale out based on the sphere data.
  18534. !#zh
  18535. 将 out 根据这个 sphere 的数据进行缩放。
  18536. @param scale Scale value
  18537. @param out Scale target
  18538. */
  18539. setScale(scale: any, out: any): void;
  18540. }
  18541. }
  18542. /****************************************************
  18543. * geomUtils
  18544. *****************************************************/
  18545. export namespace geomUtils {
  18546. /** Triangle */
  18547. export class Triangle {
  18548. /**
  18549. create a new triangle
  18550. @param ax ax
  18551. @param ay ay
  18552. @param az az
  18553. @param bx bx
  18554. @param by by
  18555. @param bz bz
  18556. @param cx cx
  18557. @param cy cy
  18558. @param cz cz
  18559. */
  18560. create(ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Triangle;
  18561. /**
  18562. clone a new triangle
  18563. @param t the source plane
  18564. */
  18565. clone(t: Triangle): Triangle;
  18566. /**
  18567. copy the values from one triangle to another
  18568. @param out the receiving triangle
  18569. @param t the source triangle
  18570. */
  18571. copy(out: Triangle, t: Triangle): Triangle;
  18572. /**
  18573. Create a triangle from three points
  18574. @param out the receiving triangle
  18575. @param a a
  18576. @param b b
  18577. @param c c
  18578. */
  18579. fromPoints(out: Triangle, a: Vec3, b: Vec3, c: Vec3): Triangle;
  18580. /**
  18581. Set the components of a triangle to the given values
  18582. @param out the receiving plane
  18583. @param ax X component of a
  18584. @param ay Y component of a
  18585. @param az Z component of a
  18586. @param bx X component of b
  18587. @param by Y component of b
  18588. @param bz Z component of b
  18589. @param cx X component of c
  18590. @param cy Y component of c
  18591. @param cz Z component of c
  18592. */
  18593. set(out: Triangle, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): Plane;
  18594. a: Vec3;
  18595. b: Vec3;
  18596. c: Vec3;
  18597. }
  18598. }
  18599. /****************************************************
  18600. * Camera
  18601. *****************************************************/
  18602. export namespace Camera {
  18603. /** !#en Values for Camera.clearFlags, determining what to clear when rendering a Camera.
  18604. !#zh 摄像机清除标记位,决定摄像机渲染时会清除哪些状态 */
  18605. export enum ClearFlags {
  18606. COLOR = 0,
  18607. DEPTH = 0,
  18608. STENCIL = 0,
  18609. }
  18610. }
  18611. /****************************************************
  18612. * MeshRenderer
  18613. *****************************************************/
  18614. export namespace MeshRenderer {
  18615. /** !#en Shadow projection mode
  18616. !#ch 阴影投射方式 */
  18617. export enum ShadowCastingMode {
  18618. OFF = 0,
  18619. ON = 0,
  18620. }
  18621. }
  18622. /****************************************************
  18623. * PhysicsManager
  18624. *****************************************************/
  18625. export namespace PhysicsManager {
  18626. /** !#en
  18627. The draw bits for drawing physics debug information.<br>
  18628. example:<br>
  18629. ```js
  18630. cc.director.getPhysicsManager().debugDrawFlags =
  18631. // cc.PhysicsManager.DrawBits.e_aabbBit |
  18632. // cc.PhysicsManager.DrawBits.e_pairBit |
  18633. // cc.PhysicsManager.DrawBits.e_centerOfMassBit |
  18634. cc.PhysicsManager.DrawBits.e_jointBit |
  18635. cc.PhysicsManager.DrawBits.e_shapeBit;
  18636. ```
  18637. !#zh
  18638. 指定物理系统需要绘制哪些调试信息。<br>
  18639. example:<br>
  18640. ```js
  18641. cc.director.getPhysicsManager().debugDrawFlags =
  18642. // cc.PhysicsManager.DrawBits.e_aabbBit |
  18643. // cc.PhysicsManager.DrawBits.e_pairBit |
  18644. // cc.PhysicsManager.DrawBits.e_centerOfMassBit |
  18645. cc.PhysicsManager.DrawBits.e_jointBit |
  18646. cc.PhysicsManager.DrawBits.e_shapeBit;
  18647. ``` */
  18648. export enum DrawBits {
  18649. e_aabbBit = 0,
  18650. e_jointBit = 0,
  18651. e_shapeBit = 0,
  18652. }
  18653. }
  18654. /****************************************************
  18655. * macro
  18656. *****************************************************/
  18657. export namespace macro {
  18658. /** !#en Key map for keyboard event
  18659. !#zh 键盘事件的按键值 */
  18660. export enum KEY {
  18661. none = 0,
  18662. back = 0,
  18663. menu = 0,
  18664. backspace = 0,
  18665. tab = 0,
  18666. enter = 0,
  18667. shift = 0,
  18668. ctrl = 0,
  18669. alt = 0,
  18670. pause = 0,
  18671. capslock = 0,
  18672. escape = 0,
  18673. space = 0,
  18674. pageup = 0,
  18675. pagedown = 0,
  18676. end = 0,
  18677. home = 0,
  18678. left = 0,
  18679. up = 0,
  18680. right = 0,
  18681. down = 0,
  18682. select = 0,
  18683. insert = 0,
  18684. Delete = 0,
  18685. a = 0,
  18686. b = 0,
  18687. c = 0,
  18688. d = 0,
  18689. e = 0,
  18690. f = 0,
  18691. g = 0,
  18692. h = 0,
  18693. i = 0,
  18694. j = 0,
  18695. k = 0,
  18696. l = 0,
  18697. m = 0,
  18698. n = 0,
  18699. o = 0,
  18700. p = 0,
  18701. q = 0,
  18702. r = 0,
  18703. s = 0,
  18704. t = 0,
  18705. u = 0,
  18706. v = 0,
  18707. w = 0,
  18708. x = 0,
  18709. y = 0,
  18710. z = 0,
  18711. num0 = 0,
  18712. num1 = 0,
  18713. num2 = 0,
  18714. num3 = 0,
  18715. num4 = 0,
  18716. num5 = 0,
  18717. num6 = 0,
  18718. num7 = 0,
  18719. num8 = 0,
  18720. num9 = 0,
  18721. '*' = 0,
  18722. '+' = 0,
  18723. '-' = 0,
  18724. numdel = 0,
  18725. '/' = 0,
  18726. f1 = 0,
  18727. f2 = 0,
  18728. f3 = 0,
  18729. f4 = 0,
  18730. f5 = 0,
  18731. f6 = 0,
  18732. f7 = 0,
  18733. f8 = 0,
  18734. f9 = 0,
  18735. f10 = 0,
  18736. f11 = 0,
  18737. f12 = 0,
  18738. numlock = 0,
  18739. scrolllock = 0,
  18740. ';' = 0,
  18741. semicolon = 0,
  18742. equal = 0,
  18743. '=' = 0,
  18744. ',' = 0,
  18745. comma = 0,
  18746. dash = 0,
  18747. '.' = 0,
  18748. period = 0,
  18749. forwardslash = 0,
  18750. grave = 0,
  18751. '[' = 0,
  18752. openbracket = 0,
  18753. backslash = 0,
  18754. ']' = 0,
  18755. closebracket = 0,
  18756. quote = 0,
  18757. dpadLeft = 0,
  18758. dpadRight = 0,
  18759. dpadUp = 0,
  18760. dpadDown = 0,
  18761. dpadCenter = 0,
  18762. }
  18763. }
  18764. /****************************************************
  18765. * macro
  18766. *****************************************************/
  18767. export namespace macro {
  18768. /** Image formats */
  18769. export enum ImageFormat {
  18770. JPG = 0,
  18771. PNG = 0,
  18772. TIFF = 0,
  18773. WEBP = 0,
  18774. PVR = 0,
  18775. ETC = 0,
  18776. S3TC = 0,
  18777. ATITC = 0,
  18778. TGA = 0,
  18779. RAWDATA = 0,
  18780. UNKNOWN = 0,
  18781. }
  18782. }
  18783. /****************************************************
  18784. * macro
  18785. *****************************************************/
  18786. export namespace macro {
  18787. /** !#en
  18788. Enum for blend factor
  18789. Refer to: http://www.andersriggelsen.dk/glblendfunc.php
  18790. !#zh
  18791. 混合因子
  18792. 可参考: http://www.andersriggelsen.dk/glblendfunc.php */
  18793. export enum BlendFactor {
  18794. ONE = 0,
  18795. ZERO = 0,
  18796. SRC_ALPHA = 0,
  18797. SRC_COLOR = 0,
  18798. DST_ALPHA = 0,
  18799. DST_COLOR = 0,
  18800. ONE_MINUS_SRC_ALPHA = 0,
  18801. ONE_MINUS_SRC_COLOR = 0,
  18802. ONE_MINUS_DST_ALPHA = 0,
  18803. ONE_MINUS_DST_COLOR = 0,
  18804. }
  18805. }
  18806. /****************************************************
  18807. * macro
  18808. *****************************************************/
  18809. export namespace macro {
  18810. /** undefined */
  18811. export enum TextAlignment {
  18812. LEFT = 0,
  18813. CENTER = 0,
  18814. RIGHT = 0,
  18815. }
  18816. }
  18817. /****************************************************
  18818. * sys
  18819. *****************************************************/
  18820. export namespace sys {
  18821. /** !#en
  18822. Network type enumeration
  18823. !#zh
  18824. 网络类型枚举 */
  18825. export enum NetworkType {
  18826. NONE = 0,
  18827. LAN = 0,
  18828. WWAN = 0,
  18829. }
  18830. }
  18831. /****************************************************
  18832. * AnimationCurve
  18833. *****************************************************/
  18834. export namespace AnimationCurve {
  18835. /** !#en The wrap mode
  18836. !#zh 循环模式 */
  18837. export enum WrapMode {
  18838. Default = 0,
  18839. Once = 0,
  18840. Loop = 0,
  18841. PingPong = 0,
  18842. ClampForever = 0,
  18843. time = 0,
  18844. value = 0,
  18845. inTangent = 0,
  18846. outTangent = 0,
  18847. }
  18848. }
  18849. /****************************************************
  18850. * ParticleSystem3DAssembler
  18851. *****************************************************/
  18852. export namespace ParticleSystem3DAssembler {
  18853. /** undefined */
  18854. export enum Space {
  18855. }
  18856. }
  18857. /****************************************************
  18858. * ParticleSystem3DAssembler
  18859. *****************************************************/
  18860. export namespace ParticleSystem3DAssembler {
  18861. /** 粒子的生成模式 */
  18862. export enum RenderMode {
  18863. }
  18864. }
  18865. /****************************************************
  18866. * shapeModule
  18867. *****************************************************/
  18868. export namespace shapeModule {
  18869. /** 粒子发射器类型 */
  18870. export enum ShapeType {
  18871. Box = 0,
  18872. Circle = 0,
  18873. Cone = 0,
  18874. Sphere = 0,
  18875. Hemisphere = 0,
  18876. }
  18877. }
  18878. /****************************************************
  18879. * shapeModule
  18880. *****************************************************/
  18881. export namespace shapeModule {
  18882. /** 粒子从发射器的哪个部位发射 */
  18883. export enum EmitLocation {
  18884. Base = 0,
  18885. Edge = 0,
  18886. Shell = 0,
  18887. Volume = 0,
  18888. }
  18889. }
  18890. /****************************************************
  18891. * shapeModule
  18892. *****************************************************/
  18893. export namespace shapeModule {
  18894. /** 粒子在扇形区域的发射方式 */
  18895. export enum ArcMode {
  18896. Random = 0,
  18897. Loop = 0,
  18898. PingPong = 0,
  18899. }
  18900. }
  18901. /****************************************************
  18902. * trailModule
  18903. *****************************************************/
  18904. export namespace trailModule {
  18905. /** 选择如何为粒子系统生成轨迹 */
  18906. export enum TrailMode {
  18907. }
  18908. }
  18909. /****************************************************
  18910. * trailModule
  18911. *****************************************************/
  18912. export namespace trailModule {
  18913. /** 纹理填充模式 */
  18914. export enum TextureMode {
  18915. }
  18916. }
  18917. /****************************************************
  18918. * primitive
  18919. *****************************************************/
  18920. export namespace primitive {
  18921. /** undefined */
  18922. export enum PolyhedronType {
  18923. Tetrahedron = 0,
  18924. Octahedron = 0,
  18925. Dodecahedron = 0,
  18926. Icosahedron = 0,
  18927. Rhombicuboctahedron = 0,
  18928. TriangularPrism = 0,
  18929. PentagonalPrism = 0,
  18930. HexagonalPrism = 0,
  18931. SquarePyramid = 0,
  18932. PentagonalPyramid = 0,
  18933. TriangularDipyramid = 0,
  18934. PentagonalDipyramid = 0,
  18935. ElongatedSquareDipyramid = 0,
  18936. ElongatedPentagonalDipyramid = 0,
  18937. ElongatedPentagonalCupola = 0,
  18938. }
  18939. }
  18940. /****************************************************
  18941. * primitive
  18942. *****************************************************/
  18943. export namespace primitive {
  18944. /** undefined */
  18945. export class VertexData {
  18946. positions: number[];
  18947. normals: number[];
  18948. uvs: number[];
  18949. indices: number[];
  18950. minPos: Vec3;
  18951. maxPos: Vec3;
  18952. boundingRadius: number;
  18953. }
  18954. }
  18955. /****************************************************
  18956. * Material
  18957. *****************************************************/
  18958. export namespace Material {
  18959. /** !#en Material builtin name
  18960. !#zh 内置材质名字 */
  18961. export enum BUILTIN_NAME {
  18962. SPRITE = 0,
  18963. GRAY_SPRITE = 0,
  18964. UNLIT = 0,
  18965. }
  18966. }
  18967. /****************************************************
  18968. * EditBox
  18969. *****************************************************/
  18970. export namespace EditBox {
  18971. /** !#en Enum for keyboard return types
  18972. !#zh 键盘的返回键类型 */
  18973. export enum KeyboardReturnType {
  18974. DEFAULT = 0,
  18975. DONE = 0,
  18976. SEND = 0,
  18977. SEARCH = 0,
  18978. GO = 0,
  18979. NEXT = 0,
  18980. }
  18981. }
  18982. /****************************************************
  18983. * EditBox
  18984. *****************************************************/
  18985. export namespace EditBox {
  18986. /** !#en The EditBox's InputMode defines the type of text that the user is allowed to enter.
  18987. !#zh 输入模式 */
  18988. export enum InputMode {
  18989. ANY = 0,
  18990. EMAIL_ADDR = 0,
  18991. NUMERIC = 0,
  18992. PHONE_NUMBER = 0,
  18993. URL = 0,
  18994. DECIMAL = 0,
  18995. SINGLE_LINE = 0,
  18996. }
  18997. }
  18998. /****************************************************
  18999. * EditBox
  19000. *****************************************************/
  19001. export namespace EditBox {
  19002. /** !#en Enum for the EditBox's input flags
  19003. !#zh 定义了一些用于设置文本显示和文本格式化的标志位。 */
  19004. export enum InputFlag {
  19005. PASSWORD = 0,
  19006. SENSITIVE = 0,
  19007. INITIAL_CAPS_WORD = 0,
  19008. INITIAL_CAPS_SENTENCE = 0,
  19009. INITIAL_CAPS_ALL_CHARACTERS = 0,
  19010. DEFAULT = 0,
  19011. }
  19012. }
  19013. /****************************************************
  19014. * textureAnimationModule
  19015. *****************************************************/
  19016. export namespace textureAnimationModule {
  19017. /** 粒子贴图动画类型 */
  19018. export enum Mode {
  19019. }
  19020. }
  19021. /****************************************************
  19022. * textureAnimationModule
  19023. *****************************************************/
  19024. export namespace textureAnimationModule {
  19025. /** 贴图动画的播放方式 */
  19026. export enum Animation {
  19027. }
  19028. }
  19029. }
  19030. /** !#en
  19031. The global main namespace of DragonBones, all classes, functions,
  19032. properties and constants of DragonBones are defined in this namespace
  19033. !#zh
  19034. DragonBones 的全局的命名空间,
  19035. 与 DragonBones 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  19036. declare namespace dragonBones {
  19037. /** !#en
  19038. The Armature Display of DragonBones <br/>
  19039. <br/>
  19040. Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
  19041. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  19042. Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments. <br/>
  19043. !#zh
  19044. DragonBones 骨骼动画 <br/>
  19045. <br/>
  19046. Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  19047. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  19048. 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。<br/> */
  19049. export class ArmatureDisplay extends cc.RenderComponent {
  19050. /** !#en
  19051. The DragonBones data contains the armatures information (bind pose bones, slots, draw order,
  19052. attachments, skins, etc) and animations but does not hold any state.<br/>
  19053. Multiple ArmatureDisplay can share the same DragonBones data.
  19054. !#zh
  19055. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  19056. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  19057. 多个 ArmatureDisplay 可以共用相同的骨骼数据。 */
  19058. dragonAsset: DragonBonesAsset;
  19059. /** !#en
  19060. The atlas asset for the DragonBones.
  19061. !#zh
  19062. 骨骼数据所需的 Atlas Texture 数据。 */
  19063. dragonAtlasAsset: DragonBonesAtlasAsset;
  19064. /** !#en The name of current armature.
  19065. !#zh 当前的 Armature 名称。 */
  19066. armatureName: string;
  19067. /** !#en The name of current playing animation.
  19068. !#zh 当前播放的动画名称。 */
  19069. animationName: string;
  19070. _defaultArmatureIndex: number;
  19071. /** !#en The time scale of this armature.
  19072. !#zh 当前骨骼中所有动画的时间缩放率。 */
  19073. timeScale: number;
  19074. /** !#en The play times of the default animation.
  19075. -1 means using the value of config file;
  19076. 0 means repeat for ever
  19077. >0 means repeat times
  19078. !#zh 播放默认动画的循环次数
  19079. -1 表示使用配置文件中的默认值;
  19080. 0 表示无限循环
  19081. >0 表示循环次数 */
  19082. playTimes: number;
  19083. /** !#en Indicates whether to enable premultiplied alpha.
  19084. You should disable this option when image's transparent area appears to have opaque pixels,
  19085. or enable this option when image's half transparent area appears to be darken.
  19086. !#zh 是否启用贴图预乘。
  19087. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  19088. premultipliedAlpha: boolean;
  19089. /** !#en Indicates whether open debug bones.
  19090. !#zh 是否显示 bone 的 debug 信息。 */
  19091. debugBones: 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. The key of dragonbones cache data, which is regard as 'dragonbonesName', when you want to change dragonbones cloth.
  19098. !#zh
  19099. 缓存龙骨数据的key值,换装的时会使用到该值,作为dragonbonesName使用
  19100. @example
  19101. ```js
  19102. let factory = dragonBones.CCFactory.getInstance();
  19103. let needChangeSlot = needChangeArmature.armature().getSlot("changeSlotName");
  19104. factory.replaceSlotDisplay(toChangeArmature.getArmatureKey(), "armatureName", "slotName", "displayName", needChangeSlot);
  19105. ```
  19106. */
  19107. getArmatureKey(): string;
  19108. /**
  19109. !#en
  19110. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  19111. If set the mode in editor, then no need to worry about order problem.
  19112. !#zh
  19113. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  19114. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  19115. @param cacheMode cacheMode
  19116. @example
  19117. ```js
  19118. armatureDisplay.setAnimationCacheMode(dragonBones.ArmatureDisplay.AnimationCacheMode.SHARED_CACHE);
  19119. ```
  19120. */
  19121. setAnimationCacheMode(cacheMode: ArmatureDisplay.AnimationCacheMode): void;
  19122. /**
  19123. !#en Whether in cached mode.
  19124. !#zh 当前是否处于缓存模式。
  19125. */
  19126. isAnimationCached(): boolean;
  19127. /**
  19128. !#en
  19129. Play the specified animation.
  19130. Parameter animName specify the animation name.
  19131. Parameter playTimes specify the repeat times of the animation.
  19132. -1 means use the value of the config file.
  19133. 0 means play the animation for ever.
  19134. >0 means repeat times.
  19135. !#zh
  19136. 播放指定的动画.
  19137. animName 指定播放动画的名称。
  19138. playTimes 指定播放动画的次数。
  19139. -1 为使用配置文件中的次数。
  19140. 0 为无限循环播放。
  19141. >0 为动画的重复次数。
  19142. @param animName animName
  19143. @param playTimes playTimes
  19144. */
  19145. playAnimation(animName: string, playTimes: number): dragonBones.AnimationState;
  19146. /**
  19147. !#en
  19148. Updating an animation cache to calculate all frame data in the animation is a cost in
  19149. performance due to calculating all data in a single frame.
  19150. To update the cache, use the invalidAnimationCache method with high performance.
  19151. !#zh
  19152. 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  19153. 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  19154. @param animName animName
  19155. */
  19156. updateAnimationCache(animName: string): void;
  19157. /**
  19158. !#en
  19159. Invalidates the animation cache, which is then recomputed on each frame..
  19160. !#zh
  19161. 使动画缓存失效,之后会在每帧重新计算。
  19162. */
  19163. invalidAnimationCache(): void;
  19164. /**
  19165. !#en
  19166. Get the all armature names in the DragonBones Data.
  19167. !#zh
  19168. 获取 DragonBones 数据中所有的 armature 名称
  19169. */
  19170. getArmatureNames(): any[];
  19171. /**
  19172. !#en
  19173. Get the all animation names of specified armature.
  19174. !#zh
  19175. 获取指定的 armature 的所有动画名称。
  19176. @param armatureName armatureName
  19177. */
  19178. getAnimationNames(armatureName: string): any[];
  19179. /**
  19180. !#en
  19181. Add event listener for the DragonBones Event, the same to addEventListener.
  19182. !#zh
  19183. 添加 DragonBones 事件监听器,与 addEventListener 作用相同。
  19184. @param type A string representing the event type to listen for.
  19185. @param listener The callback that will be invoked when the event is dispatched.
  19186. @param target The target (this object) to invoke the callback, can be null
  19187. */
  19188. on(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19189. /**
  19190. !#en
  19191. Remove the event listener for the DragonBones Event, the same to removeEventListener.
  19192. !#zh
  19193. 移除 DragonBones 事件监听器,与 removeEventListener 作用相同。
  19194. @param type A string representing the event type to listen for.
  19195. @param listener listener
  19196. @param target target
  19197. */
  19198. off(type: string, listener?: Function, target?: any): void;
  19199. /**
  19200. !#en
  19201. Add DragonBones one-time event listener, the callback will remove itself after the first time it is triggered.
  19202. !#zh
  19203. 添加 DragonBones 一次性事件监听器,回调会在第一时间被触发后删除自身。
  19204. @param type A string representing the event type to listen for.
  19205. @param listener The callback that will be invoked when the event is dispatched.
  19206. @param target The target (this object) to invoke the callback, can be null
  19207. */
  19208. once(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19209. /**
  19210. !#en
  19211. Add event listener for the DragonBones Event.
  19212. !#zh
  19213. 添加 DragonBones 事件监听器。
  19214. @param type A string representing the event type to listen for.
  19215. @param listener The callback that will be invoked when the event is dispatched.
  19216. @param target The target (this object) to invoke the callback, can be null
  19217. */
  19218. addEventListener(type: string, listener: (event: cc.Event) => void, target?: any): void;
  19219. /**
  19220. !#en
  19221. Remove the event listener for the DragonBones Event.
  19222. !#zh
  19223. 移除 DragonBones 事件监听器。
  19224. @param type A string representing the event type to listen for.
  19225. @param listener listener
  19226. @param target target
  19227. */
  19228. removeEventListener(type: string, listener?: Function, target?: any): void;
  19229. /**
  19230. !#en
  19231. Build the armature for specified name.
  19232. !#zh
  19233. 构建指定名称的 armature 对象
  19234. @param armatureName armatureName
  19235. @param node node
  19236. */
  19237. buildArmature(armatureName: string, node: cc.Node): ArmatureDisplay;
  19238. /**
  19239. !#en
  19240. Get the current armature object of the ArmatureDisplay.
  19241. !#zh
  19242. 获取 ArmatureDisplay 当前使用的 Armature 对象
  19243. */
  19244. armature(): any;
  19245. }
  19246. /** DragonBones factory */
  19247. export class CCFactory extends BaseFactory {
  19248. /**
  19249. @example
  19250. ```js
  19251. let factory = dragonBones.CCFactory.getInstance();
  19252. ```
  19253. */
  19254. static getInstance(): CCFactory;
  19255. }
  19256. /** !#en The skeleton data of dragonBones.
  19257. !#zh dragonBones 的 骨骼数据。 */
  19258. export class DragonBonesAsset extends cc.Asset {
  19259. /** !#en See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
  19260. !#zh 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html */
  19261. dragonBonesJson: string;
  19262. }
  19263. /** !#en The skeleton atlas data of dragonBones.
  19264. !#zh dragonBones 的骨骼纹理数据。 */
  19265. export class DragonBonesAtlasAsset extends cc.Asset {
  19266. atlasJson: string;
  19267. texture: cc.Texture2D;
  19268. }
  19269. /****************************************************
  19270. * ArmatureDisplay
  19271. *****************************************************/
  19272. export namespace ArmatureDisplay {
  19273. /** !#en Enum for cache mode type.
  19274. !#zh Dragonbones渲染类型 */
  19275. export enum AnimationCacheMode {
  19276. REALTIME = 0,
  19277. SHARED_CACHE = 0,
  19278. PRIVATE_CACHE = 0,
  19279. }
  19280. }
  19281. /****************************************************
  19282. * dragonBones
  19283. *****************************************************/
  19284. export namespace dragonBones {
  19285. /** !#en Attach node tool
  19286. !#zh 挂点工具类 */
  19287. export class AttachUtil {
  19288. /**
  19289. !#en Gets attached root node.
  19290. !#zh 获取挂接节点树的根节点
  19291. */
  19292. getAttachedRootNode(): cc.Node;
  19293. /**
  19294. !#en Gets attached node which you want.
  19295. !#zh 获得对应的挂点
  19296. @param boneName boneName
  19297. */
  19298. getAttachedNodes(boneName: string): cc.Node[];
  19299. /**
  19300. !#en Destroy attached node which you want.
  19301. !#zh 销毁对应的挂点
  19302. @param boneName boneName
  19303. */
  19304. destroyAttachedNodes(boneName: string): void;
  19305. /**
  19306. !#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.
  19307. !#zh 遍历所有插槽,生成包含所有给定插槽名称的最小节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19308. @param boneName boneName
  19309. */
  19310. generateAttachedNodes(boneName: string): cc.Node[];
  19311. /**
  19312. !#en Destroy all attached node.
  19313. !#zh 销毁所有挂点
  19314. */
  19315. destroyAllAttachedNodes(): void;
  19316. /**
  19317. !#en Traverse all bones to generate a tree containing all bones nodes, NOTE that make sure the skeleton has initialized before calling this interface.
  19318. !#zh 遍历所有插槽,生成包含所有插槽的节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19319. */
  19320. generateAllAttachedNodes(): cc.Node;
  19321. }
  19322. }
  19323. }
  19324. /** !#en
  19325. The global main namespace of Spine, all classes, functions,
  19326. properties and constants of Spine are defined in this namespace
  19327. !#zh
  19328. Spine 的全局的命名空间,
  19329. 与 Spine 相关的所有的类,函数,属性,常量都在这个命名空间中定义。 */
  19330. declare namespace sp {
  19331. /** !#en
  19332. The skeleton of Spine <br/>
  19333. <br/>
  19334. (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
  19335. which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
  19336. Multiple skeletons can use the same SkeletonData which includes all animations, skins, and attachments.) <br/>
  19337. !#zh
  19338. Spine 骨骼动画 <br/>
  19339. <br/>
  19340. (Skeleton 具有对骨骼数据的引用并且存储了骨骼实例的状态,
  19341. 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。<br/>
  19342. 多个 Skeleton 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。 */
  19343. export class Skeleton extends cc.RenderComponent {
  19344. /** !#en The skeletal animation is paused?
  19345. !#zh 该骨骼动画是否暂停。 */
  19346. paused: boolean;
  19347. /** !#en
  19348. The skeleton data contains the skeleton information (bind pose bones, slots, draw order,
  19349. attachments, skins, etc) and animations but does not hold any state.<br/>
  19350. Multiple skeletons can share the same skeleton data.
  19351. !#zh
  19352. 骨骼数据包含了骨骼信息(绑定骨骼动作,slots,渲染顺序,
  19353. attachments,皮肤等等)和动画但不持有任何状态。<br/>
  19354. 多个 Skeleton 可以共用相同的骨骼数据。 */
  19355. skeletonData: SkeletonData;
  19356. /** !#en The name of default skin.
  19357. !#zh 默认的皮肤名称。 */
  19358. defaultSkin: string;
  19359. /** !#en The name of default animation.
  19360. !#zh 默认的动画名称。 */
  19361. defaultAnimation: string;
  19362. /** !#en The name of current playing animation.
  19363. !#zh 当前播放的动画名称。 */
  19364. animation: string;
  19365. _defaultSkinIndex: number;
  19366. /** !#en TODO
  19367. !#zh 是否循环播放当前骨骼动画。 */
  19368. loop: boolean;
  19369. /** !#en Indicates whether to enable premultiplied alpha.
  19370. You should disable this option when image's transparent area appears to have opaque pixels,
  19371. or enable this option when image's half transparent area appears to be darken.
  19372. !#zh 是否启用贴图预乘。
  19373. 当图片的透明区域出现色块时需要关闭该选项,当图片的半透明区域颜色变黑时需要启用该选项。 */
  19374. premultipliedAlpha: boolean;
  19375. /** !#en The time scale of this skeleton.
  19376. !#zh 当前骨骼中所有动画的时间缩放率。 */
  19377. timeScale: number;
  19378. /** !#en Indicates whether open debug slots.
  19379. !#zh 是否显示 slot 的 debug 信息。 */
  19380. debugSlots: boolean;
  19381. /** !#en Indicates whether open debug bones.
  19382. !#zh 是否显示 bone 的 debug 信息。 */
  19383. debugBones: boolean;
  19384. /** !#en Indicates whether open debug mesh.
  19385. !#zh 是否显示 mesh 的 debug 信息。 */
  19386. debugMesh: boolean;
  19387. /** !#en Enabled two color tint.
  19388. !#zh 是否启用染色效果。 */
  19389. useTint: boolean;
  19390. /** !#en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
  19391. !#zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。 */
  19392. enableBatch: boolean;
  19393. /**
  19394. !#en
  19395. Sets runtime skeleton data to sp.Skeleton.<br>
  19396. 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.
  19397. !#zh
  19398. 设置底层运行时用到的 SkeletonData。<br>
  19399. 这个接口有别于 `skeletonData` 属性,这个接口传入的是 Spine runtime 提供的原始数据,而 skeletonData 的类型是 Creator 提供的资源类型。
  19400. @param skeletonData skeletonData
  19401. */
  19402. setSkeletonData(skeletonData: sp.spine.SkeletonData): void;
  19403. /**
  19404. !#en Sets slots visible range.
  19405. !#zh 设置骨骼插槽可视范围。
  19406. @param startSlotIndex startSlotIndex
  19407. @param endSlotIndex endSlotIndex
  19408. */
  19409. setSlotsRange(startSlotIndex: number, endSlotIndex: number): void;
  19410. /**
  19411. !#en Sets animation state data.<br>
  19412. The parameter type is {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData.
  19413. !#zh 设置动画状态数据。<br>
  19414. 参数是 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.AnimationStateData。
  19415. @param stateData stateData
  19416. */
  19417. setAnimationStateData(stateData: sp.spine.AnimationStateData): void;
  19418. /**
  19419. !#en
  19420. It's best to set cache mode before set property 'dragonAsset', or will waste some cpu time.
  19421. If set the mode in editor, then no need to worry about order problem.
  19422. !#zh
  19423. 若想切换渲染模式,最好在设置'dragonAsset'之前,先设置好渲染模式,否则有运行时开销。
  19424. 若在编辑中设置渲染模式,则无需担心设置次序的问题。
  19425. @param cacheMode cacheMode
  19426. @example
  19427. ```js
  19428. skeleton.setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.SHARED_CACHE);
  19429. ```
  19430. */
  19431. setAnimationCacheMode(cacheMode: Skeleton.AnimationCacheMode): void;
  19432. /**
  19433. !#en Whether in cached mode.
  19434. !#zh 当前是否处于缓存模式。
  19435. */
  19436. isAnimationCached(): boolean;
  19437. /**
  19438. !#en Sets vertex effect delegate.
  19439. !#zh 设置顶点动画代理
  19440. @param effectDelegate effectDelegate
  19441. */
  19442. setVertexEffectDelegate(effectDelegate: VertexEffectDelegate): void;
  19443. /**
  19444. !#en Computes the world SRT from the local SRT for each bone.
  19445. !#zh 重新更新所有骨骼的世界 Transform,
  19446. 当获取 bone 的数值未更新时,即可使用该函数进行更新数值。
  19447. @example
  19448. ```js
  19449. var bone = spine.findBone('head');
  19450. cc.log(bone.worldX); // return 0;
  19451. spine.updateWorldTransform();
  19452. bone = spine.findBone('head');
  19453. cc.log(bone.worldX); // return -23.12;
  19454. ```
  19455. */
  19456. updateWorldTransform(): void;
  19457. /**
  19458. !#en Sets the bones and slots to the setup pose.
  19459. !#zh 还原到起始动作
  19460. */
  19461. setToSetupPose(): void;
  19462. /**
  19463. !#en
  19464. Sets the bones to the setup pose,
  19465. using the values from the `BoneData` list in the `SkeletonData`.
  19466. !#zh
  19467. 设置 bone 到起始动作
  19468. 使用 SkeletonData 中的 BoneData 列表中的值。
  19469. */
  19470. setBonesToSetupPose(): void;
  19471. /**
  19472. !#en
  19473. Sets the slots to the setup pose,
  19474. using the values from the `SlotData` list in the `SkeletonData`.
  19475. !#zh
  19476. 设置 slot 到起始动作。
  19477. 使用 SkeletonData 中的 SlotData 列表中的值。
  19478. */
  19479. setSlotsToSetupPose(): void;
  19480. /**
  19481. !#en
  19482. Updating an animation cache to calculate all frame data in the animation is a cost in
  19483. performance due to calculating all data in a single frame.
  19484. To update the cache, use the invalidAnimationCache method with high performance.
  19485. !#zh
  19486. 更新某个动画缓存, 预计算动画中所有帧数据,由于在单帧计算所有数据,所以较消耗性能。
  19487. 若想更新缓存,可使用 invalidAnimationCache 方法,具有较高性能。
  19488. @param animName animName
  19489. */
  19490. updateAnimationCache(animName: string): void;
  19491. /**
  19492. !#en
  19493. Invalidates the animation cache, which is then recomputed on each frame..
  19494. !#zh
  19495. 使动画缓存失效,之后会在每帧重新计算。
  19496. */
  19497. invalidAnimationCache(): void;
  19498. /**
  19499. !#en
  19500. Finds a bone by name.
  19501. This does a string comparison for every bone.<br>
  19502. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone object.
  19503. !#zh
  19504. 通过名称查找 bone。
  19505. 这里对每个 bone 的名称进行了对比。<br>
  19506. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Bone 对象。
  19507. @param boneName boneName
  19508. */
  19509. findBone(boneName: string): sp.spine.Bone;
  19510. /**
  19511. !#en
  19512. Finds a slot by name. This does a string comparison for every slot.<br>
  19513. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot object.
  19514. !#zh
  19515. 通过名称查找 slot。这里对每个 slot 的名称进行了比较。<br>
  19516. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Slot 对象。
  19517. @param slotName slotName
  19518. */
  19519. findSlot(slotName: string): sp.spine.Slot;
  19520. /**
  19521. !#en
  19522. Finds a skin by name and makes it the active skin.
  19523. This does a string comparison for every skin.<br>
  19524. Note that setting the skin does not change which attachments are visible.<br>
  19525. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin object.
  19526. !#zh
  19527. 按名称查找皮肤,激活该皮肤。这里对每个皮肤的名称进行了比较。<br>
  19528. 注意:设置皮肤不会改变 attachment 的可见性。<br>
  19529. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Skin 对象。
  19530. @param skinName skinName
  19531. */
  19532. setSkin(skinName: string): void;
  19533. /**
  19534. !#en
  19535. Returns the attachment for the slot and attachment name.
  19536. The skeleton looks first in its skin, then in the skeleton data’s default skin.<br>
  19537. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment object.
  19538. !#zh
  19539. 通过 slot 和 attachment 的名称获取 attachment。Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。<br>
  19540. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.Attachment 对象。
  19541. @param slotName slotName
  19542. @param attachmentName attachmentName
  19543. */
  19544. getAttachment(slotName: string, attachmentName: string): sp.spine.Attachment;
  19545. /**
  19546. !#en
  19547. Sets the attachment for the slot and attachment name.
  19548. The skeleton looks first in its skin, then in the skeleton data’s default skin.
  19549. !#zh
  19550. 通过 slot 和 attachment 的名字来设置 attachment。
  19551. Skeleton 优先查找它的皮肤,然后才是 Skeleton Data 中默认的皮肤。
  19552. @param slotName slotName
  19553. @param attachmentName attachmentName
  19554. */
  19555. setAttachment(slotName: string, attachmentName: string): void;
  19556. /**
  19557. Return the renderer of attachment.
  19558. @param regionAttachment regionAttachment
  19559. */
  19560. getTextureAtlas(regionAttachment: sp.spine.RegionAttachment|spine.BoundingBoxAttachment): sp.spine.TextureAtlasRegion;
  19561. /**
  19562. !#en
  19563. Mix applies all keyframe values,
  19564. interpolated for the specified time and mixed with the current values.
  19565. !#zh 为所有关键帧设定混合及混合时间(从当前值开始差值)。
  19566. @param fromAnimation fromAnimation
  19567. @param toAnimation toAnimation
  19568. @param duration duration
  19569. */
  19570. setMix(fromAnimation: string, toAnimation: string, duration: number): void;
  19571. /**
  19572. !#en Set the current animation. Any queued animations are cleared.<br>
  19573. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19574. !#zh 设置当前动画。队列中的任何的动画将被清除。<br>
  19575. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19576. @param trackIndex trackIndex
  19577. @param name name
  19578. @param loop loop
  19579. */
  19580. setAnimation(trackIndex: number, name: string, loop: boolean): sp.spine.TrackEntry;
  19581. /**
  19582. !#en Adds an animation to be played delay seconds after the current or last queued animation.<br>
  19583. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19584. !#zh 添加一个动画到动画队列尾部,还可以延迟指定的秒数。<br>
  19585. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19586. @param trackIndex trackIndex
  19587. @param name name
  19588. @param loop loop
  19589. @param delay delay
  19590. */
  19591. addAnimation(trackIndex: number, name: string, loop: boolean, delay?: number): sp.spine.TrackEntry;
  19592. /**
  19593. !#en Find animation with specified name.
  19594. !#zh 查找指定名称的动画
  19595. @param name name
  19596. */
  19597. findAnimation(name: string): sp.spine.Animation;
  19598. /**
  19599. !#en Returns track entry by trackIndex.<br>
  19600. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry object.
  19601. !#zh 通过 track 索引获取 TrackEntry。<br>
  19602. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.TrackEntry 对象。
  19603. @param trackIndex trackIndex
  19604. */
  19605. getCurrent(trackIndex: any): sp.spine.TrackEntry;
  19606. /**
  19607. !#en Clears all tracks of animation state.
  19608. !#zh 清除所有 track 的动画状态。
  19609. */
  19610. clearTracks(): void;
  19611. /**
  19612. !#en Clears track of animation state by trackIndex.
  19613. !#zh 清除出指定 track 的动画状态。
  19614. @param trackIndex trackIndex
  19615. */
  19616. clearTrack(trackIndex: number): void;
  19617. /**
  19618. !#en Set the start event listener.
  19619. !#zh 用来设置开始播放动画的事件监听。
  19620. @param listener listener
  19621. */
  19622. setStartListener(listener: Function): void;
  19623. /**
  19624. !#en Set the interrupt event listener.
  19625. !#zh 用来设置动画被打断的事件监听。
  19626. @param listener listener
  19627. */
  19628. setInterruptListener(listener: Function): void;
  19629. /**
  19630. !#en Set the end event listener.
  19631. !#zh 用来设置动画播放完后的事件监听。
  19632. @param listener listener
  19633. */
  19634. setEndListener(listener: Function): void;
  19635. /**
  19636. !#en Set the dispose event listener.
  19637. !#zh 用来设置动画将被销毁的事件监听。
  19638. @param listener listener
  19639. */
  19640. setDisposeListener(listener: Function): void;
  19641. /**
  19642. !#en Set the complete event listener.
  19643. !#zh 用来设置动画播放一次循环结束后的事件监听。
  19644. @param listener listener
  19645. */
  19646. setCompleteListener(listener: Function): void;
  19647. /**
  19648. !#en Set the animation event listener.
  19649. !#zh 用来设置动画播放过程中帧事件的监听。
  19650. @param listener listener
  19651. */
  19652. setEventListener(listener: Function): void;
  19653. /**
  19654. !#en Set the start event listener for specified TrackEntry.
  19655. !#zh 用来为指定的 TrackEntry 设置动画开始播放的事件监听。
  19656. @param entry entry
  19657. @param listener listener
  19658. */
  19659. setTrackStartListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19660. /**
  19661. !#en Set the interrupt event listener for specified TrackEntry.
  19662. !#zh 用来为指定的 TrackEntry 设置动画被打断的事件监听。
  19663. @param entry entry
  19664. @param listener listener
  19665. */
  19666. setTrackInterruptListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19667. /**
  19668. !#en Set the end event listener for specified TrackEntry.
  19669. !#zh 用来为指定的 TrackEntry 设置动画播放结束的事件监听。
  19670. @param entry entry
  19671. @param listener listener
  19672. */
  19673. setTrackEndListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19674. /**
  19675. !#en Set the dispose event listener for specified TrackEntry.
  19676. !#zh 用来为指定的 TrackEntry 设置动画即将被销毁的事件监听。
  19677. @param entry entry
  19678. @param listener listener
  19679. */
  19680. setTrackDisposeListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19681. /**
  19682. !#en Set the complete event listener for specified TrackEntry.
  19683. !#zh 用来为指定的 TrackEntry 设置动画一次循环播放结束的事件监听。
  19684. @param entry entry
  19685. @param listener listener
  19686. */
  19687. setTrackCompleteListener(entry: sp.spine.TrackEntry, listener: (entry: sp.spine.TrackEntry, loopCount: number) => void): void;
  19688. /**
  19689. !#en Set the event listener for specified TrackEntry.
  19690. !#zh 用来为指定的 TrackEntry 设置动画帧事件的监听。
  19691. @param entry entry
  19692. @param listener listener
  19693. */
  19694. setTrackEventListener(entry: sp.spine.TrackEntry, listener: Function): void;
  19695. /**
  19696. !#en Get the animation state object
  19697. !#zh 获取动画状态
  19698. */
  19699. getState(): sp.spine.AnimationState;
  19700. }
  19701. /** !#en The event type of spine skeleton animation.
  19702. !#zh 骨骼动画事件类型。 */
  19703. export enum AnimationEventType {
  19704. START = 0,
  19705. END = 0,
  19706. COMPLETE = 0,
  19707. EVENT = 0,
  19708. }
  19709. /** !#en The skeleton data of spine.
  19710. !#zh Spine 的 骨骼数据。 */
  19711. export class SkeletonData extends cc.Asset {
  19712. /** !#en See http://en.esotericsoftware.com/spine-json-format
  19713. !#zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format */
  19714. skeletonJson: any;
  19715. atlasText: string;
  19716. textures: cc.Texture2D[];
  19717. /** !#en
  19718. A scale can be specified on the JSON or binary loader which will scale the bone positions,
  19719. image sizes, and animation translations.
  19720. This can be useful when using different sized images than were used when designing the skeleton
  19721. in Spine. For example, if using images that are half the size than were used in Spine,
  19722. a scale of 0.5 can be used. This is commonly used for games that can run with either low or high
  19723. resolution texture atlases.
  19724. see http://en.esotericsoftware.com/spine-using-runtimes#Scaling
  19725. !#zh 可查看 Spine 官方文档: http://zh.esotericsoftware.com/spine-using-runtimes#Scaling */
  19726. scale: number;
  19727. /**
  19728. !#en Get the included SkeletonData used in spine runtime.<br>
  19729. Returns a {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData object.
  19730. !#zh 获取 Spine Runtime 使用的 SkeletonData。<br>
  19731. 返回一个 {{#crossLinkModule "sp.spine"}}sp.spine{{/crossLinkModule}}.SkeletonData 对象。
  19732. @param quiet quiet
  19733. */
  19734. getRuntimeData(quiet?: boolean): sp.spine.SkeletonData;
  19735. }
  19736. /** !#en
  19737. The delegate of spine vertex effect
  19738. !#zh
  19739. Spine 顶点动画代理 */
  19740. export class VertexEffectDelegate {
  19741. /**
  19742. !#en Clears vertex effect.
  19743. !#zh 清空顶点效果
  19744. */
  19745. clear(): void;
  19746. /**
  19747. !#en Inits delegate with jitter effect
  19748. !#zh 设置顶点抖动效果
  19749. @param jitterX jitterX
  19750. @param jitterY jitterY
  19751. */
  19752. initJitter(jitterX: number, jitterY: number): void;
  19753. /**
  19754. !#en Inits delegate with swirl effect
  19755. !#zh 设置顶点漩涡效果
  19756. @param radius radius
  19757. @param power power
  19758. */
  19759. initSwirlWithPow(radius: number, power: number): sp.spine.JitterEffect;
  19760. /**
  19761. !#en Inits delegate with swirl effect
  19762. !#zh 设置顶点漩涡效果
  19763. @param radius radius
  19764. @param power power
  19765. */
  19766. initSwirlWithPowOut(radius: number, power: number): sp.spine.SwirlEffect;
  19767. /**
  19768. !#en Gets jitter vertex effect
  19769. !#zh 获取顶点抖动效果
  19770. */
  19771. getJitterVertexEffect(): sp.spine.JitterEffect;
  19772. /**
  19773. !#en Gets swirl vertex effect
  19774. !#zh 获取顶点漩涡效果
  19775. */
  19776. getSwirlVertexEffect(): sp.spine.SwirlEffect;
  19777. /**
  19778. !#en Gets vertex effect
  19779. !#zh 获取顶点效果
  19780. */
  19781. getVertexEffect(): sp.spine.JitterEffect;
  19782. /**
  19783. !#en Gets effect type
  19784. !#zh 获取效果类型
  19785. */
  19786. getEffectType(): string;
  19787. }
  19788. /****************************************************
  19789. * sp
  19790. *****************************************************/
  19791. export namespace sp {
  19792. /** !#en Attach node tool
  19793. !#zh 挂点工具类 */
  19794. export class AttachUtil {
  19795. /**
  19796. !#en Gets attached root node.
  19797. !#zh 获取挂接节点树的根节点
  19798. */
  19799. getAttachedRootNode(): cc.Node;
  19800. /**
  19801. !#en Gets attached node which you want.
  19802. !#zh 获得对应的挂点
  19803. @param boneName boneName
  19804. */
  19805. getAttachedNodes(boneName: string): cc.Node[];
  19806. /**
  19807. !#en Destroy attached node which you want.
  19808. !#zh 销毁对应的挂点
  19809. @param boneName boneName
  19810. */
  19811. destroyAttachedNodes(boneName: string): void;
  19812. /**
  19813. !#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.
  19814. !#zh 遍历所有插槽,生成包含所有给定插槽名称的最小节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19815. @param boneName boneName
  19816. */
  19817. generateAttachedNodes(boneName: string): cc.Node[];
  19818. /**
  19819. !#en Destroy all attached node.
  19820. !#zh 销毁所有挂点
  19821. */
  19822. destroyAllAttachedNodes(): void;
  19823. /**
  19824. !#en Traverse all bones to generate a tree containing all bones nodes, NOTE that make sure the skeleton has initialized before calling this interface.
  19825. !#zh 遍历所有插槽,生成包含所有插槽的节点树,注意,调用该接口前请确保骨骼动画已经初始化好。
  19826. */
  19827. generateAllAttachedNodes(): cc.Node;
  19828. }
  19829. }
  19830. /****************************************************
  19831. * Skeleton
  19832. *****************************************************/
  19833. export namespace Skeleton {
  19834. /** !#en Enum for animation cache mode type.
  19835. !#zh Spine动画缓存类型 */
  19836. export enum AnimationCacheMode {
  19837. REALTIME = 0,
  19838. SHARED_CACHE = 0,
  19839. PRIVATE_CACHE = 0,
  19840. }
  19841. }
  19842. }
  19843. /** !#en
  19844. `sp.spine` is the namespace for official Spine Runtime, which officially implemented and maintained by Spine.<br>
  19845. Please refer to the official documentation for its detailed usage: [http://en.esotericsoftware.com/spine-using-runtimes](http://en.esotericsoftware.com/spine-using-runtimes)
  19846. !#zh
  19847. sp.spine 模块是 Spine 官方运行库的 API 入口,由 Spine 官方统一实现和维护,具体用法请参考:[http://zh.esotericsoftware.com/spine-using-runtimes](http://zh.esotericsoftware.com/spine-using-runtimes) */
  19848. declare namespace sp.spine {
  19849. }
  19850. /** !#en
  19851. This module controls asset's behaviors and information, include loading, releasing etc.
  19852. All member can be accessed with `cc.assetManager`. All class or enum can be accessed with `cc.AssetManager`
  19853. !#zh
  19854. 此模块管理资源的行为和信息,包括加载,释放等,所有成员能够通过 `cc.assetManager` 调用. 所有类型或枚举能通过 `cc.AssetManager` 访问 */
  19855. declare namespace cc.AssetManager {
  19856. /** !#en
  19857. This module contains the builtin asset, it's a singleton, all member can be accessed with `cc.assetManager.builtins`
  19858. !#zh
  19859. 此模块包含内建资源,这是一个单例,所有成员能通过 `cc.assetManager.builtins` 访问 */
  19860. export class Builtins {
  19861. /**
  19862. !#en
  19863. Initialize
  19864. !#zh
  19865. 初始化
  19866. @param cb Callback when finish loading built-in assets
  19867. */
  19868. init (cb: () => void): void;
  19869. /**
  19870. !#en
  19871. Get the built-in asset using specific type and name.
  19872. !#zh
  19873. 通过特定的类型和名称获取内建资源
  19874. @param type The type of asset, such as `effect`
  19875. @param name The name of asset, such as `phong`
  19876. @example
  19877. ```js
  19878. cc.assetManaer.builtins.getBuiltin('effect', 'phone');
  19879. ```
  19880. */
  19881. getBuiltin(type?: string, name?: string): cc.Asset | Cache<cc.Asset>;
  19882. /**
  19883. !#en
  19884. Clear all builtin assets
  19885. !#zh
  19886. 清空所有内置资源
  19887. */
  19888. clear(): void;
  19889. }
  19890. /** !#en
  19891. A bundle contains an amount of assets(includes scene), you can load, preload, release asset which is in this bundle
  19892. !#zh
  19893. 一个包含一定数量资源(包括场景)的包,你可以加载,预加载,释放此包内的资源 */
  19894. export class Bundle {
  19895. /**
  19896. !#en
  19897. Create a bundle
  19898. !#zh
  19899. 创建一个 bundle
  19900. */
  19901. constructor();
  19902. /** !#en
  19903. The name of this bundle
  19904. !#zh
  19905. 此 bundle 的名称 */
  19906. name: string;
  19907. /** !#en
  19908. The dependency of this bundle
  19909. !#zh
  19910. 此 bundle 的依赖 */
  19911. deps: string[];
  19912. /** !#en
  19913. The root path of this bundle, such like 'http://example.com/bundle1'
  19914. !#zh
  19915. 此 bundle 的根路径, 例如 'http://example.com/bundle1' */
  19916. base: string;
  19917. /**
  19918. !#en
  19919. Get asset's info using path, only valid when asset is in bundle folder.
  19920. !#zh
  19921. 使用 path 获取资源的配置信息
  19922. @param path The relative path of asset, such as 'images/a'
  19923. @param type The constructor of asset, such as `cc.Texture2D`
  19924. @example
  19925. ```js
  19926. var info = bundle.getInfoWithPath('image/a', cc.Texture2D);
  19927. ```
  19928. */
  19929. getInfoWithPath (path: string, type?: typeof cc.Asset): Record<string, any>;
  19930. /**
  19931. !#en
  19932. Get all asset's info within specific folder
  19933. !#zh
  19934. 获取在某个指定文件夹下的所有资源信息
  19935. @param path The relative path of folder, such as 'images'
  19936. @param type The constructor should be used to filter paths
  19937. @param out The output array
  19938. @example
  19939. ```js
  19940. var infos = [];
  19941. bundle.getDirWithPath('images', cc.Texture2D, infos);
  19942. ```
  19943. */
  19944. getDirWithPath (path: string, type: typeof cc.Asset, out: Array<Record<string, any>>): Array<Record<string, any>>;
  19945. getDirWithPath (path: string, type: typeof cc.Asset): Array<Record<string, any>>;
  19946. getDirWithPath (path: string): Array<Record<string, any>>;
  19947. /**
  19948. !#en
  19949. Get asset's info with uuid
  19950. !#zh
  19951. 通过 uuid 获取资源信息
  19952. @param uuid The asset's uuid
  19953. @example
  19954. ```js
  19955. var info = bundle.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  19956. ```
  19957. */
  19958. getAssetInfo (uuid: string): Record<string, any>;
  19959. /**
  19960. !#en
  19961. Get scene'info with name
  19962. !#zh
  19963. 通过场景名获取场景信息
  19964. @param name The name of scene
  19965. @example
  19966. ```js
  19967. var info = bundle.getSceneInfo('first.fire');
  19968. ```
  19969. */
  19970. getSceneInfo(name: string): Record<string, any>;
  19971. /**
  19972. !#en
  19973. Initialize this bundle with options
  19974. !#zh
  19975. 初始化此 bundle
  19976. @param options options
  19977. */
  19978. init(options: Record<string, any>): void;
  19979. /**
  19980. !#en
  19981. Load the asset within this bundle by the path which is relative to bundle's path
  19982. !#zh
  19983. 通过相对路径加载分包中的资源。路径是相对分包文件夹路径的相对路径
  19984. @param paths Paths of the target assets.The path is relative to the bundle's folder, extensions must be omitted.
  19985. @param type Only asset of type will be loaded if this argument is supplied.
  19986. @param onProgress Callback invoked when progression change.
  19987. @param onComplete Callback invoked when all assets loaded.
  19988. @example
  19989. ```js
  19990. // load the texture (${project}/assets/resources/textures/background.jpg) from resources
  19991. cc.resources.load('textures/background', cc.Texture2D, (err, texture) => console.log(err));
  19992. // load the audio (${project}/assets/resources/music/hit.mp3) from resources
  19993. cc.resources.load('music/hit', cc.AudioClip, (err, audio) => console.log(err));
  19994. // load the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  19995. bundle1.load('misc/character/cocos', cc.Prefab, (err, prefab) => console.log(err));
  19996. // load the sprite frame (${project}/assets/some/xxx/bundle2/imgs/cocos.png) from bundle2 folder
  19997. bundle2.load('imgs/cocos', cc.SpriteFrame, null, (err, spriteFrame) => console.log(err));
  19998. ```
  19999. */
  20000. 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;
  20001. 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;
  20002. load<T extends cc.Asset>(paths: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: T) => void): void;
  20003. load<T extends cc.Asset>(paths: string[], onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: Array<T>) => void): void;
  20004. load<T extends cc.Asset>(paths: string, type: typeof cc.Asset, onComplete?: (error: Error, assets: T) => void): void;
  20005. load<T extends cc.Asset>(paths: string[], type: typeof cc.Asset, onComplete?: (error: Error, assets: Array<T>) => void): void;
  20006. load<T extends cc.Asset>(paths: string, onComplete?: (error: Error, assets: T) => void): void;
  20007. load<T extends cc.Asset>(paths: string[], onComplete?: (error: Error, assets: Array<T>) => void): void;
  20008. /**
  20009. !#en
  20010. Preload the asset within this bundle by the path which is relative to bundle's path.
  20011. After calling this method, you still need to finish loading by calling `Bundle.load`.
  20012. It will be totally fine to call `Bundle.load` at any time even if the preloading is not
  20013. yet finished
  20014. !#zh
  20015. 通过相对路径预加载分包中的资源。路径是相对分包文件夹路径的相对路径。调用完后,你仍然需要通过 `Bundle.load` 来完成加载。
  20016. 就算预加载还没完成,你也可以直接调用 `Bundle.load`。
  20017. @param paths Paths of the target asset.The path is relative to bundle folder, extensions must be omitted.
  20018. @param type Only asset of type will be loaded if this argument is supplied.
  20019. @param onProgress Callback invoked when progression change.
  20020. @param onComplete Callback invoked when the resource loaded.
  20021. @example
  20022. ```js
  20023. // preload the texture (${project}/assets/resources/textures/background.jpg) from resources
  20024. cc.resources.preload('textures/background', cc.Texture2D);
  20025. // preload the audio (${project}/assets/resources/music/hit.mp3) from resources
  20026. cc.resources.preload('music/hit', cc.AudioClip);
  20027. // wait for while
  20028. cc.resources.load('music/hit', cc.AudioClip, (err, audioClip) => {});
  20029. * // preload the prefab (${project}/assets/bundle1/misc/character/cocos) from bundle1 folder
  20030. bundle1.preload('misc/character/cocos', cc.Prefab);
  20031. // load the sprite frame of (${project}/assets/bundle2/imgs/cocos.png) from bundle2 folder
  20032. bundle2.preload('imgs/cocos', cc.SpriteFrame);
  20033. // wait for while
  20034. bundle2.load('imgs/cocos', cc.SpriteFrame, (err, spriteFrame) => {});
  20035. ```
  20036. */
  20037. preload(paths: string|string[], type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20038. preload(paths: string|string[], onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20039. preload(paths: string|string[], type: typeof cc.Asset, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20040. preload(paths: string|string[], type: typeof cc.Asset): void;
  20041. preload(paths: string|string[], onComplete: (error: Error, items: RequestItem[]) => void): void;
  20042. preload(paths: string|string[]): void;
  20043. /**
  20044. !#en
  20045. Load all assets under a folder inside the bundle folder.<br>
  20046. <br>
  20047. Note: All asset paths in Creator use forward slashes, paths using backslashes will not work.
  20048. !#zh
  20049. 加载目标文件夹中的所有资源, 注意:路径中只能使用斜杠,反斜杠将停止工作
  20050. @param dir path of the target folder.The path is relative to the bundle folder, extensions must be omitted.
  20051. @param type Only asset of type will be loaded if this argument is supplied.
  20052. @param onProgress Callback invoked when progression change.
  20053. @param onComplete A callback which is called when all assets have been loaded, or an error occurs.
  20054. @example
  20055. ```js
  20056. // load all audios (resources/audios/)
  20057. cc.resources.loadDir('audios', cc.AudioClip, (err, audios) => {});
  20058. // load all textures in "resources/imgs/"
  20059. cc.resources.loadDir('imgs', cc.Texture2D, null, function (err, textures) {
  20060. var texture1 = textures[0];
  20061. var texture2 = textures[1];
  20062. });
  20063. // load all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  20064. bundle1.loadDir('misc/characters', cc.Prefab, (err, prefabs) => console.log(err));
  20065. // load all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  20066. bundle2.loadDir('skills', cc.SpriteFrame, null, (err, spriteFrames) => console.log(err));
  20067. ```
  20068. */
  20069. 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;
  20070. loadDir<T extends cc.Asset>(dir: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, assets: Array<T>) => void): void;
  20071. loadDir<T extends cc.Asset>(dir: string, type: typeof cc.Asset, onComplete: (error: Error, assets: Array<T>) => void): void;
  20072. loadDir<T extends cc.Asset>(dir: string, type: typeof cc.Asset): void;
  20073. loadDir<T extends cc.Asset>(dir: string, onComplete: (error: Error, assets: Array<T>) => void): void;
  20074. loadDir<T extends cc.Asset>(dir: string): void;
  20075. /**
  20076. !#en
  20077. 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`.
  20078. It will be totally fine to call `Bundle.loadDir` at any time even if the preloading is not yet finished
  20079. !#zh
  20080. 预加载目标文件夹中的所有资源。调用完后,你仍然需要通过 `Bundle.loadDir` 来完成加载。
  20081. 就算预加载还没完成,你也可以直接调用 `Bundle.loadDir`。
  20082. @param dir path of the target folder.The path is relative to the bundle folder, extensions must be omitted.
  20083. @param type Only asset of type will be preloaded if this argument is supplied.
  20084. @param onProgress Callback invoked when progression change.
  20085. @param onComplete A callback which is called when all assets have been loaded, or an error occurs.
  20086. @example
  20087. ```js
  20088. // preload all audios (resources/audios/)
  20089. cc.resources.preloadDir('audios', cc.AudioClip);
  20090. // preload all textures in "resources/imgs/"
  20091. cc.resources.preloadDir('imgs', cc.Texture2D);
  20092. // wait for while
  20093. cc.resources.loadDir('imgs', cc.Texture2D, (err, textures) => {});
  20094. // preload all prefabs (${project}/assets/bundle1/misc/characters/) from bundle1 folder
  20095. bundle1.preloadDir('misc/characters', cc.Prefab);
  20096. // preload all sprite frame (${project}/assets/some/xxx/bundle2/skills/) from bundle2 folder
  20097. bundle2.preloadDir('skills', cc.SpriteFrame);
  20098. // wait for while
  20099. bundle2.loadDir('skills', cc.SpriteFrame, (err, spriteFrames) => {});
  20100. ```
  20101. */
  20102. preloadDir(dir: string, type: typeof cc.Asset, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20103. preloadDir(dir: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20104. preloadDir(dir: string, type: typeof cc.Asset, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20105. preloadDir(dir: string, type: typeof cc.Asset): void;
  20106. preloadDir(dir: string, onComplete: (error: Error, items: RequestItem[]) => void): void;
  20107. preloadDir(dir: string): void;
  20108. /**
  20109. !#en
  20110. Loads the scene within this bundle by its name.
  20111. !#zh
  20112. 通过场景名称加载分包中的场景。
  20113. @param sceneName The name of the scene to load.
  20114. @param options Some optional parameters
  20115. @param onProgress Callback invoked when progression change.
  20116. @param onComplete callback, will be called after scene launched.
  20117. @example
  20118. ```js
  20119. bundle1.loadScene('first', (err, sceneAsset) => cc.director.runScene(sceneAsset));
  20120. ```
  20121. */
  20122. loadScene(sceneName: string, options: Record<string, any>, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20123. loadScene(sceneName: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20124. loadScene(sceneName: string, options: Record<string, any>, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20125. loadScene(sceneName: string, onComplete: (error: Error, sceneAsset: cc.SceneAsset) => void): void;
  20126. loadScene(sceneName: string, options: Record<string, any>): void;
  20127. loadScene(sceneName: string): void;
  20128. /**
  20129. !#en
  20130. 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`.
  20131. It will be totally fine to call `Bundle.loadDir` at any time even if the preloading is not yet finished
  20132. !#zh
  20133. 通过场景名称预加载分包中的场景.调用完后,你仍然需要通过 `Bundle.loadScene` 或 `cc.director.loadScene` 来完成加载。
  20134. 就算预加载还没完成,你也可以直接调用 `Bundle.loadScene` 或 `cc.director.loadScene`。
  20135. @param sceneName The name of the scene to preload.
  20136. @param options Some optional parameters
  20137. @param onProgress callback, will be called when the load progression change.
  20138. @param onComplete callback, will be called after scene loaded.
  20139. @example
  20140. ```js
  20141. bundle1.preloadScene('first');
  20142. // wait for a while
  20143. bundle1.loadScene('first', (err, scene) => cc.director.runScene(scene));
  20144. ```
  20145. */
  20146. preloadScene(sceneName: string, options: Record<string, any>, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error) => void): void;
  20147. preloadScene(sceneName: string, onProgress: (finish: number, total: number, item: RequestItem) => void, onComplete: (error: Error) => void): void;
  20148. preloadScene(sceneName: string, options: Record<string, any>, onComplete: (error: Error) => void): void;
  20149. preloadScene(sceneName: string, onComplete: (error: Error) => void): void;
  20150. preloadScene(sceneName: string, options: Record<string, any>): void;
  20151. preloadScene(sceneName: string): void;
  20152. /**
  20153. !#en
  20154. Get asset within this bundle by path and type. <br>
  20155. After you load asset with {{#crossLink "Bundle/load:method"}}{{/crossLink}} or {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}},
  20156. you can acquire them by passing the path to this API.
  20157. !#zh
  20158. 通过路径与类型获取资源。在你使用 {{#crossLink "Bundle/load:method"}}{{/crossLink}} 或者 {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} 之后,
  20159. 你能通过传路径通过这个 API 获取到这些资源。
  20160. @param path The path of asset
  20161. @param type Only asset of type will be returned if this argument is supplied.
  20162. @example
  20163. ```js
  20164. bundle1.get('music/hit', cc.AudioClip);
  20165. ```
  20166. */
  20167. get<T extends cc.Asset> (path: string, type?: typeof cc.Asset): T;
  20168. /**
  20169. !#en
  20170. Release the asset loaded by {{#crossLink "Bundle/load:method"}}{{/crossLink}} or {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} and it's dependencies.
  20171. Refer to {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}} for detailed informations.
  20172. !#zh
  20173. 释放通过 {{#crossLink "Bundle/load:method"}}{{/crossLink}} 或者 {{#crossLink "Bundle/loadDir:method"}}{{/crossLink}} 加载的资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
  20174. @param path The path of asset
  20175. @param type Only asset of type will be released if this argument is supplied.
  20176. @example
  20177. ```js
  20178. // release a texture which is no longer need
  20179. bundle1.release('misc/character/cocos');
  20180. ```
  20181. */
  20182. release(path: string, type: typeof cc.Asset): void;
  20183. release(path: string): void;
  20184. /**
  20185. !#en
  20186. Release all assets within this bundle. Refer to {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}} for detailed informations.
  20187. !#zh
  20188. 释放此包中的所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAll:method"}}{{/crossLink}}
  20189. @example
  20190. ```js
  20191. // release all asset within bundle1
  20192. bundle1.releaseAll();
  20193. ```
  20194. */
  20195. releaseAll(): void;
  20196. }
  20197. /** !#en
  20198. Cache manager is a module which controls all caches downloaded from server in non-web platform, it is a singleton
  20199. All member can be accessed with `cc.assetManager.cacheManager`.
  20200. !#zh
  20201. 缓存管理器是一个模块,在非 WEB 平台上,用于管理所有从服务器上下载下来的缓存,这是一个单例,所有成员能通过 `cc.assetManager.cacheManager` 访问。 */
  20202. export class CacheManager {
  20203. /** !#en
  20204. The name of cacheDir
  20205. !#zh
  20206. 缓存目录的名称 */
  20207. cacheDir: string;
  20208. /** !#en
  20209. Whether or not cache asset into user's storage space, this property only works on mini-game platforms
  20210. !#zh
  20211. 是否缓存资源到用户存储空间,此属性只在小游戏平台有效 */
  20212. cacheEnabled: boolean;
  20213. /** !#en
  20214. Whether or not auto clear cache when storage ran out, this property only works on mini-game platforms
  20215. !#zh
  20216. 是否在存储空间满了后自动清理缓存,此属性只在小游戏平台有效 */
  20217. autoClear: boolean;
  20218. /** !#en
  20219. The interval between caching resources, this property only works on mini-game platforms, unit: ms
  20220. !#zh
  20221. 缓存资源的间隔时间,此属性只在小游戏平台有效,单位:ms */
  20222. cacheInterval: number;
  20223. /** !#en
  20224. The interval between deleting resources, when you use `cleanLRU`, the resources will be deleted as this interval, unit: ms
  20225. !#zh
  20226. 清理资源的间隔时间,当你使用 `cleanLRU` 时,资源将以此间隔被删除,单位:ms */
  20227. deleteInterval: number;
  20228. /** !#en
  20229. List of all cached files
  20230. !#zh
  20231. 所有缓存文件列表 */
  20232. cachedFiles: Cache<{ bundle: string, url: string, lastTime: number }>;
  20233. /**
  20234. !#en
  20235. Get cached path with origin url
  20236. !#zh
  20237. 通过原始 url 获取缓存后的路径
  20238. @param originUrl originUrl
  20239. */
  20240. getCache(originUrl: string): string;
  20241. /**
  20242. !#en
  20243. Get temporary path with origin url, this method only works on mini-game platforms
  20244. !#zh
  20245. 通过原始 url 获取临时文件的路径,此方法只在小游戏平台有效
  20246. @param originUrl originUrl
  20247. */
  20248. getTemp(originUrl: string): string;
  20249. /**
  20250. !#en
  20251. Clear all caches, please use with caution, If necessary, we recommend using it before the game is launched
  20252. !#zh
  20253. 清空所有缓存,请谨慎使用,如果必要的话,我们建议在游戏启动之前使用
  20254. */
  20255. clearCache(): void;
  20256. /**
  20257. !#en
  20258. Clear part of caches with LRU strategy
  20259. !#zh
  20260. 使用 LRU 策略清空部分缓存
  20261. */
  20262. clearLRU(): void;
  20263. /**
  20264. !#en
  20265. Remove cache with origin url
  20266. !#zh
  20267. 通过原始 url 移除缓存
  20268. */
  20269. removeCache(): void;
  20270. }
  20271. /** !#en
  20272. use to cache something
  20273. !#zh
  20274. 用于缓存某些内容 */
  20275. export class Cache<T = any> {
  20276. /**
  20277. !#en
  20278. Create a cache
  20279. !#zh
  20280. 创建一个 cache
  20281. @param map An object used to initialize
  20282. */
  20283. constructor(map?: Record<string, T>);
  20284. /**
  20285. !#en
  20286. Add Key-Value to cache
  20287. !#zh
  20288. 增加键值对到缓存中
  20289. @param key The key
  20290. @param val The value
  20291. @example
  20292. ```js
  20293. var cache = new Cache();
  20294. cache.add('test', null);
  20295. ```
  20296. */
  20297. add(key: string, val: T): T;
  20298. /**
  20299. !#en
  20300. Get the cached content by key
  20301. !#zh
  20302. 通过 key 获取对应的 value
  20303. @param key The key
  20304. @example
  20305. ```js
  20306. var cache = new Cache();
  20307. var test = cache.get('test');
  20308. ```
  20309. */
  20310. get(key: string): T;
  20311. /**
  20312. !#en
  20313. Check whether or not content exists by key
  20314. !#zh
  20315. 通过 Key 判断是否存在对应的内容
  20316. @param key The key
  20317. @example
  20318. ```js
  20319. var cache = new Cache();
  20320. var exist = cache.has('test');
  20321. ```
  20322. */
  20323. has(key: string): boolean;
  20324. /**
  20325. !#en
  20326. Remove the cached content by key
  20327. !#zh
  20328. 通过 Key 移除对应的内容
  20329. @param key The key
  20330. @example
  20331. ```js
  20332. var cache = new Cache();
  20333. var content = cache.remove('test');
  20334. ```
  20335. */
  20336. remove(key: string): T;
  20337. /**
  20338. !#en
  20339. Clear all content
  20340. !#zh
  20341. 清除所有内容
  20342. @example
  20343. ```js
  20344. var cache = new Cache();
  20345. cache.clear();
  20346. ```
  20347. */
  20348. clear():void;
  20349. /**
  20350. !#en
  20351. Enumerate all content and invoke function
  20352. !#zh
  20353. 枚举所有内容并执行方法
  20354. @param func Function to be invoked
  20355. @example
  20356. ```js
  20357. var cache = new Cache();
  20358. cache.forEach((val, key) => console.log(key));
  20359. ```
  20360. */
  20361. forEach(func: (val: T, key: string) => void): void;
  20362. /**
  20363. !#en
  20364. Enumerate all content to find one element which can fulfill condition
  20365. !#zh
  20366. 枚举所有内容,找到一个可以满足条件的元素
  20367. @param predicate The condition
  20368. @example
  20369. ```js
  20370. var cache = new Cache();
  20371. var val = cache.find((val, key) => key === 'test');
  20372. ```
  20373. */
  20374. find(predicate: (val: T, key: string) => boolean): T;
  20375. /** !#en
  20376. The count of cached content
  20377. !#zh
  20378. 缓存数量 */
  20379. count: number;
  20380. /**
  20381. !#en
  20382. Destroy this cache
  20383. !#zh
  20384. 销毁这个 cache
  20385. */
  20386. destroy(): void;
  20387. }
  20388. /** !#en
  20389. Control asset's dependency list, it is a singleton. All member can be accessed with `cc.assetManager.dependUtil`
  20390. !#zh
  20391. 控制资源的依赖列表,这是一个单例, 所有成员能通过 `cc.assetManager.dependUtil` 访问 */
  20392. export class DependUtil {
  20393. /**
  20394. !#en
  20395. Get asset's native dependency. For example, Texture's native dependency is image.
  20396. !#zh
  20397. 获取资源的原生依赖,例如 Texture 的原生依赖是图片
  20398. @param uuid asset's uuid
  20399. @example
  20400. ```js
  20401. var dep = dependUtil.getNativeDep('fcmR3XADNLgJ1ByKhqcC5Z');
  20402. ```
  20403. */
  20404. getNativeDep(uuid: string): Record<string, any>;
  20405. /**
  20406. !#en
  20407. Get asset's direct referencing non-native dependency list. For example, Material's non-native dependencies are Texture.
  20408. !#zh
  20409. 获取资源直接引用的非原生依赖列表,例如,材质的非原生依赖是 Texture
  20410. @param uuid asset's uuid
  20411. @example
  20412. ```js
  20413. var deps = dependUtil.getDeps('fcmR3XADNLgJ1ByKhqcC5Z');
  20414. ```
  20415. */
  20416. getDeps(uuid: string): string[];
  20417. /**
  20418. !#en
  20419. Get non-native dependency list of the loaded asset, include indirect reference.
  20420. The returned array stores the dependencies with their uuid, after retrieve dependencies,
  20421. !#zh
  20422. 获取某个已经加载好的资源的所有非原生依赖资源列表,包括间接引用的资源,并保存在数组中返回。
  20423. 返回的数组将仅保存依赖资源的 uuid。
  20424. @param uuid The asset's uuid
  20425. @example
  20426. ```js
  20427. var deps = dependUtil.getDepsRecursively('fcmR3XADNLgJ1ByKhqcC5Z');
  20428. ```
  20429. */
  20430. getDepsRecursively(uuid: string): string[];
  20431. }
  20432. /** !#en
  20433. Control all download process, it is a singleton. All member can be accessed with `cc.assetManager.downloader` , it can download several types of files:
  20434. 1. Text
  20435. 2. Image
  20436. 3. Audio
  20437. 4. Assets
  20438. 5. Scripts
  20439. !#zh
  20440. 管理所有下载过程,downloader 是个单例,所有成员能通过 `cc.assetManager.downloader` 访问,它能下载以下几种类型的文件:
  20441. 1. 文本
  20442. 2. 图片
  20443. 3. 音频
  20444. 4. 资源
  20445. 5. 脚本 */
  20446. export class Downloader {
  20447. /** !#en
  20448. The address of remote server
  20449. !#zh
  20450. 远程服务器地址 */
  20451. remoteServerAddress: string;
  20452. /** !#en
  20453. The maximum number of concurrent when downloading
  20454. !#zh
  20455. 下载时的最大并发数 */
  20456. maxConcurrency: number;
  20457. /** !#en
  20458. The maximum number of request can be launched per frame when downloading
  20459. !#zh
  20460. 下载时每帧可以启动的最大请求数 */
  20461. maxRequestsPerFrame: number;
  20462. /** !#en
  20463. The max number of retries when fail
  20464. !#zh
  20465. 失败重试次数 */
  20466. maxRetryCount: number;
  20467. /** !#en
  20468. Wait for while before another retry, unit: ms
  20469. !#zh
  20470. 重试的间隔时间 */
  20471. retryInterval: number;
  20472. /**
  20473. !#en
  20474. Register custom handler if you want to change default behavior or extend downloader to download other format file
  20475. !#zh
  20476. 当你想修改默认行为或者拓展 downloader 来下载其他格式文件时可以注册自定义的 handler
  20477. @param type Extension likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}
  20478. @param handler handler
  20479. @example
  20480. ```js
  20481. downloader.register('.tga', (url, options, onComplete) => onComplete(null, null));
  20482. downloader.register({'.tga': (url, options, onComplete) => onComplete(null, null), '.ext': (url, options, onComplete) => onComplete(null, null)});
  20483. ```
  20484. */
  20485. register(type: string, handler: (url: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void): void;
  20486. register(map: Record<string, (url: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void>): void;
  20487. /**
  20488. !#en
  20489. Use corresponding handler to download file under limitation
  20490. !#zh
  20491. 在限制下使用对应的 handler 来下载文件
  20492. @param url The url should be downloaded
  20493. @param type The type indicates that which handler should be used to download, such as '.jpg'
  20494. @param options some optional paramters will be transferred to the corresponding handler.
  20495. @param onComplete callback when finishing downloading
  20496. @example
  20497. ```js
  20498. download('http://example.com/test.tga', '.tga', {onFileProgress: (loaded, total) => console.lgo(loaded/total)}, onComplete: (err) => console.log(err));
  20499. ```
  20500. */
  20501. download(id: string, url: string, type: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void): void;
  20502. }
  20503. /** !#en
  20504. Provide some helpful function, it is a singleton. All member can be accessed with `cc.assetManager.utils`
  20505. !#zh
  20506. 提供一些辅助方法,helper 是一个单例, 所有成员能通过 `cc.assetManager.utils` 访问 */
  20507. export class Helper {
  20508. /**
  20509. !#en
  20510. Decode uuid, returns the original uuid
  20511. !#zh
  20512. 解码 uuid,返回原始 uuid
  20513. @param base64 the encoded uuid
  20514. @example
  20515. ```js
  20516. var uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  20517. var originalUuid = decodeUuid(uuid); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  20518. ```
  20519. */
  20520. decodeUuid(base64: string): string;
  20521. /**
  20522. !#en
  20523. Extract uuid from url
  20524. !#zh
  20525. 从 url 中提取 uuid
  20526. @param url url
  20527. @example
  20528. ```js
  20529. var url = 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  20530. var uuid = getUuidFromURL(url); // fc991dd7-0033-4b80-9d41-c8a86a702e59
  20531. ```
  20532. */
  20533. getUuidFromURL(url: string): string;
  20534. /**
  20535. !#en
  20536. Transform uuid to url
  20537. !#zh
  20538. 转换 uuid 为 url
  20539. @param uuid The uuid of asset
  20540. @param options Some optional parameters
  20541. @example
  20542. ```js
  20543. // json path, 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
  20544. var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: false});
  20545. // png path, 'assets/main/native/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.png';
  20546. var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: true, nativeExt: '.png'});
  20547. ```
  20548. */
  20549. getUrlWithUuid(uuid: string, options?: Record<string, any>): string;
  20550. /**
  20551. !#en
  20552. Check if the type of asset is scene
  20553. !#zh
  20554. 检查资源类型是否是场景
  20555. @param asset asset
  20556. */
  20557. isScene(asset: any): boolean;
  20558. /**
  20559. !#en
  20560. Normalize url, strip './' and '/'
  20561. !#zh
  20562. 标准化 url ,去除 './' 和 '/'
  20563. @param url url
  20564. */
  20565. normalize(url: string): string;
  20566. }
  20567. /** !#en
  20568. Handle the packed asset, include unpacking, loading, cache and so on. It is a singleton. All member can be accessed with `cc.assetManager.packManager`
  20569. !#zh
  20570. 处理打包资源,包括拆包,加载,缓存等等,这是一个单例, 所有成员能通过 `cc.assetManager.packManager` 访问 */
  20571. export class PackManager {
  20572. /**
  20573. !#en
  20574. Unpack the json, revert to what it was before packing
  20575. !#zh
  20576. 拆解 json 包,恢复为打包之前的内容
  20577. @param pack The pack
  20578. @param json The content of pack
  20579. @param options Some optional parameters
  20580. @param onComplete Callback when finish unpacking
  20581. @example
  20582. ```js
  20583. downloader.downloadFile('pack.json', {responseType: 'json'}, null, (err, file) => {
  20584. packManager.unpackJson(['a', 'b'], file, null, (err, data) => console.log(err));
  20585. });
  20586. ```
  20587. */
  20588. unpackJson(pack: string[], json: any, options: Record<string, any>, onComplete?: (err: Error, content: any) => void): void;
  20589. /**
  20590. !#en
  20591. Register custom handler if you want to change default behavior or extend packManager to unpack other format pack
  20592. !#zh
  20593. 当你想修改默认行为或者拓展 packManager 来拆分其他格式的包时可以注册自定义的 handler
  20594. @param type Extension likes '.bin' or map likes {'.bin': binHandler, '.ab': abHandler}
  20595. @param handler handler
  20596. @example
  20597. ```js
  20598. packManager.register('.bin', (packUuid, file, options, onComplete) => onComplete(null, null));
  20599. packManager.register({'.bin': (packUuid, file, options, onComplete) => onComplete(null, null), '.ab': (packUuid, file, options, onComplete) => onComplete(null, null)});
  20600. ```
  20601. */
  20602. register(type: string, handler: (packUuid: string, data: any, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void): void;
  20603. register(map: Record<string, (packUuid: string, data: any, options: Record<string, any>, onComplete: (err: Error, content: any) => void) => void>): void;
  20604. /**
  20605. !#en
  20606. Use corresponding handler to unpack package
  20607. !#zh
  20608. 用对应的 handler 来进行解包
  20609. @param pack The uuid of packed assets
  20610. @param data The packed data
  20611. @param type The type indicates that which handler should be used to download, such as '.jpg'
  20612. @param options Some optional parameter
  20613. @param onComplete callback when finishing unpacking
  20614. @example
  20615. ```js
  20616. downloader.downloadFile('pack.json', {responseType: 'json'}, null, (err, file) => {
  20617. packManager.unpack(['2fawq123d', '1zsweq23f'], file, '.json', null, (err, data) => console.log(err));
  20618. });
  20619. ```
  20620. */
  20621. unpack(pack: string[], data: any, type: string, options: Record<string, any>, onComplete?: (err: Error, data: any) => void): void;
  20622. /**
  20623. !#en
  20624. Download request item, If item is not in any package, download as usual. Otherwise, download the corresponding package and unpack it.
  20625. And then retrieve the corresponding content form it.
  20626. !#zh
  20627. 下载请求对象,如果请求对象不在任何包内,则正常下载,否则下载对应的 package 并进行拆解,并取回包内对应的内容
  20628. @param item Some item you want to download
  20629. @param options Some optional parameters
  20630. @param onComplete Callback when finished
  20631. @example
  20632. ```js
  20633. var requestItem = cc.AssetManager.RequestItem.create();
  20634. requestItem.uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
  20635. requestItem.info = config.getAssetInfo('fcmR3XADNLgJ1ByKhqcC5Z');
  20636. packManager.load(requestItem, null, (err, data) => console.log(err));
  20637. ```
  20638. */
  20639. load(item: RequestItem, options: Record<string, any>, onComplete: (err: Error, data: any) => void): void;
  20640. }
  20641. /** !#en
  20642. Parse the downloaded file, it's a singleton, all member can be accessed with `cc.assetManager.parser`
  20643. !#zh
  20644. 解析已下载的文件,parser 是一个单例, 所有成员能通过 `cc.assetManaager.parser` 访问 */
  20645. export class Parser {
  20646. /**
  20647. !#en
  20648. Register custom handler if you want to change default behavior or extend parser to parse other format file
  20649. !#zh
  20650. 当你想修改默认行为或者拓展 parser 来解析其他格式文件时可以注册自定义的handler
  20651. @param type Extension likes '.jpg' or map likes {'.jpg': jpgHandler, '.png': pngHandler}
  20652. @param handler The corresponding handler
  20653. @example
  20654. ```js
  20655. parser.register('.tga', (file, options, onComplete) => onComplete(null, null));
  20656. parser.register({'.tga': (file, options, onComplete) => onComplete(null, null), '.ext': (file, options, onComplete) => onComplete(null, null)});
  20657. ```
  20658. */
  20659. register(type: string, handler: (file: any, options: Record<string, any>, onComplete: (err: Error, data: any) => void) => void): void;
  20660. register(map: Record<string, (file: any, options: Record<string, any>, onComplete: (err: Error, data: any) => void) => void>): void;
  20661. /**
  20662. !#en
  20663. Use corresponding handler to parse file
  20664. !#zh
  20665. 使用对应的handler来解析文件
  20666. @param id The id of file
  20667. @param file File
  20668. @param type The corresponding type of file, likes '.jpg'.
  20669. @param options Some optional paramters will be transferred to the corresponding handler.
  20670. @param onComplete callback when finishing downloading
  20671. @example
  20672. ```js
  20673. downloader.downloadFile('test.jpg', {responseType: 'blob'}, null, (err, file) => {
  20674. parser.parse('test.jpg', file, '.jpg', null, (err, img) => console.log(err));
  20675. });
  20676. ```
  20677. */
  20678. parse(id: string, file: any, type: string, options: Record<string, any>, onComplete: (err: Error, content: any) => void): void;
  20679. }
  20680. /** !#en
  20681. Pipeline can execute the task for some effect.
  20682. !#zh
  20683. 管线能执行任务达到某个效果 */
  20684. export class Pipeline {
  20685. /** !#en
  20686. The id of pipeline
  20687. !#zh
  20688. 管线的 id */
  20689. id: number;
  20690. /** !#en
  20691. The name of pipeline
  20692. !#zh
  20693. 管线的名字 */
  20694. name: string;
  20695. /** !#en
  20696. All pipes of pipeline
  20697. !#zh
  20698. 所有的管道 */
  20699. pipes: Function[];
  20700. /**
  20701. !#en
  20702. Create a new pipeline
  20703. !#zh
  20704. 创建一个管线
  20705. @param name The name of pipeline
  20706. @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
  20707. @example
  20708. ```js
  20709. var pipeline = new Pipeline('download', [
  20710. (task, done) => {
  20711. var url = task.input;
  20712. cc.assetManager.downloader.downloadFile(url, null, null, (err, result) => {
  20713. task.output = result;
  20714. done(err);
  20715. });
  20716. },
  20717. (task, done) => {
  20718. var text = task.input;
  20719. var json = JSON.stringify(text);
  20720. task.output = json;
  20721. done();
  20722. }
  20723. ]);
  20724. ```
  20725. */
  20726. constructor(name: string, funcs: Array<(task: Task, done?: (err: Error) => void) => void>);
  20727. /**
  20728. !#en
  20729. At specific point insert a new pipe to pipeline
  20730. !#zh
  20731. 在某个特定的点为管线插入一个新的 pipe
  20732. @param func The new pipe
  20733. @param index The specific point you want to insert at.
  20734. @example
  20735. ```js
  20736. var pipeline = new Pipeline('test', []);
  20737. pipeline.insert((task, done) => {
  20738. // do something
  20739. done();
  20740. }, 0);
  20741. ```
  20742. */
  20743. insert(func: (task: Task, callback?: (err: Error) => void) => void, index: number): Pipeline;
  20744. /**
  20745. !#en
  20746. Append a new pipe to the pipeline
  20747. !#zh
  20748. 添加一个管道到管线中
  20749. @param func The new pipe
  20750. @example
  20751. ```js
  20752. var pipeline = new Pipeline('test', []);
  20753. pipeline.append((task, done) => {
  20754. // do something
  20755. done();
  20756. });
  20757. ```
  20758. */
  20759. append(func: (task: Task, callback?: (err: Error) => void) => void): Pipeline;
  20760. /**
  20761. !#en
  20762. Remove pipe which at specific point
  20763. !#zh
  20764. 移除特定位置的管道
  20765. @param index The specific point
  20766. @example
  20767. ```js
  20768. var pipeline = new Pipeline('test', (task, done) => {
  20769. // do something
  20770. done();
  20771. });
  20772. pipeline.remove(0);
  20773. ```
  20774. */
  20775. remove(index: number): Pipeline;
  20776. /**
  20777. !#en
  20778. Execute task synchronously
  20779. !#zh
  20780. 同步执行任务
  20781. @param task The task will be executed
  20782. @example
  20783. ```js
  20784. var pipeline = new Pipeline('sync', [(task) => {
  20785. let input = task.input;
  20786. task.output = doSomething(task.input);
  20787. }]);
  20788. var task = new Task({input: 'test'});
  20789. console.log(pipeline.sync(task));
  20790. ```
  20791. */
  20792. sync(task: Task): any;
  20793. /**
  20794. !#en
  20795. Execute task asynchronously
  20796. !#zh
  20797. 异步执行任务
  20798. @param task The task will be executed
  20799. @example
  20800. ```js
  20801. var pipeline = new Pipeline('sync', [(task, done) => {
  20802. let input = task.input;
  20803. task.output = doSomething(task.input);
  20804. done();
  20805. }]);
  20806. var task = new Task({input: 'test', onComplete: (err, result) => console.log(result)});
  20807. pipeline.async(task);
  20808. ```
  20809. */
  20810. async(task: Task): void;
  20811. }
  20812. /** !#en
  20813. A collection of information about a request
  20814. !#zh
  20815. 请求的相关信息集合 */
  20816. export class RequestItem {
  20817. /** !#en
  20818. The uuid of request
  20819. !#zh
  20820. 请求资源的uuid */
  20821. uuid: string;
  20822. /** !#en
  20823. The final url of request
  20824. !#zh
  20825. 请求的最终url */
  20826. url: string;
  20827. /** !#en
  20828. The extension name of asset
  20829. !#zh
  20830. 资源的扩展名 */
  20831. ext: string;
  20832. /** !#en
  20833. The content of asset
  20834. !#zh
  20835. 资源的内容 */
  20836. content: any;
  20837. /** !#en
  20838. The file of asset
  20839. !#zh
  20840. 资源的文件 */
  20841. file: any;
  20842. /** !#en
  20843. The information of asset
  20844. !#zh
  20845. 资源的相关信息 */
  20846. info: any;
  20847. /** !#en
  20848. Whether or not it is native asset
  20849. !#zh
  20850. 资源是否是原生资源 */
  20851. isNative: boolean;
  20852. /** !#en
  20853. Custom options
  20854. !#zh
  20855. 自定义参数 */
  20856. options: any;
  20857. /**
  20858. !#en
  20859. Create a request item
  20860. !#zh
  20861. 创建一个 request item
  20862. */
  20863. constructor();
  20864. /** !#en
  20865. The id of request, combined from uuid and isNative
  20866. !#zh
  20867. 请求的 id, 由 uuid 和 isNative 组合而成 */
  20868. id: string;
  20869. /**
  20870. !#en
  20871. Recycle this for reuse
  20872. !#zh
  20873. 回收 requestItem 用于复用
  20874. */
  20875. recycle(): void;
  20876. /**
  20877. !#en
  20878. Create a new request item from pool
  20879. !#zh
  20880. 从对象池中创建 requestItem
  20881. */
  20882. static create(): RequestItem;
  20883. }
  20884. /** !#en
  20885. Task is used to run in the pipeline for some effect
  20886. !#zh
  20887. 任务用于在管线中运行以达成某种效果 */
  20888. export class Task {
  20889. /** !#en
  20890. The id of task
  20891. !#zh
  20892. 任务id */
  20893. id: number;
  20894. /** !#en
  20895. The callback when task is completed
  20896. !#zh
  20897. 完成回调 */
  20898. onComplete: Function;
  20899. /** !#en
  20900. The callback of progression
  20901. !#zh
  20902. 进度回调 */
  20903. onProgress: Function;
  20904. /** !#en
  20905. The callback when something goes wrong
  20906. !#zh
  20907. 错误回调 */
  20908. onError: Function;
  20909. /** !#en
  20910. The source of task
  20911. !#zh
  20912. 任务的源 */
  20913. source: any;
  20914. /** !#en
  20915. The output of task
  20916. !#zh
  20917. 任务的输出 */
  20918. output: any;
  20919. /** !#en
  20920. The input of task
  20921. !#zh
  20922. 任务的输入 */
  20923. input: any;
  20924. /** !#en
  20925. The progression of task
  20926. !#zh
  20927. 任务的进度 */
  20928. progress: any;
  20929. /** !#en
  20930. Custom options
  20931. !#zh
  20932. 自定义参数 */
  20933. options: any;
  20934. /**
  20935. !#en
  20936. Create a new Task
  20937. !#zh
  20938. 创建一个任务
  20939. @param options Some optional paramters
  20940. */
  20941. constructor(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>});
  20942. /**
  20943. !#en
  20944. Set paramters of this task
  20945. !#zh
  20946. 设置任务的参数
  20947. @param options Some optional paramters
  20948. @example
  20949. ```js
  20950. var task = new Task();
  20951. task.set({input: ['test'], onComplete: (err, result) => console.log(err), onProgress: (finish, total) => console.log(finish / total)});
  20952. ```
  20953. */
  20954. set(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>}): void;
  20955. /**
  20956. !#en
  20957. Dispatch event
  20958. !#zh
  20959. 发布事件
  20960. @param event The event name
  20961. @param param1 Parameter 1
  20962. @param param2 Parameter 2
  20963. @param param3 Parameter 3
  20964. @param param4 Parameter 4
  20965. @example
  20966. ```js
  20967. var task = Task.create();
  20968. Task.onComplete = (msg) => console.log(msg);
  20969. Task.dispatch('complete', 'hello world');
  20970. ```
  20971. */
  20972. dispatch(event: string, param1?: any, param2?: any, param3?: any, param4?: any): void;
  20973. /**
  20974. !#en
  20975. Recycle this for reuse
  20976. !#zh
  20977. 回收 task 用于复用
  20978. */
  20979. recycle(): void;
  20980. /** !#en
  20981. Whether or not this task is completed
  20982. !#zh
  20983. 此任务是否已经完成 */
  20984. isFinish: boolean;
  20985. /**
  20986. !#en
  20987. Create a new task from pool
  20988. !#zh
  20989. 从对象池中创建 task
  20990. @param options Some optional paramters
  20991. */
  20992. static create(options?: {onComplete?: (err: Error, result: any) => void, onError?: () => void, onProgress?: Function, input: any, progress?: any, options?: Record<string, any>}): Task;
  20993. }
  20994. /** !#en
  20995. The builtin bundles
  20996. !#zh
  20997. 内置 bundle */
  20998. export enum BuiltinBundleName {
  20999. RESOURCES = 0,
  21000. INTERNAL = 0,
  21001. MAIN = 0,
  21002. START_SCENE = 0,
  21003. }
  21004. }
  21005. /** Some helpful utilities */
  21006. declare namespace cc.geomUtils {
  21007. /**
  21008. !#en
  21009. the distance between a point and a plane
  21010. !#zh
  21011. 计算点和平面之间的距离。
  21012. @param point point
  21013. @param plane plane
  21014. */
  21015. export function point_plane(point: cc.Vec3, plane: cc.Plane): number;
  21016. /**
  21017. !#en
  21018. the closest point on plane to a given point
  21019. !#zh
  21020. 计算平面上最接近给定点的点。
  21021. @param out Closest point
  21022. @param point Given point
  21023. @param plane plane
  21024. */
  21025. export function pt_point_plane(out: cc.Vec3, point: cc.Vec3, plane: cc.Plane): cc.Vec3;
  21026. /**
  21027. !#en
  21028. the closest point on aabb to a given point
  21029. !#zh
  21030. 计算 aabb 上最接近给定点的点。
  21031. @param out Closest point.
  21032. @param point Given point.
  21033. @param aabb Align the axis around the box.
  21034. */
  21035. export function pt_point_aabb(out: cc.Vec3, point: cc.Vec3, aabb: cc.Aabb): cc.Vec3;
  21036. /**
  21037. !#en
  21038. the closest point on obb to a given point
  21039. !#zh
  21040. 计算 obb 上最接近给定点的点。
  21041. @param out Closest point
  21042. @param point Given point
  21043. @param obb Direction box
  21044. */
  21045. export function pt_point_obb(out: cc.Vec3, point: cc.Vec3, obb: cc.Obb): cc.Vec3;
  21046. }
  21047. /** !#en Some JavaScript decorators which can be accessed with "cc._decorator".
  21048. !#zh 一些 JavaScript 装饰器,目前可以通过 "cc._decorator" 来访问。
  21049. (这些 API 仍不完全稳定,有可能随着 JavaScript 装饰器的标准实现而调整) */
  21050. declare namespace cc._decorator {
  21051. /**
  21052. !#en
  21053. Declare the standard [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
  21054. as CCClass, please see [Class](../../../manual/en/scripting/class.html) for details.
  21055. !#zh
  21056. 将标准写法的 [ES6 Class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) 声明为 CCClass,具体用法请参阅[类型定义](../../../manual/zh/scripting/class.html)。
  21057. @param name The class name used for serialization.
  21058. @example
  21059. ```js
  21060. const {ccclass} = cc._decorator;
  21061. // define a CCClass, omit the name
  21062. &#64;ccclass
  21063. class NewScript extends cc.Component {
  21064. // ...
  21065. }
  21066. // define a CCClass with a name
  21067. &#64;ccclass('LoginData')
  21068. class LoginData {
  21069. // ...
  21070. }
  21071. ```
  21072. */
  21073. export function ccclass(name?: string): Function;
  21074. export function ccclass(_class?: Function): void;
  21075. /**
  21076. !#en
  21077. Declare property for [CCClass](../../../manual/en/scripting/reference/attributes.html).
  21078. !#zh
  21079. 定义 [CCClass](../../../manual/zh/scripting/reference/attributes.html) 所用的属性。
  21080. @param options an object with some property attributes
  21081. @example
  21082. ```js
  21083. const {ccclass, property} = cc._decorator;
  21084. &#64;ccclass
  21085. class NewScript extends cc.Component {
  21086. &#64;property({
  21087. type: cc.Node
  21088. })
  21089. targetNode1 = null;
  21090. &#64;property(cc.Node)
  21091. targetNode2 = null;
  21092. &#64;property(cc.Button)
  21093. targetButton = null;
  21094. &#64;property
  21095. _width = 100;
  21096. &#64;property
  21097. get width () {
  21098. return this._width;
  21099. }
  21100. &#64;property
  21101. set width (value) {
  21102. this._width = value;
  21103. }
  21104. &#64;property
  21105. offset = new cc.Vec2(100, 100);
  21106. &#64;property(cc.Vec2)
  21107. offsets = [];
  21108. &#64;property(cc.SpriteFrame)
  21109. frame = null;
  21110. }
  21111. // above is equivalent to (上面的代码相当于):
  21112. var NewScript = cc.Class({
  21113. properties: {
  21114. targetNode1: {
  21115. default: null,
  21116. type: cc.Node
  21117. },
  21118. targetNode2: {
  21119. default: null,
  21120. type: cc.Node
  21121. },
  21122. targetButton: {
  21123. default: null,
  21124. type: cc.Button
  21125. },
  21126. _width: 100,
  21127. width: {
  21128. get () {
  21129. return this._width;
  21130. },
  21131. set (value) {
  21132. this._width = value;
  21133. }
  21134. },
  21135. offset: new cc.Vec2(100, 100)
  21136. offsets: {
  21137. default: [],
  21138. type: cc.Vec2
  21139. }
  21140. frame: {
  21141. default: null,
  21142. type: cc.SpriteFrame
  21143. },
  21144. }
  21145. });
  21146. ```
  21147. */
  21148. 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;
  21149. export function property(_target: Object, _key: any, _desc?: any): void;
  21150. /**
  21151. !#en
  21152. Makes a CCClass that inherit from component execute in edit mode.<br>
  21153. By default, all components are only executed in play mode,
  21154. which means they will not have their callback functions executed while the Editor is in edit mode.
  21155. !#zh
  21156. 允许继承自 Component 的 CCClass 在编辑器里执行。<br>
  21157. 默认情况下,所有 Component 都只会在运行时才会执行,也就是说它们的生命周期回调不会在编辑器里触发。
  21158. @example
  21159. ```js
  21160. const {ccclass, executeInEditMode} = cc._decorator;
  21161. &#64;ccclass
  21162. &#64;executeInEditMode
  21163. class NewScript extends cc.Component {
  21164. // ...
  21165. }
  21166. ```
  21167. */
  21168. export function executeInEditMode(): Function;
  21169. export function executeInEditMode(_class: Function): void;
  21170. /**
  21171. !#en
  21172. Automatically add required component as a dependency for the CCClass that inherit from component.
  21173. !#zh
  21174. 为声明为 CCClass 的组件添加依赖的其它组件。当组件添加到节点上时,如果依赖的组件不存在,引擎将会自动将依赖组件添加到同一个节点,防止脚本出错。该设置在运行时同样有效。
  21175. @param requiredComponent requiredComponent
  21176. @example
  21177. ```js
  21178. const {ccclass, requireComponent} = cc._decorator;
  21179. &#64;ccclass
  21180. &#64;requireComponent(cc.Sprite)
  21181. class SpriteCtrl extends cc.Component {
  21182. // ...
  21183. }
  21184. ```
  21185. */
  21186. export function requireComponent(requiredComponent: typeof cc.Component): Function;
  21187. /**
  21188. !#en
  21189. The menu path to register a component to the editors "Component" menu. Eg. "Rendering/CameraCtrl".
  21190. !#zh
  21191. 将当前组件添加到组件菜单中,方便用户查找。例如 "Rendering/CameraCtrl"。
  21192. @param path The path is the menu represented like a pathname.
  21193. For example the menu could be "Rendering/CameraCtrl".
  21194. @example
  21195. ```js
  21196. const {ccclass, menu} = cc._decorator;
  21197. &#64;ccclass
  21198. &#64;menu("Rendering/CameraCtrl")
  21199. class NewScript extends cc.Component {
  21200. // ...
  21201. }
  21202. ```
  21203. */
  21204. export function menu(path: string): Function;
  21205. /**
  21206. !#en
  21207. The execution order of lifecycle methods for Component.
  21208. Those less than 0 will execute before while those greater than 0 will execute after.
  21209. The order will only affect onLoad, onEnable, start, update and lateUpdate while onDisable and onDestroy will not be affected.
  21210. !#zh
  21211. 设置脚本生命周期方法调用的优先级。优先级小于 0 的组件将会优先执行,优先级大于 0 的组件将会延后执行。优先级仅会影响 onLoad, onEnable, start, update 和 lateUpdate,而 onDisable 和 onDestroy 不受影响。
  21212. @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.
  21213. @example
  21214. ```js
  21215. const {ccclass, executionOrder} = cc._decorator;
  21216. &#64;ccclass
  21217. &#64;executionOrder(1)
  21218. class CameraCtrl extends cc.Component {
  21219. // ...
  21220. }
  21221. ```
  21222. */
  21223. export function executionOrder(order: number): Function;
  21224. /**
  21225. !#en
  21226. Prevents Component of the same type (or subtype) to be added more than once to a Node.
  21227. !#zh
  21228. 防止多个相同类型(或子类型)的组件被添加到同一个节点。
  21229. @example
  21230. ```js
  21231. const {ccclass, disallowMultiple} = cc._decorator;
  21232. &#64;ccclass
  21233. &#64;disallowMultiple
  21234. class CameraCtrl extends cc.Component {
  21235. // ...
  21236. }
  21237. ```
  21238. */
  21239. export function disallowMultiple(): Function;
  21240. export function disallowMultiple(_class: Function): void;
  21241. /**
  21242. !#en
  21243. 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>
  21244. This property is only available if executeInEditMode is true.
  21245. !#zh
  21246. 当指定了 "executeInEditMode" 以后,playOnFocus 可以在选中当前组件所在的节点时,提高编辑器的场景刷新频率到 60 FPS,否则场景就只会在必要的时候进行重绘。
  21247. @example
  21248. ```js
  21249. const {ccclass, playOnFocus, executeInEditMode} = cc._decorator;
  21250. &#64;ccclass
  21251. &#64;executeInEditMode
  21252. &#64;playOnFocus
  21253. class CameraCtrl extends cc.Component {
  21254. // ...
  21255. }
  21256. ```
  21257. */
  21258. export function playOnFocus(): Function;
  21259. export function playOnFocus(_class: Function): void;
  21260. /**
  21261. !#en
  21262. Specifying the url of the custom html to draw the component in **Properties**.
  21263. !#zh
  21264. 自定义当前组件在 **属性检查器** 中渲染时所用的网页 url。
  21265. @param url url
  21266. @example
  21267. ```js
  21268. const {ccclass, inspector} = cc._decorator;
  21269. &#64;ccclass
  21270. &#64;inspector("packages://inspector/inspectors/comps/camera-ctrl.js")
  21271. class NewScript extends cc.Component {
  21272. // ...
  21273. }
  21274. ```
  21275. */
  21276. export function inspector(path: string): Function;
  21277. /**
  21278. !#en
  21279. The custom documentation URL.
  21280. !#zh
  21281. 指定当前组件的帮助文档的 url,设置过后,在 **属性检查器** 中就会出现一个帮助图标,用户点击将打开指定的网页。
  21282. @param url url
  21283. @example
  21284. ```js
  21285. const {ccclass, help} = cc._decorator;
  21286. &#64;ccclass
  21287. &#64;help("app://docs/html/components/spine.html")
  21288. class NewScript extends cc.Component {
  21289. // ...
  21290. }
  21291. ```
  21292. */
  21293. export function help(path: string): Function;
  21294. /**
  21295. NOTE:<br>
  21296. The old mixins implemented in cc.Class(ES5) behaves exact the same as multiple inheritance.
  21297. But since ES6, class constructor can't be function-called and class methods become non-enumerable,
  21298. so we can not mix in ES6 Classes.<br>
  21299. See:<br>
  21300. [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>
  21301. One possible solution (but IDE unfriendly):<br>
  21302. [http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes](http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/)<br>
  21303. <br>
  21304. NOTE:<br>
  21305. You must manually call mixins constructor, this is different from cc.Class(ES5).
  21306. @param ctor constructors to mix, only support ES5 constructors or classes defined by using `cc.Class`,
  21307. not support ES6 Classes.
  21308. @example
  21309. ```js
  21310. const {ccclass, mixins} = cc._decorator;
  21311. class Animal { ... }
  21312. const Fly = cc.Class({
  21313. constructor () { ... }
  21314. });
  21315. &#64;ccclass
  21316. &#64;mixins(cc.EventTarget, Fly)
  21317. class Bird extends Animal {
  21318. constructor () {
  21319. super();
  21320. // You must manually call mixins constructor, this is different from cc.Class(ES5)
  21321. cc.EventTarget.call(this);
  21322. Fly.call(this);
  21323. }
  21324. // ...
  21325. }
  21326. ```
  21327. */
  21328. export function mixins(ctor: Function, ...rest: Function[]): Function;
  21329. }
  21330. /** !#en This module provides some JavaScript utilities. All members can be accessed with `cc.js`.
  21331. !#zh 这个模块封装了 JavaScript 相关的一些实用函数,你可以通过 `cc.js` 来访问这个模块。 */
  21332. declare namespace cc.js {
  21333. /**
  21334. Check the obj whether is number or not
  21335. If a number is created by using 'new Number(10086)', the typeof it will be "object"...
  21336. Then you can use this function if you care about this case.
  21337. @param obj obj
  21338. */
  21339. export function isNumber(obj: any): boolean;
  21340. /**
  21341. Check the obj whether is string or not.
  21342. If a string is created by using 'new String("blabla")', the typeof it will be "object"...
  21343. Then you can use this function if you care about this case.
  21344. @param obj obj
  21345. */
  21346. export function isString(obj: any): boolean;
  21347. /**
  21348. Copy all properties not defined in obj from arguments[1...n]
  21349. @param obj object to extend its properties
  21350. @param sourceObj source object to copy properties from
  21351. */
  21352. export function addon(obj: any, ...sourceObj: any[]): any;
  21353. /**
  21354. copy all properties from arguments[1...n] to obj
  21355. @param obj obj
  21356. @param sourceObj sourceObj
  21357. */
  21358. export function mixin(obj: any, ...sourceObj: any[]): any;
  21359. /**
  21360. Derive the class from the supplied base class.
  21361. Both classes are just native javascript constructors, not created by cc.Class, so
  21362. usually you will want to inherit using {{#crossLink "cc/Class:method"}}cc.Class {{/crossLink}} instead.
  21363. @param cls cls
  21364. @param base the baseclass to inherit
  21365. */
  21366. export function extend(cls: Function, base: Function): Function;
  21367. /**
  21368. Get super class
  21369. @param ctor the constructor of subclass
  21370. */
  21371. export function getSuper(ctor: Function): Function;
  21372. /**
  21373. Checks whether subclass is child of superclass or equals to superclass
  21374. @param subclass subclass
  21375. @param superclass superclass
  21376. */
  21377. export function isChildClassOf(subclass: Function, superclass: Function): boolean;
  21378. /**
  21379. Removes all enumerable properties from object
  21380. @param obj obj
  21381. */
  21382. export function clear(obj: any): void;
  21383. /**
  21384. Checks whether obj is an empty object
  21385. @param obj obj
  21386. */
  21387. export function isEmptyObject(obj: any): boolean;
  21388. /**
  21389. Get property descriptor in object and all its ancestors
  21390. @param obj obj
  21391. @param name name
  21392. */
  21393. export function getPropertyDescriptor(obj: any, name: string): any;
  21394. /**
  21395. Define value, just help to call Object.defineProperty.<br>
  21396. The configurable will be true.
  21397. @param obj obj
  21398. @param prop prop
  21399. @param value value
  21400. @param writable writable
  21401. @param enumerable enumerable
  21402. */
  21403. export function value(obj: any, prop: string, value: any, writable?: boolean, enumerable?: boolean): void;
  21404. /**
  21405. Define get set accessor, just help to call Object.defineProperty(...)
  21406. @param obj obj
  21407. @param prop prop
  21408. @param getter getter
  21409. @param setter setter
  21410. @param enumerable enumerable
  21411. @param configurable configurable
  21412. */
  21413. export function getset(obj: any, prop: string, getter: Function, setter?: Function, enumerable?: boolean, configurable?: boolean): void;
  21414. /**
  21415. Define get accessor, just help to call Object.defineProperty(...)
  21416. @param obj obj
  21417. @param prop prop
  21418. @param getter getter
  21419. @param enumerable enumerable
  21420. @param configurable configurable
  21421. */
  21422. export function get(obj: any, prop: string, getter: Function, enumerable?: boolean, configurable?: boolean): void;
  21423. /**
  21424. Define set accessor, just help to call Object.defineProperty(...)
  21425. @param obj obj
  21426. @param prop prop
  21427. @param setter setter
  21428. @param enumerable enumerable
  21429. @param configurable configurable
  21430. */
  21431. export function set(obj: any, prop: string, setter: Function, enumerable?: boolean, configurable?: boolean): void;
  21432. /**
  21433. Get class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
  21434. (modified from <a href="http://stackoverflow.com/questions/1249531/how-to-get-a-javascript-objects-class">the code from this stackoverflow post</a>)
  21435. @param objOrCtor instance or constructor
  21436. */
  21437. export function getClassName(objOrCtor: any|Function): string;
  21438. /** !#en All classes registered in the engine, indexed by ID.
  21439. !#zh 引擎中已注册的所有类型,通过 ID 进行索引。 */
  21440. export var _registeredClassIds: any;
  21441. /** !#en All classes registered in the engine, indexed by name.
  21442. !#zh 引擎中已注册的所有类型,通过名称进行索引。 */
  21443. export var _registeredClassNames: any;
  21444. /**
  21445. Register the class by specified name manually
  21446. @param className className
  21447. @param constructor constructor
  21448. */
  21449. export function setClassName(className: string, constructor: Function): void;
  21450. /**
  21451. Unregister a class from fireball.
  21452. If you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.
  21453. Please note that its still your responsibility to free other references to the class.
  21454. @param constructor the class you will want to unregister, any number of classes can be added
  21455. */
  21456. export function unregisterClass(...constructor: Function[]): void;
  21457. /**
  21458. Get the registered class by name
  21459. @param classname classname
  21460. */
  21461. export function getClassByName(classname: string): Function;
  21462. /**
  21463. Defines a polyfill field for deprecated codes.
  21464. @param obj YourObject or YourClass.prototype
  21465. @param obsoleted "OldParam" or "YourClass.OldParam"
  21466. @param newExpr "NewParam" or "YourClass.NewParam"
  21467. @param writable writable
  21468. */
  21469. export function obsolete(obj: any, obsoleted: string, newExpr: string, writable?: boolean): void;
  21470. /**
  21471. Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.
  21472. @param obj YourObject or YourClass.prototype
  21473. @param objName "YourObject" or "YourClass"
  21474. @param props props
  21475. @param writable writable
  21476. */
  21477. export function obsoletes(obj: any, objName: any, props: any, writable?: boolean): void;
  21478. /**
  21479. A string tool to construct a string with format string.
  21480. @param msg A JavaScript string containing zero or more substitution strings (%s).
  21481. @param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
  21482. @example
  21483. ```js
  21484. cc.js.formatStr("a: %s, b: %s", a, b);
  21485. cc.js.formatStr(a, b, c);
  21486. ```
  21487. */
  21488. export function formatStr(msg: string|any, ...subst: any[]): string;
  21489. /**
  21490. !#en
  21491. 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.
  21492. !#zh
  21493. 该方法是对 `Object.create(null)` 的简单封装。`Object.create(null)` 用于创建无 prototype (也就无继承)的空对象。这样我们在该对象上查找属性时,就不用进行 `hasOwnProperty` 判断。在需要频繁判断 `hasOwnProperty` 时,使用这个方法性能会比 `{}` 更高。
  21494. @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.
  21495. */
  21496. export function createMap(forceDictMode?: boolean): any;
  21497. /** undefined */
  21498. export class array {
  21499. /**
  21500. Removes the array item at the specified index.
  21501. @param array array
  21502. @param index index
  21503. */
  21504. static removeAt(array: any[], index: number): void;
  21505. /**
  21506. Removes the array item at the specified index.
  21507. It's faster but the order of the array will be changed.
  21508. @param array array
  21509. @param index index
  21510. */
  21511. static fastRemoveAt(array: any[], index: number): void;
  21512. /**
  21513. Removes the first occurrence of a specific object from the array.
  21514. @param array array
  21515. @param value value
  21516. */
  21517. static remove(array: any[], value: any): boolean;
  21518. /**
  21519. Removes the first occurrence of a specific object from the array.
  21520. It's faster but the order of the array will be changed.
  21521. @param array array
  21522. @param value value
  21523. */
  21524. static fastRemove(array: any[], value: number): void;
  21525. /**
  21526. Verify array's Type
  21527. @param array array
  21528. @param type type
  21529. */
  21530. static verifyType(array: any[], type: Function): boolean;
  21531. /**
  21532. Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.
  21533. @param array Source Array
  21534. @param minusArr minus Array
  21535. */
  21536. static removeArray(array: any[], minusArr: any[]): void;
  21537. /**
  21538. Inserts some objects at index
  21539. @param array array
  21540. @param addObjs addObjs
  21541. @param index index
  21542. */
  21543. static appendObjectsAt(array: any[], addObjs: any[], index: number): any[];
  21544. /**
  21545. Determines whether the array contains a specific value.
  21546. @param array array
  21547. @param value value
  21548. */
  21549. static contains(array: any[], value: any): boolean;
  21550. /**
  21551. Copy an array's item to a new array (its performance is better than Array.slice)
  21552. @param array array
  21553. */
  21554. static copy(array: any[]): any[];
  21555. }
  21556. /** !#en
  21557. A fixed-length object pool designed for general type.<br>
  21558. The implementation of this object pool is very simple,
  21559. it can helps you to improve your game performance for objects which need frequent release and recreate operations<br/>
  21560. !#zh
  21561. 长度固定的对象缓存池,可以用来缓存各种对象类型。<br/>
  21562. 这个对象池的实现非常精简,它可以帮助您提高游戏性能,适用于优化对象的反复创建和销毁。 */
  21563. export class Pool {
  21564. /**
  21565. !#en
  21566. Constructor for creating an object pool for the specific object type.
  21567. You can pass a callback argument for process the cleanup logic when the object is recycled.
  21568. !#zh
  21569. 使用构造函数来创建一个指定对象类型的对象池,您可以传递一个回调函数,用于处理对象回收时的清理逻辑。
  21570. @param cleanupFunc the callback method used to process the cleanup logic when the object is recycled.
  21571. @param size initializes the length of the array
  21572. */
  21573. constructor(cleanupFunc: (obj: any) => void, size: number);
  21574. constructor(size: number);
  21575. /**
  21576. !#en
  21577. Get and initialize an object from pool. This method defaults to null and requires the user to implement it.
  21578. !#zh
  21579. 获取并初始化对象池中的对象。这个方法默认为空,需要用户自己实现。
  21580. @param params parameters to used to initialize the object
  21581. */
  21582. get(...params: any[]): any;
  21583. /** !#en
  21584. The current number of available objects, the default is 0, it will gradually increase with the recycle of the object,
  21585. the maximum will not exceed the size specified when the constructor is called.
  21586. !#zh
  21587. 当前可用对象数量,一开始默认是 0,随着对象的回收会逐渐增大,最大不会超过调用构造函数时指定的 size。 */
  21588. count: number;
  21589. /**
  21590. !#en
  21591. Get an object from pool, if no available object in the pool, null will be returned.
  21592. !#zh
  21593. 获取对象池中的对象,如果对象池没有可用对象,则返回空。
  21594. */
  21595. _get(): any;
  21596. /**
  21597. !#en Put an object into the pool.
  21598. !#zh 向对象池返还一个不再需要的对象。
  21599. */
  21600. put(): void;
  21601. /**
  21602. !#en Resize the pool.
  21603. !#zh 设置对象池容量。
  21604. */
  21605. resize(): void;
  21606. }
  21607. }
  21608. /** !#en A basic module for creating vertex data for 3D objects. You can access this module by `cc.primitive`.
  21609. !#zh 一个创建 3D 物体顶点数据的基础模块,你可以通过 `cc.primitive` 来访问这个模块。 */
  21610. declare namespace cc.primitive {
  21611. /**
  21612. !#en Create box vertex data
  21613. !#zh 创建长方体顶点数据
  21614. @param width width
  21615. @param height height
  21616. @param length length
  21617. @param opts opts
  21618. */
  21619. export function box(width: number, height: number, length: number, opts: {widthSegments: number; heightSegments: number; lengthSegments: number; }): cc.VertexData;
  21620. /**
  21621. !#en Create cone vertex data
  21622. !#zh 创建圆锥体顶点数据
  21623. @param radius radius
  21624. @param height height
  21625. @param opts opts
  21626. */
  21627. export function cone(radius: number, height: number, opts: {radialSegments: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21628. /**
  21629. !#en Create cylinder vertex data
  21630. !#zh 创建圆柱体顶点数据
  21631. @param radiusTop radiusTop
  21632. @param radiusBottom radiusBottom
  21633. @param height height
  21634. @param opts opts
  21635. */
  21636. export function cylinder(radiusTop: number, radiusBottom: number, height: number, opts: {radialSegments: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21637. /**
  21638. !#en Create plane vertex data
  21639. !#zh 创建平台顶点数据
  21640. @param width width
  21641. @param length length
  21642. @param opts opts
  21643. */
  21644. export function plane(width: number, length: number, opts: {widthSegments: number; lengthSegments: number; }): cc.VertexData;
  21645. /**
  21646. !#en Create quad vertex data
  21647. !#zh 创建面片顶点数据
  21648. */
  21649. export function quad(): cc.VertexData;
  21650. /**
  21651. !#en Create sphere vertex data
  21652. !#zh 创建球体顶点数据
  21653. @param radius radius
  21654. @param opts opts
  21655. */
  21656. export function sphere(radius: number, opts: {segments: number; }): cc.VertexData;
  21657. /**
  21658. !#en Create torus vertex data
  21659. !#zh 创建圆环顶点数据
  21660. @param radius radius
  21661. @param tube tube
  21662. @param opts opts
  21663. */
  21664. export function torus(radius: number, tube: number, opts: {radialSegments: number; tubularSegments: number; arc: number; }): cc.VertexData;
  21665. /**
  21666. !#en Create capsule vertex data
  21667. !#zh 创建胶囊体顶点数据
  21668. @param radiusTop radiusTop
  21669. @param radiusBottom radiusBottom
  21670. @param height height
  21671. @param opts opts
  21672. */
  21673. export function capsule(radiusTop: number, radiusBottom: number, height: number, opts: {sides: number; heightSegments: number; capped: boolean; arc: number; }): cc.VertexData;
  21674. /**
  21675. !#en Create polyhedron vertex data
  21676. !#zh 创建多面体顶点数据
  21677. @param type type
  21678. @param Size Size
  21679. @param opts opts
  21680. */
  21681. export function polyhedron(type: cc.primitive.PolyhedronType, Size: number, opts: {sizeX: number; sizeY: number; sizeZ: number; }): cc.VertexData;
  21682. }
  21683. declare let CC_JSB: boolean
  21684. declare let CC_NATIVERENDERER: boolean
  21685. declare let CC_EDITOR: boolean
  21686. declare let CC_PREVIEW: boolean
  21687. declare let CC_TEST: boolean
  21688. declare let CC_DEBUG: boolean
  21689. declare let cc: {
  21690. // polyfills: {
  21691. // destroyObject? (object: any): void;
  21692. // };
  21693. [x: string]: any;
  21694. }
  21695. declare let Editor: any;
  21696. // https://medium.com/dailyjs/typescript-create-a-condition-based-subset-types-9d902cea5b8c
  21697. type FlagExcludedType<Base, Type> = { [Key in keyof Base]: Base[Key] extends Type ? never : Key };
  21698. type AllowedNames<Base, Type> = FlagExcludedType<Base, Type>[keyof Base];
  21699. type KeyPartial<T, K extends keyof T> = { [P in K]?: T[P] };
  21700. type OmitType<Base, Type> = KeyPartial<Base, AllowedNames<Base, Type>>;
  21701. type ConstructorType<T> = OmitType<T, Function>;
  21702. declare interface IWritableArrayLike<T> {
  21703. readonly length: number;
  21704. [index: number]: T;
  21705. }
  21706. declare let module: {
  21707. exports: object
  21708. }
  21709. declare interface Math {
  21710. sign(v: number);
  21711. }
  21712. declare interface Object {
  21713. assign(target: {}, source: {});
  21714. }
  21715. type FloatArray = Float64Array | Float32Array;
  21716. interface IColorLike {
  21717. r: number;
  21718. g: number;
  21719. b: number;
  21720. a: number;
  21721. _val: number;
  21722. }
  21723. interface IMat3Like {
  21724. m: FloatArray
  21725. }
  21726. interface IMat4Like {
  21727. m: FloatArray
  21728. }
  21729. interface IQuatLike {
  21730. x: number;
  21731. y: number;
  21732. z: number;
  21733. w: number;
  21734. }
  21735. interface IRectLike {
  21736. x: number;
  21737. y: number;
  21738. width: number;
  21739. height: number;
  21740. }
  21741. interface ISizeLike {
  21742. width: number;
  21743. height: number;
  21744. }
  21745. interface IVec2Like {
  21746. x: number;
  21747. y: number;
  21748. }
  21749. interface IVec3Like {
  21750. x: number;
  21751. y: number;
  21752. z: number;
  21753. }
  21754. interface IVec4Like {
  21755. x: number;
  21756. y: number;
  21757. z: number;
  21758. w: number;
  21759. }
  21760. declare namespace dragonBones {
  21761. /**
  21762. * @internal
  21763. * @private
  21764. */
  21765. const webAssemblyModule: {
  21766. HEAP16: Int16Array;
  21767. _malloc(byteSize: number): number;
  21768. _free(pointer: number): void;
  21769. setDataBinary(data: DragonBonesData, binaryPointer: number, intBytesLength: number, floatBytesLength: number, frameIntBytesLength: number, frameFloatBytesLength: number, frameBytesLength: number, timelineBytesLength: number): void;
  21770. };
  21771. }
  21772. /**
  21773. * The MIT License (MIT)
  21774. *
  21775. * Copyright (c) 2012-2017 DragonBones team and other contributors
  21776. *
  21777. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  21778. * this software and associated documentation files (the "Software"), to deal in
  21779. * the Software without restriction, including without limitation the rights to
  21780. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  21781. * the Software, and to permit persons to whom the Software is furnished to do so,
  21782. * subject to the following conditions:
  21783. *
  21784. * The above copyright notice and this permission notice shall be included in all
  21785. * copies or substantial portions of the Software.
  21786. *
  21787. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21788. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  21789. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  21790. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21791. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21792. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21793. */
  21794. declare namespace dragonBones {
  21795. /**
  21796. * @internal
  21797. * @private
  21798. */
  21799. const enum BinaryOffset {
  21800. WeigthBoneCount = 0,
  21801. WeigthFloatOffset = 1,
  21802. WeigthBoneIndices = 2,
  21803. MeshVertexCount = 0,
  21804. MeshTriangleCount = 1,
  21805. MeshFloatOffset = 2,
  21806. MeshWeightOffset = 3,
  21807. MeshVertexIndices = 4,
  21808. TimelineScale = 0,
  21809. TimelineOffset = 1,
  21810. TimelineKeyFrameCount = 2,
  21811. TimelineFrameValueCount = 3,
  21812. TimelineFrameValueOffset = 4,
  21813. TimelineFrameOffset = 5,
  21814. FramePosition = 0,
  21815. FrameTweenType = 1,
  21816. FrameTweenEasingOrCurveSampleCount = 2,
  21817. FrameCurveSamples = 3,
  21818. DeformMeshOffset = 0,
  21819. DeformCount = 1,
  21820. DeformValueCount = 2,
  21821. DeformValueOffset = 3,
  21822. DeformFloatOffset = 4,
  21823. }
  21824. /**
  21825. * @internal
  21826. * @private
  21827. */
  21828. const enum ArmatureType {
  21829. Armature = 0,
  21830. MovieClip = 1,
  21831. Stage = 2,
  21832. }
  21833. /**
  21834. * @internal
  21835. * @private
  21836. */
  21837. const enum BoneType {
  21838. Bone = 0,
  21839. Surface = 1,
  21840. }
  21841. /**
  21842. * @private
  21843. */
  21844. const enum DisplayType {
  21845. Image = 0,
  21846. Armature = 1,
  21847. Mesh = 2,
  21848. BoundingBox = 3,
  21849. }
  21850. /**
  21851. * - Bounding box type.
  21852. * @version DragonBones 5.0
  21853. * @language en_US
  21854. */
  21855. /**
  21856. * - 边界框类型。
  21857. * @version DragonBones 5.0
  21858. * @language zh_CN
  21859. */
  21860. const enum BoundingBoxType {
  21861. Rectangle = 0,
  21862. Ellipse = 1,
  21863. Polygon = 2,
  21864. }
  21865. /**
  21866. * @internal
  21867. * @private
  21868. */
  21869. const enum ActionType {
  21870. Play = 0,
  21871. Frame = 10,
  21872. Sound = 11,
  21873. }
  21874. /**
  21875. * @internal
  21876. * @private
  21877. */
  21878. const enum BlendMode {
  21879. Normal = 0,
  21880. Add = 1,
  21881. Alpha = 2,
  21882. Darken = 3,
  21883. Difference = 4,
  21884. Erase = 5,
  21885. HardLight = 6,
  21886. Invert = 7,
  21887. Layer = 8,
  21888. Lighten = 9,
  21889. Multiply = 10,
  21890. Overlay = 11,
  21891. Screen = 12,
  21892. Subtract = 13,
  21893. }
  21894. /**
  21895. * @internal
  21896. * @private
  21897. */
  21898. const enum TweenType {
  21899. None = 0,
  21900. Line = 1,
  21901. Curve = 2,
  21902. QuadIn = 3,
  21903. QuadOut = 4,
  21904. QuadInOut = 5,
  21905. }
  21906. /**
  21907. * @internal
  21908. * @private
  21909. */
  21910. const enum TimelineType {
  21911. Action = 0,
  21912. ZOrder = 1,
  21913. BoneAll = 10,
  21914. BoneTranslate = 11,
  21915. BoneRotate = 12,
  21916. BoneScale = 13,
  21917. Surface = 50,
  21918. SlotDisplay = 20,
  21919. SlotColor = 21,
  21920. SlotFFD = 22,
  21921. IKConstraint = 30,
  21922. AnimationTime = 40,
  21923. AnimationWeight = 41,
  21924. }
  21925. /**
  21926. * - Offset mode.
  21927. * @version DragonBones 5.5
  21928. * @language en_US
  21929. */
  21930. /**
  21931. * - 偏移模式。
  21932. * @version DragonBones 5.5
  21933. * @language zh_CN
  21934. */
  21935. const enum OffsetMode {
  21936. None = 0,
  21937. Additive = 1,
  21938. Override = 2,
  21939. }
  21940. /**
  21941. * - Animation fade out mode.
  21942. * @version DragonBones 4.5
  21943. * @language en_US
  21944. */
  21945. /**
  21946. * - 动画淡出模式。
  21947. * @version DragonBones 4.5
  21948. * @language zh_CN
  21949. */
  21950. const enum AnimationFadeOutMode {
  21951. /**
  21952. * - Do not fade out of any animation states.
  21953. * @language en_US
  21954. */
  21955. /**
  21956. * - 不淡出任何的动画状态。
  21957. * @language zh_CN
  21958. */
  21959. None = 0,
  21960. /**
  21961. * - Fade out the animation states of the same layer.
  21962. * @language en_US
  21963. */
  21964. /**
  21965. * - 淡出同层的动画状态。
  21966. * @language zh_CN
  21967. */
  21968. SameLayer = 1,
  21969. /**
  21970. * - Fade out the animation states of the same group.
  21971. * @language en_US
  21972. */
  21973. /**
  21974. * - 淡出同组的动画状态。
  21975. * @language zh_CN
  21976. */
  21977. SameGroup = 2,
  21978. /**
  21979. * - Fade out the animation states of the same layer and group.
  21980. * @language en_US
  21981. */
  21982. /**
  21983. * - 淡出同层并且同组的动画状态。
  21984. * @language zh_CN
  21985. */
  21986. SameLayerAndGroup = 3,
  21987. /**
  21988. * - Fade out of all animation states.
  21989. * @language en_US
  21990. */
  21991. /**
  21992. * - 淡出所有的动画状态。
  21993. * @language zh_CN
  21994. */
  21995. All = 4,
  21996. /**
  21997. * - Does not replace the animation state with the same name.
  21998. * @language en_US
  21999. */
  22000. /**
  22001. * - 不替换同名的动画状态。
  22002. * @language zh_CN
  22003. */
  22004. Single = 5,
  22005. }
  22006. /**
  22007. * @private
  22008. */
  22009. interface Map<T> {
  22010. [key: string]: T;
  22011. }
  22012. /**
  22013. * @private
  22014. */
  22015. class DragonBones {
  22016. static readonly VERSION: string;
  22017. static yDown: boolean;
  22018. static debug: boolean;
  22019. static debugDraw: boolean;
  22020. static webAssembly: boolean;
  22021. private readonly _clock;
  22022. private readonly _events;
  22023. private readonly _objects;
  22024. private _eventManager;
  22025. constructor(eventManager: IEventDispatcher);
  22026. advanceTime(passedTime: number): void;
  22027. bufferEvent(value: EventObject): void;
  22028. bufferObject(object: BaseObject): void;
  22029. readonly clock: WorldClock;
  22030. readonly eventManager: IEventDispatcher;
  22031. }
  22032. }
  22033. /**
  22034. * The MIT License (MIT)
  22035. *
  22036. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22037. *
  22038. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22039. * this software and associated documentation files (the "Software"), to deal in
  22040. * the Software without restriction, including without limitation the rights to
  22041. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22042. * the Software, and to permit persons to whom the Software is furnished to do so,
  22043. * subject to the following conditions:
  22044. *
  22045. * The above copyright notice and this permission notice shall be included in all
  22046. * copies or substantial portions of the Software.
  22047. *
  22048. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22049. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22050. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22051. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22052. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22053. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22054. */
  22055. declare namespace dragonBones {
  22056. /**
  22057. * - The BaseObject is the base class for all objects in the DragonBones framework.
  22058. * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery.
  22059. * @version DragonBones 4.5
  22060. * @language en_US
  22061. */
  22062. /**
  22063. * - 基础对象,通常 DragonBones 的对象都继承自该类。
  22064. * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。
  22065. * @version DragonBones 4.5
  22066. * @language zh_CN
  22067. */
  22068. abstract class BaseObject {
  22069. private static _hashCode;
  22070. private static _defaultMaxCount;
  22071. private static readonly _maxCountMap;
  22072. private static readonly _poolsMap;
  22073. private static _returnObject(object);
  22074. static toString(): string;
  22075. /**
  22076. * - Set the maximum cache count of the specify object pool.
  22077. * @param objectConstructor - The specify class. (Set all object pools max cache count if not set)
  22078. * @param maxCount - Max count.
  22079. * @version DragonBones 4.5
  22080. * @language en_US
  22081. */
  22082. /**
  22083. * - 设置特定对象池的最大缓存数量。
  22084. * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量)
  22085. * @param maxCount - 最大缓存数量。
  22086. * @version DragonBones 4.5
  22087. * @language zh_CN
  22088. */
  22089. static setMaxCount(objectConstructor: (typeof BaseObject) | null, maxCount: number): void;
  22090. /**
  22091. * - Clear the cached instances of a specify object pool.
  22092. * @param objectConstructor - Specify class. (Clear all cached instances if not set)
  22093. * @version DragonBones 4.5
  22094. * @language en_US
  22095. */
  22096. /**
  22097. * - 清除特定对象池的缓存实例。
  22098. * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例)
  22099. * @version DragonBones 4.5
  22100. * @language zh_CN
  22101. */
  22102. static clearPool(objectConstructor?: (typeof BaseObject) | null): void;
  22103. /**
  22104. * - Get an instance of the specify class from object pool.
  22105. * @param objectConstructor - The specify class.
  22106. * @version DragonBones 4.5
  22107. * @language en_US
  22108. */
  22109. /**
  22110. * - 从对象池中获取特定类的实例。
  22111. * @param objectConstructor - 特定的类。
  22112. * @version DragonBones 4.5
  22113. * @language zh_CN
  22114. */
  22115. static borrowObject<T extends BaseObject>(objectConstructor: {
  22116. new (): T;
  22117. }): T;
  22118. /**
  22119. * - A unique identification number assigned to the object.
  22120. * @version DragonBones 4.5
  22121. * @language en_US
  22122. */
  22123. /**
  22124. * - 分配给此实例的唯一标识号。
  22125. * @version DragonBones 4.5
  22126. * @language zh_CN
  22127. */
  22128. readonly hashCode: number;
  22129. private _isInPool;
  22130. /**
  22131. * @private
  22132. */
  22133. protected abstract _onClear(): void;
  22134. /**
  22135. * - Clear the object and return it back to object pool。
  22136. * @version DragonBones 4.5
  22137. * @language en_US
  22138. */
  22139. /**
  22140. * - 清除该实例的所有数据并将其返还对象池。
  22141. * @version DragonBones 4.5
  22142. * @language zh_CN
  22143. */
  22144. returnToPool(): void;
  22145. }
  22146. }
  22147. /**
  22148. * The MIT License (MIT)
  22149. *
  22150. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22151. *
  22152. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22153. * this software and associated documentation files (the "Software"), to deal in
  22154. * the Software without restriction, including without limitation the rights to
  22155. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22156. * the Software, and to permit persons to whom the Software is furnished to do so,
  22157. * subject to the following conditions:
  22158. *
  22159. * The above copyright notice and this permission notice shall be included in all
  22160. * copies or substantial portions of the Software.
  22161. *
  22162. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22163. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22164. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22165. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22166. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22167. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22168. */
  22169. declare namespace dragonBones {
  22170. /**
  22171. * - 2D Transform matrix.
  22172. * @version DragonBones 3.0
  22173. * @language en_US
  22174. */
  22175. /**
  22176. * - 2D 转换矩阵。
  22177. * @version DragonBones 3.0
  22178. * @language zh_CN
  22179. */
  22180. class Matrix {
  22181. /**
  22182. * - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.
  22183. * @default 1.0
  22184. * @version DragonBones 3.0
  22185. * @language en_US
  22186. */
  22187. /**
  22188. * - 缩放或旋转图像时影响像素沿 x 轴定位的值。
  22189. * @default 1.0
  22190. * @version DragonBones 3.0
  22191. * @language zh_CN
  22192. */
  22193. a: number;
  22194. /**
  22195. * - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.
  22196. * @default 0.0
  22197. * @version DragonBones 3.0
  22198. * @language en_US
  22199. */
  22200. /**
  22201. * - 旋转或倾斜图像时影响像素沿 y 轴定位的值。
  22202. * @default 0.0
  22203. * @version DragonBones 3.0
  22204. * @language zh_CN
  22205. */
  22206. b: number;
  22207. /**
  22208. * - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.
  22209. * @default 0.0
  22210. * @version DragonBones 3.0
  22211. * @language en_US
  22212. */
  22213. /**
  22214. * - 旋转或倾斜图像时影响像素沿 x 轴定位的值。
  22215. * @default 0.0
  22216. * @version DragonBones 3.0
  22217. * @language zh_CN
  22218. */
  22219. c: number;
  22220. /**
  22221. * - The value that affects the positioning of pixels along the y axis when scaling or rotating an image.
  22222. * @default 1.0
  22223. * @version DragonBones 3.0
  22224. * @language en_US
  22225. */
  22226. /**
  22227. * - 缩放或旋转图像时影响像素沿 y 轴定位的值。
  22228. * @default 1.0
  22229. * @version DragonBones 3.0
  22230. * @language zh_CN
  22231. */
  22232. d: number;
  22233. /**
  22234. * - The distance by which to translate each point along the x axis.
  22235. * @default 0.0
  22236. * @version DragonBones 3.0
  22237. * @language en_US
  22238. */
  22239. /**
  22240. * - 沿 x 轴平移每个点的距离。
  22241. * @default 0.0
  22242. * @version DragonBones 3.0
  22243. * @language zh_CN
  22244. */
  22245. tx: number;
  22246. /**
  22247. * - The distance by which to translate each point along the y axis.
  22248. * @default 0.0
  22249. * @version DragonBones 3.0
  22250. * @language en_US
  22251. */
  22252. /**
  22253. * - 沿 y 轴平移每个点的距离。
  22254. * @default 0.0
  22255. * @version DragonBones 3.0
  22256. * @language zh_CN
  22257. */
  22258. ty: number;
  22259. /**
  22260. * @private
  22261. */
  22262. constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
  22263. toString(): string;
  22264. /**
  22265. * @private
  22266. */
  22267. copyFrom(value: Matrix): Matrix;
  22268. /**
  22269. * @private
  22270. */
  22271. copyFromArray(value: Array<number>, offset?: number): Matrix;
  22272. /**
  22273. * - Convert to unit matrix.
  22274. * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0.
  22275. * @version DragonBones 3.0
  22276. * @language en_US
  22277. */
  22278. /**
  22279. * - 转换为单位矩阵。
  22280. * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。
  22281. * @version DragonBones 3.0
  22282. * @language zh_CN
  22283. */
  22284. identity(): Matrix;
  22285. /**
  22286. * - Multiplies the current matrix with another matrix.
  22287. * @param value - The matrix that needs to be multiplied.
  22288. * @version DragonBones 3.0
  22289. * @language en_US
  22290. */
  22291. /**
  22292. * - 将当前矩阵与另一个矩阵相乘。
  22293. * @param value - 需要相乘的矩阵。
  22294. * @version DragonBones 3.0
  22295. * @language zh_CN
  22296. */
  22297. concat(value: Matrix): Matrix;
  22298. /**
  22299. * - Convert to inverse matrix.
  22300. * @version DragonBones 3.0
  22301. * @language en_US
  22302. */
  22303. /**
  22304. * - 转换为逆矩阵。
  22305. * @version DragonBones 3.0
  22306. * @language zh_CN
  22307. */
  22308. invert(): Matrix;
  22309. /**
  22310. * - Apply a matrix transformation to a specific point.
  22311. * @param x - X coordinate.
  22312. * @param y - Y coordinate.
  22313. * @param result - The point after the transformation is applied.
  22314. * @param delta - Whether to ignore tx, ty's conversion to point.
  22315. * @version DragonBones 3.0
  22316. * @language en_US
  22317. */
  22318. /**
  22319. * - 将矩阵转换应用于特定点。
  22320. * @param x - 横坐标。
  22321. * @param y - 纵坐标。
  22322. * @param result - 应用转换之后的点。
  22323. * @param delta - 是否忽略 tx,ty 对点的转换。
  22324. * @version DragonBones 3.0
  22325. * @language zh_CN
  22326. */
  22327. transformPoint(x: number, y: number, result: {
  22328. x: number;
  22329. y: number;
  22330. }, delta?: boolean): void;
  22331. /**
  22332. * @private
  22333. */
  22334. transformRectangle(rectangle: {
  22335. x: number;
  22336. y: number;
  22337. width: number;
  22338. height: number;
  22339. }, delta?: boolean): void;
  22340. }
  22341. }
  22342. /**
  22343. * The MIT License (MIT)
  22344. *
  22345. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22346. *
  22347. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22348. * this software and associated documentation files (the "Software"), to deal in
  22349. * the Software without restriction, including without limitation the rights to
  22350. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22351. * the Software, and to permit persons to whom the Software is furnished to do so,
  22352. * subject to the following conditions:
  22353. *
  22354. * The above copyright notice and this permission notice shall be included in all
  22355. * copies or substantial portions of the Software.
  22356. *
  22357. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22358. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22359. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22360. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22361. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22362. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22363. */
  22364. declare namespace dragonBones {
  22365. /**
  22366. * - 2D Transform.
  22367. * @version DragonBones 3.0
  22368. * @language en_US
  22369. */
  22370. /**
  22371. * - 2D 变换。
  22372. * @version DragonBones 3.0
  22373. * @language zh_CN
  22374. */
  22375. class Transform {
  22376. /**
  22377. * @private
  22378. */
  22379. static readonly PI: number;
  22380. /**
  22381. * @private
  22382. */
  22383. static readonly PI_D: number;
  22384. /**
  22385. * @private
  22386. */
  22387. static readonly PI_H: number;
  22388. /**
  22389. * @private
  22390. */
  22391. static readonly PI_Q: number;
  22392. /**
  22393. * @private
  22394. */
  22395. static readonly RAD_DEG: number;
  22396. /**
  22397. * @private
  22398. */
  22399. static readonly DEG_RAD: number;
  22400. /**
  22401. * @private
  22402. */
  22403. static normalizeRadian(value: number): number;
  22404. /**
  22405. * - Horizontal translate.
  22406. * @version DragonBones 3.0
  22407. * @language en_US
  22408. */
  22409. /**
  22410. * - 水平位移。
  22411. * @version DragonBones 3.0
  22412. * @language zh_CN
  22413. */
  22414. x: number;
  22415. /**
  22416. * - Vertical translate.
  22417. * @version DragonBones 3.0
  22418. * @language en_US
  22419. */
  22420. /**
  22421. * - 垂直位移。
  22422. * @version DragonBones 3.0
  22423. * @language zh_CN
  22424. */
  22425. y: number;
  22426. /**
  22427. * - Skew. (In radians)
  22428. * @version DragonBones 3.0
  22429. * @language en_US
  22430. */
  22431. /**
  22432. * - 倾斜。 (以弧度为单位)
  22433. * @version DragonBones 3.0
  22434. * @language zh_CN
  22435. */
  22436. skew: number;
  22437. /**
  22438. * - rotation. (In radians)
  22439. * @version DragonBones 3.0
  22440. * @language en_US
  22441. */
  22442. /**
  22443. * - 旋转。 (以弧度为单位)
  22444. * @version DragonBones 3.0
  22445. * @language zh_CN
  22446. */
  22447. rotation: number;
  22448. /**
  22449. * - Horizontal Scaling.
  22450. * @version DragonBones 3.0
  22451. * @language en_US
  22452. */
  22453. /**
  22454. * - 水平缩放。
  22455. * @version DragonBones 3.0
  22456. * @language zh_CN
  22457. */
  22458. scaleX: number;
  22459. /**
  22460. * - Vertical scaling.
  22461. * @version DragonBones 3.0
  22462. * @language en_US
  22463. */
  22464. /**
  22465. * - 垂直缩放。
  22466. * @version DragonBones 3.0
  22467. * @language zh_CN
  22468. */
  22469. scaleY: number;
  22470. /**
  22471. * @private
  22472. */
  22473. constructor(x?: number, y?: number, skew?: number, rotation?: number, scaleX?: number, scaleY?: number);
  22474. toString(): string;
  22475. /**
  22476. * @private
  22477. */
  22478. copyFrom(value: Transform): Transform;
  22479. /**
  22480. * @private
  22481. */
  22482. identity(): Transform;
  22483. /**
  22484. * @private
  22485. */
  22486. add(value: Transform): Transform;
  22487. /**
  22488. * @private
  22489. */
  22490. minus(value: Transform): Transform;
  22491. /**
  22492. * @private
  22493. */
  22494. fromMatrix(matrix: Matrix): Transform;
  22495. /**
  22496. * @private
  22497. */
  22498. toMatrix(matrix: Matrix): Transform;
  22499. }
  22500. }
  22501. /**
  22502. * The MIT License (MIT)
  22503. *
  22504. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22505. *
  22506. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22507. * this software and associated documentation files (the "Software"), to deal in
  22508. * the Software without restriction, including without limitation the rights to
  22509. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22510. * the Software, and to permit persons to whom the Software is furnished to do so,
  22511. * subject to the following conditions:
  22512. *
  22513. * The above copyright notice and this permission notice shall be included in all
  22514. * copies or substantial portions of the Software.
  22515. *
  22516. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22517. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22518. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22519. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22520. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22521. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22522. */
  22523. declare namespace dragonBones {
  22524. /**
  22525. * @internal
  22526. * @private
  22527. */
  22528. class ColorTransform {
  22529. alphaMultiplier: number;
  22530. redMultiplier: number;
  22531. greenMultiplier: number;
  22532. blueMultiplier: number;
  22533. alphaOffset: number;
  22534. redOffset: number;
  22535. greenOffset: number;
  22536. blueOffset: number;
  22537. constructor(alphaMultiplier?: number, redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaOffset?: number, redOffset?: number, greenOffset?: number, blueOffset?: number);
  22538. copyFrom(value: ColorTransform): void;
  22539. identity(): void;
  22540. }
  22541. }
  22542. /**
  22543. * The MIT License (MIT)
  22544. *
  22545. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22546. *
  22547. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22548. * this software and associated documentation files (the "Software"), to deal in
  22549. * the Software without restriction, including without limitation the rights to
  22550. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22551. * the Software, and to permit persons to whom the Software is furnished to do so,
  22552. * subject to the following conditions:
  22553. *
  22554. * The above copyright notice and this permission notice shall be included in all
  22555. * copies or substantial portions of the Software.
  22556. *
  22557. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22558. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22559. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22560. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22561. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22562. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22563. */
  22564. declare namespace dragonBones {
  22565. /**
  22566. * - The Point object represents a location in a two-dimensional coordinate system.
  22567. * @version DragonBones 3.0
  22568. * @language en_US
  22569. */
  22570. /**
  22571. * - Point 对象表示二维坐标系统中的某个位置。
  22572. * @version DragonBones 3.0
  22573. * @language zh_CN
  22574. */
  22575. class Point {
  22576. /**
  22577. * - The horizontal coordinate.
  22578. * @default 0.0
  22579. * @version DragonBones 3.0
  22580. * @language en_US
  22581. */
  22582. /**
  22583. * - 该点的水平坐标。
  22584. * @default 0.0
  22585. * @version DragonBones 3.0
  22586. * @language zh_CN
  22587. */
  22588. x: number;
  22589. /**
  22590. * - The vertical coordinate.
  22591. * @default 0.0
  22592. * @version DragonBones 3.0
  22593. * @language en_US
  22594. */
  22595. /**
  22596. * - 该点的垂直坐标。
  22597. * @default 0.0
  22598. * @version DragonBones 3.0
  22599. * @language zh_CN
  22600. */
  22601. y: number;
  22602. /**
  22603. * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0).
  22604. * @param x - The horizontal coordinate.
  22605. * @param y - The vertical coordinate.
  22606. * @version DragonBones 3.0
  22607. * @language en_US
  22608. */
  22609. /**
  22610. * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。
  22611. * @param x - 该对象的x属性值,默认为 0.0。
  22612. * @param y - 该对象的y属性值,默认为 0.0。
  22613. * @version DragonBones 3.0
  22614. * @language zh_CN
  22615. */
  22616. constructor(x?: number, y?: number);
  22617. /**
  22618. * @private
  22619. */
  22620. copyFrom(value: Point): void;
  22621. /**
  22622. * @private
  22623. */
  22624. clear(): void;
  22625. }
  22626. }
  22627. /**
  22628. * The MIT License (MIT)
  22629. *
  22630. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22631. *
  22632. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22633. * this software and associated documentation files (the "Software"), to deal in
  22634. * the Software without restriction, including without limitation the rights to
  22635. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22636. * the Software, and to permit persons to whom the Software is furnished to do so,
  22637. * subject to the following conditions:
  22638. *
  22639. * The above copyright notice and this permission notice shall be included in all
  22640. * copies or substantial portions of the Software.
  22641. *
  22642. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22643. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22644. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22645. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22646. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22647. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22648. */
  22649. declare namespace dragonBones {
  22650. /**
  22651. * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its
  22652. * width and its height.<br/>
  22653. * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of
  22654. * one property has no effect on the others. However, the right and bottom properties are integrally related to those
  22655. * four properties. For example, if you change the value of the right property, the value of the width property changes;
  22656. * if you change the bottom property, the value of the height property changes.
  22657. * @version DragonBones 3.0
  22658. * @language en_US
  22659. */
  22660. /**
  22661. * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。<br/>
  22662. * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。
  22663. * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width
  22664. * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。
  22665. * @version DragonBones 3.0
  22666. * @language zh_CN
  22667. */
  22668. class Rectangle {
  22669. /**
  22670. * - The x coordinate of the top-left corner of the rectangle.
  22671. * @default 0.0
  22672. * @version DragonBones 3.0
  22673. * @language en_US
  22674. */
  22675. /**
  22676. * - 矩形左上角的 x 坐标。
  22677. * @default 0.0
  22678. * @version DragonBones 3.0
  22679. * @language zh_CN
  22680. */
  22681. x: number;
  22682. /**
  22683. * - The y coordinate of the top-left corner of the rectangle.
  22684. * @default 0.0
  22685. * @version DragonBones 3.0
  22686. * @language en_US
  22687. */
  22688. /**
  22689. * - 矩形左上角的 y 坐标。
  22690. * @default 0.0
  22691. * @version DragonBones 3.0
  22692. * @language zh_CN
  22693. */
  22694. y: number;
  22695. /**
  22696. * - The width of the rectangle, in pixels.
  22697. * @default 0.0
  22698. * @version DragonBones 3.0
  22699. * @language en_US
  22700. */
  22701. /**
  22702. * - 矩形的宽度(以像素为单位)。
  22703. * @default 0.0
  22704. * @version DragonBones 3.0
  22705. * @language zh_CN
  22706. */
  22707. width: number;
  22708. /**
  22709. * - 矩形的高度(以像素为单位)。
  22710. * @default 0.0
  22711. * @version DragonBones 3.0
  22712. * @language en_US
  22713. */
  22714. /**
  22715. * - The height of the rectangle, in pixels.
  22716. * @default 0.0
  22717. * @version DragonBones 3.0
  22718. * @language zh_CN
  22719. */
  22720. height: number;
  22721. /**
  22722. * @private
  22723. */
  22724. constructor(x?: number, y?: number, width?: number, height?: number);
  22725. /**
  22726. * @private
  22727. */
  22728. copyFrom(value: Rectangle): void;
  22729. /**
  22730. * @private
  22731. */
  22732. clear(): void;
  22733. }
  22734. }
  22735. /**
  22736. * The MIT License (MIT)
  22737. *
  22738. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22739. *
  22740. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22741. * this software and associated documentation files (the "Software"), to deal in
  22742. * the Software without restriction, including without limitation the rights to
  22743. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22744. * the Software, and to permit persons to whom the Software is furnished to do so,
  22745. * subject to the following conditions:
  22746. *
  22747. * The above copyright notice and this permission notice shall be included in all
  22748. * copies or substantial portions of the Software.
  22749. *
  22750. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22751. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22752. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22753. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22754. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22755. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22756. */
  22757. declare namespace dragonBones {
  22758. /**
  22759. * - The user custom data.
  22760. * @version DragonBones 5.0
  22761. * @language en_US
  22762. */
  22763. /**
  22764. * - 用户自定义数据。
  22765. * @version DragonBones 5.0
  22766. * @language zh_CN
  22767. */
  22768. class UserData extends BaseObject {
  22769. static toString(): string;
  22770. /**
  22771. * - The custom int numbers.
  22772. * @version DragonBones 5.0
  22773. * @language en_US
  22774. */
  22775. /**
  22776. * - 自定义整数。
  22777. * @version DragonBones 5.0
  22778. * @language zh_CN
  22779. */
  22780. readonly ints: Array<number>;
  22781. /**
  22782. * - The custom float numbers.
  22783. * @version DragonBones 5.0
  22784. * @language en_US
  22785. */
  22786. /**
  22787. * - 自定义浮点数。
  22788. * @version DragonBones 5.0
  22789. * @language zh_CN
  22790. */
  22791. readonly floats: Array<number>;
  22792. /**
  22793. * - The custom strings.
  22794. * @version DragonBones 5.0
  22795. * @language en_US
  22796. */
  22797. /**
  22798. * - 自定义字符串。
  22799. * @version DragonBones 5.0
  22800. * @language zh_CN
  22801. */
  22802. readonly strings: Array<string>;
  22803. /**
  22804. * @inheritDoc
  22805. */
  22806. protected _onClear(): void;
  22807. /**
  22808. * @internal
  22809. * @private
  22810. */
  22811. addInt(value: number): void;
  22812. /**
  22813. * @internal
  22814. * @private
  22815. */
  22816. addFloat(value: number): void;
  22817. /**
  22818. * @internal
  22819. * @private
  22820. */
  22821. addString(value: string): void;
  22822. /**
  22823. * - Get the custom int number.
  22824. * @version DragonBones 5.0
  22825. * @language en_US
  22826. */
  22827. /**
  22828. * - 获取自定义整数。
  22829. * @version DragonBones 5.0
  22830. * @language zh_CN
  22831. */
  22832. getInt(index?: number): number;
  22833. /**
  22834. * - Get the custom float number.
  22835. * @version DragonBones 5.0
  22836. * @language en_US
  22837. */
  22838. /**
  22839. * - 获取自定义浮点数。
  22840. * @version DragonBones 5.0
  22841. * @language zh_CN
  22842. */
  22843. getFloat(index?: number): number;
  22844. /**
  22845. * - Get the custom string.
  22846. * @version DragonBones 5.0
  22847. * @language en_US
  22848. */
  22849. /**
  22850. * - 获取自定义字符串。
  22851. * @version DragonBones 5.0
  22852. * @language zh_CN
  22853. */
  22854. getString(index?: number): string;
  22855. }
  22856. /**
  22857. * @internal
  22858. * @private
  22859. */
  22860. class ActionData extends BaseObject {
  22861. static toString(): string;
  22862. type: ActionType;
  22863. name: string;
  22864. bone: BoneData | null;
  22865. slot: SlotData | null;
  22866. data: UserData | null;
  22867. protected _onClear(): void;
  22868. }
  22869. }
  22870. /**
  22871. * The MIT License (MIT)
  22872. *
  22873. * Copyright (c) 2012-2017 DragonBones team and other contributors
  22874. *
  22875. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  22876. * this software and associated documentation files (the "Software"), to deal in
  22877. * the Software without restriction, including without limitation the rights to
  22878. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  22879. * the Software, and to permit persons to whom the Software is furnished to do so,
  22880. * subject to the following conditions:
  22881. *
  22882. * The above copyright notice and this permission notice shall be included in all
  22883. * copies or substantial portions of the Software.
  22884. *
  22885. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22886. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22887. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  22888. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  22889. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22890. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22891. */
  22892. declare namespace dragonBones {
  22893. /**
  22894. * - The DragonBones data.
  22895. * A DragonBones data contains multiple armature data.
  22896. * @see dragonBones.ArmatureData
  22897. * @version DragonBones 3.0
  22898. * @language en_US
  22899. */
  22900. /**
  22901. * - 龙骨数据。
  22902. * 一个龙骨数据包含多个骨架数据。
  22903. * @see dragonBones.ArmatureData
  22904. * @version DragonBones 3.0
  22905. * @language zh_CN
  22906. */
  22907. class DragonBonesData extends BaseObject {
  22908. static toString(): string;
  22909. /**
  22910. * @private
  22911. */
  22912. autoSearch: boolean;
  22913. /**
  22914. * - The animation frame rate.
  22915. * @version DragonBones 3.0
  22916. * @language en_US
  22917. */
  22918. /**
  22919. * - 动画帧频。
  22920. * @version DragonBones 3.0
  22921. * @language zh_CN
  22922. */
  22923. frameRate: number;
  22924. /**
  22925. * - The data version.
  22926. * @version DragonBones 3.0
  22927. * @language en_US
  22928. */
  22929. /**
  22930. * - 数据版本。
  22931. * @version DragonBones 3.0
  22932. * @language zh_CN
  22933. */
  22934. version: string;
  22935. /**
  22936. * - The DragonBones data name.
  22937. * The name is consistent with the DragonBones project name.
  22938. * @version DragonBones 3.0
  22939. * @language en_US
  22940. */
  22941. /**
  22942. * - 龙骨数据名称。
  22943. * 该名称与龙骨项目名保持一致。
  22944. * @version DragonBones 3.0
  22945. * @language zh_CN
  22946. */
  22947. name: string;
  22948. /**
  22949. * @private
  22950. */
  22951. stage: ArmatureData | null;
  22952. /**
  22953. * @internal
  22954. * @private
  22955. */
  22956. readonly frameIndices: Array<number>;
  22957. /**
  22958. * @internal
  22959. * @private
  22960. */
  22961. readonly cachedFrames: Array<number>;
  22962. /**
  22963. * - All armature data names.
  22964. * @version DragonBones 3.0
  22965. * @language en_US
  22966. */
  22967. /**
  22968. * - 所有的骨架数据名称。
  22969. * @version DragonBones 3.0
  22970. * @language zh_CN
  22971. */
  22972. readonly armatureNames: Array<string>;
  22973. /**
  22974. * @private
  22975. */
  22976. readonly armatures: Map<ArmatureData>;
  22977. /**
  22978. * @internal
  22979. * @private
  22980. */
  22981. binary: ArrayBuffer;
  22982. /**
  22983. * @internal
  22984. * @private
  22985. */
  22986. intArray: Int16Array;
  22987. /**
  22988. * @internal
  22989. * @private
  22990. */
  22991. floatArray: Float32Array;
  22992. /**
  22993. * @internal
  22994. * @private
  22995. */
  22996. frameIntArray: Int16Array;
  22997. /**
  22998. * @internal
  22999. * @private
  23000. */
  23001. frameFloatArray: Float32Array;
  23002. /**
  23003. * @internal
  23004. * @private
  23005. */
  23006. frameArray: Int16Array;
  23007. /**
  23008. * @internal
  23009. * @private
  23010. */
  23011. timelineArray: Uint16Array;
  23012. /**
  23013. * @private
  23014. */
  23015. userData: UserData | null;
  23016. /**
  23017. * @inheritDoc
  23018. */
  23019. protected _onClear(): void;
  23020. /**
  23021. * @internal
  23022. * @private
  23023. */
  23024. addArmature(value: ArmatureData): void;
  23025. /**
  23026. * - Get a specific armature data.
  23027. * @param name - The armature data name.
  23028. * @version DragonBones 3.0
  23029. * @language en_US
  23030. */
  23031. /**
  23032. * - 获取特定的骨架数据。
  23033. * @param name - 骨架数据名称。
  23034. * @version DragonBones 3.0
  23035. * @language zh_CN
  23036. */
  23037. getArmature(name: string): ArmatureData | null;
  23038. /**
  23039. * - Deprecated, please refer to {@link #dragonBones.BaseFactory#removeDragonBonesData()}.
  23040. * @deprecated
  23041. * @language en_US
  23042. */
  23043. /**
  23044. * - 已废弃,请参考 {@link #dragonBones.BaseFactory#removeDragonBonesData()}。
  23045. * @deprecated
  23046. * @language zh_CN
  23047. */
  23048. dispose(): void;
  23049. }
  23050. }
  23051. /**
  23052. * The MIT License (MIT)
  23053. *
  23054. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23055. *
  23056. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23057. * this software and associated documentation files (the "Software"), to deal in
  23058. * the Software without restriction, including without limitation the rights to
  23059. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23060. * the Software, and to permit persons to whom the Software is furnished to do so,
  23061. * subject to the following conditions:
  23062. *
  23063. * The above copyright notice and this permission notice shall be included in all
  23064. * copies or substantial portions of the Software.
  23065. *
  23066. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23067. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23068. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23069. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23070. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23071. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23072. */
  23073. declare namespace dragonBones {
  23074. /**
  23075. * - The armature data.
  23076. * @version DragonBones 3.0
  23077. * @language en_US
  23078. */
  23079. /**
  23080. * - 骨架数据。
  23081. * @version DragonBones 3.0
  23082. * @language zh_CN
  23083. */
  23084. class ArmatureData extends BaseObject {
  23085. static toString(): string;
  23086. /**
  23087. * @private
  23088. */
  23089. type: ArmatureType;
  23090. /**
  23091. * - The animation frame rate.
  23092. * @version DragonBones 3.0
  23093. * @language en_US
  23094. */
  23095. /**
  23096. * - 动画帧率。
  23097. * @version DragonBones 3.0
  23098. * @language zh_CN
  23099. */
  23100. frameRate: number;
  23101. /**
  23102. * @private
  23103. */
  23104. cacheFrameRate: number;
  23105. /**
  23106. * @private
  23107. */
  23108. scale: number;
  23109. /**
  23110. * - The armature name.
  23111. * @version DragonBones 3.0
  23112. * @language en_US
  23113. */
  23114. /**
  23115. * - 骨架名称。
  23116. * @version DragonBones 3.0
  23117. * @language zh_CN
  23118. */
  23119. name: string;
  23120. /**
  23121. * @private
  23122. */
  23123. readonly aabb: Rectangle;
  23124. /**
  23125. * - The names of all the animation data.
  23126. * @version DragonBones 3.0
  23127. * @language en_US
  23128. */
  23129. /**
  23130. * - 所有的动画数据名称。
  23131. * @version DragonBones 3.0
  23132. * @language zh_CN
  23133. */
  23134. readonly animationNames: Array<string>;
  23135. /**
  23136. * @private
  23137. */
  23138. readonly sortedBones: Array<BoneData>;
  23139. /**
  23140. * @private
  23141. */
  23142. readonly sortedSlots: Array<SlotData>;
  23143. /**
  23144. * @private
  23145. */
  23146. readonly defaultActions: Array<ActionData>;
  23147. /**
  23148. * @private
  23149. */
  23150. readonly actions: Array<ActionData>;
  23151. /**
  23152. * @private
  23153. */
  23154. readonly bones: Map<BoneData>;
  23155. /**
  23156. * @private
  23157. */
  23158. readonly slots: Map<SlotData>;
  23159. /**
  23160. * @private
  23161. */
  23162. readonly constraints: Map<ConstraintData>;
  23163. /**
  23164. * @private
  23165. */
  23166. readonly skins: Map<SkinData>;
  23167. /**
  23168. * @private
  23169. */
  23170. readonly animations: Map<AnimationData>;
  23171. /**
  23172. * - The default skin data.
  23173. * @version DragonBones 4.5
  23174. * @language en_US
  23175. */
  23176. /**
  23177. * - 默认插槽数据。
  23178. * @version DragonBones 4.5
  23179. * @language zh_CN
  23180. */
  23181. defaultSkin: SkinData | null;
  23182. /**
  23183. * - The default animation data.
  23184. * @version DragonBones 4.5
  23185. * @language en_US
  23186. */
  23187. /**
  23188. * - 默认动画数据。
  23189. * @version DragonBones 4.5
  23190. * @language zh_CN
  23191. */
  23192. defaultAnimation: AnimationData | null;
  23193. /**
  23194. * @private
  23195. */
  23196. canvas: CanvasData | null;
  23197. /**
  23198. * @private
  23199. */
  23200. userData: UserData | null;
  23201. /**
  23202. * @private
  23203. */
  23204. parent: DragonBonesData;
  23205. /**
  23206. * @inheritDoc
  23207. */
  23208. protected _onClear(): void;
  23209. /**
  23210. * @internal
  23211. * @private
  23212. */
  23213. sortBones(): void;
  23214. /**
  23215. * @internal
  23216. * @private
  23217. */
  23218. cacheFrames(frameRate: number): void;
  23219. /**
  23220. * @internal
  23221. * @private
  23222. */
  23223. setCacheFrame(globalTransformMatrix: Matrix, transform: Transform): number;
  23224. /**
  23225. * @internal
  23226. * @private
  23227. */
  23228. getCacheFrame(globalTransformMatrix: Matrix, transform: Transform, arrayOffset: number): void;
  23229. /**
  23230. * @internal
  23231. * @private
  23232. */
  23233. addBone(value: BoneData): void;
  23234. /**
  23235. * @internal
  23236. * @private
  23237. */
  23238. addSlot(value: SlotData): void;
  23239. /**
  23240. * @internal
  23241. * @private
  23242. */
  23243. addConstraint(value: ConstraintData): void;
  23244. /**
  23245. * @internal
  23246. * @private
  23247. */
  23248. addSkin(value: SkinData): void;
  23249. /**
  23250. * @internal
  23251. * @private
  23252. */
  23253. addAnimation(value: AnimationData): void;
  23254. /**
  23255. * @internal
  23256. * @private
  23257. */
  23258. addAction(value: ActionData, isDefault: boolean): void;
  23259. /**
  23260. * - Get a specific done data.
  23261. * @param name - The bone name.
  23262. * @version DragonBones 3.0
  23263. * @language en_US
  23264. */
  23265. /**
  23266. * - 获取特定的骨骼数据。
  23267. * @param name - 骨骼名称。
  23268. * @version DragonBones 3.0
  23269. * @language zh_CN
  23270. */
  23271. getBone(name: string): BoneData | null;
  23272. /**
  23273. * - Get a specific slot data.
  23274. * @param name - The slot name.
  23275. * @version DragonBones 3.0
  23276. * @language en_US
  23277. */
  23278. /**
  23279. * - 获取特定的插槽数据。
  23280. * @param name - 插槽名称。
  23281. * @version DragonBones 3.0
  23282. * @language zh_CN
  23283. */
  23284. getSlot(name: string): SlotData | null;
  23285. /**
  23286. * @private
  23287. */
  23288. getConstraint(name: string): ConstraintData | null;
  23289. /**
  23290. * - Get a specific skin data.
  23291. * @param name - The skin name.
  23292. * @version DragonBones 3.0
  23293. * @language en_US
  23294. */
  23295. /**
  23296. * - 获取特定皮肤数据。
  23297. * @param name - 皮肤名称。
  23298. * @version DragonBones 3.0
  23299. * @language zh_CN
  23300. */
  23301. getSkin(name: string): SkinData | null;
  23302. /**
  23303. * @internal
  23304. * @private
  23305. */
  23306. getMesh(skinName: string, slotName: string, meshName: string): MeshDisplayData | null;
  23307. /**
  23308. * - Get a specific animation data.
  23309. * @param name - The animation name.
  23310. * @version DragonBones 3.0
  23311. * @language en_US
  23312. */
  23313. /**
  23314. * - 获取特定的动画数据。
  23315. * @param name - 动画名称。
  23316. * @version DragonBones 3.0
  23317. * @language zh_CN
  23318. */
  23319. getAnimation(name: string): AnimationData | null;
  23320. }
  23321. /**
  23322. * - The bone data.
  23323. * @version DragonBones 3.0
  23324. * @language en_US
  23325. */
  23326. /**
  23327. * - 骨骼数据。
  23328. * @version DragonBones 3.0
  23329. * @language zh_CN
  23330. */
  23331. class BoneData extends BaseObject {
  23332. static toString(): string;
  23333. /**
  23334. * @private
  23335. */
  23336. inheritTranslation: boolean;
  23337. /**
  23338. * @private
  23339. */
  23340. inheritRotation: boolean;
  23341. /**
  23342. * @private
  23343. */
  23344. inheritScale: boolean;
  23345. /**
  23346. * @private
  23347. */
  23348. inheritReflection: boolean;
  23349. /**
  23350. * @private
  23351. */
  23352. type: BoneType;
  23353. /**
  23354. * - The bone length.
  23355. * @version DragonBones 3.0
  23356. * @language en_US
  23357. */
  23358. /**
  23359. * - 骨骼长度。
  23360. * @version DragonBones 3.0
  23361. * @language zh_CN
  23362. */
  23363. length: number;
  23364. /**
  23365. * - The bone name.
  23366. * @version DragonBones 3.0
  23367. * @language en_US
  23368. */
  23369. /**
  23370. * - 骨骼名称。
  23371. * @version DragonBones 3.0
  23372. * @language zh_CN
  23373. */
  23374. name: string;
  23375. /**
  23376. * @private
  23377. */
  23378. readonly transform: Transform;
  23379. /**
  23380. * @private
  23381. */
  23382. userData: UserData | null;
  23383. /**
  23384. * - The parent bone data.
  23385. * @version DragonBones 3.0
  23386. * @language en_US
  23387. */
  23388. /**
  23389. * - 父骨骼数据。
  23390. * @version DragonBones 3.0
  23391. * @language zh_CN
  23392. */
  23393. parent: BoneData | null;
  23394. /**
  23395. * @inheritDoc
  23396. */
  23397. protected _onClear(): void;
  23398. }
  23399. /**
  23400. * @internal
  23401. * @private
  23402. */
  23403. class SurfaceData extends BoneData {
  23404. static toString(): string;
  23405. segmentX: number;
  23406. segmentY: number;
  23407. readonly vertices: Array<number>;
  23408. /**
  23409. * @inheritDoc
  23410. */
  23411. protected _onClear(): void;
  23412. }
  23413. /**
  23414. * - The slot data.
  23415. * @version DragonBones 3.0
  23416. * @language en_US
  23417. */
  23418. /**
  23419. * - 插槽数据。
  23420. * @version DragonBones 3.0
  23421. * @language zh_CN
  23422. */
  23423. class SlotData extends BaseObject {
  23424. /**
  23425. * @internal
  23426. * @private
  23427. */
  23428. static readonly DEFAULT_COLOR: ColorTransform;
  23429. /**
  23430. * @internal
  23431. * @private
  23432. */
  23433. static createColor(): ColorTransform;
  23434. static toString(): string;
  23435. /**
  23436. * @private
  23437. */
  23438. blendMode: BlendMode;
  23439. /**
  23440. * @private
  23441. */
  23442. displayIndex: number;
  23443. /**
  23444. * @private
  23445. */
  23446. zOrder: number;
  23447. /**
  23448. * - The slot name.
  23449. * @version DragonBones 3.0
  23450. * @language en_US
  23451. */
  23452. /**
  23453. * - 插槽名称。
  23454. * @version DragonBones 3.0
  23455. * @language zh_CN
  23456. */
  23457. name: string;
  23458. /**
  23459. * @private
  23460. */
  23461. color: ColorTransform;
  23462. /**
  23463. * @private
  23464. */
  23465. userData: UserData | null;
  23466. /**
  23467. * - The parent bone data.
  23468. * @version DragonBones 3.0
  23469. * @language en_US
  23470. */
  23471. /**
  23472. * - 父骨骼数据。
  23473. * @version DragonBones 3.0
  23474. * @language zh_CN
  23475. */
  23476. parent: BoneData;
  23477. /**
  23478. * @inheritDoc
  23479. */
  23480. protected _onClear(): void;
  23481. }
  23482. }
  23483. /**
  23484. * The MIT License (MIT)
  23485. *
  23486. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23487. *
  23488. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23489. * this software and associated documentation files (the "Software"), to deal in
  23490. * the Software without restriction, including without limitation the rights to
  23491. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23492. * the Software, and to permit persons to whom the Software is furnished to do so,
  23493. * subject to the following conditions:
  23494. *
  23495. * The above copyright notice and this permission notice shall be included in all
  23496. * copies or substantial portions of the Software.
  23497. *
  23498. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23499. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23500. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23501. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23502. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23503. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23504. */
  23505. declare namespace dragonBones {
  23506. /**
  23507. * @internal
  23508. * @private
  23509. */
  23510. abstract class ConstraintData extends BaseObject {
  23511. order: number;
  23512. name: string;
  23513. target: BoneData;
  23514. root: BoneData;
  23515. bone: BoneData | null;
  23516. protected _onClear(): void;
  23517. }
  23518. /**
  23519. * @internal
  23520. * @private
  23521. */
  23522. class IKConstraintData extends ConstraintData {
  23523. static toString(): string;
  23524. scaleEnabled: boolean;
  23525. bendPositive: boolean;
  23526. weight: number;
  23527. protected _onClear(): void;
  23528. }
  23529. }
  23530. /**
  23531. * The MIT License (MIT)
  23532. *
  23533. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23534. *
  23535. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23536. * this software and associated documentation files (the "Software"), to deal in
  23537. * the Software without restriction, including without limitation the rights to
  23538. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23539. * the Software, and to permit persons to whom the Software is furnished to do so,
  23540. * subject to the following conditions:
  23541. *
  23542. * The above copyright notice and this permission notice shall be included in all
  23543. * copies or substantial portions of the Software.
  23544. *
  23545. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23546. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23547. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23548. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23549. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23550. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23551. */
  23552. declare namespace dragonBones {
  23553. /**
  23554. * @internal
  23555. * @private
  23556. */
  23557. class CanvasData extends BaseObject {
  23558. static toString(): string;
  23559. hasBackground: boolean;
  23560. color: number;
  23561. x: number;
  23562. y: number;
  23563. width: number;
  23564. height: number;
  23565. protected _onClear(): void;
  23566. }
  23567. }
  23568. /**
  23569. * The MIT License (MIT)
  23570. *
  23571. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23572. *
  23573. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23574. * this software and associated documentation files (the "Software"), to deal in
  23575. * the Software without restriction, including without limitation the rights to
  23576. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23577. * the Software, and to permit persons to whom the Software is furnished to do so,
  23578. * subject to the following conditions:
  23579. *
  23580. * The above copyright notice and this permission notice shall be included in all
  23581. * copies or substantial portions of the Software.
  23582. *
  23583. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23584. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23585. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23586. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23587. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23588. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23589. */
  23590. declare namespace dragonBones {
  23591. /**
  23592. * - The skin data, typically a armature data instance contains at least one skinData.
  23593. * @version DragonBones 3.0
  23594. * @language en_US
  23595. */
  23596. /**
  23597. * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。
  23598. * @version DragonBones 3.0
  23599. * @language zh_CN
  23600. */
  23601. class SkinData extends BaseObject {
  23602. static toString(): string;
  23603. /**
  23604. * - The skin name.
  23605. * @version DragonBones 3.0
  23606. * @language en_US
  23607. */
  23608. /**
  23609. * - 皮肤名称。
  23610. * @version DragonBones 3.0
  23611. * @language zh_CN
  23612. */
  23613. name: string;
  23614. /**
  23615. * @private
  23616. */
  23617. readonly displays: Map<Array<DisplayData | null>>;
  23618. /**
  23619. * @private
  23620. */
  23621. parent: ArmatureData;
  23622. /**
  23623. * @inheritDoc
  23624. */
  23625. protected _onClear(): void;
  23626. /**
  23627. * @internal
  23628. * @private
  23629. */
  23630. addDisplay(slotName: string, value: DisplayData | null): void;
  23631. /**
  23632. * @private
  23633. */
  23634. getDisplay(slotName: string, displayName: string): DisplayData | null;
  23635. /**
  23636. * @private
  23637. */
  23638. getDisplays(slotName: string): Array<DisplayData | null> | null;
  23639. }
  23640. }
  23641. /**
  23642. * The MIT License (MIT)
  23643. *
  23644. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23645. *
  23646. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23647. * this software and associated documentation files (the "Software"), to deal in
  23648. * the Software without restriction, including without limitation the rights to
  23649. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23650. * the Software, and to permit persons to whom the Software is furnished to do so,
  23651. * subject to the following conditions:
  23652. *
  23653. * The above copyright notice and this permission notice shall be included in all
  23654. * copies or substantial portions of the Software.
  23655. *
  23656. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23657. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23658. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23659. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23660. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23661. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23662. */
  23663. declare namespace dragonBones {
  23664. /**
  23665. * @internal
  23666. * @private
  23667. */
  23668. abstract class DisplayData extends BaseObject {
  23669. type: DisplayType;
  23670. name: string;
  23671. path: string;
  23672. parent: SkinData;
  23673. readonly transform: Transform;
  23674. protected _onClear(): void;
  23675. }
  23676. /**
  23677. * @internal
  23678. * @private
  23679. */
  23680. class ImageDisplayData extends DisplayData {
  23681. static toString(): string;
  23682. readonly pivot: Point;
  23683. texture: TextureData | null;
  23684. protected _onClear(): void;
  23685. }
  23686. /**
  23687. * @internal
  23688. * @private
  23689. */
  23690. class ArmatureDisplayData extends DisplayData {
  23691. static toString(): string;
  23692. inheritAnimation: boolean;
  23693. readonly actions: Array<ActionData>;
  23694. armature: ArmatureData | null;
  23695. protected _onClear(): void;
  23696. /**
  23697. * @private
  23698. */
  23699. addAction(value: ActionData): void;
  23700. }
  23701. /**
  23702. * @internal
  23703. * @private
  23704. */
  23705. class MeshDisplayData extends DisplayData {
  23706. static toString(): string;
  23707. inheritDeform: boolean;
  23708. offset: number;
  23709. weight: WeightData | null;
  23710. glue: GlueData | null;
  23711. texture: TextureData | null;
  23712. protected _onClear(): void;
  23713. }
  23714. /**
  23715. * @internal
  23716. * @private
  23717. */
  23718. class BoundingBoxDisplayData extends DisplayData {
  23719. static toString(): string;
  23720. boundingBox: BoundingBoxData | null;
  23721. protected _onClear(): void;
  23722. }
  23723. /**
  23724. * @internal
  23725. * @private
  23726. */
  23727. class WeightData extends BaseObject {
  23728. static toString(): string;
  23729. count: number;
  23730. offset: number;
  23731. readonly bones: Array<BoneData>;
  23732. protected _onClear(): void;
  23733. addBone(value: BoneData): void;
  23734. }
  23735. /**
  23736. * @internal
  23737. * @private
  23738. */
  23739. class GlueData extends BaseObject {
  23740. static toString(): string;
  23741. readonly weights: Array<number>;
  23742. readonly meshes: Array<MeshDisplayData | null>;
  23743. protected _onClear(): void;
  23744. addMesh(value: MeshDisplayData | null): void;
  23745. }
  23746. }
  23747. /**
  23748. * The MIT License (MIT)
  23749. *
  23750. * Copyright (c) 2012-2017 DragonBones team and other contributors
  23751. *
  23752. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  23753. * this software and associated documentation files (the "Software"), to deal in
  23754. * the Software without restriction, including without limitation the rights to
  23755. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  23756. * the Software, and to permit persons to whom the Software is furnished to do so,
  23757. * subject to the following conditions:
  23758. *
  23759. * The above copyright notice and this permission notice shall be included in all
  23760. * copies or substantial portions of the Software.
  23761. *
  23762. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23763. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  23764. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23765. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  23766. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23767. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23768. */
  23769. declare namespace dragonBones {
  23770. /**
  23771. * - The base class of bounding box data.
  23772. * @see dragonBones.RectangleData
  23773. * @see dragonBones.EllipseData
  23774. * @see dragonBones.PolygonData
  23775. * @version DragonBones 5.0
  23776. * @language en_US
  23777. */
  23778. /**
  23779. * - 边界框数据基类。
  23780. * @see dragonBones.RectangleData
  23781. * @see dragonBones.EllipseData
  23782. * @see dragonBones.PolygonData
  23783. * @version DragonBones 5.0
  23784. * @language zh_CN
  23785. */
  23786. abstract class BoundingBoxData extends BaseObject {
  23787. /**
  23788. * - The bounding box type.
  23789. * @version DragonBones 5.0
  23790. * @language en_US
  23791. */
  23792. /**
  23793. * - 边界框类型。
  23794. * @version DragonBones 5.0
  23795. * @language zh_CN
  23796. */
  23797. type: BoundingBoxType;
  23798. /**
  23799. * @private
  23800. */
  23801. color: number;
  23802. /**
  23803. * @private
  23804. */
  23805. width: number;
  23806. /**
  23807. * @private
  23808. */
  23809. height: number;
  23810. /**
  23811. * @private
  23812. */
  23813. protected _onClear(): void;
  23814. /**
  23815. * - Check whether the bounding box contains a specific point. (Local coordinate system)
  23816. * @version DragonBones 5.0
  23817. * @language en_US
  23818. */
  23819. /**
  23820. * - 检查边界框是否包含特定点。(本地坐标系)
  23821. * @version DragonBones 5.0
  23822. * @language zh_CN
  23823. */
  23824. abstract containsPoint(pX: number, pY: number): boolean;
  23825. /**
  23826. * - Check whether the bounding box intersects a specific segment. (Local coordinate system)
  23827. * @version DragonBones 5.0
  23828. * @language en_US
  23829. */
  23830. /**
  23831. * - 检查边界框是否与特定线段相交。(本地坐标系)
  23832. * @version DragonBones 5.0
  23833. * @language zh_CN
  23834. */
  23835. abstract intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA: {
  23836. x: number;
  23837. y: number;
  23838. } | null, intersectionPointB: {
  23839. x: number;
  23840. y: number;
  23841. } | null, normalRadians: {
  23842. x: number;
  23843. y: number;
  23844. } | null): number;
  23845. }
  23846. /**
  23847. * - The rectangle bounding box data.
  23848. * @version DragonBones 5.1
  23849. * @language en_US
  23850. */
  23851. /**
  23852. * - 矩形边界框数据。
  23853. * @version DragonBones 5.1
  23854. * @language zh_CN
  23855. */
  23856. class RectangleBoundingBoxData extends BoundingBoxData {
  23857. static toString(): string;
  23858. /**
  23859. * - Compute the bit code for a point (x, y) using the clip rectangle
  23860. */
  23861. private static _computeOutCode(x, y, xMin, yMin, xMax, yMax);
  23862. /**
  23863. * @private
  23864. */
  23865. static rectangleIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xMin: number, yMin: number, xMax: number, yMax: number, intersectionPointA?: {
  23866. x: number;
  23867. y: number;
  23868. } | null, intersectionPointB?: {
  23869. x: number;
  23870. y: number;
  23871. } | null, normalRadians?: {
  23872. x: number;
  23873. y: number;
  23874. } | null): number;
  23875. /**
  23876. * @inheritDoc
  23877. * @private
  23878. */
  23879. protected _onClear(): void;
  23880. /**
  23881. * @inheritDoc
  23882. */
  23883. containsPoint(pX: number, pY: number): boolean;
  23884. /**
  23885. * @inheritDoc
  23886. */
  23887. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23888. x: number;
  23889. y: number;
  23890. } | null, intersectionPointB?: {
  23891. x: number;
  23892. y: number;
  23893. } | null, normalRadians?: {
  23894. x: number;
  23895. y: number;
  23896. } | null): number;
  23897. }
  23898. /**
  23899. * - The ellipse bounding box data.
  23900. * @version DragonBones 5.1
  23901. * @language en_US
  23902. */
  23903. /**
  23904. * - 椭圆边界框数据。
  23905. * @version DragonBones 5.1
  23906. * @language zh_CN
  23907. */
  23908. class EllipseBoundingBoxData extends BoundingBoxData {
  23909. static toString(): string;
  23910. /**
  23911. * @private
  23912. */
  23913. static ellipseIntersectsSegment(xA: number, yA: number, xB: number, yB: number, xC: number, yC: number, widthH: number, heightH: number, intersectionPointA?: {
  23914. x: number;
  23915. y: number;
  23916. } | null, intersectionPointB?: {
  23917. x: number;
  23918. y: number;
  23919. } | null, normalRadians?: {
  23920. x: number;
  23921. y: number;
  23922. } | null): number;
  23923. /**
  23924. * @inheritDoc
  23925. * @private
  23926. */
  23927. protected _onClear(): void;
  23928. /**
  23929. * @inheritDoc
  23930. */
  23931. containsPoint(pX: number, pY: number): boolean;
  23932. /**
  23933. * @inheritDoc
  23934. */
  23935. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  23936. x: number;
  23937. y: number;
  23938. } | null, intersectionPointB?: {
  23939. x: number;
  23940. y: number;
  23941. } | null, normalRadians?: {
  23942. x: number;
  23943. y: number;
  23944. } | null): number;
  23945. }
  23946. /**
  23947. * - The polygon bounding box data.
  23948. * @version DragonBones 5.1
  23949. * @language en_US
  23950. */
  23951. /**
  23952. * - 多边形边界框数据。
  23953. * @version DragonBones 5.1
  23954. * @language zh_CN
  23955. */
  23956. class PolygonBoundingBoxData extends BoundingBoxData {
  23957. static toString(): string;
  23958. /**
  23959. * @private
  23960. */
  23961. static polygonIntersectsSegment(xA: number, yA: number, xB: number, yB: number, vertices: Array<number>, intersectionPointA?: {
  23962. x: number;
  23963. y: number;
  23964. } | null, intersectionPointB?: {
  23965. x: number;
  23966. y: number;
  23967. } | null, normalRadians?: {
  23968. x: number;
  23969. y: number;
  23970. } | null): number;
  23971. /**
  23972. * @private
  23973. */
  23974. x: number;
  23975. /**
  23976. * @private
  23977. */
  23978. y: number;
  23979. /**
  23980. * - The polygon vertices.
  23981. * @version DragonBones 5.1
  23982. * @language en_US
  23983. */
  23984. /**
  23985. * - 多边形顶点。
  23986. * @version DragonBones 5.1
  23987. * @language zh_CN
  23988. */
  23989. readonly vertices: Array<number>;
  23990. /**
  23991. * @private
  23992. */
  23993. weight: WeightData | null;
  23994. /**
  23995. * @inheritDoc
  23996. * @private
  23997. */
  23998. protected _onClear(): void;
  23999. /**
  24000. * @inheritDoc
  24001. */
  24002. containsPoint(pX: number, pY: number): boolean;
  24003. /**
  24004. * @inheritDoc
  24005. */
  24006. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  24007. x: number;
  24008. y: number;
  24009. } | null, intersectionPointB?: {
  24010. x: number;
  24011. y: number;
  24012. } | null, normalRadians?: {
  24013. x: number;
  24014. y: number;
  24015. } | null): number;
  24016. }
  24017. }
  24018. /**
  24019. * The MIT License (MIT)
  24020. *
  24021. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24022. *
  24023. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24024. * this software and associated documentation files (the "Software"), to deal in
  24025. * the Software without restriction, including without limitation the rights to
  24026. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24027. * the Software, and to permit persons to whom the Software is furnished to do so,
  24028. * subject to the following conditions:
  24029. *
  24030. * The above copyright notice and this permission notice shall be included in all
  24031. * copies or substantial portions of the Software.
  24032. *
  24033. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24034. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24035. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24036. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24037. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24038. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24039. */
  24040. declare namespace dragonBones {
  24041. /**
  24042. * - The animation data.
  24043. * @version DragonBones 3.0
  24044. * @language en_US
  24045. */
  24046. /**
  24047. * - 动画数据。
  24048. * @version DragonBones 3.0
  24049. * @language zh_CN
  24050. */
  24051. class AnimationData extends BaseObject {
  24052. static toString(): string;
  24053. /**
  24054. * - FrameIntArray.
  24055. * @internal
  24056. * @private
  24057. */
  24058. frameIntOffset: number;
  24059. /**
  24060. * - FrameFloatArray.
  24061. * @internal
  24062. * @private
  24063. */
  24064. frameFloatOffset: number;
  24065. /**
  24066. * - FrameArray.
  24067. * @internal
  24068. * @private
  24069. */
  24070. frameOffset: number;
  24071. /**
  24072. * - The frame count of the animation.
  24073. * @version DragonBones 3.0
  24074. * @language en_US
  24075. */
  24076. /**
  24077. * - 动画的帧数。
  24078. * @version DragonBones 3.0
  24079. * @language zh_CN
  24080. */
  24081. frameCount: number;
  24082. /**
  24083. * - The play times of the animation. [0: Loop play, [1~N]: Play N times]
  24084. * @version DragonBones 3.0
  24085. * @language en_US
  24086. */
  24087. /**
  24088. * - 动画的播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  24089. * @version DragonBones 3.0
  24090. * @language zh_CN
  24091. */
  24092. playTimes: number;
  24093. /**
  24094. * - The duration of the animation. (In seconds)
  24095. * @version DragonBones 3.0
  24096. * @language en_US
  24097. */
  24098. /**
  24099. * - 动画的持续时间。 (以秒为单位)
  24100. * @version DragonBones 3.0
  24101. * @language zh_CN
  24102. */
  24103. duration: number;
  24104. /**
  24105. * @private
  24106. */
  24107. scale: number;
  24108. /**
  24109. * - The fade in time of the animation. (In seconds)
  24110. * @version DragonBones 3.0
  24111. * @language en_US
  24112. */
  24113. /**
  24114. * - 动画的淡入时间。 (以秒为单位)
  24115. * @version DragonBones 3.0
  24116. * @language zh_CN
  24117. */
  24118. fadeInTime: number;
  24119. /**
  24120. * @private
  24121. */
  24122. cacheFrameRate: number;
  24123. /**
  24124. * - The animation name.
  24125. * @version DragonBones 3.0
  24126. * @language en_US
  24127. */
  24128. /**
  24129. * - 动画名称。
  24130. * @version DragonBones 3.0
  24131. * @language zh_CN
  24132. */
  24133. name: string;
  24134. /**
  24135. * @private
  24136. */
  24137. readonly cachedFrames: Array<boolean>;
  24138. /**
  24139. * @private
  24140. */
  24141. readonly boneTimelines: Map<Array<TimelineData>>;
  24142. /**
  24143. * @private
  24144. */
  24145. readonly surfaceTimelines: Map<Array<TimelineData>>;
  24146. /**
  24147. * @private
  24148. */
  24149. readonly slotTimelines: Map<Array<TimelineData>>;
  24150. /**
  24151. * @private
  24152. */
  24153. readonly constraintTimelines: Map<Array<TimelineData>>;
  24154. /**
  24155. * @private
  24156. */
  24157. readonly animationTimelines: Map<Array<TimelineData>>;
  24158. /**
  24159. * @private
  24160. */
  24161. readonly boneCachedFrameIndices: Map<Array<number>>;
  24162. /**
  24163. * @private
  24164. */
  24165. readonly slotCachedFrameIndices: Map<Array<number>>;
  24166. /**
  24167. * @private
  24168. */
  24169. actionTimeline: TimelineData | null;
  24170. /**
  24171. * @private
  24172. */
  24173. zOrderTimeline: TimelineData | null;
  24174. /**
  24175. * @private
  24176. */
  24177. parent: ArmatureData;
  24178. /**
  24179. * @inheritDoc
  24180. */
  24181. protected _onClear(): void;
  24182. /**
  24183. * @internal
  24184. * @private
  24185. */
  24186. cacheFrames(frameRate: number): void;
  24187. /**
  24188. * @private
  24189. */
  24190. addBoneTimeline(bone: BoneData, timeline: TimelineData): void;
  24191. /**
  24192. * @private
  24193. */
  24194. addSurfaceTimeline(surface: SurfaceData, timeline: TimelineData): void;
  24195. /**
  24196. * @private
  24197. */
  24198. addSlotTimeline(slot: SlotData, timeline: TimelineData): void;
  24199. /**
  24200. * @private
  24201. */
  24202. addConstraintTimeline(constraint: ConstraintData, timeline: TimelineData): void;
  24203. /**
  24204. * @private
  24205. */
  24206. addAnimationTimeline(name: string, timeline: TimelineData): void;
  24207. /**
  24208. * @private
  24209. */
  24210. getBoneTimelines(name: string): Array<TimelineData> | null;
  24211. /**
  24212. * @private
  24213. */
  24214. getSurfaceTimelines(name: string): Array<TimelineData> | null;
  24215. /**
  24216. * @private
  24217. */
  24218. getSlotTimelines(name: string): Array<TimelineData> | null;
  24219. /**
  24220. * @private
  24221. */
  24222. getConstraintTimelines(name: string): Array<TimelineData> | null;
  24223. /**
  24224. * @private
  24225. */
  24226. getAnimationTimelines(name: string): Array<TimelineData> | null;
  24227. /**
  24228. * @private
  24229. */
  24230. getBoneCachedFrameIndices(name: string): Array<number> | null;
  24231. /**
  24232. * @private
  24233. */
  24234. getSlotCachedFrameIndices(name: string): Array<number> | null;
  24235. }
  24236. /**
  24237. * @internal
  24238. * @private
  24239. */
  24240. class TimelineData extends BaseObject {
  24241. static toString(): string;
  24242. type: TimelineType;
  24243. offset: number;
  24244. frameIndicesOffset: number;
  24245. protected _onClear(): void;
  24246. }
  24247. }
  24248. /**
  24249. * The MIT License (MIT)
  24250. *
  24251. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24252. *
  24253. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24254. * this software and associated documentation files (the "Software"), to deal in
  24255. * the Software without restriction, including without limitation the rights to
  24256. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24257. * the Software, and to permit persons to whom the Software is furnished to do so,
  24258. * subject to the following conditions:
  24259. *
  24260. * The above copyright notice and this permission notice shall be included in all
  24261. * copies or substantial portions of the Software.
  24262. *
  24263. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24264. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24265. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24266. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24267. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24268. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24269. */
  24270. declare namespace dragonBones {
  24271. /**
  24272. * - The animation config is used to describe all the information needed to play an animation state.
  24273. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  24274. * @see dragonBones.AnimationState
  24275. * @beta
  24276. * @version DragonBones 5.0
  24277. * @language en_US
  24278. */
  24279. /**
  24280. * - 动画配置用来描述播放一个动画状态所需要的全部信息。
  24281. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  24282. * @see dragonBones.AnimationState
  24283. * @beta
  24284. * @version DragonBones 5.0
  24285. * @language zh_CN
  24286. */
  24287. class AnimationConfig extends BaseObject {
  24288. static toString(): string;
  24289. /**
  24290. * @private
  24291. */
  24292. pauseFadeOut: boolean;
  24293. /**
  24294. * - Fade out the pattern of other animation states when the animation state is fade in.
  24295. * This property is typically used to specify the substitution of multiple animation states blend.
  24296. * @default dragonBones.AnimationFadeOutMode.All
  24297. * @version DragonBones 5.0
  24298. * @language en_US
  24299. */
  24300. /**
  24301. * - 淡入动画状态时淡出其他动画状态的模式。
  24302. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  24303. * @default dragonBones.AnimationFadeOutMode.All
  24304. * @version DragonBones 5.0
  24305. * @language zh_CN
  24306. */
  24307. fadeOutMode: AnimationFadeOutMode;
  24308. /**
  24309. * @private
  24310. */
  24311. fadeOutTweenType: TweenType;
  24312. /**
  24313. * @private
  24314. */
  24315. fadeOutTime: number;
  24316. /**
  24317. * @private
  24318. */
  24319. pauseFadeIn: boolean;
  24320. /**
  24321. * @private
  24322. */
  24323. actionEnabled: boolean;
  24324. /**
  24325. * @private
  24326. */
  24327. additiveBlending: boolean;
  24328. /**
  24329. * - Whether the animation state has control over the display property of the slots.
  24330. * Sometimes blend a animation state does not want it to control the display properties of the slots,
  24331. * especially if other animation state are controlling the display properties of the slots.
  24332. * @default true
  24333. * @version DragonBones 5.0
  24334. * @language en_US
  24335. */
  24336. /**
  24337. * - 动画状态是否对插槽的显示对象属性有控制权。
  24338. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  24339. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  24340. * @default true
  24341. * @version DragonBones 5.0
  24342. * @language zh_CN
  24343. */
  24344. displayControl: boolean;
  24345. /**
  24346. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  24347. * This property should usually be set to false when blend multiple animation states.
  24348. * @default true
  24349. * @version DragonBones 5.1
  24350. * @language en_US
  24351. */
  24352. /**
  24353. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  24354. * 通常在混合多个动画状态时应该将该属性设置为 false。
  24355. * @default true
  24356. * @version DragonBones 5.1
  24357. * @language zh_CN
  24358. */
  24359. resetToPose: boolean;
  24360. /**
  24361. * @private
  24362. */
  24363. fadeInTweenType: TweenType;
  24364. /**
  24365. * - The play times. [0: Loop play, [1~N]: Play N times]
  24366. * @version DragonBones 3.0
  24367. * @language en_US
  24368. */
  24369. /**
  24370. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  24371. * @version DragonBones 3.0
  24372. * @language zh_CN
  24373. */
  24374. playTimes: number;
  24375. /**
  24376. * - The blend layer.
  24377. * High layer animation state will get the blend weight first.
  24378. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  24379. * @readonly
  24380. * @version DragonBones 5.0
  24381. * @language en_US
  24382. */
  24383. /**
  24384. * - 混合图层。
  24385. * 图层高的动画状态会优先获取混合权重。
  24386. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  24387. * @readonly
  24388. * @version DragonBones 5.0
  24389. * @language zh_CN
  24390. */
  24391. layer: number;
  24392. /**
  24393. * - The start time of play. (In seconds)
  24394. * @default 0.0
  24395. * @version DragonBones 5.0
  24396. * @language en_US
  24397. */
  24398. /**
  24399. * - 播放的开始时间。 (以秒为单位)
  24400. * @default 0.0
  24401. * @version DragonBones 5.0
  24402. * @language zh_CN
  24403. */
  24404. position: number;
  24405. /**
  24406. * - The duration of play.
  24407. * [-1: Use the default value of the animation data, 0: Stop play, (0~N]: The duration] (In seconds)
  24408. * @default -1.0
  24409. * @version DragonBones 5.0
  24410. * @language en_US
  24411. */
  24412. /**
  24413. * - 播放的持续时间。
  24414. * [-1: 使用动画数据默认值, 0: 动画停止, (0~N]: 持续时间] (以秒为单位)
  24415. * @default -1.0
  24416. * @version DragonBones 5.0
  24417. * @language zh_CN
  24418. */
  24419. duration: number;
  24420. /**
  24421. * - The play speed.
  24422. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  24423. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  24424. * @default 1.0
  24425. * @version DragonBones 3.0
  24426. * @language en_US
  24427. */
  24428. /**
  24429. * - 播放速度。
  24430. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  24431. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  24432. * @default 1.0
  24433. * @version DragonBones 3.0
  24434. * @language zh_CN
  24435. */
  24436. timeScale: number;
  24437. /**
  24438. * - The blend weight.
  24439. * @default 1.0
  24440. * @version DragonBones 5.0
  24441. * @language en_US
  24442. */
  24443. /**
  24444. * - 混合权重。
  24445. * @default 1.0
  24446. * @version DragonBones 5.0
  24447. * @language zh_CN
  24448. */
  24449. weight: number;
  24450. /**
  24451. * - The fade in time.
  24452. * [-1: Use the default value of the animation data, [0~N]: The fade in time] (In seconds)
  24453. * @default -1.0
  24454. * @version DragonBones 5.0
  24455. * @language en_US
  24456. */
  24457. /**
  24458. * - 淡入时间。
  24459. * [-1: 使用动画数据默认值, [0~N]: 淡入时间] (以秒为单位)
  24460. * @default -1.0
  24461. * @version DragonBones 5.0
  24462. * @language zh_CN
  24463. */
  24464. fadeInTime: number;
  24465. /**
  24466. * - The auto fade out time when the animation state play completed.
  24467. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  24468. * @default -1.0
  24469. * @version DragonBones 5.0
  24470. * @language en_US
  24471. */
  24472. /**
  24473. * - 动画状态播放完成后的自动淡出时间。
  24474. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  24475. * @default -1.0
  24476. * @version DragonBones 5.0
  24477. * @language zh_CN
  24478. */
  24479. autoFadeOutTime: number;
  24480. /**
  24481. * - The name of the animation state. (Can be different from the name of the animation data)
  24482. * @version DragonBones 5.0
  24483. * @language en_US
  24484. */
  24485. /**
  24486. * - 动画状态名称。 (可以不同于动画数据)
  24487. * @version DragonBones 5.0
  24488. * @language zh_CN
  24489. */
  24490. name: string;
  24491. /**
  24492. * - The animation data name.
  24493. * @version DragonBones 5.0
  24494. * @language en_US
  24495. */
  24496. /**
  24497. * - 动画数据名称。
  24498. * @version DragonBones 5.0
  24499. * @language zh_CN
  24500. */
  24501. animation: string;
  24502. /**
  24503. * - The blend group name of the animation state.
  24504. * This property is typically used to specify the substitution of multiple animation states blend.
  24505. * @readonly
  24506. * @version DragonBones 5.0
  24507. * @language en_US
  24508. */
  24509. /**
  24510. * - 混合组名称。
  24511. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  24512. * @readonly
  24513. * @version DragonBones 5.0
  24514. * @language zh_CN
  24515. */
  24516. group: string;
  24517. /**
  24518. * @private
  24519. */
  24520. readonly boneMask: Array<string>;
  24521. /**
  24522. * @private
  24523. */
  24524. protected _onClear(): void;
  24525. /**
  24526. * @private
  24527. */
  24528. clear(): void;
  24529. /**
  24530. * @private
  24531. */
  24532. copyFrom(value: AnimationConfig): void;
  24533. /**
  24534. * @private
  24535. */
  24536. containsBoneMask(name: string): boolean;
  24537. /**
  24538. * @private
  24539. */
  24540. addBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  24541. /**
  24542. * @private
  24543. */
  24544. removeBoneMask(armature: Armature, name: string, recursive?: boolean): void;
  24545. }
  24546. }
  24547. /**
  24548. * The MIT License (MIT)
  24549. *
  24550. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24551. *
  24552. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24553. * this software and associated documentation files (the "Software"), to deal in
  24554. * the Software without restriction, including without limitation the rights to
  24555. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24556. * the Software, and to permit persons to whom the Software is furnished to do so,
  24557. * subject to the following conditions:
  24558. *
  24559. * The above copyright notice and this permission notice shall be included in all
  24560. * copies or substantial portions of the Software.
  24561. *
  24562. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24563. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24564. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24565. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24566. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24567. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24568. */
  24569. declare namespace dragonBones {
  24570. /**
  24571. * - The texture atlas data.
  24572. * @version DragonBones 3.0
  24573. * @language en_US
  24574. */
  24575. /**
  24576. * - 贴图集数据。
  24577. * @version DragonBones 3.0
  24578. * @language zh_CN
  24579. */
  24580. abstract class TextureAtlasData extends BaseObject {
  24581. /**
  24582. * @private
  24583. */
  24584. autoSearch: boolean;
  24585. /**
  24586. * @private
  24587. */
  24588. width: number;
  24589. /**
  24590. * @private
  24591. */
  24592. height: number;
  24593. /**
  24594. * @private
  24595. */
  24596. scale: number;
  24597. /**
  24598. * - The texture atlas name.
  24599. * @version DragonBones 3.0
  24600. * @language en_US
  24601. */
  24602. /**
  24603. * - 贴图集名称。
  24604. * @version DragonBones 3.0
  24605. * @language zh_CN
  24606. */
  24607. name: string;
  24608. /**
  24609. * - The image path of the texture atlas.
  24610. * @version DragonBones 3.0
  24611. * @language en_US
  24612. */
  24613. /**
  24614. * - 贴图集图片路径。
  24615. * @version DragonBones 3.0
  24616. * @language zh_CN
  24617. */
  24618. imagePath: string;
  24619. /**
  24620. * @private
  24621. */
  24622. readonly textures: Map<TextureData>;
  24623. /**
  24624. * @inheritDoc
  24625. */
  24626. protected _onClear(): void;
  24627. /**
  24628. * @private
  24629. */
  24630. copyFrom(value: TextureAtlasData): void;
  24631. /**
  24632. * @internal
  24633. * @private
  24634. */
  24635. abstract createTexture(): TextureData;
  24636. /**
  24637. * @internal
  24638. * @private
  24639. */
  24640. addTexture(value: TextureData): void;
  24641. /**
  24642. * @private
  24643. */
  24644. getTexture(name: string): TextureData | null;
  24645. }
  24646. /**
  24647. * @internal
  24648. * @private
  24649. */
  24650. abstract class TextureData extends BaseObject {
  24651. static createRectangle(): Rectangle;
  24652. rotated: boolean;
  24653. name: string;
  24654. readonly region: Rectangle;
  24655. parent: TextureAtlasData;
  24656. frame: Rectangle | null;
  24657. protected _onClear(): void;
  24658. copyFrom(value: TextureData): void;
  24659. }
  24660. }
  24661. /**
  24662. * The MIT License (MIT)
  24663. *
  24664. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24665. *
  24666. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24667. * this software and associated documentation files (the "Software"), to deal in
  24668. * the Software without restriction, including without limitation the rights to
  24669. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24670. * the Software, and to permit persons to whom the Software is furnished to do so,
  24671. * subject to the following conditions:
  24672. *
  24673. * The above copyright notice and this permission notice shall be included in all
  24674. * copies or substantial portions of the Software.
  24675. *
  24676. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24677. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24678. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24679. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24680. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24681. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24682. */
  24683. declare namespace dragonBones {
  24684. /**
  24685. * - The armature proxy interface, the docking engine needs to implement it concretely.
  24686. * @see dragonBones.Armature
  24687. * @version DragonBones 5.0
  24688. * @language en_US
  24689. */
  24690. /**
  24691. * - 骨架代理接口,对接的引擎需要对其进行具体实现。
  24692. * @see dragonBones.Armature
  24693. * @version DragonBones 5.0
  24694. * @language zh_CN
  24695. */
  24696. interface IArmatureProxy extends IEventDispatcher {
  24697. /**
  24698. * @internal
  24699. * @private
  24700. */
  24701. dbInit(armature: Armature): void;
  24702. /**
  24703. * @internal
  24704. * @private
  24705. */
  24706. dbClear(): void;
  24707. /**
  24708. * @internal
  24709. * @private
  24710. */
  24711. dbUpdate(): void;
  24712. /**
  24713. * - Dispose the instance and the Armature instance. (The Armature instance will return to the object pool)
  24714. * @example
  24715. * <pre>
  24716. * removeChild(armatureDisplay);
  24717. * armatureDisplay.dispose();
  24718. * </pre>
  24719. * @version DragonBones 4.5
  24720. * @language en_US
  24721. */
  24722. /**
  24723. * - 释放该实例和骨架。 (骨架会回收到对象池)
  24724. * @example
  24725. * <pre>
  24726. * removeChild(armatureDisplay);
  24727. * armatureDisplay.dispose();
  24728. * </pre>
  24729. * @version DragonBones 4.5
  24730. * @language zh_CN
  24731. */
  24732. dispose(disposeProxy: boolean): void;
  24733. /**
  24734. * - The armature.
  24735. * @version DragonBones 4.5
  24736. * @language en_US
  24737. */
  24738. /**
  24739. * - 骨架。
  24740. * @version DragonBones 4.5
  24741. * @language zh_CN
  24742. */
  24743. readonly armature: Armature;
  24744. /**
  24745. * - The animation player.
  24746. * @version DragonBones 3.0
  24747. * @language en_US
  24748. */
  24749. /**
  24750. * - 动画播放器。
  24751. * @version DragonBones 3.0
  24752. * @language zh_CN
  24753. */
  24754. readonly animation: Animation;
  24755. }
  24756. }
  24757. /**
  24758. * The MIT License (MIT)
  24759. *
  24760. * Copyright (c) 2012-2017 DragonBones team and other contributors
  24761. *
  24762. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  24763. * this software and associated documentation files (the "Software"), to deal in
  24764. * the Software without restriction, including without limitation the rights to
  24765. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  24766. * the Software, and to permit persons to whom the Software is furnished to do so,
  24767. * subject to the following conditions:
  24768. *
  24769. * The above copyright notice and this permission notice shall be included in all
  24770. * copies or substantial portions of the Software.
  24771. *
  24772. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24773. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  24774. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  24775. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24776. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24777. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24778. */
  24779. declare namespace dragonBones {
  24780. /**
  24781. * - Armature is the core of the skeleton animation system.
  24782. * @see dragonBones.ArmatureData
  24783. * @see dragonBones.Bone
  24784. * @see dragonBones.Slot
  24785. * @see dragonBones.Animation
  24786. * @version DragonBones 3.0
  24787. * @language en_US
  24788. */
  24789. /**
  24790. * - 骨架是骨骼动画系统的核心。
  24791. * @see dragonBones.ArmatureData
  24792. * @see dragonBones.Bone
  24793. * @see dragonBones.Slot
  24794. * @see dragonBones.Animation
  24795. * @version DragonBones 3.0
  24796. * @language zh_CN
  24797. */
  24798. class Armature extends BaseObject implements IAnimatable {
  24799. static toString(): string;
  24800. private static _onSortSlots(a, b);
  24801. /**
  24802. * - Whether to inherit the animation control of the parent armature.
  24803. * True to try to have the child armature play an animation with the same name when the parent armature play the animation.
  24804. * @default true
  24805. * @version DragonBones 4.5
  24806. * @language en_US
  24807. */
  24808. /**
  24809. * - 是否继承父骨架的动画控制。
  24810. * 如果该值为 true,当父骨架播放动画时,会尝试让子骨架播放同名动画。
  24811. * @default true
  24812. * @version DragonBones 4.5
  24813. * @language zh_CN
  24814. */
  24815. inheritAnimation: boolean;
  24816. /**
  24817. * @private
  24818. */
  24819. userData: any;
  24820. private _lockUpdate;
  24821. private _bonesDirty;
  24822. private _slotsDirty;
  24823. private _zOrderDirty;
  24824. private _flipX;
  24825. private _flipY;
  24826. /**
  24827. * @internal
  24828. * @private
  24829. */
  24830. _cacheFrameIndex: number;
  24831. private readonly _bones;
  24832. private readonly _slots;
  24833. /**
  24834. * @internal
  24835. * @private
  24836. */
  24837. readonly _glueSlots: Array<Slot>;
  24838. /**
  24839. * @internal
  24840. * @private
  24841. */
  24842. readonly _constraints: Array<Constraint>;
  24843. private readonly _actions;
  24844. /**
  24845. * @internal
  24846. * @private
  24847. */
  24848. _armatureData: ArmatureData;
  24849. private _animation;
  24850. private _proxy;
  24851. private _display;
  24852. /**
  24853. * @internal
  24854. * @private
  24855. */
  24856. _replaceTextureAtlasData: TextureAtlasData | null;
  24857. private _replacedTexture;
  24858. /**
  24859. * @internal
  24860. * @private
  24861. */
  24862. _dragonBones: DragonBones;
  24863. private _clock;
  24864. /**
  24865. * @internal
  24866. * @private
  24867. */
  24868. _parent: Slot | null;
  24869. /**
  24870. * @private
  24871. */
  24872. protected _onClear(): void;
  24873. private _sortBones();
  24874. private _sortSlots();
  24875. /**
  24876. * @internal
  24877. * @private
  24878. */
  24879. _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void;
  24880. /**
  24881. * @internal
  24882. * @private
  24883. */
  24884. _addBoneToBoneList(value: Bone): void;
  24885. /**
  24886. * @internal
  24887. * @private
  24888. */
  24889. _removeBoneFromBoneList(value: Bone): void;
  24890. /**
  24891. * @internal
  24892. * @private
  24893. */
  24894. _addSlotToSlotList(value: Slot): void;
  24895. /**
  24896. * @internal
  24897. * @private
  24898. */
  24899. _removeSlotFromSlotList(value: Slot): void;
  24900. /**
  24901. * @internal
  24902. * @private
  24903. */
  24904. _bufferAction(action: ActionData, append: boolean): void;
  24905. /**
  24906. * - Dispose the armature. (Return to the object pool)
  24907. * @example
  24908. * <pre>
  24909. * removeChild(armature.display);
  24910. * armature.dispose();
  24911. * </pre>
  24912. * @version DragonBones 3.0
  24913. * @language en_US
  24914. */
  24915. /**
  24916. * - 释放骨架。 (回收到对象池)
  24917. * @example
  24918. * <pre>
  24919. * removeChild(armature.display);
  24920. * armature.dispose();
  24921. * </pre>
  24922. * @version DragonBones 3.0
  24923. * @language zh_CN
  24924. */
  24925. dispose(): void;
  24926. /**
  24927. * @internal
  24928. * @private
  24929. */
  24930. init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void;
  24931. /**
  24932. * @inheritDoc
  24933. */
  24934. advanceTime(passedTime: number): void;
  24935. /**
  24936. * - Forces a specific bone or its owning slot to update the transform or display property in the next frame.
  24937. * @param boneName - The bone name. (If not set, all bones will be update)
  24938. * @param updateSlot - Whether to update the bone's slots. (Default: false)
  24939. * @see dragonBones.Bone#invalidUpdate()
  24940. * @see dragonBones.Slot#invalidUpdate()
  24941. * @version DragonBones 3.0
  24942. * @language en_US
  24943. */
  24944. /**
  24945. * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。
  24946. * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼)
  24947. * @param updateSlot - 是否更新骨骼的插槽。 (默认: false)
  24948. * @see dragonBones.Bone#invalidUpdate()
  24949. * @see dragonBones.Slot#invalidUpdate()
  24950. * @version DragonBones 3.0
  24951. * @language zh_CN
  24952. */
  24953. invalidUpdate(boneName?: string | null, updateSlot?: boolean): void;
  24954. /**
  24955. * - Check whether a specific point is inside a custom bounding box in a slot.
  24956. * The coordinate system of the point is the inner coordinate system of the armature.
  24957. * Custom bounding boxes need to be customized in Dragonbones Pro.
  24958. * @param x - The horizontal coordinate of the point.
  24959. * @param y - The vertical coordinate of the point.
  24960. * @version DragonBones 5.0
  24961. * @language en_US
  24962. */
  24963. /**
  24964. * - 检查特定点是否在某个插槽的自定义边界框内。
  24965. * 点的坐标系为骨架内坐标系。
  24966. * 自定义边界框需要在 DragonBones Pro 中自定义。
  24967. * @param x - 点的水平坐标。
  24968. * @param y - 点的垂直坐标。
  24969. * @version DragonBones 5.0
  24970. * @language zh_CN
  24971. */
  24972. containsPoint(x: number, y: number): Slot | null;
  24973. /**
  24974. * - Check whether a specific segment intersects a custom bounding box for a slot in the armature.
  24975. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  24976. * Custom bounding boxes need to be customized in Dragonbones Pro.
  24977. * @param xA - The horizontal coordinate of the beginning of the segment.
  24978. * @param yA - The vertical coordinate of the beginning of the segment.
  24979. * @param xB - The horizontal coordinate of the end point of the segment.
  24980. * @param yB - The vertical coordinate of the end point of the segment.
  24981. * @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)
  24982. * @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)
  24983. * @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)
  24984. * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point.
  24985. * @version DragonBones 5.0
  24986. * @language en_US
  24987. */
  24988. /**
  24989. * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。
  24990. * 线段和交点的坐标系均为骨架内坐标系。
  24991. * 自定义边界框需要在 DragonBones Pro 中自定义。
  24992. * @param xA - 线段起点的水平坐标。
  24993. * @param yA - 线段起点的垂直坐标。
  24994. * @param xB - 线段终点的水平坐标。
  24995. * @param yB - 线段终点的垂直坐标。
  24996. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  24997. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  24998. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  24999. * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。
  25000. * @version DragonBones 5.0
  25001. * @language zh_CN
  25002. */
  25003. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  25004. x: number;
  25005. y: number;
  25006. } | null, intersectionPointB?: {
  25007. x: number;
  25008. y: number;
  25009. } | null, normalRadians?: {
  25010. x: number;
  25011. y: number;
  25012. } | null): Slot | null;
  25013. /**
  25014. * - Get a specific bone.
  25015. * @param name - The bone name.
  25016. * @see dragonBones.Bone
  25017. * @version DragonBones 3.0
  25018. * @language en_US
  25019. */
  25020. /**
  25021. * - 获取特定的骨骼。
  25022. * @param name - 骨骼名称。
  25023. * @see dragonBones.Bone
  25024. * @version DragonBones 3.0
  25025. * @language zh_CN
  25026. */
  25027. getBone(name: string): Bone | null;
  25028. /**
  25029. * - Get a specific bone by the display.
  25030. * @param display - The display object.
  25031. * @see dragonBones.Bone
  25032. * @version DragonBones 3.0
  25033. * @language en_US
  25034. */
  25035. /**
  25036. * - 通过显示对象获取特定的骨骼。
  25037. * @param display - 显示对象。
  25038. * @see dragonBones.Bone
  25039. * @version DragonBones 3.0
  25040. * @language zh_CN
  25041. */
  25042. getBoneByDisplay(display: any): Bone | null;
  25043. /**
  25044. * - Get a specific slot.
  25045. * @param name - The slot name.
  25046. * @see dragonBones.Slot
  25047. * @version DragonBones 3.0
  25048. * @language en_US
  25049. */
  25050. /**
  25051. * - 获取特定的插槽。
  25052. * @param name - 插槽名称。
  25053. * @see dragonBones.Slot
  25054. * @version DragonBones 3.0
  25055. * @language zh_CN
  25056. */
  25057. getSlot(name: string): Slot | null;
  25058. /**
  25059. * - Get a specific slot by the display.
  25060. * @param display - The display object.
  25061. * @see dragonBones.Slot
  25062. * @version DragonBones 3.0
  25063. * @language en_US
  25064. */
  25065. /**
  25066. * - 通过显示对象获取特定的插槽。
  25067. * @param display - 显示对象。
  25068. * @see dragonBones.Slot
  25069. * @version DragonBones 3.0
  25070. * @language zh_CN
  25071. */
  25072. getSlotByDisplay(display: any): Slot | null;
  25073. /**
  25074. * @deprecated
  25075. */
  25076. addBone(value: Bone, parentName: string): void;
  25077. /**
  25078. * @deprecated
  25079. */
  25080. addSlot(value: Slot, parentName: string): void;
  25081. /**
  25082. * @private
  25083. */
  25084. addConstraint(value: Constraint): void;
  25085. /**
  25086. * @deprecated
  25087. */
  25088. removeBone(value: Bone): void;
  25089. /**
  25090. * @deprecated
  25091. */
  25092. removeSlot(value: Slot): void;
  25093. /**
  25094. * - Get all bones.
  25095. * @see dragonBones.Bone
  25096. * @version DragonBones 3.0
  25097. * @language en_US
  25098. */
  25099. /**
  25100. * - 获取所有的骨骼。
  25101. * @see dragonBones.Bone
  25102. * @version DragonBones 3.0
  25103. * @language zh_CN
  25104. */
  25105. getBones(): Array<Bone>;
  25106. /**
  25107. * - Get all slots.
  25108. * @see dragonBones.Slot
  25109. * @version DragonBones 3.0
  25110. * @language en_US
  25111. */
  25112. /**
  25113. * - 获取所有的插槽。
  25114. * @see dragonBones.Slot
  25115. * @version DragonBones 3.0
  25116. * @language zh_CN
  25117. */
  25118. getSlots(): Array<Slot>;
  25119. /**
  25120. * - Whether to flip the armature horizontally.
  25121. * @version DragonBones 5.5
  25122. * @language en_US
  25123. */
  25124. /**
  25125. * - 是否将骨架水平翻转。
  25126. * @version DragonBones 5.5
  25127. * @language zh_CN
  25128. */
  25129. flipX: boolean;
  25130. /**
  25131. * - Whether to flip the armature vertically.
  25132. * @version DragonBones 5.5
  25133. * @language en_US
  25134. */
  25135. /**
  25136. * - 是否将骨架垂直翻转。
  25137. * @version DragonBones 5.5
  25138. * @language zh_CN
  25139. */
  25140. flipY: boolean;
  25141. /**
  25142. * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0.
  25143. * There is a certain amount of memory overhead to improve performance by caching animation data in memory.
  25144. * 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.
  25145. * When the animation cache is turned on, some features will fail, such as the offset property of bone.
  25146. * @example
  25147. * <pre>
  25148. * armature.cacheFrameRate = 24;
  25149. * </pre>
  25150. * @see dragonBones.DragonBonesData#frameRate
  25151. * @see dragonBones.ArmatureData#frameRate
  25152. * @version DragonBones 4.5
  25153. * @language en_US
  25154. */
  25155. /**
  25156. * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。
  25157. * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。
  25158. * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。
  25159. * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。
  25160. * @example
  25161. * <pre>
  25162. * armature.cacheFrameRate = 24;
  25163. * </pre>
  25164. * @see dragonBones.DragonBonesData#frameRate
  25165. * @see dragonBones.ArmatureData#frameRate
  25166. * @version DragonBones 4.5
  25167. * @language zh_CN
  25168. */
  25169. cacheFrameRate: number;
  25170. /**
  25171. * - The armature name.
  25172. * @version DragonBones 3.0
  25173. * @language en_US
  25174. */
  25175. /**
  25176. * - 骨架名称。
  25177. * @version DragonBones 3.0
  25178. * @language zh_CN
  25179. */
  25180. readonly name: string;
  25181. /**
  25182. * - The armature data.
  25183. * @see dragonBones.ArmatureData
  25184. * @version DragonBones 4.5
  25185. * @language en_US
  25186. */
  25187. /**
  25188. * - 骨架数据。
  25189. * @see dragonBones.ArmatureData
  25190. * @version DragonBones 4.5
  25191. * @language zh_CN
  25192. */
  25193. readonly armatureData: ArmatureData;
  25194. /**
  25195. * - The animation player.
  25196. * @see dragonBones.Animation
  25197. * @version DragonBones 3.0
  25198. * @language en_US
  25199. */
  25200. /**
  25201. * - 动画播放器。
  25202. * @see dragonBones.Animation
  25203. * @version DragonBones 3.0
  25204. * @language zh_CN
  25205. */
  25206. readonly animation: Animation;
  25207. /**
  25208. * @pivate
  25209. */
  25210. readonly proxy: IArmatureProxy;
  25211. /**
  25212. * - The EventDispatcher instance of the armature.
  25213. * @version DragonBones 4.5
  25214. * @language en_US
  25215. */
  25216. /**
  25217. * - 该骨架的 EventDispatcher 实例。
  25218. * @version DragonBones 4.5
  25219. * @language zh_CN
  25220. */
  25221. readonly eventDispatcher: IEventDispatcher;
  25222. /**
  25223. * - The display container.
  25224. * The display of the slot is displayed as the parent.
  25225. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.
  25226. * @version DragonBones 3.0
  25227. * @language en_US
  25228. */
  25229. /**
  25230. * - 显示容器实例。
  25231. * 插槽的显示对象都会以此显示容器为父级。
  25232. * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。
  25233. * @version DragonBones 3.0
  25234. * @language zh_CN
  25235. */
  25236. readonly display: any;
  25237. /**
  25238. * @private
  25239. */
  25240. replacedTexture: any;
  25241. /**
  25242. * @inheritDoc
  25243. */
  25244. clock: WorldClock | null;
  25245. /**
  25246. * - Get the parent slot which the armature belongs to.
  25247. * @see dragonBones.Slot
  25248. * @version DragonBones 4.5
  25249. * @language en_US
  25250. */
  25251. /**
  25252. * - 该骨架所属的父插槽。
  25253. * @see dragonBones.Slot
  25254. * @version DragonBones 4.5
  25255. * @language zh_CN
  25256. */
  25257. readonly parent: Slot | null;
  25258. /**
  25259. * @deprecated
  25260. * @private
  25261. */
  25262. replaceTexture(texture: any): void;
  25263. /**
  25264. * - Deprecated, please refer to {@link #eventDispatcher}.
  25265. * @deprecated
  25266. * @language en_US
  25267. */
  25268. /**
  25269. * - 已废弃,请参考 {@link #eventDispatcher}。
  25270. * @deprecated
  25271. * @language zh_CN
  25272. */
  25273. hasEventListener(type: EventStringType): boolean;
  25274. /**
  25275. * - Deprecated, please refer to {@link #eventDispatcher}.
  25276. * @deprecated
  25277. * @language en_US
  25278. */
  25279. /**
  25280. * - 已废弃,请参考 {@link #eventDispatcher}。
  25281. * @deprecated
  25282. * @language zh_CN
  25283. */
  25284. addEventListener(type: EventStringType, listener: Function, target: any): void;
  25285. /**
  25286. * - Deprecated, please refer to {@link #eventDispatcher}.
  25287. * @deprecated
  25288. * @language en_US
  25289. */
  25290. /**
  25291. * - 已废弃,请参考 {@link #eventDispatcher}。
  25292. * @deprecated
  25293. * @language zh_CN
  25294. */
  25295. removeEventListener(type: EventStringType, listener: Function, target: any): void;
  25296. /**
  25297. * - Deprecated, please refer to {@link #cacheFrameRate}.
  25298. * @deprecated
  25299. * @language en_US
  25300. */
  25301. /**
  25302. * - 已废弃,请参考 {@link #cacheFrameRate}。
  25303. * @deprecated
  25304. * @language zh_CN
  25305. */
  25306. enableAnimationCache(frameRate: number): void;
  25307. /**
  25308. * - Deprecated, please refer to {@link #display}.
  25309. * @deprecated
  25310. * @language en_US
  25311. */
  25312. /**
  25313. * - 已废弃,请参考 {@link #display}。
  25314. * @deprecated
  25315. * @language zh_CN
  25316. */
  25317. getDisplay(): any;
  25318. }
  25319. }
  25320. /**
  25321. * The MIT License (MIT)
  25322. *
  25323. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25324. *
  25325. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25326. * this software and associated documentation files (the "Software"), to deal in
  25327. * the Software without restriction, including without limitation the rights to
  25328. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25329. * the Software, and to permit persons to whom the Software is furnished to do so,
  25330. * subject to the following conditions:
  25331. *
  25332. * The above copyright notice and this permission notice shall be included in all
  25333. * copies or substantial portions of the Software.
  25334. *
  25335. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25336. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25337. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25338. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25339. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25340. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25341. */
  25342. declare namespace dragonBones {
  25343. /**
  25344. * - The base class of the transform object.
  25345. * @see dragonBones.Transform
  25346. * @version DragonBones 4.5
  25347. * @language en_US
  25348. */
  25349. /**
  25350. * - 变换对象的基类。
  25351. * @see dragonBones.Transform
  25352. * @version DragonBones 4.5
  25353. * @language zh_CN
  25354. */
  25355. abstract class TransformObject extends BaseObject {
  25356. /**
  25357. * @private
  25358. */
  25359. protected static readonly _helpMatrix: Matrix;
  25360. /**
  25361. * @private
  25362. */
  25363. protected static readonly _helpTransform: Transform;
  25364. /**
  25365. * @private
  25366. */
  25367. protected static readonly _helpPoint: Point;
  25368. /**
  25369. * - A matrix relative to the armature coordinate system.
  25370. * @version DragonBones 3.0
  25371. * @language en_US
  25372. */
  25373. /**
  25374. * - 相对于骨架坐标系的矩阵。
  25375. * @version DragonBones 3.0
  25376. * @language zh_CN
  25377. */
  25378. readonly globalTransformMatrix: Matrix;
  25379. /**
  25380. * - A transform relative to the armature coordinate system.
  25381. * @see #updateGlobalTransform()
  25382. * @version DragonBones 3.0
  25383. * @language en_US
  25384. */
  25385. /**
  25386. * - 相对于骨架坐标系的变换。
  25387. * @see #updateGlobalTransform()
  25388. * @version DragonBones 3.0
  25389. * @language zh_CN
  25390. */
  25391. readonly global: Transform;
  25392. /**
  25393. * - The offset transform relative to the armature or the parent bone coordinate system.
  25394. * @see #dragonBones.Bone#invalidUpdate()
  25395. * @version DragonBones 3.0
  25396. * @language en_US
  25397. */
  25398. /**
  25399. * - 相对于骨架或父骨骼坐标系的偏移变换。
  25400. * @see #dragonBones.Bone#invalidUpdate()
  25401. * @version DragonBones 3.0
  25402. * @language zh_CN
  25403. */
  25404. readonly offset: Transform;
  25405. /**
  25406. * @private
  25407. */
  25408. origin: Transform | null;
  25409. /**
  25410. * @private
  25411. */
  25412. userData: any;
  25413. /**
  25414. * @private
  25415. */
  25416. protected _globalDirty: boolean;
  25417. /**
  25418. * @internal
  25419. * @private
  25420. */
  25421. _armature: Armature;
  25422. /**
  25423. * @internal
  25424. * @private
  25425. */
  25426. _parent: Bone;
  25427. /**
  25428. * @private
  25429. */
  25430. protected _onClear(): void;
  25431. /**
  25432. * @internal
  25433. * @private
  25434. */
  25435. _setArmature(value: Armature | null): void;
  25436. /**
  25437. * @internal
  25438. * @private
  25439. */
  25440. _setParent(value: Bone | null): void;
  25441. /**
  25442. * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
  25443. * some engines do not rely on these attributes to update rendering, such as Egret.
  25444. * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
  25445. * @example
  25446. * <pre>
  25447. * bone.updateGlobalTransform();
  25448. * let rotation = bone.global.rotation;
  25449. * </pre>
  25450. * @version DragonBones 3.0
  25451. * @language en_US
  25452. */
  25453. /**
  25454. * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。
  25455. * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。
  25456. * @example
  25457. * <pre>
  25458. * bone.updateGlobalTransform();
  25459. * let rotation = bone.global.rotation;
  25460. * </pre>
  25461. * @version DragonBones 3.0
  25462. * @language zh_CN
  25463. */
  25464. updateGlobalTransform(): void;
  25465. /**
  25466. * - The armature to which it belongs.
  25467. * @version DragonBones 3.0
  25468. * @language en_US
  25469. */
  25470. /**
  25471. * - 所属的骨架。
  25472. * @version DragonBones 3.0
  25473. * @language zh_CN
  25474. */
  25475. readonly armature: Armature;
  25476. /**
  25477. * - The parent bone to which it belongs.
  25478. * @version DragonBones 3.0
  25479. * @language en_US
  25480. */
  25481. /**
  25482. * - 所属的父骨骼。
  25483. * @version DragonBones 3.0
  25484. * @language zh_CN
  25485. */
  25486. readonly parent: Bone;
  25487. }
  25488. }
  25489. /**
  25490. * The MIT License (MIT)
  25491. *
  25492. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25493. *
  25494. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25495. * this software and associated documentation files (the "Software"), to deal in
  25496. * the Software without restriction, including without limitation the rights to
  25497. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25498. * the Software, and to permit persons to whom the Software is furnished to do so,
  25499. * subject to the following conditions:
  25500. *
  25501. * The above copyright notice and this permission notice shall be included in all
  25502. * copies or substantial portions of the Software.
  25503. *
  25504. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25505. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25506. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25507. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25508. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25509. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25510. */
  25511. declare namespace dragonBones {
  25512. /**
  25513. * - Bone is one of the most important logical units in the armature animation system,
  25514. * and is responsible for the realization of translate, rotation, scaling in the animations.
  25515. * A armature can contain multiple bones.
  25516. * @see dragonBones.BoneData
  25517. * @see dragonBones.Armature
  25518. * @see dragonBones.Slot
  25519. * @version DragonBones 3.0
  25520. * @language en_US
  25521. */
  25522. /**
  25523. * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。
  25524. * 一个骨架中可以包含多个骨骼。
  25525. * @see dragonBones.BoneData
  25526. * @see dragonBones.Armature
  25527. * @see dragonBones.Slot
  25528. * @version DragonBones 3.0
  25529. * @language zh_CN
  25530. */
  25531. class Bone extends TransformObject {
  25532. static toString(): string;
  25533. /**
  25534. * - The offset mode.
  25535. * @see #offset
  25536. * @version DragonBones 5.5
  25537. * @language en_US
  25538. */
  25539. /**
  25540. * - 偏移模式。
  25541. * @see #offset
  25542. * @version DragonBones 5.5
  25543. * @language zh_CN
  25544. */
  25545. offsetMode: OffsetMode;
  25546. /**
  25547. * @internal
  25548. * @private
  25549. */
  25550. readonly animationPose: Transform;
  25551. /**
  25552. * @internal
  25553. * @private
  25554. */
  25555. _transformDirty: boolean;
  25556. /**
  25557. * @internal
  25558. * @private
  25559. */
  25560. _childrenTransformDirty: boolean;
  25561. protected _localDirty: boolean;
  25562. /**
  25563. * @internal
  25564. * @private
  25565. */
  25566. _hasConstraint: boolean;
  25567. private _visible;
  25568. protected _cachedFrameIndex: number;
  25569. /**
  25570. * @internal
  25571. * @private
  25572. */
  25573. readonly _blendState: BlendState;
  25574. /**
  25575. * @internal
  25576. * @private
  25577. */
  25578. _boneData: BoneData;
  25579. /**
  25580. * @internal
  25581. * @private
  25582. */
  25583. _cachedFrameIndices: Array<number> | null;
  25584. /**
  25585. * @inheritDoc
  25586. */
  25587. protected _onClear(): void;
  25588. /**
  25589. * @private
  25590. */
  25591. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25592. /**
  25593. * @inheritDoc
  25594. */
  25595. _setArmature(value: Armature | null): void;
  25596. /**
  25597. * @internal
  25598. * @private
  25599. */
  25600. init(boneData: BoneData): void;
  25601. /**
  25602. * @internal
  25603. * @private
  25604. */
  25605. update(cacheFrameIndex: number): void;
  25606. /**
  25607. * @internal
  25608. * @private
  25609. */
  25610. updateByConstraint(): void;
  25611. /**
  25612. * - Forces the bone to update the transform in the next frame.
  25613. * When the bone is not animated or its animation state is finished, the bone will not continue to update,
  25614. * and when the skeleton must be updated for some reason, the method needs to be called explicitly.
  25615. * @example
  25616. * <pre>
  25617. * let bone = armature.getBone("arm");
  25618. * bone.offset.scaleX = 2.0;
  25619. * bone.invalidUpdate();
  25620. * </pre>
  25621. * @version DragonBones 3.0
  25622. * @language en_US
  25623. */
  25624. /**
  25625. * - 强制骨骼在下一帧更新变换。
  25626. * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。
  25627. * @example
  25628. * <pre>
  25629. * let bone = armature.getBone("arm");
  25630. * bone.offset.scaleX = 2.0;
  25631. * bone.invalidUpdate();
  25632. * </pre>
  25633. * @version DragonBones 3.0
  25634. * @language zh_CN
  25635. */
  25636. invalidUpdate(): void;
  25637. /**
  25638. * - Check whether the bone contains a specific bone or slot.
  25639. * @see dragonBones.Bone
  25640. * @see dragonBones.Slot
  25641. * @version DragonBones 3.0
  25642. * @language en_US
  25643. */
  25644. /**
  25645. * - 检查该骨骼是否包含特定的骨骼或插槽。
  25646. * @see dragonBones.Bone
  25647. * @see dragonBones.Slot
  25648. * @version DragonBones 3.0
  25649. * @language zh_CN
  25650. */
  25651. contains(value: TransformObject): boolean;
  25652. /**
  25653. * - The bone data.
  25654. * @version DragonBones 4.5
  25655. * @language en_US
  25656. */
  25657. /**
  25658. * - 骨骼数据。
  25659. * @version DragonBones 4.5
  25660. * @language zh_CN
  25661. */
  25662. readonly boneData: BoneData;
  25663. /**
  25664. * - The visible of all slots in the bone.
  25665. * @default true
  25666. * @see dragonBones.Slot#visible
  25667. * @version DragonBones 3.0
  25668. * @language en_US
  25669. */
  25670. /**
  25671. * - 此骨骼所有插槽的可见。
  25672. * @default true
  25673. * @see dragonBones.Slot#visible
  25674. * @version DragonBones 3.0
  25675. * @language zh_CN
  25676. */
  25677. visible: boolean;
  25678. /**
  25679. * - The bone name.
  25680. * @version DragonBones 3.0
  25681. * @language en_US
  25682. */
  25683. /**
  25684. * - 骨骼名称。
  25685. * @version DragonBones 3.0
  25686. * @language zh_CN
  25687. */
  25688. readonly name: string;
  25689. /**
  25690. * - Deprecated, please refer to {@link dragonBones.Armature#getBones()}.
  25691. * @deprecated
  25692. * @language en_US
  25693. */
  25694. /**
  25695. * - 已废弃,请参考 {@link dragonBones.Armature#getBones()}。
  25696. * @deprecated
  25697. * @language zh_CN
  25698. */
  25699. getBones(): Array<Bone>;
  25700. /**
  25701. * - Deprecated, please refer to {@link dragonBones.Armature#getSlots()}.
  25702. * @deprecated
  25703. * @language en_US
  25704. */
  25705. /**
  25706. * - 已废弃,请参考 {@link dragonBones.Armature#getSlots()}。
  25707. * @deprecated
  25708. * @language zh_CN
  25709. */
  25710. getSlots(): Array<Slot>;
  25711. /**
  25712. * - Deprecated, please refer to {@link dragonBones.Armature#getSlot()}.
  25713. * @deprecated
  25714. * @language en_US
  25715. */
  25716. /**
  25717. * - 已废弃,请参考 {@link dragonBones.Armature#getSlot()}。
  25718. * @deprecated
  25719. * @language zh_CN
  25720. */
  25721. readonly slot: Slot | null;
  25722. }
  25723. }
  25724. /**
  25725. * The MIT License (MIT)
  25726. *
  25727. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25728. *
  25729. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25730. * this software and associated documentation files (the "Software"), to deal in
  25731. * the Software without restriction, including without limitation the rights to
  25732. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25733. * the Software, and to permit persons to whom the Software is furnished to do so,
  25734. * subject to the following conditions:
  25735. *
  25736. * The above copyright notice and this permission notice shall be included in all
  25737. * copies or substantial portions of the Software.
  25738. *
  25739. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25740. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25741. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25742. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25743. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25744. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25745. */
  25746. declare namespace dragonBones {
  25747. /**
  25748. * @internal
  25749. * @private
  25750. */
  25751. class Surface extends Bone {
  25752. static toString(): string;
  25753. private _dX;
  25754. private _dY;
  25755. private _k;
  25756. private _kX;
  25757. private _kY;
  25758. /**
  25759. * For debug draw.
  25760. * @internal
  25761. * @private
  25762. */
  25763. readonly _vertices: Array<number>;
  25764. /**
  25765. * For timeline state.
  25766. * @internal
  25767. * @private
  25768. */
  25769. readonly _deformVertices: Array<number>;
  25770. /**
  25771. * x1, y1, x2, y2, x3, y3, x4, y4, d1X, d1Y, d2X, d2Y
  25772. */
  25773. private readonly _hullCache;
  25774. /**
  25775. * Inside [flag, a, b, c, d, tx, ty], Outside [flag, a, b, c, d, tx, ty]
  25776. */
  25777. private readonly _matrixCahce;
  25778. /**
  25779. * @inheritDoc
  25780. */
  25781. protected _onClear(): void;
  25782. private _getAffineTransform(x, y, lX, lY, aX, aY, bX, bY, cX, cY, transform, matrix, isDown);
  25783. private _updateVertices();
  25784. /**
  25785. * @private
  25786. */
  25787. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  25788. _getGlobalTransformMatrix(x: number, y: number): Matrix;
  25789. init(surfaceData: SurfaceData): void;
  25790. /**
  25791. * @internal
  25792. * @private
  25793. */
  25794. update(cacheFrameIndex: number): void;
  25795. }
  25796. }
  25797. /**
  25798. * The MIT License (MIT)
  25799. *
  25800. * Copyright (c) 2012-2017 DragonBones team and other contributors
  25801. *
  25802. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25803. * this software and associated documentation files (the "Software"), to deal in
  25804. * the Software without restriction, including without limitation the rights to
  25805. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  25806. * the Software, and to permit persons to whom the Software is furnished to do so,
  25807. * subject to the following conditions:
  25808. *
  25809. * The above copyright notice and this permission notice shall be included in all
  25810. * copies or substantial portions of the Software.
  25811. *
  25812. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25813. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  25814. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  25815. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  25816. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25817. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25818. */
  25819. declare namespace dragonBones {
  25820. /**
  25821. * - The slot attached to the armature, controls the display status and properties of the display object.
  25822. * A bone can contain multiple slots.
  25823. * A slot can contain multiple display objects, displaying only one of the display objects at a time,
  25824. * but you can toggle the display object into frame animation while the animation is playing.
  25825. * The display object can be a normal texture, or it can be a display of a child armature, a grid display object,
  25826. * and a custom other display object.
  25827. * @see dragonBones.Armature
  25828. * @see dragonBones.Bone
  25829. * @see dragonBones.SlotData
  25830. * @version DragonBones 3.0
  25831. * @language en_US
  25832. */
  25833. /**
  25834. * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。
  25835. * 一个骨骼上可以包含多个插槽。
  25836. * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。
  25837. * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。
  25838. * @see dragonBones.Armature
  25839. * @see dragonBones.Bone
  25840. * @see dragonBones.SlotData
  25841. * @version DragonBones 3.0
  25842. * @language zh_CN
  25843. */
  25844. abstract class Slot extends TransformObject {
  25845. /**
  25846. * - Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
  25847. * @default null
  25848. * @see dragonBones.AnimationState#displayControl
  25849. * @see dragonBones.AnimationState#name
  25850. * @see dragonBones.AnimationState#group
  25851. * @version DragonBones 4.5
  25852. * @language en_US
  25853. */
  25854. /**
  25855. * - 显示对象受到控制的动画状态或混合组名称,设置为 null 则表示受所有的动画状态控制。
  25856. * @default null
  25857. * @see dragonBones.AnimationState#displayControl
  25858. * @see dragonBones.AnimationState#name
  25859. * @see dragonBones.AnimationState#group
  25860. * @version DragonBones 4.5
  25861. * @language zh_CN
  25862. */
  25863. displayController: string | null;
  25864. /**
  25865. * @private
  25866. */
  25867. protected _displayDirty: boolean;
  25868. /**
  25869. * @private
  25870. */
  25871. protected _zOrderDirty: boolean;
  25872. /**
  25873. * @private
  25874. */
  25875. protected _visibleDirty: boolean;
  25876. /**
  25877. * @private
  25878. */
  25879. protected _blendModeDirty: boolean;
  25880. /**
  25881. * @internal
  25882. * @private
  25883. */
  25884. _colorDirty: boolean;
  25885. /**
  25886. * @internal
  25887. * @private
  25888. */
  25889. _meshDirty: boolean;
  25890. /**
  25891. * @private
  25892. */
  25893. protected _transformDirty: boolean;
  25894. /**
  25895. * @private
  25896. */
  25897. protected _visible: boolean;
  25898. /**
  25899. * @private
  25900. */
  25901. protected _blendMode: BlendMode;
  25902. /**
  25903. * @private
  25904. */
  25905. protected _displayIndex: number;
  25906. /**
  25907. * @private
  25908. */
  25909. protected _animationDisplayIndex: number;
  25910. /**
  25911. * @internal
  25912. * @private
  25913. */
  25914. _zOrder: number;
  25915. /**
  25916. * @private
  25917. */
  25918. protected _cachedFrameIndex: number;
  25919. /**
  25920. * @internal
  25921. * @private
  25922. */
  25923. _pivotX: number;
  25924. /**
  25925. * @internal
  25926. * @private
  25927. */
  25928. _pivotY: number;
  25929. /**
  25930. * @private
  25931. */
  25932. protected readonly _localMatrix: Matrix;
  25933. /**
  25934. * @internal
  25935. * @private
  25936. */
  25937. readonly _colorTransform: ColorTransform;
  25938. /**
  25939. * @internal
  25940. * @private
  25941. */
  25942. readonly _deformVertices: Array<number>;
  25943. /**
  25944. * @private
  25945. */
  25946. readonly _displayDatas: Array<DisplayData | null>;
  25947. /**
  25948. * @private
  25949. */
  25950. protected readonly _displayList: Array<any | Armature>;
  25951. /**
  25952. * @private
  25953. */
  25954. protected readonly _meshBones: Array<Bone | null>;
  25955. /**
  25956. * @private
  25957. */
  25958. protected readonly _meshSlots: Array<Slot | null>;
  25959. /**
  25960. * @internal
  25961. * @private
  25962. */
  25963. _slotData: SlotData;
  25964. /**
  25965. * @private
  25966. */
  25967. protected _rawDisplayDatas: Array<DisplayData | null> | null;
  25968. /**
  25969. * @private
  25970. */
  25971. protected _displayData: DisplayData | null;
  25972. /**
  25973. * @private
  25974. */
  25975. protected _textureData: TextureData | null;
  25976. /**
  25977. * @internal
  25978. * @private
  25979. */
  25980. _meshData: MeshDisplayData | null;
  25981. /**
  25982. * @private
  25983. */
  25984. protected _boundingBoxData: BoundingBoxData | null;
  25985. /**
  25986. * @private
  25987. */
  25988. protected _rawDisplay: any;
  25989. /**
  25990. * @private
  25991. */
  25992. protected _meshDisplay: any;
  25993. /**
  25994. * @private
  25995. */
  25996. protected _display: any;
  25997. /**
  25998. * @private
  25999. */
  26000. protected _childArmature: Armature | null;
  26001. /**
  26002. * @internal
  26003. * @private
  26004. */
  26005. _cachedFrameIndices: Array<number> | null;
  26006. /**
  26007. * @inheritDoc
  26008. */
  26009. protected _onClear(): void;
  26010. /**
  26011. * @private
  26012. */
  26013. protected abstract _initDisplay(value: any, isRetain: boolean): void;
  26014. /**
  26015. * @private
  26016. */
  26017. protected abstract _disposeDisplay(value: any, isRelease: boolean): void;
  26018. /**
  26019. * @private
  26020. */
  26021. protected abstract _onUpdateDisplay(): void;
  26022. /**
  26023. * @private
  26024. */
  26025. protected abstract _addDisplay(): void;
  26026. /**
  26027. * @private
  26028. */
  26029. protected abstract _replaceDisplay(value: any): void;
  26030. /**
  26031. * @private
  26032. */
  26033. protected abstract _removeDisplay(): void;
  26034. /**
  26035. * @private
  26036. */
  26037. protected abstract _updateZOrder(): void;
  26038. /**
  26039. * @private
  26040. */
  26041. abstract _updateVisible(): void;
  26042. /**
  26043. * @private
  26044. */
  26045. protected abstract _updateBlendMode(): void;
  26046. /**
  26047. * @private
  26048. */
  26049. protected abstract _updateColor(): void;
  26050. /**
  26051. * @private
  26052. */
  26053. protected abstract _updateFrame(): void;
  26054. /**
  26055. * @private
  26056. */
  26057. protected abstract _updateMesh(): void;
  26058. /**
  26059. * @internal
  26060. * @private
  26061. */
  26062. abstract _updateGlueMesh(): void;
  26063. /**
  26064. * @private
  26065. */
  26066. protected abstract _updateTransform(): void;
  26067. /**
  26068. * @private
  26069. */
  26070. protected abstract _identityTransform(): void;
  26071. /**
  26072. * @private
  26073. */
  26074. protected _getDefaultRawDisplayData(): DisplayData | null;
  26075. /**
  26076. * @private
  26077. */
  26078. protected _updateDisplayData(): void;
  26079. /**
  26080. * @private
  26081. */
  26082. protected _updateDisplay(): void;
  26083. /**
  26084. * @private
  26085. */
  26086. protected _updateGlobalTransformMatrix(isCache: boolean): void;
  26087. /**
  26088. * @private
  26089. */
  26090. protected _isMeshBonesUpdate(): boolean;
  26091. /**
  26092. * @inheritDoc
  26093. */
  26094. _setArmature(value: Armature | null): void;
  26095. /**
  26096. * @internal
  26097. * @private
  26098. */
  26099. _setDisplayIndex(value: number, isAnimation?: boolean): boolean;
  26100. /**
  26101. * @internal
  26102. * @private
  26103. */
  26104. _setZorder(value: number): boolean;
  26105. /**
  26106. * @internal
  26107. * @private
  26108. */
  26109. _setColor(value: ColorTransform): boolean;
  26110. /**
  26111. * @internal
  26112. * @private
  26113. */
  26114. _setDisplayList(value: Array<any> | null): boolean;
  26115. /**
  26116. * @internal
  26117. * @private
  26118. */
  26119. init(slotData: SlotData, displayDatas: Array<DisplayData | null> | null, rawDisplay: any, meshDisplay: any): void;
  26120. /**
  26121. * @internal
  26122. * @private
  26123. */
  26124. update(cacheFrameIndex: number): void;
  26125. /**
  26126. * @private
  26127. */
  26128. updateTransformAndMatrix(): void;
  26129. /**
  26130. * @private
  26131. */
  26132. replaceDisplayData(value: DisplayData | null, displayIndex?: number): void;
  26133. /**
  26134. * - Check whether a specific point is inside a custom bounding box in the slot.
  26135. * The coordinate system of the point is the inner coordinate system of the armature.
  26136. * Custom bounding boxes need to be customized in Dragonbones Pro.
  26137. * @param x - The horizontal coordinate of the point.
  26138. * @param y - The vertical coordinate of the point.
  26139. * @version DragonBones 5.0
  26140. * @language en_US
  26141. */
  26142. /**
  26143. * - 检查特定点是否在插槽的自定义边界框内。
  26144. * 点的坐标系为骨架内坐标系。
  26145. * 自定义边界框需要在 DragonBones Pro 中自定义。
  26146. * @param x - 点的水平坐标。
  26147. * @param y - 点的垂直坐标。
  26148. * @version DragonBones 5.0
  26149. * @language zh_CN
  26150. */
  26151. containsPoint(x: number, y: number): boolean;
  26152. /**
  26153. * - Check whether a specific segment intersects a custom bounding box for the slot.
  26154. * The coordinate system of the segment and intersection is the inner coordinate system of the armature.
  26155. * Custom bounding boxes need to be customized in Dragonbones Pro.
  26156. * @param xA - The horizontal coordinate of the beginning of the segment.
  26157. * @param yA - The vertical coordinate of the beginning of the segment.
  26158. * @param xB - The horizontal coordinate of the end point of the segment.
  26159. * @param yB - The vertical coordinate of the end point of the segment.
  26160. * @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)
  26161. * @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)
  26162. * @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)
  26163. * @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]
  26164. * @version DragonBones 5.0
  26165. * @language en_US
  26166. */
  26167. /**
  26168. * - 检查特定线段是否与插槽的自定义边界框相交。
  26169. * 线段和交点的坐标系均为骨架内坐标系。
  26170. * 自定义边界框需要在 DragonBones Pro 中自定义。
  26171. * @param xA - 线段起点的水平坐标。
  26172. * @param yA - 线段起点的垂直坐标。
  26173. * @param xB - 线段终点的水平坐标。
  26174. * @param yB - 线段终点的垂直坐标。
  26175. * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  26176. * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点)
  26177. * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线)
  26178. * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点]
  26179. * @version DragonBones 5.0
  26180. * @language zh_CN
  26181. */
  26182. intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: {
  26183. x: number;
  26184. y: number;
  26185. } | null, intersectionPointB?: {
  26186. x: number;
  26187. y: number;
  26188. } | null, normalRadians?: {
  26189. x: number;
  26190. y: number;
  26191. } | null): number;
  26192. /**
  26193. * - Forces the slot to update the state of the display object in the next frame.
  26194. * @version DragonBones 4.5
  26195. * @language en_US
  26196. */
  26197. /**
  26198. * - 强制插槽在下一帧更新显示对象的状态。
  26199. * @version DragonBones 4.5
  26200. * @language zh_CN
  26201. */
  26202. invalidUpdate(): void;
  26203. /**
  26204. * - The visible of slot's display object.
  26205. * @default true
  26206. * @version DragonBones 5.6
  26207. * @language en_US
  26208. */
  26209. /**
  26210. * - 插槽的显示对象的可见。
  26211. * @default true
  26212. * @version DragonBones 5.6
  26213. * @language zh_CN
  26214. */
  26215. visible: boolean;
  26216. /**
  26217. * - The index of the display object displayed in the display list.
  26218. * @example
  26219. * <pre>
  26220. * let slot = armature.getSlot("weapon");
  26221. * slot.displayIndex = 3;
  26222. * slot.displayController = "none";
  26223. * </pre>
  26224. * @version DragonBones 4.5
  26225. * @language en_US
  26226. */
  26227. /**
  26228. * - 此时显示的显示对象在显示列表中的索引。
  26229. * @example
  26230. * <pre>
  26231. * let slot = armature.getSlot("weapon");
  26232. * slot.displayIndex = 3;
  26233. * slot.displayController = "none";
  26234. * </pre>
  26235. * @version DragonBones 4.5
  26236. * @language zh_CN
  26237. */
  26238. displayIndex: number;
  26239. /**
  26240. * - The slot name.
  26241. * @see dragonBones.SlotData#name
  26242. * @version DragonBones 3.0
  26243. * @language en_US
  26244. */
  26245. /**
  26246. * - 插槽名称。
  26247. * @see dragonBones.SlotData#name
  26248. * @version DragonBones 3.0
  26249. * @language zh_CN
  26250. */
  26251. readonly name: string;
  26252. /**
  26253. * - Contains a display list of display objects or child armatures.
  26254. * @version DragonBones 3.0
  26255. * @language en_US
  26256. */
  26257. /**
  26258. * - 包含显示对象或子骨架的显示列表。
  26259. * @version DragonBones 3.0
  26260. * @language zh_CN
  26261. */
  26262. displayList: Array<any>;
  26263. /**
  26264. * - The slot data.
  26265. * @see dragonBones.SlotData
  26266. * @version DragonBones 4.5
  26267. * @language en_US
  26268. */
  26269. /**
  26270. * - 插槽数据。
  26271. * @see dragonBones.SlotData
  26272. * @version DragonBones 4.5
  26273. * @language zh_CN
  26274. */
  26275. readonly slotData: SlotData;
  26276. /**
  26277. * @private
  26278. */
  26279. rawDisplayDatas: Array<DisplayData | null> | null;
  26280. /**
  26281. * - The custom bounding box data for the slot at current time.
  26282. * @version DragonBones 5.0
  26283. * @language en_US
  26284. */
  26285. /**
  26286. * - 插槽此时的自定义包围盒数据。
  26287. * @version DragonBones 5.0
  26288. * @language zh_CN
  26289. */
  26290. readonly boundingBoxData: BoundingBoxData | null;
  26291. /**
  26292. * @private
  26293. */
  26294. readonly rawDisplay: any;
  26295. /**
  26296. * @private
  26297. */
  26298. readonly meshDisplay: any;
  26299. /**
  26300. * - The display object that the slot displays at this time.
  26301. * @example
  26302. * <pre>
  26303. * let slot = armature.getSlot("text");
  26304. * slot.display = new yourEngine.TextField();
  26305. * </pre>
  26306. * @version DragonBones 3.0
  26307. * @language en_US
  26308. */
  26309. /**
  26310. * - 插槽此时显示的显示对象。
  26311. * @example
  26312. * <pre>
  26313. * let slot = armature.getSlot("text");
  26314. * slot.display = new yourEngine.TextField();
  26315. * </pre>
  26316. * @version DragonBones 3.0
  26317. * @language zh_CN
  26318. */
  26319. display: any;
  26320. /**
  26321. * - The child armature that the slot displayed at current time.
  26322. * @example
  26323. * <pre>
  26324. * let slot = armature.getSlot("weapon");
  26325. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  26326. * </pre>
  26327. * @version DragonBones 3.0
  26328. * @language en_US
  26329. */
  26330. /**
  26331. * - 插槽此时显示的子骨架。
  26332. * @example
  26333. * <pre>
  26334. * let slot = armature.getSlot("weapon");
  26335. * slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
  26336. * </pre>
  26337. * @version DragonBones 3.0
  26338. * @language zh_CN
  26339. */
  26340. childArmature: Armature | null;
  26341. /**
  26342. * - Deprecated, please refer to {@link #display}.
  26343. * @deprecated
  26344. * @language en_US
  26345. */
  26346. /**
  26347. * - 已废弃,请参考 {@link #display}。
  26348. * @deprecated
  26349. * @language zh_CN
  26350. */
  26351. getDisplay(): any;
  26352. /**
  26353. * - Deprecated, please refer to {@link #display}.
  26354. * @deprecated
  26355. * @language en_US
  26356. */
  26357. /**
  26358. * - 已废弃,请参考 {@link #display}。
  26359. * @deprecated
  26360. * @language zh_CN
  26361. */
  26362. setDisplay(value: any): void;
  26363. }
  26364. }
  26365. /**
  26366. * The MIT License (MIT)
  26367. *
  26368. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26369. *
  26370. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26371. * this software and associated documentation files (the "Software"), to deal in
  26372. * the Software without restriction, including without limitation the rights to
  26373. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26374. * the Software, and to permit persons to whom the Software is furnished to do so,
  26375. * subject to the following conditions:
  26376. *
  26377. * The above copyright notice and this permission notice shall be included in all
  26378. * copies or substantial portions of the Software.
  26379. *
  26380. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26381. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26382. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26383. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26384. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26385. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26386. */
  26387. declare namespace dragonBones {
  26388. /**
  26389. * @internal
  26390. * @private
  26391. */
  26392. abstract class Constraint extends BaseObject {
  26393. protected static readonly _helpMatrix: Matrix;
  26394. protected static readonly _helpTransform: Transform;
  26395. protected static readonly _helpPoint: Point;
  26396. /**
  26397. * - For timeline state.
  26398. * @internal
  26399. */
  26400. _constraintData: ConstraintData;
  26401. protected _armature: Armature;
  26402. /**
  26403. * - For sort bones.
  26404. * @internal
  26405. */
  26406. _target: Bone;
  26407. /**
  26408. * - For sort bones.
  26409. * @internal
  26410. */
  26411. _root: Bone;
  26412. protected _bone: Bone | null;
  26413. protected _onClear(): void;
  26414. abstract init(constraintData: ConstraintData, armature: Armature): void;
  26415. abstract update(): void;
  26416. abstract invalidUpdate(): void;
  26417. readonly name: string;
  26418. }
  26419. /**
  26420. * @internal
  26421. * @private
  26422. */
  26423. class IKConstraint extends Constraint {
  26424. static toString(): string;
  26425. private _scaleEnabled;
  26426. /**
  26427. * - For timeline state.
  26428. * @internal
  26429. */
  26430. _bendPositive: boolean;
  26431. /**
  26432. * - For timeline state.
  26433. * @internal
  26434. */
  26435. _weight: number;
  26436. protected _onClear(): void;
  26437. private _computeA();
  26438. private _computeB();
  26439. init(constraintData: ConstraintData, armature: Armature): void;
  26440. update(): void;
  26441. invalidUpdate(): void;
  26442. }
  26443. }
  26444. /**
  26445. * The MIT License (MIT)
  26446. *
  26447. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26448. *
  26449. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26450. * this software and associated documentation files (the "Software"), to deal in
  26451. * the Software without restriction, including without limitation the rights to
  26452. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26453. * the Software, and to permit persons to whom the Software is furnished to do so,
  26454. * subject to the following conditions:
  26455. *
  26456. * The above copyright notice and this permission notice shall be included in all
  26457. * copies or substantial portions of the Software.
  26458. *
  26459. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26460. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26461. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26462. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26463. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26464. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26465. */
  26466. declare namespace dragonBones {
  26467. /**
  26468. * - Play animation interface. (Both Armature and Wordclock implement the interface)
  26469. * Any instance that implements the interface can be added to the Worldclock instance and advance time by Worldclock instance uniformly.
  26470. * @see dragonBones.WorldClock
  26471. * @see dragonBones.Armature
  26472. * @version DragonBones 3.0
  26473. * @language en_US
  26474. */
  26475. /**
  26476. * - 播放动画接口。 (Armature 和 WordClock 都实现了该接口)
  26477. * 任何实现了此接口的实例都可以添加到 WorldClock 实例中,由 WorldClock 实例统一更新时间。
  26478. * @see dragonBones.WorldClock
  26479. * @see dragonBones.Armature
  26480. * @version DragonBones 3.0
  26481. * @language zh_CN
  26482. */
  26483. interface IAnimatable {
  26484. /**
  26485. * - Advance time.
  26486. * @param passedTime - Passed time. (In seconds)
  26487. * @version DragonBones 3.0
  26488. * @language en_US
  26489. */
  26490. /**
  26491. * - 更新时间。
  26492. * @param passedTime - 前进的时间。 (以秒为单位)
  26493. * @version DragonBones 3.0
  26494. * @language zh_CN
  26495. */
  26496. advanceTime(passedTime: number): void;
  26497. /**
  26498. * - The Wordclock instance to which the current belongs.
  26499. * @example
  26500. * <pre>
  26501. * armature.clock = factory.clock; // Add armature to clock.
  26502. * armature.clock = null; // Remove armature from clock.
  26503. * </pre>
  26504. * @version DragonBones 5.0
  26505. * @language en_US
  26506. */
  26507. /**
  26508. * - 当前所属的 WordClock 实例。
  26509. * @example
  26510. * <pre>
  26511. * armature.clock = factory.clock; // 将骨架添加到时钟。
  26512. * armature.clock = null; // 将骨架从时钟移除。
  26513. * </pre>
  26514. * @version DragonBones 5.0
  26515. * @language zh_CN
  26516. */
  26517. clock: WorldClock | null;
  26518. }
  26519. }
  26520. /**
  26521. * The MIT License (MIT)
  26522. *
  26523. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26524. *
  26525. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26526. * this software and associated documentation files (the "Software"), to deal in
  26527. * the Software without restriction, including without limitation the rights to
  26528. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26529. * the Software, and to permit persons to whom the Software is furnished to do so,
  26530. * subject to the following conditions:
  26531. *
  26532. * The above copyright notice and this permission notice shall be included in all
  26533. * copies or substantial portions of the Software.
  26534. *
  26535. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26536. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26537. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26538. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26539. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26540. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26541. */
  26542. declare namespace dragonBones {
  26543. /**
  26544. * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.
  26545. * @see dragonBones.IAnimateble
  26546. * @see dragonBones.Armature
  26547. * @version DragonBones 3.0
  26548. * @language en_US
  26549. */
  26550. /**
  26551. * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。
  26552. * @see dragonBones.IAnimateble
  26553. * @see dragonBones.Armature
  26554. * @version DragonBones 3.0
  26555. * @language zh_CN
  26556. */
  26557. class WorldClock implements IAnimatable {
  26558. /**
  26559. * - Current time. (In seconds)
  26560. * @version DragonBones 3.0
  26561. * @language en_US
  26562. */
  26563. /**
  26564. * - 当前的时间。 (以秒为单位)
  26565. * @version DragonBones 3.0
  26566. * @language zh_CN
  26567. */
  26568. time: number;
  26569. /**
  26570. * - The play speed, used to control animation speed-shift play.
  26571. * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  26572. * @default 1.0
  26573. * @version DragonBones 3.0
  26574. * @language en_US
  26575. */
  26576. /**
  26577. * - 播放速度,用于控制动画变速播放。
  26578. * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  26579. * @default 1.0
  26580. * @version DragonBones 3.0
  26581. * @language zh_CN
  26582. */
  26583. timeScale: number;
  26584. private readonly _animatebles;
  26585. private _clock;
  26586. /**
  26587. * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance.
  26588. * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.
  26589. * @version DragonBones 3.0
  26590. * @language en_US
  26591. */
  26592. /**
  26593. * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。
  26594. * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。
  26595. * @version DragonBones 3.0
  26596. * @language zh_CN
  26597. */
  26598. constructor(time?: number);
  26599. /**
  26600. * - Advance time for all IAnimatable instances.
  26601. * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)
  26602. * @version DragonBones 3.0
  26603. * @language en_US
  26604. */
  26605. /**
  26606. * - 为所有的 IAnimatable 实例更新时间。
  26607. * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位)
  26608. * @version DragonBones 3.0
  26609. * @language zh_CN
  26610. */
  26611. advanceTime(passedTime: number): void;
  26612. /**
  26613. * - Check whether contains a specific instance of IAnimatable.
  26614. * @param value - The IAnimatable instance.
  26615. * @version DragonBones 3.0
  26616. * @language en_US
  26617. */
  26618. /**
  26619. * - 检查是否包含特定的 IAnimatable 实例。
  26620. * @param value - IAnimatable 实例。
  26621. * @version DragonBones 3.0
  26622. * @language zh_CN
  26623. */
  26624. contains(value: IAnimatable): boolean;
  26625. /**
  26626. * - Add IAnimatable instance.
  26627. * @param value - The IAnimatable instance.
  26628. * @version DragonBones 3.0
  26629. * @language en_US
  26630. */
  26631. /**
  26632. * - 添加 IAnimatable 实例。
  26633. * @param value - IAnimatable 实例。
  26634. * @version DragonBones 3.0
  26635. * @language zh_CN
  26636. */
  26637. add(value: IAnimatable): void;
  26638. /**
  26639. * - Removes a specified IAnimatable instance.
  26640. * @param value - The IAnimatable instance.
  26641. * @version DragonBones 3.0
  26642. * @language en_US
  26643. */
  26644. /**
  26645. * - 移除特定的 IAnimatable 实例。
  26646. * @param value - IAnimatable 实例。
  26647. * @version DragonBones 3.0
  26648. * @language zh_CN
  26649. */
  26650. remove(value: IAnimatable): void;
  26651. /**
  26652. * - Clear all IAnimatable instances.
  26653. * @version DragonBones 3.0
  26654. * @language en_US
  26655. */
  26656. /**
  26657. * - 清除所有的 IAnimatable 实例。
  26658. * @version DragonBones 3.0
  26659. * @language zh_CN
  26660. */
  26661. clear(): void;
  26662. /**
  26663. * @inheritDoc
  26664. */
  26665. clock: WorldClock | null;
  26666. /**
  26667. * - Deprecated, please refer to {@link dragonBones.BaseFactory#clock}.
  26668. * @deprecated
  26669. * @language en_US
  26670. */
  26671. /**
  26672. * - 已废弃,请参考 {@link dragonBones.BaseFactory#clock}。
  26673. * @deprecated
  26674. * @language zh_CN
  26675. */
  26676. static readonly clock: WorldClock;
  26677. }
  26678. }
  26679. /**
  26680. * The MIT License (MIT)
  26681. *
  26682. * Copyright (c) 2012-2017 DragonBones team and other contributors
  26683. *
  26684. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  26685. * this software and associated documentation files (the "Software"), to deal in
  26686. * the Software without restriction, including without limitation the rights to
  26687. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  26688. * the Software, and to permit persons to whom the Software is furnished to do so,
  26689. * subject to the following conditions:
  26690. *
  26691. * The above copyright notice and this permission notice shall be included in all
  26692. * copies or substantial portions of the Software.
  26693. *
  26694. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26695. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  26696. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  26697. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26698. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  26699. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26700. */
  26701. declare namespace dragonBones {
  26702. /**
  26703. * - The animation player is used to play the animation data and manage the animation states.
  26704. * @see dragonBones.AnimationData
  26705. * @see dragonBones.AnimationState
  26706. * @version DragonBones 3.0
  26707. * @language en_US
  26708. */
  26709. /**
  26710. * - 动画播放器用来播放动画数据和管理动画状态。
  26711. * @see dragonBones.AnimationData
  26712. * @see dragonBones.AnimationState
  26713. * @version DragonBones 3.0
  26714. * @language zh_CN
  26715. */
  26716. class Animation extends BaseObject {
  26717. static toString(): string;
  26718. /**
  26719. * - The play speed of all animations. [0: Stop, (0~1): Slow, 1: Normal, (1~N): Fast]
  26720. * @default 1.0
  26721. * @version DragonBones 3.0
  26722. * @language en_US
  26723. */
  26724. /**
  26725. * - 所有动画的播放速度。 [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  26726. * @default 1.0
  26727. * @version DragonBones 3.0
  26728. * @language zh_CN
  26729. */
  26730. timeScale: number;
  26731. private _lockUpdate;
  26732. private _animationDirty;
  26733. private _inheritTimeScale;
  26734. private readonly _animationNames;
  26735. private readonly _animationStates;
  26736. private readonly _animations;
  26737. private _armature;
  26738. private _animationConfig;
  26739. private _lastAnimationState;
  26740. /**
  26741. * @private
  26742. */
  26743. protected _onClear(): void;
  26744. private _fadeOut(animationConfig);
  26745. /**
  26746. * @internal
  26747. * @private
  26748. */
  26749. init(armature: Armature): void;
  26750. /**
  26751. * @internal
  26752. * @private
  26753. */
  26754. advanceTime(passedTime: number): void;
  26755. /**
  26756. * - Clear all animations states.
  26757. * @see dragonBones.AnimationState
  26758. * @version DragonBones 4.5
  26759. * @language en_US
  26760. */
  26761. /**
  26762. * - 清除所有的动画状态。
  26763. * @see dragonBones.AnimationState
  26764. * @version DragonBones 4.5
  26765. * @language zh_CN
  26766. */
  26767. reset(): void;
  26768. /**
  26769. * - Pause a specific animation state.
  26770. * @param animationName - The name of animation state. (If not set, it will pause all animations)
  26771. * @see dragonBones.AnimationState
  26772. * @version DragonBones 3.0
  26773. * @language en_US
  26774. */
  26775. /**
  26776. * - 暂停指定动画状态的播放。
  26777. * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画)
  26778. * @see dragonBones.AnimationState
  26779. * @version DragonBones 3.0
  26780. * @language zh_CN
  26781. */
  26782. stop(animationName?: string | null): void;
  26783. /**
  26784. * - Play animation with a specific animation config.
  26785. * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used.
  26786. * @param animationConfig - The animation config.
  26787. * @returns The playing animation state.
  26788. * @see dragonBones.AnimationConfig
  26789. * @beta
  26790. * @version DragonBones 5.0
  26791. * @language en_US
  26792. */
  26793. /**
  26794. * - 通过指定的动画配置来播放动画。
  26795. * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。
  26796. * @param animationConfig - 动画配置。
  26797. * @returns 播放的动画状态。
  26798. * @see dragonBones.AnimationConfig
  26799. * @beta
  26800. * @version DragonBones 5.0
  26801. * @language zh_CN
  26802. */
  26803. playConfig(animationConfig: AnimationConfig): AnimationState | null;
  26804. /**
  26805. * - Play a specific animation.
  26806. * @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)
  26807. * @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)
  26808. * @returns The playing animation state.
  26809. * @example
  26810. * <pre>
  26811. * armature.animation.play("walk");
  26812. * </pre>
  26813. * @version DragonBones 3.0
  26814. * @language en_US
  26815. */
  26816. /**
  26817. * - 播放指定动画。
  26818. * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画)
  26819. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26820. * @returns 播放的动画状态。
  26821. * @example
  26822. * <pre>
  26823. * armature.animation.play("walk");
  26824. * </pre>
  26825. * @version DragonBones 3.0
  26826. * @language zh_CN
  26827. */
  26828. play(animationName?: string | null, playTimes?: number): AnimationState | null;
  26829. /**
  26830. * - Fade in a specific animation.
  26831. * @param animationName - The name of animation data.
  26832. * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1)
  26833. * @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)
  26834. * @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)
  26835. * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null)
  26836. * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup)
  26837. * @returns The playing animation state.
  26838. * @example
  26839. * <pre>
  26840. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  26841. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  26842. * </pre>
  26843. * @version DragonBones 4.5
  26844. * @language en_US
  26845. */
  26846. /**
  26847. * - 淡入播放指定的动画。
  26848. * @param animationName - 动画数据名称。
  26849. * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1)
  26850. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26851. * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0)
  26852. * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null)
  26853. * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup)
  26854. * @returns 播放的动画状态。
  26855. * @example
  26856. * <pre>
  26857. * armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
  26858. * armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
  26859. * </pre>
  26860. * @version DragonBones 4.5
  26861. * @language zh_CN
  26862. */
  26863. fadeIn(animationName: string, fadeInTime?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode): AnimationState | null;
  26864. /**
  26865. * - Play a specific animation from the specific time.
  26866. * @param animationName - The name of animation data.
  26867. * @param time - The start time point of playing. (In seconds)
  26868. * @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)
  26869. * @returns The played animation state.
  26870. * @version DragonBones 4.5
  26871. * @language en_US
  26872. */
  26873. /**
  26874. * - 从指定时间开始播放指定的动画。
  26875. * @param animationName - 动画数据名称。
  26876. * @param time - 播放开始的时间。 (以秒为单位)
  26877. * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26878. * @returns 播放的动画状态。
  26879. * @version DragonBones 4.5
  26880. * @language zh_CN
  26881. */
  26882. gotoAndPlayByTime(animationName: string, time?: number, playTimes?: number): AnimationState | null;
  26883. /**
  26884. * - Play a specific animation from the specific frame.
  26885. * @param animationName - The name of animation data.
  26886. * @param frame - The start frame of playing.
  26887. * @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)
  26888. * @returns The played animation state.
  26889. * @version DragonBones 4.5
  26890. * @language en_US
  26891. */
  26892. /**
  26893. * - 从指定帧开始播放指定的动画。
  26894. * @param animationName - 动画数据名称。
  26895. * @param frame - 播放开始的帧数。
  26896. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26897. * @returns 播放的动画状态。
  26898. * @version DragonBones 4.5
  26899. * @language zh_CN
  26900. */
  26901. gotoAndPlayByFrame(animationName: string, frame?: number, playTimes?: number): AnimationState | null;
  26902. /**
  26903. * - Play a specific animation from the specific progress.
  26904. * @param animationName - The name of animation data.
  26905. * @param progress - The start progress value of playing.
  26906. * @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)
  26907. * @returns The played animation state.
  26908. * @version DragonBones 4.5
  26909. * @language en_US
  26910. */
  26911. /**
  26912. * - 从指定进度开始播放指定的动画。
  26913. * @param animationName - 动画数据名称。
  26914. * @param progress - 开始播放的进度。
  26915. * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1)
  26916. * @returns 播放的动画状态。
  26917. * @version DragonBones 4.5
  26918. * @language zh_CN
  26919. */
  26920. gotoAndPlayByProgress(animationName: string, progress?: number, playTimes?: number): AnimationState | null;
  26921. /**
  26922. * - Stop a specific animation at the specific time.
  26923. * @param animationName - The name of animation data.
  26924. * @param time - The stop time. (In seconds)
  26925. * @returns The played animation state.
  26926. * @version DragonBones 4.5
  26927. * @language en_US
  26928. */
  26929. /**
  26930. * - 在指定时间停止指定动画播放
  26931. * @param animationName - 动画数据名称。
  26932. * @param time - 停止的时间。 (以秒为单位)
  26933. * @returns 播放的动画状态。
  26934. * @version DragonBones 4.5
  26935. * @language zh_CN
  26936. */
  26937. gotoAndStopByTime(animationName: string, time?: number): AnimationState | null;
  26938. /**
  26939. * - Stop a specific animation at the specific frame.
  26940. * @param animationName - The name of animation data.
  26941. * @param frame - The stop frame.
  26942. * @returns The played animation state.
  26943. * @version DragonBones 4.5
  26944. * @language en_US
  26945. */
  26946. /**
  26947. * - 在指定帧停止指定动画的播放
  26948. * @param animationName - 动画数据名称。
  26949. * @param frame - 停止的帧数。
  26950. * @returns 播放的动画状态。
  26951. * @version DragonBones 4.5
  26952. * @language zh_CN
  26953. */
  26954. gotoAndStopByFrame(animationName: string, frame?: number): AnimationState | null;
  26955. /**
  26956. * - Stop a specific animation at the specific progress.
  26957. * @param animationName - The name of animation data.
  26958. * @param progress - The stop progress value.
  26959. * @returns The played animation state.
  26960. * @version DragonBones 4.5
  26961. * @language en_US
  26962. */
  26963. /**
  26964. * - 在指定的进度停止指定的动画播放。
  26965. * @param animationName - 动画数据名称。
  26966. * @param progress - 停止进度。
  26967. * @returns 播放的动画状态。
  26968. * @version DragonBones 4.5
  26969. * @language zh_CN
  26970. */
  26971. gotoAndStopByProgress(animationName: string, progress?: number): AnimationState | null;
  26972. /**
  26973. * - Get a specific animation state.
  26974. * @param animationName - The name of animation state.
  26975. * @example
  26976. * <pre>
  26977. * armature.animation.play("walk");
  26978. * let walkState = armature.animation.getState("walk");
  26979. * walkState.timeScale = 0.5;
  26980. * </pre>
  26981. * @version DragonBones 3.0
  26982. * @language en_US
  26983. */
  26984. /**
  26985. * - 获取指定的动画状态
  26986. * @param animationName - 动画状态名称。
  26987. * @example
  26988. * <pre>
  26989. * armature.animation.play("walk");
  26990. * let walkState = armature.animation.getState("walk");
  26991. * walkState.timeScale = 0.5;
  26992. * </pre>
  26993. * @version DragonBones 3.0
  26994. * @language zh_CN
  26995. */
  26996. getState(animationName: string): AnimationState | null;
  26997. /**
  26998. * - Check whether a specific animation data is included.
  26999. * @param animationName - The name of animation data.
  27000. * @see dragonBones.AnimationData
  27001. * @version DragonBones 3.0
  27002. * @language en_US
  27003. */
  27004. /**
  27005. * - 检查是否包含指定的动画数据
  27006. * @param animationName - 动画数据名称。
  27007. * @see dragonBones.AnimationData
  27008. * @version DragonBones 3.0
  27009. * @language zh_CN
  27010. */
  27011. hasAnimation(animationName: string): boolean;
  27012. /**
  27013. * - Get all the animation states.
  27014. * @version DragonBones 5.1
  27015. * @language en_US
  27016. */
  27017. /**
  27018. * - 获取所有的动画状态
  27019. * @version DragonBones 5.1
  27020. * @language zh_CN
  27021. */
  27022. getStates(): Array<AnimationState>;
  27023. /**
  27024. * - Check whether there is an animation state is playing
  27025. * @see dragonBones.AnimationState
  27026. * @version DragonBones 3.0
  27027. * @language en_US
  27028. */
  27029. /**
  27030. * - 检查是否有动画状态正在播放
  27031. * @see dragonBones.AnimationState
  27032. * @version DragonBones 3.0
  27033. * @language zh_CN
  27034. */
  27035. readonly isPlaying: boolean;
  27036. /**
  27037. * - Check whether all the animation states' playing were finished.
  27038. * @see dragonBones.AnimationState
  27039. * @version DragonBones 3.0
  27040. * @language en_US
  27041. */
  27042. /**
  27043. * - 检查是否所有的动画状态均已播放完毕。
  27044. * @see dragonBones.AnimationState
  27045. * @version DragonBones 3.0
  27046. * @language zh_CN
  27047. */
  27048. readonly isCompleted: boolean;
  27049. /**
  27050. * - The name of the last playing animation state.
  27051. * @see #lastAnimationState
  27052. * @version DragonBones 3.0
  27053. * @language en_US
  27054. */
  27055. /**
  27056. * - 上一个播放的动画状态名称
  27057. * @see #lastAnimationState
  27058. * @version DragonBones 3.0
  27059. * @language zh_CN
  27060. */
  27061. readonly lastAnimationName: string;
  27062. /**
  27063. * - The name of all animation data
  27064. * @version DragonBones 4.5
  27065. * @language en_US
  27066. */
  27067. /**
  27068. * - 所有动画数据的名称
  27069. * @version DragonBones 4.5
  27070. * @language zh_CN
  27071. */
  27072. readonly animationNames: Array<string>;
  27073. /**
  27074. * - All animation data.
  27075. * @version DragonBones 4.5
  27076. * @language en_US
  27077. */
  27078. /**
  27079. * - 所有的动画数据。
  27080. * @version DragonBones 4.5
  27081. * @language zh_CN
  27082. */
  27083. animations: Map<AnimationData>;
  27084. /**
  27085. * - An AnimationConfig instance that can be used quickly.
  27086. * @see dragonBones.AnimationConfig
  27087. * @version DragonBones 5.0
  27088. * @language en_US
  27089. */
  27090. /**
  27091. * - 一个可以快速使用的动画配置实例。
  27092. * @see dragonBones.AnimationConfig
  27093. * @version DragonBones 5.0
  27094. * @language zh_CN
  27095. */
  27096. readonly animationConfig: AnimationConfig;
  27097. /**
  27098. * - The last playing animation state
  27099. * @see dragonBones.AnimationState
  27100. * @version DragonBones 3.0
  27101. * @language en_US
  27102. */
  27103. /**
  27104. * - 上一个播放的动画状态
  27105. * @see dragonBones.AnimationState
  27106. * @version DragonBones 3.0
  27107. * @language zh_CN
  27108. */
  27109. readonly lastAnimationState: AnimationState | null;
  27110. /**
  27111. * - Deprecated, please refer to {@link #play()} {@link #fadeIn()}.
  27112. * @deprecated
  27113. * @language en_US
  27114. */
  27115. /**
  27116. * - 已废弃,请参考 {@link #play()} {@link #fadeIn()}。
  27117. * @deprecated
  27118. * @language zh_CN
  27119. */
  27120. gotoAndPlay(animationName: string, fadeInTime?: number, duration?: number, playTimes?: number, layer?: number, group?: string | null, fadeOutMode?: AnimationFadeOutMode, pauseFadeOut?: boolean, pauseFadeIn?: boolean): AnimationState | null;
  27121. /**
  27122. * - Deprecated, please refer to {@link #gotoAndStopByTime()}.
  27123. * @deprecated
  27124. * @language en_US
  27125. */
  27126. /**
  27127. * - 已废弃,请参考 {@link #gotoAndStopByTime()}。
  27128. * @deprecated
  27129. * @language zh_CN
  27130. */
  27131. gotoAndStop(animationName: string, time?: number): AnimationState | null;
  27132. /**
  27133. * - Deprecated, please refer to {@link #animationNames}.
  27134. * @deprecated
  27135. * @language en_US
  27136. */
  27137. /**
  27138. * - 已废弃,请参考 {@link #animationNames}。
  27139. * @deprecated
  27140. * @language zh_CN
  27141. */
  27142. readonly animationList: Array<string>;
  27143. /**
  27144. * - Deprecated, please refer to {@link #animationNames}.
  27145. * @deprecated
  27146. * @language en_US
  27147. */
  27148. /**
  27149. * - 已废弃,请参考 {@link #animationNames}。
  27150. * @deprecated
  27151. * @language zh_CN
  27152. */
  27153. readonly animationDataList: Array<AnimationData>;
  27154. }
  27155. }
  27156. /**
  27157. * The MIT License (MIT)
  27158. *
  27159. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27160. *
  27161. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27162. * this software and associated documentation files (the "Software"), to deal in
  27163. * the Software without restriction, including without limitation the rights to
  27164. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27165. * the Software, and to permit persons to whom the Software is furnished to do so,
  27166. * subject to the following conditions:
  27167. *
  27168. * The above copyright notice and this permission notice shall be included in all
  27169. * copies or substantial portions of the Software.
  27170. *
  27171. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27172. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27173. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27174. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27175. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27176. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27177. */
  27178. declare namespace dragonBones {
  27179. /**
  27180. * - The animation state is generated when the animation data is played.
  27181. * @see dragonBones.Animation
  27182. * @see dragonBones.AnimationData
  27183. * @version DragonBones 3.0
  27184. * @language en_US
  27185. */
  27186. /**
  27187. * - 动画状态由播放动画数据时产生。
  27188. * @see dragonBones.Animation
  27189. * @see dragonBones.AnimationData
  27190. * @version DragonBones 3.0
  27191. * @language zh_CN
  27192. */
  27193. class AnimationState extends BaseObject {
  27194. static toString(): string;
  27195. /**
  27196. * @private
  27197. */
  27198. actionEnabled: boolean;
  27199. /**
  27200. * @private
  27201. */
  27202. additiveBlending: boolean;
  27203. /**
  27204. * - Whether the animation state has control over the display object properties of the slots.
  27205. * Sometimes blend a animation state does not want it to control the display object properties of the slots,
  27206. * especially if other animation state are controlling the display object properties of the slots.
  27207. * @default true
  27208. * @version DragonBones 5.0
  27209. * @language en_US
  27210. */
  27211. /**
  27212. * - 动画状态是否对插槽的显示对象属性有控制权。
  27213. * 有时混合一个动画状态并不希望其控制插槽的显示对象属性,
  27214. * 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
  27215. * @default true
  27216. * @version DragonBones 5.0
  27217. * @language zh_CN
  27218. */
  27219. displayControl: boolean;
  27220. /**
  27221. * - Whether to reset the objects without animation to the armature pose when the animation state is start to play.
  27222. * This property should usually be set to false when blend multiple animation states.
  27223. * @default true
  27224. * @version DragonBones 5.1
  27225. * @language en_US
  27226. */
  27227. /**
  27228. * - 开始播放动画状态时是否将没有动画的对象重置为骨架初始值。
  27229. * 通常在混合多个动画状态时应该将该属性设置为 false。
  27230. * @default true
  27231. * @version DragonBones 5.1
  27232. * @language zh_CN
  27233. */
  27234. resetToPose: boolean;
  27235. /**
  27236. * - The play times. [0: Loop play, [1~N]: Play N times]
  27237. * @version DragonBones 3.0
  27238. * @language en_US
  27239. */
  27240. /**
  27241. * - 播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
  27242. * @version DragonBones 3.0
  27243. * @language zh_CN
  27244. */
  27245. playTimes: number;
  27246. /**
  27247. * - The blend layer.
  27248. * High layer animation state will get the blend weight first.
  27249. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.
  27250. * @readonly
  27251. * @version DragonBones 5.0
  27252. * @language en_US
  27253. */
  27254. /**
  27255. * - 混合图层。
  27256. * 图层高的动画状态会优先获取混合权重。
  27257. * 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
  27258. * @readonly
  27259. * @version DragonBones 5.0
  27260. * @language zh_CN
  27261. */
  27262. layer: number;
  27263. /**
  27264. * - The play speed.
  27265. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}.
  27266. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]
  27267. * @default 1.0
  27268. * @version DragonBones 3.0
  27269. * @language en_US
  27270. */
  27271. /**
  27272. * - 播放速度。
  27273. * 该值与 {@link dragonBones.Animation#timeScale} 是叠加关系。
  27274. * [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
  27275. * @default 1.0
  27276. * @version DragonBones 3.0
  27277. * @language zh_CN
  27278. */
  27279. timeScale: number;
  27280. /**
  27281. * - The blend weight.
  27282. * @default 1.0
  27283. * @version DragonBones 5.0
  27284. * @language en_US
  27285. */
  27286. /**
  27287. * - 混合权重。
  27288. * @default 1.0
  27289. * @version DragonBones 5.0
  27290. * @language zh_CN
  27291. */
  27292. weight: number;
  27293. /**
  27294. * - The auto fade out time when the animation state play completed.
  27295. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)
  27296. * @default -1.0
  27297. * @version DragonBones 5.0
  27298. * @language en_US
  27299. */
  27300. /**
  27301. * - 动画状态播放完成后的自动淡出时间。
  27302. * [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
  27303. * @default -1.0
  27304. * @version DragonBones 5.0
  27305. * @language zh_CN
  27306. */
  27307. autoFadeOutTime: number;
  27308. /**
  27309. * @private
  27310. */
  27311. fadeTotalTime: number;
  27312. /**
  27313. * - The name of the animation state. (Can be different from the name of the animation data)
  27314. * @readonly
  27315. * @version DragonBones 5.0
  27316. * @language en_US
  27317. */
  27318. /**
  27319. * - 动画状态名称。 (可以不同于动画数据)
  27320. * @readonly
  27321. * @version DragonBones 5.0
  27322. * @language zh_CN
  27323. */
  27324. name: string;
  27325. /**
  27326. * - The blend group name of the animation state.
  27327. * This property is typically used to specify the substitution of multiple animation states blend.
  27328. * @readonly
  27329. * @version DragonBones 5.0
  27330. * @language en_US
  27331. */
  27332. /**
  27333. * - 混合组名称。
  27334. * 该属性通常用来指定多个动画状态混合时的相互替换关系。
  27335. * @readonly
  27336. * @version DragonBones 5.0
  27337. * @language zh_CN
  27338. */
  27339. group: string;
  27340. private _timelineDirty;
  27341. /**
  27342. * - xx: Play Enabled, Fade Play Enabled
  27343. * @internal
  27344. * @private
  27345. */
  27346. _playheadState: number;
  27347. /**
  27348. * -1: Fade in, 0: Fade complete, 1: Fade out;
  27349. * @internal
  27350. * @private
  27351. */
  27352. _fadeState: number;
  27353. /**
  27354. * -1: Fade start, 0: Fading, 1: Fade complete;
  27355. * @internal
  27356. * @private
  27357. */
  27358. _subFadeState: number;
  27359. /**
  27360. * @internal
  27361. * @private
  27362. */
  27363. _position: number;
  27364. /**
  27365. * @internal
  27366. * @private
  27367. */
  27368. _duration: number;
  27369. private _fadeTime;
  27370. private _time;
  27371. /**
  27372. * @internal
  27373. * @private
  27374. */
  27375. _fadeProgress: number;
  27376. /**
  27377. * @internal
  27378. * @private
  27379. */
  27380. _weightResult: number;
  27381. /**
  27382. * @internal
  27383. * @private
  27384. */
  27385. readonly _blendState: BlendState;
  27386. private readonly _boneMask;
  27387. private readonly _boneTimelines;
  27388. private readonly _surfaceTimelines;
  27389. private readonly _slotTimelines;
  27390. private readonly _constraintTimelines;
  27391. private readonly _animationTimelines;
  27392. private readonly _poseTimelines;
  27393. private readonly _bonePoses;
  27394. /**
  27395. * @internal
  27396. * @private
  27397. */
  27398. _animationData: AnimationData;
  27399. private _armature;
  27400. /**
  27401. * @internal
  27402. * @private
  27403. */
  27404. _actionTimeline: ActionTimelineState;
  27405. private _zOrderTimeline;
  27406. /**
  27407. * @internal
  27408. * @private
  27409. */
  27410. _parent: AnimationState;
  27411. /**
  27412. * @private
  27413. */
  27414. protected _onClear(): void;
  27415. private _updateTimelines();
  27416. private _updateBoneAndSlotTimelines();
  27417. private _advanceFadeTime(passedTime);
  27418. /**
  27419. * @internal
  27420. * @private
  27421. */
  27422. init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void;
  27423. /**
  27424. * @internal
  27425. * @private
  27426. */
  27427. advanceTime(passedTime: number, cacheFrameRate: number): void;
  27428. /**
  27429. * - Continue play.
  27430. * @version DragonBones 3.0
  27431. * @language en_US
  27432. */
  27433. /**
  27434. * - 继续播放。
  27435. * @version DragonBones 3.0
  27436. * @language zh_CN
  27437. */
  27438. play(): void;
  27439. /**
  27440. * - Stop play.
  27441. * @version DragonBones 3.0
  27442. * @language en_US
  27443. */
  27444. /**
  27445. * - 暂停播放。
  27446. * @version DragonBones 3.0
  27447. * @language zh_CN
  27448. */
  27449. stop(): void;
  27450. /**
  27451. * - Fade out the animation state.
  27452. * @param fadeOutTime - The fade out time. (In seconds)
  27453. * @param pausePlayhead - Whether to pause the animation playing when fade out.
  27454. * @version DragonBones 3.0
  27455. * @language en_US
  27456. */
  27457. /**
  27458. * - 淡出动画状态。
  27459. * @param fadeOutTime - 淡出时间。 (以秒为单位)
  27460. * @param pausePlayhead - 淡出时是否暂停播放。
  27461. * @version DragonBones 3.0
  27462. * @language zh_CN
  27463. */
  27464. fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void;
  27465. /**
  27466. * - Check if a specific bone mask is included.
  27467. * @param name - The bone name.
  27468. * @version DragonBones 3.0
  27469. * @language en_US
  27470. */
  27471. /**
  27472. * - 检查是否包含特定骨骼遮罩。
  27473. * @param name - 骨骼名称。
  27474. * @version DragonBones 3.0
  27475. * @language zh_CN
  27476. */
  27477. containsBoneMask(name: string): boolean;
  27478. /**
  27479. * - Add a specific bone mask.
  27480. * @param name - The bone name.
  27481. * @param recursive - Whether or not to add a mask to the bone's sub-bone.
  27482. * @version DragonBones 3.0
  27483. * @language en_US
  27484. */
  27485. /**
  27486. * - 添加特定的骨骼遮罩。
  27487. * @param name - 骨骼名称。
  27488. * @param recursive - 是否为该骨骼的子骨骼添加遮罩。
  27489. * @version DragonBones 3.0
  27490. * @language zh_CN
  27491. */
  27492. addBoneMask(name: string, recursive?: boolean): void;
  27493. /**
  27494. * - Remove the mask of a specific bone.
  27495. * @param name - The bone name.
  27496. * @param recursive - Whether to remove the bone's sub-bone mask.
  27497. * @version DragonBones 3.0
  27498. * @language en_US
  27499. */
  27500. /**
  27501. * - 删除特定骨骼的遮罩。
  27502. * @param name - 骨骼名称。
  27503. * @param recursive - 是否删除该骨骼的子骨骼遮罩。
  27504. * @version DragonBones 3.0
  27505. * @language zh_CN
  27506. */
  27507. removeBoneMask(name: string, recursive?: boolean): void;
  27508. /**
  27509. * - Remove all bone masks.
  27510. * @version DragonBones 3.0
  27511. * @language en_US
  27512. */
  27513. /**
  27514. * - 删除所有骨骼遮罩。
  27515. * @version DragonBones 3.0
  27516. * @language zh_CN
  27517. */
  27518. removeAllBoneMask(): void;
  27519. /**
  27520. * - Whether the animation state is fading in.
  27521. * @version DragonBones 5.1
  27522. * @language en_US
  27523. */
  27524. /**
  27525. * - 是否正在淡入。
  27526. * @version DragonBones 5.1
  27527. * @language zh_CN
  27528. */
  27529. readonly isFadeIn: boolean;
  27530. /**
  27531. * - Whether the animation state is fading out.
  27532. * @version DragonBones 5.1
  27533. * @language en_US
  27534. */
  27535. /**
  27536. * - 是否正在淡出。
  27537. * @version DragonBones 5.1
  27538. * @language zh_CN
  27539. */
  27540. readonly isFadeOut: boolean;
  27541. /**
  27542. * - Whether the animation state is fade completed.
  27543. * @version DragonBones 5.1
  27544. * @language en_US
  27545. */
  27546. /**
  27547. * - 是否淡入或淡出完毕。
  27548. * @version DragonBones 5.1
  27549. * @language zh_CN
  27550. */
  27551. readonly isFadeComplete: boolean;
  27552. /**
  27553. * - Whether the animation state is playing.
  27554. * @version DragonBones 3.0
  27555. * @language en_US
  27556. */
  27557. /**
  27558. * - 是否正在播放。
  27559. * @version DragonBones 3.0
  27560. * @language zh_CN
  27561. */
  27562. readonly isPlaying: boolean;
  27563. /**
  27564. * - Whether the animation state is play completed.
  27565. * @version DragonBones 3.0
  27566. * @language en_US
  27567. */
  27568. /**
  27569. * - 是否播放完毕。
  27570. * @version DragonBones 3.0
  27571. * @language zh_CN
  27572. */
  27573. readonly isCompleted: boolean;
  27574. /**
  27575. * - The times has been played.
  27576. * @version DragonBones 3.0
  27577. * @language en_US
  27578. */
  27579. /**
  27580. * - 已经循环播放的次数。
  27581. * @version DragonBones 3.0
  27582. * @language zh_CN
  27583. */
  27584. readonly currentPlayTimes: number;
  27585. /**
  27586. * - The total time. (In seconds)
  27587. * @version DragonBones 3.0
  27588. * @language en_US
  27589. */
  27590. /**
  27591. * - 总播放时间。 (以秒为单位)
  27592. * @version DragonBones 3.0
  27593. * @language zh_CN
  27594. */
  27595. readonly totalTime: number;
  27596. /**
  27597. * - The time is currently playing. (In seconds)
  27598. * @version DragonBones 3.0
  27599. * @language en_US
  27600. */
  27601. /**
  27602. * - 当前播放的时间。 (以秒为单位)
  27603. * @version DragonBones 3.0
  27604. * @language zh_CN
  27605. */
  27606. currentTime: number;
  27607. /**
  27608. * - The animation data.
  27609. * @see dragonBones.AnimationData
  27610. * @version DragonBones 3.0
  27611. * @language en_US
  27612. */
  27613. /**
  27614. * - 动画数据。
  27615. * @see dragonBones.AnimationData
  27616. * @version DragonBones 3.0
  27617. * @language zh_CN
  27618. */
  27619. readonly animationData: AnimationData;
  27620. }
  27621. /**
  27622. * @internal
  27623. * @private
  27624. */
  27625. class BonePose extends BaseObject {
  27626. static toString(): string;
  27627. readonly current: Transform;
  27628. readonly delta: Transform;
  27629. readonly result: Transform;
  27630. protected _onClear(): void;
  27631. }
  27632. /**
  27633. * @internal
  27634. * @private
  27635. */
  27636. class BlendState {
  27637. dirty: boolean;
  27638. layer: number;
  27639. leftWeight: number;
  27640. layerWeight: number;
  27641. blendWeight: number;
  27642. update(weight: number, layer: number): number;
  27643. clear(): void;
  27644. }
  27645. }
  27646. /**
  27647. * The MIT License (MIT)
  27648. *
  27649. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27650. *
  27651. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27652. * this software and associated documentation files (the "Software"), to deal in
  27653. * the Software without restriction, including without limitation the rights to
  27654. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27655. * the Software, and to permit persons to whom the Software is furnished to do so,
  27656. * subject to the following conditions:
  27657. *
  27658. * The above copyright notice and this permission notice shall be included in all
  27659. * copies or substantial portions of the Software.
  27660. *
  27661. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27662. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27663. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27664. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27665. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27666. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27667. */
  27668. declare namespace dragonBones {
  27669. /**
  27670. * @internal
  27671. * @private
  27672. */
  27673. const enum TweenState {
  27674. None = 0,
  27675. Once = 1,
  27676. Always = 2,
  27677. }
  27678. /**
  27679. * @internal
  27680. * @private
  27681. */
  27682. abstract class TimelineState extends BaseObject {
  27683. playState: number;
  27684. currentPlayTimes: number;
  27685. currentTime: number;
  27686. protected _tweenState: TweenState;
  27687. protected _frameRate: number;
  27688. protected _frameValueOffset: number;
  27689. protected _frameCount: number;
  27690. protected _frameOffset: number;
  27691. protected _frameIndex: number;
  27692. protected _frameRateR: number;
  27693. protected _position: number;
  27694. protected _duration: number;
  27695. protected _timeScale: number;
  27696. protected _timeOffset: number;
  27697. protected _dragonBonesData: DragonBonesData;
  27698. protected _animationData: AnimationData;
  27699. protected _timelineData: TimelineData | null;
  27700. protected _armature: Armature;
  27701. protected _animationState: AnimationState;
  27702. protected _actionTimeline: TimelineState;
  27703. protected _frameArray: Array<number> | Int16Array;
  27704. protected _frameIntArray: Array<number> | Int16Array;
  27705. protected _frameFloatArray: Array<number> | Int16Array;
  27706. protected _timelineArray: Array<number> | Uint16Array;
  27707. protected _frameIndices: Array<number>;
  27708. protected _onClear(): void;
  27709. protected abstract _onArriveAtFrame(): void;
  27710. protected abstract _onUpdateFrame(): void;
  27711. protected _setCurrentTime(passedTime: number): boolean;
  27712. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27713. fadeOut(): void;
  27714. update(passedTime: number): void;
  27715. }
  27716. /**
  27717. * @internal
  27718. * @private
  27719. */
  27720. abstract class TweenTimelineState extends TimelineState {
  27721. private static _getEasingValue(tweenType, progress, easing);
  27722. private static _getEasingCurveValue(progress, samples, count, offset);
  27723. protected _tweenType: TweenType;
  27724. protected _curveCount: number;
  27725. protected _framePosition: number;
  27726. protected _frameDurationR: number;
  27727. protected _tweenProgress: number;
  27728. protected _tweenEasing: number;
  27729. protected _onClear(): void;
  27730. protected _onArriveAtFrame(): void;
  27731. protected _onUpdateFrame(): void;
  27732. }
  27733. /**
  27734. * @internal
  27735. * @private
  27736. */
  27737. abstract class BoneTimelineState extends TweenTimelineState {
  27738. bone: Bone;
  27739. bonePose: BonePose;
  27740. protected _onClear(): void;
  27741. blend(state: number): void;
  27742. }
  27743. /**
  27744. * @internal
  27745. * @private
  27746. */
  27747. abstract class SlotTimelineState extends TweenTimelineState {
  27748. slot: Slot;
  27749. protected _onClear(): void;
  27750. }
  27751. /**
  27752. * @internal
  27753. * @private
  27754. */
  27755. abstract class ConstraintTimelineState extends TweenTimelineState {
  27756. constraint: Constraint;
  27757. protected _onClear(): void;
  27758. }
  27759. }
  27760. /**
  27761. * The MIT License (MIT)
  27762. *
  27763. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27764. *
  27765. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27766. * this software and associated documentation files (the "Software"), to deal in
  27767. * the Software without restriction, including without limitation the rights to
  27768. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27769. * the Software, and to permit persons to whom the Software is furnished to do so,
  27770. * subject to the following conditions:
  27771. *
  27772. * The above copyright notice and this permission notice shall be included in all
  27773. * copies or substantial portions of the Software.
  27774. *
  27775. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27776. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27777. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27778. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27779. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27780. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27781. */
  27782. declare namespace dragonBones {
  27783. /**
  27784. * @internal
  27785. * @private
  27786. */
  27787. class ActionTimelineState extends TimelineState {
  27788. static toString(): string;
  27789. private _onCrossFrame(frameIndex);
  27790. protected _onArriveAtFrame(): void;
  27791. protected _onUpdateFrame(): void;
  27792. update(passedTime: number): void;
  27793. setCurrentTime(value: number): void;
  27794. }
  27795. /**
  27796. * @internal
  27797. * @private
  27798. */
  27799. class ZOrderTimelineState extends TimelineState {
  27800. static toString(): string;
  27801. protected _onArriveAtFrame(): void;
  27802. protected _onUpdateFrame(): void;
  27803. }
  27804. /**
  27805. * @internal
  27806. * @private
  27807. */
  27808. class BoneAllTimelineState extends BoneTimelineState {
  27809. static toString(): string;
  27810. protected _onArriveAtFrame(): void;
  27811. protected _onUpdateFrame(): void;
  27812. fadeOut(): void;
  27813. }
  27814. /**
  27815. * @internal
  27816. * @private
  27817. */
  27818. class BoneTranslateTimelineState extends BoneTimelineState {
  27819. static toString(): string;
  27820. protected _onArriveAtFrame(): void;
  27821. protected _onUpdateFrame(): void;
  27822. }
  27823. /**
  27824. * @internal
  27825. * @private
  27826. */
  27827. class BoneRotateTimelineState extends BoneTimelineState {
  27828. static toString(): string;
  27829. protected _onArriveAtFrame(): void;
  27830. protected _onUpdateFrame(): void;
  27831. fadeOut(): void;
  27832. }
  27833. /**
  27834. * @internal
  27835. * @private
  27836. */
  27837. class BoneScaleTimelineState extends BoneTimelineState {
  27838. static toString(): string;
  27839. protected _onArriveAtFrame(): void;
  27840. protected _onUpdateFrame(): void;
  27841. }
  27842. /**
  27843. * @internal
  27844. * @private
  27845. */
  27846. class SurfaceTimelineState extends TweenTimelineState {
  27847. static toString(): string;
  27848. surface: Surface;
  27849. private _frameFloatOffset;
  27850. private _valueCount;
  27851. private _deformCount;
  27852. private _valueOffset;
  27853. private readonly _current;
  27854. private readonly _delta;
  27855. private readonly _result;
  27856. protected _onClear(): void;
  27857. protected _onArriveAtFrame(): void;
  27858. protected _onUpdateFrame(): void;
  27859. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27860. blend(state: number): void;
  27861. }
  27862. /**
  27863. * @internal
  27864. * @private
  27865. */
  27866. class SlotDislayTimelineState extends SlotTimelineState {
  27867. static toString(): string;
  27868. protected _onArriveAtFrame(): void;
  27869. }
  27870. /**
  27871. * @internal
  27872. * @private
  27873. */
  27874. class SlotColorTimelineState extends SlotTimelineState {
  27875. static toString(): string;
  27876. private _dirty;
  27877. private readonly _current;
  27878. private readonly _delta;
  27879. private readonly _result;
  27880. protected _onClear(): void;
  27881. protected _onArriveAtFrame(): void;
  27882. protected _onUpdateFrame(): void;
  27883. fadeOut(): void;
  27884. update(passedTime: number): void;
  27885. }
  27886. /**
  27887. * @internal
  27888. * @private
  27889. */
  27890. class SlotFFDTimelineState extends SlotTimelineState {
  27891. static toString(): string;
  27892. meshOffset: number;
  27893. private _dirty;
  27894. private _frameFloatOffset;
  27895. private _valueCount;
  27896. private _deformCount;
  27897. private _valueOffset;
  27898. private readonly _current;
  27899. private readonly _delta;
  27900. private readonly _result;
  27901. protected _onClear(): void;
  27902. protected _onArriveAtFrame(): void;
  27903. protected _onUpdateFrame(): void;
  27904. init(armature: Armature, animationState: AnimationState, timelineData: TimelineData | null): void;
  27905. fadeOut(): void;
  27906. update(passedTime: number): void;
  27907. }
  27908. /**
  27909. * @internal
  27910. * @private
  27911. */
  27912. class IKConstraintTimelineState extends ConstraintTimelineState {
  27913. static toString(): string;
  27914. private _current;
  27915. private _delta;
  27916. protected _onClear(): void;
  27917. protected _onArriveAtFrame(): void;
  27918. protected _onUpdateFrame(): void;
  27919. }
  27920. /**
  27921. * @internal
  27922. * @private
  27923. */
  27924. class AnimationTimelineState extends TweenTimelineState {
  27925. static toString(): string;
  27926. animationState: AnimationState;
  27927. private readonly _floats;
  27928. protected _onClear(): void;
  27929. protected _onArriveAtFrame(): void;
  27930. protected _onUpdateFrame(): void;
  27931. blend(state: number): void;
  27932. }
  27933. }
  27934. /**
  27935. * The MIT License (MIT)
  27936. *
  27937. * Copyright (c) 2012-2017 DragonBones team and other contributors
  27938. *
  27939. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  27940. * this software and associated documentation files (the "Software"), to deal in
  27941. * the Software without restriction, including without limitation the rights to
  27942. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  27943. * the Software, and to permit persons to whom the Software is furnished to do so,
  27944. * subject to the following conditions:
  27945. *
  27946. * The above copyright notice and this permission notice shall be included in all
  27947. * copies or substantial portions of the Software.
  27948. *
  27949. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27950. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  27951. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  27952. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  27953. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27954. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27955. */
  27956. declare namespace dragonBones {
  27957. /**
  27958. * - The properties of the object carry basic information about an event,
  27959. * which are passed as parameter or parameter's parameter to event listeners when an event occurs.
  27960. * @version DragonBones 4.5
  27961. * @language en_US
  27962. */
  27963. /**
  27964. * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。
  27965. * @version DragonBones 4.5
  27966. * @language zh_CN
  27967. */
  27968. class EventObject extends BaseObject {
  27969. /**
  27970. * - Animation start play.
  27971. * @version DragonBones 4.5
  27972. * @language en_US
  27973. */
  27974. /**
  27975. * - 动画开始播放。
  27976. * @version DragonBones 4.5
  27977. * @language zh_CN
  27978. */
  27979. static readonly START: string;
  27980. /**
  27981. * - Animation loop play complete once.
  27982. * @version DragonBones 4.5
  27983. * @language en_US
  27984. */
  27985. /**
  27986. * - 动画循环播放完成一次。
  27987. * @version DragonBones 4.5
  27988. * @language zh_CN
  27989. */
  27990. static readonly LOOP_COMPLETE: string;
  27991. /**
  27992. * - Animation play complete.
  27993. * @version DragonBones 4.5
  27994. * @language en_US
  27995. */
  27996. /**
  27997. * - 动画播放完成。
  27998. * @version DragonBones 4.5
  27999. * @language zh_CN
  28000. */
  28001. static readonly COMPLETE: string;
  28002. /**
  28003. * - Animation fade in start.
  28004. * @version DragonBones 4.5
  28005. * @language en_US
  28006. */
  28007. /**
  28008. * - 动画淡入开始。
  28009. * @version DragonBones 4.5
  28010. * @language zh_CN
  28011. */
  28012. static readonly FADE_IN: string;
  28013. /**
  28014. * - Animation fade in complete.
  28015. * @version DragonBones 4.5
  28016. * @language en_US
  28017. */
  28018. /**
  28019. * - 动画淡入完成。
  28020. * @version DragonBones 4.5
  28021. * @language zh_CN
  28022. */
  28023. static readonly FADE_IN_COMPLETE: string;
  28024. /**
  28025. * - Animation fade out start.
  28026. * @version DragonBones 4.5
  28027. * @language en_US
  28028. */
  28029. /**
  28030. * - 动画淡出开始。
  28031. * @version DragonBones 4.5
  28032. * @language zh_CN
  28033. */
  28034. static readonly FADE_OUT: string;
  28035. /**
  28036. * - Animation fade out complete.
  28037. * @version DragonBones 4.5
  28038. * @language en_US
  28039. */
  28040. /**
  28041. * - 动画淡出完成。
  28042. * @version DragonBones 4.5
  28043. * @language zh_CN
  28044. */
  28045. static readonly FADE_OUT_COMPLETE: string;
  28046. /**
  28047. * - Animation frame event.
  28048. * @version DragonBones 4.5
  28049. * @language en_US
  28050. */
  28051. /**
  28052. * - 动画帧事件。
  28053. * @version DragonBones 4.5
  28054. * @language zh_CN
  28055. */
  28056. static readonly FRAME_EVENT: string;
  28057. /**
  28058. * - Animation frame sound event.
  28059. * @version DragonBones 4.5
  28060. * @language en_US
  28061. */
  28062. /**
  28063. * - 动画帧声音事件。
  28064. * @version DragonBones 4.5
  28065. * @language zh_CN
  28066. */
  28067. static readonly SOUND_EVENT: string;
  28068. static toString(): string;
  28069. /**
  28070. * - If is a frame event, the value is used to describe the time that the event was in the animation timeline. (In seconds)
  28071. * @version DragonBones 4.5
  28072. * @language en_US
  28073. */
  28074. /**
  28075. * - 如果是帧事件,此值用来描述该事件在动画时间轴中所处的时间。(以秒为单位)
  28076. * @version DragonBones 4.5
  28077. * @language zh_CN
  28078. */
  28079. time: number;
  28080. /**
  28081. * - The event type。
  28082. * @version DragonBones 4.5
  28083. * @language en_US
  28084. */
  28085. /**
  28086. * - 事件类型。
  28087. * @version DragonBones 4.5
  28088. * @language zh_CN
  28089. */
  28090. type: EventStringType;
  28091. /**
  28092. * - The event name. (The frame event name or the frame sound name)
  28093. * @version DragonBones 4.5
  28094. * @language en_US
  28095. */
  28096. /**
  28097. * - 事件名称。 (帧事件的名称或帧声音的名称)
  28098. * @version DragonBones 4.5
  28099. * @language zh_CN
  28100. */
  28101. name: string;
  28102. /**
  28103. * - The armature that dispatch the event.
  28104. * @see dragonBones.Armature
  28105. * @version DragonBones 4.5
  28106. * @language en_US
  28107. */
  28108. /**
  28109. * - 发出该事件的骨架。
  28110. * @see dragonBones.Armature
  28111. * @version DragonBones 4.5
  28112. * @language zh_CN
  28113. */
  28114. armature: Armature;
  28115. /**
  28116. * - The bone that dispatch the event.
  28117. * @see dragonBones.Bone
  28118. * @version DragonBones 4.5
  28119. * @language en_US
  28120. */
  28121. /**
  28122. * - 发出该事件的骨骼。
  28123. * @see dragonBones.Bone
  28124. * @version DragonBones 4.5
  28125. * @language zh_CN
  28126. */
  28127. bone: Bone | null;
  28128. /**
  28129. * - The slot that dispatch the event.
  28130. * @see dragonBones.Slot
  28131. * @version DragonBones 4.5
  28132. * @language en_US
  28133. */
  28134. /**
  28135. * - 发出该事件的插槽。
  28136. * @see dragonBones.Slot
  28137. * @version DragonBones 4.5
  28138. * @language zh_CN
  28139. */
  28140. slot: Slot | null;
  28141. /**
  28142. * - The animation state that dispatch the event.
  28143. * @see dragonBones.AnimationState
  28144. * @version DragonBones 4.5
  28145. * @language en_US
  28146. */
  28147. /**
  28148. * - 发出该事件的动画状态。
  28149. * @see dragonBones.AnimationState
  28150. * @version DragonBones 4.5
  28151. * @language zh_CN
  28152. */
  28153. animationState: AnimationState;
  28154. /**
  28155. * - The custom data.
  28156. * @see dragonBones.CustomData
  28157. * @version DragonBones 5.0
  28158. * @language en_US
  28159. */
  28160. /**
  28161. * - 自定义数据。
  28162. * @see dragonBones.CustomData
  28163. * @version DragonBones 5.0
  28164. * @language zh_CN
  28165. */
  28166. data: UserData | null;
  28167. /**
  28168. * @private
  28169. */
  28170. protected _onClear(): void;
  28171. }
  28172. }
  28173. /**
  28174. * The MIT License (MIT)
  28175. *
  28176. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28177. *
  28178. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28179. * this software and associated documentation files (the "Software"), to deal in
  28180. * the Software without restriction, including without limitation the rights to
  28181. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28182. * the Software, and to permit persons to whom the Software is furnished to do so,
  28183. * subject to the following conditions:
  28184. *
  28185. * The above copyright notice and this permission notice shall be included in all
  28186. * copies or substantial portions of the Software.
  28187. *
  28188. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28189. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28190. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28191. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28192. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28193. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28194. */
  28195. declare namespace dragonBones {
  28196. /**
  28197. * @private
  28198. */
  28199. type EventStringType = string | "start" | "loopComplete" | "complete" | "fadeIn" | "fadeInComplete" | "fadeOut" | "fadeOutComplete" | "frameEvent" | "soundEvent";
  28200. /**
  28201. * - The event dispatcher interface.
  28202. * Dragonbones event dispatch usually relies on docking engine to implement, which defines the event method to be implemented when docking the engine.
  28203. * @version DragonBones 4.5
  28204. * @language en_US
  28205. */
  28206. /**
  28207. * - 事件派发接口。
  28208. * DragonBones 的事件派发通常依赖于对接的引擎来实现,该接口定义了对接引擎时需要实现的事件方法。
  28209. * @version DragonBones 4.5
  28210. * @language zh_CN
  28211. */
  28212. interface IEventDispatcher {
  28213. /**
  28214. * - Checks whether the object has any listeners registered for a specific type of event。
  28215. * @param type - Event type.
  28216. * @version DragonBones 4.5
  28217. * @language en_US
  28218. */
  28219. /**
  28220. * - 检查是否为特定的事件类型注册了任何侦听器。
  28221. * @param type - 事件类型。
  28222. * @version DragonBones 4.5
  28223. * @language zh_CN
  28224. */
  28225. hasDBEventListener(type: EventStringType): boolean;
  28226. /**
  28227. * - Dispatches an event into the event flow.
  28228. * @param type - Event type.
  28229. * @param eventObject - Event object.
  28230. * @see dragonBones.EventObject
  28231. * @version DragonBones 4.5
  28232. * @language en_US
  28233. */
  28234. /**
  28235. * - 分派特定的事件到事件流中。
  28236. * @param type - 事件类型。
  28237. * @param eventObject - 事件数据。
  28238. * @see dragonBones.EventObject
  28239. * @version DragonBones 4.5
  28240. * @language zh_CN
  28241. */
  28242. dispatchDBEvent(type: EventStringType, eventObject: EventObject): void;
  28243. /**
  28244. * - Add an event listener object so that the listener receives notification of an event.
  28245. * @param type - Event type.
  28246. * @param listener - Event listener.
  28247. * @param thisObject - The listener function's "this".
  28248. * @version DragonBones 4.5
  28249. * @language en_US
  28250. */
  28251. /**
  28252. * - 添加特定事件类型的事件侦听器,以使侦听器能够接收事件通知。
  28253. * @param type - 事件类型。
  28254. * @param listener - 事件侦听器。
  28255. * @param thisObject - 侦听函数绑定的 this 对象。
  28256. * @version DragonBones 4.5
  28257. * @language zh_CN
  28258. */
  28259. addDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  28260. /**
  28261. * - Removes a listener from the object.
  28262. * @param type - Event type.
  28263. * @param listener - Event listener.
  28264. * @param thisObject - The listener function's "this".
  28265. * @version DragonBones 4.5
  28266. * @language en_US
  28267. */
  28268. /**
  28269. * - 删除特定事件类型的侦听器。
  28270. * @param type - 事件类型。
  28271. * @param listener - 事件侦听器。
  28272. * @param thisObject - 侦听函数绑定的 this 对象。
  28273. * @version DragonBones 4.5
  28274. * @language zh_CN
  28275. */
  28276. removeDBEventListener(type: EventStringType, listener: Function, thisObject: any): void;
  28277. /**
  28278. * - Deprecated, please refer to {@link #hasDBEventListener()}.
  28279. * @deprecated
  28280. * @language en_US
  28281. */
  28282. /**
  28283. * - 已废弃,请参考 {@link #hasDBEventListener()}。
  28284. * @deprecated
  28285. * @language zh_CN
  28286. */
  28287. hasEvent(type: EventStringType): boolean;
  28288. /**
  28289. * - Deprecated, please refer to {@link #addDBEventListener()}.
  28290. * @deprecated
  28291. * @language en_US
  28292. */
  28293. /**
  28294. * - 已废弃,请参考 {@link #addDBEventListener()}。
  28295. * @deprecated
  28296. * @language zh_CN
  28297. */
  28298. addEvent(type: EventStringType, listener: Function, thisObject: any): void;
  28299. /**
  28300. * - Deprecated, please refer to {@link #removeDBEventListener()}.
  28301. * @deprecated
  28302. * @language en_US
  28303. */
  28304. /**
  28305. * - 已废弃,请参考 {@link #removeDBEventListener()}。
  28306. * @deprecated
  28307. * @language zh_CN
  28308. */
  28309. removeEvent(type: EventStringType, listener: Function, thisObject: any): void;
  28310. }
  28311. }
  28312. /**
  28313. * The MIT License (MIT)
  28314. *
  28315. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28316. *
  28317. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28318. * this software and associated documentation files (the "Software"), to deal in
  28319. * the Software without restriction, including without limitation the rights to
  28320. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28321. * the Software, and to permit persons to whom the Software is furnished to do so,
  28322. * subject to the following conditions:
  28323. *
  28324. * The above copyright notice and this permission notice shall be included in all
  28325. * copies or substantial portions of the Software.
  28326. *
  28327. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28328. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28329. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28330. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28331. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28332. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28333. */
  28334. declare namespace dragonBones {
  28335. /**
  28336. * @internal
  28337. * @private
  28338. */
  28339. abstract class DataParser {
  28340. protected static readonly DATA_VERSION_2_3: string;
  28341. protected static readonly DATA_VERSION_3_0: string;
  28342. protected static readonly DATA_VERSION_4_0: string;
  28343. protected static readonly DATA_VERSION_4_5: string;
  28344. protected static readonly DATA_VERSION_5_0: string;
  28345. protected static readonly DATA_VERSION_5_5: string;
  28346. protected static readonly DATA_VERSION: string;
  28347. protected static readonly DATA_VERSIONS: Array<string>;
  28348. protected static readonly TEXTURE_ATLAS: string;
  28349. protected static readonly SUB_TEXTURE: string;
  28350. protected static readonly FORMAT: string;
  28351. protected static readonly IMAGE_PATH: string;
  28352. protected static readonly WIDTH: string;
  28353. protected static readonly HEIGHT: string;
  28354. protected static readonly ROTATED: string;
  28355. protected static readonly FRAME_X: string;
  28356. protected static readonly FRAME_Y: string;
  28357. protected static readonly FRAME_WIDTH: string;
  28358. protected static readonly FRAME_HEIGHT: string;
  28359. protected static readonly DRADON_BONES: string;
  28360. protected static readonly USER_DATA: string;
  28361. protected static readonly ARMATURE: string;
  28362. protected static readonly BONE: string;
  28363. protected static readonly SURFACE: string;
  28364. protected static readonly SLOT: string;
  28365. protected static readonly CONSTRAINT: string;
  28366. protected static readonly IK: string;
  28367. protected static readonly SKIN: string;
  28368. protected static readonly DISPLAY: string;
  28369. protected static readonly ANIMATION: string;
  28370. protected static readonly Z_ORDER: string;
  28371. protected static readonly FFD: string;
  28372. protected static readonly FRAME: string;
  28373. protected static readonly TRANSLATE_FRAME: string;
  28374. protected static readonly ROTATE_FRAME: string;
  28375. protected static readonly SCALE_FRAME: string;
  28376. protected static readonly DISPLAY_FRAME: string;
  28377. protected static readonly COLOR_FRAME: string;
  28378. protected static readonly DEFAULT_ACTIONS: string;
  28379. protected static readonly ACTIONS: string;
  28380. protected static readonly EVENTS: string;
  28381. protected static readonly INTS: string;
  28382. protected static readonly FLOATS: string;
  28383. protected static readonly STRINGS: string;
  28384. protected static readonly CANVAS: string;
  28385. protected static readonly TRANSFORM: string;
  28386. protected static readonly PIVOT: string;
  28387. protected static readonly AABB: string;
  28388. protected static readonly COLOR: string;
  28389. protected static readonly VERSION: string;
  28390. protected static readonly COMPATIBLE_VERSION: string;
  28391. protected static readonly FRAME_RATE: string;
  28392. protected static readonly TYPE: string;
  28393. protected static readonly SUB_TYPE: string;
  28394. protected static readonly NAME: string;
  28395. protected static readonly PARENT: string;
  28396. protected static readonly TARGET: string;
  28397. protected static readonly STAGE: string;
  28398. protected static readonly SHARE: string;
  28399. protected static readonly PATH: string;
  28400. protected static readonly LENGTH: string;
  28401. protected static readonly DISPLAY_INDEX: string;
  28402. protected static readonly BLEND_MODE: string;
  28403. protected static readonly INHERIT_TRANSLATION: string;
  28404. protected static readonly INHERIT_ROTATION: string;
  28405. protected static readonly INHERIT_SCALE: string;
  28406. protected static readonly INHERIT_REFLECTION: string;
  28407. protected static readonly INHERIT_ANIMATION: string;
  28408. protected static readonly INHERIT_DEFORM: string;
  28409. protected static readonly SEGMENT_X: string;
  28410. protected static readonly SEGMENT_Y: string;
  28411. protected static readonly BEND_POSITIVE: string;
  28412. protected static readonly CHAIN: string;
  28413. protected static readonly WEIGHT: string;
  28414. protected static readonly FADE_IN_TIME: string;
  28415. protected static readonly PLAY_TIMES: string;
  28416. protected static readonly SCALE: string;
  28417. protected static readonly OFFSET: string;
  28418. protected static readonly POSITION: string;
  28419. protected static readonly DURATION: string;
  28420. protected static readonly TWEEN_EASING: string;
  28421. protected static readonly TWEEN_ROTATE: string;
  28422. protected static readonly TWEEN_SCALE: string;
  28423. protected static readonly CLOCK_WISE: string;
  28424. protected static readonly CURVE: string;
  28425. protected static readonly SOUND: string;
  28426. protected static readonly EVENT: string;
  28427. protected static readonly ACTION: string;
  28428. protected static readonly X: string;
  28429. protected static readonly Y: string;
  28430. protected static readonly SKEW_X: string;
  28431. protected static readonly SKEW_Y: string;
  28432. protected static readonly SCALE_X: string;
  28433. protected static readonly SCALE_Y: string;
  28434. protected static readonly VALUE: string;
  28435. protected static readonly ROTATE: string;
  28436. protected static readonly SKEW: string;
  28437. protected static readonly ALPHA_OFFSET: string;
  28438. protected static readonly RED_OFFSET: string;
  28439. protected static readonly GREEN_OFFSET: string;
  28440. protected static readonly BLUE_OFFSET: string;
  28441. protected static readonly ALPHA_MULTIPLIER: string;
  28442. protected static readonly RED_MULTIPLIER: string;
  28443. protected static readonly GREEN_MULTIPLIER: string;
  28444. protected static readonly BLUE_MULTIPLIER: string;
  28445. protected static readonly UVS: string;
  28446. protected static readonly VERTICES: string;
  28447. protected static readonly TRIANGLES: string;
  28448. protected static readonly WEIGHTS: string;
  28449. protected static readonly SLOT_POSE: string;
  28450. protected static readonly BONE_POSE: string;
  28451. protected static readonly GLUE_WEIGHTS: string;
  28452. protected static readonly GLUE_MESHES: string;
  28453. protected static readonly GOTO_AND_PLAY: string;
  28454. protected static readonly DEFAULT_NAME: string;
  28455. protected static _getArmatureType(value: string): ArmatureType;
  28456. protected static _getBoneType(value: string): BoneType;
  28457. protected static _getDisplayType(value: string): DisplayType;
  28458. protected static _getBoundingBoxType(value: string): BoundingBoxType;
  28459. protected static _getActionType(value: string): ActionType;
  28460. protected static _getBlendMode(value: string): BlendMode;
  28461. abstract parseDragonBonesData(rawData: any, scale: number): DragonBonesData | null;
  28462. abstract parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale: number): boolean;
  28463. /**
  28464. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  28465. * @deprecated
  28466. * @language en_US
  28467. */
  28468. /**
  28469. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  28470. * @deprecated
  28471. * @language zh_CN
  28472. */
  28473. static parseDragonBonesData(rawData: any): DragonBonesData | null;
  28474. /**
  28475. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parsetTextureAtlasData()}.
  28476. * @deprecated
  28477. * @language en_US
  28478. */
  28479. /**
  28480. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parsetTextureAtlasData()}。
  28481. * @deprecated
  28482. * @language zh_CN
  28483. */
  28484. static parseTextureAtlasData(rawData: any, scale?: number): any;
  28485. }
  28486. }
  28487. /**
  28488. * The MIT License (MIT)
  28489. *
  28490. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28491. *
  28492. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28493. * this software and associated documentation files (the "Software"), to deal in
  28494. * the Software without restriction, including without limitation the rights to
  28495. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28496. * the Software, and to permit persons to whom the Software is furnished to do so,
  28497. * subject to the following conditions:
  28498. *
  28499. * The above copyright notice and this permission notice shall be included in all
  28500. * copies or substantial portions of the Software.
  28501. *
  28502. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28503. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28504. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28505. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28506. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28507. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28508. */
  28509. declare namespace dragonBones {
  28510. /**
  28511. * @internal
  28512. * @private
  28513. */
  28514. class ObjectDataParser extends DataParser {
  28515. protected static _getBoolean(rawData: any, key: string, defaultValue: boolean): boolean;
  28516. protected static _getNumber(rawData: any, key: string, defaultValue: number): number;
  28517. protected static _getString(rawData: any, key: string, defaultValue: string): string;
  28518. protected _rawTextureAtlasIndex: number;
  28519. protected readonly _rawBones: Array<BoneData>;
  28520. protected _data: DragonBonesData;
  28521. protected _armature: ArmatureData;
  28522. protected _bone: BoneData;
  28523. protected _surface: SurfaceData;
  28524. protected _slot: SlotData;
  28525. protected _skin: SkinData;
  28526. protected _mesh: MeshDisplayData;
  28527. protected _animation: AnimationData;
  28528. protected _timeline: TimelineData;
  28529. protected _rawTextureAtlases: Array<any> | null;
  28530. private _defaultColorOffset;
  28531. private _prevClockwise;
  28532. private _prevRotation;
  28533. private readonly _helpMatrixA;
  28534. private readonly _helpMatrixB;
  28535. private readonly _helpTransform;
  28536. private readonly _helpColorTransform;
  28537. private readonly _helpPoint;
  28538. private readonly _helpArray;
  28539. private readonly _intArray;
  28540. private readonly _floatArray;
  28541. private readonly _frameIntArray;
  28542. private readonly _frameFloatArray;
  28543. private readonly _frameArray;
  28544. private readonly _timelineArray;
  28545. private readonly _cacheRawMeshes;
  28546. private readonly _cacheMeshes;
  28547. private readonly _actionFrames;
  28548. private readonly _weightSlotPose;
  28549. private readonly _weightBonePoses;
  28550. private readonly _cacheBones;
  28551. private readonly _slotChildActions;
  28552. private _getCurvePoint(x1, y1, x2, y2, x3, y3, x4, y4, t, result);
  28553. private _samplingEasingCurve(curve, samples);
  28554. private _parseActionDataInFrame(rawData, frameStart, bone, slot);
  28555. private _mergeActionFrame(rawData, frameStart, type, bone, slot);
  28556. protected _parseArmature(rawData: any, scale: number): ArmatureData;
  28557. protected _parseBone(rawData: any): BoneData;
  28558. protected _parseIKConstraint(rawData: any): ConstraintData | null;
  28559. protected _parseSlot(rawData: any, zOrder: number): SlotData;
  28560. protected _parseSkin(rawData: any): SkinData;
  28561. protected _parseDisplay(rawData: any): DisplayData | null;
  28562. protected _parsePivot(rawData: any, display: ImageDisplayData): void;
  28563. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  28564. protected _parseMeshGlue(rawData: any, mesh: MeshDisplayData): void;
  28565. protected _parseBoundingBox(rawData: any): BoundingBoxData | null;
  28566. protected _parsePolygonBoundingBox(rawData: any): PolygonBoundingBoxData;
  28567. protected _parseAnimation(rawData: any): AnimationData;
  28568. 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;
  28569. protected _parseBoneTimeline(rawData: any): void;
  28570. protected _parseSlotTimeline(rawData: any): void;
  28571. protected _parseFrame(rawData: any, frameStart: number, frameCount: number): number;
  28572. protected _parseTweenFrame(rawData: any, frameStart: number, frameCount: number): number;
  28573. protected _parseActionFrame(frame: ActionFrame, frameStart: number, frameCount: number): number;
  28574. protected _parseZOrderFrame(rawData: any, frameStart: number, frameCount: number): number;
  28575. protected _parseBoneAllFrame(rawData: any, frameStart: number, frameCount: number): number;
  28576. protected _parseBoneTranslateFrame(rawData: any, frameStart: number, frameCount: number): number;
  28577. protected _parseBoneRotateFrame(rawData: any, frameStart: number, frameCount: number): number;
  28578. protected _parseBoneScaleFrame(rawData: any, frameStart: number, frameCount: number): number;
  28579. protected _parseSurfaceFrame(rawData: any, frameStart: number, frameCount: number): number;
  28580. protected _parseSlotDisplayFrame(rawData: any, frameStart: number, frameCount: number): number;
  28581. protected _parseSlotColorFrame(rawData: any, frameStart: number, frameCount: number): number;
  28582. protected _parseSlotFFDFrame(rawData: any, frameStart: number, frameCount: number): number;
  28583. protected _parseIKConstraintFrame(rawData: any, frameStart: number, frameCount: number): number;
  28584. protected _parseAnimationFrame(rawData: any, frameStart: number, frameCount: number): number;
  28585. protected _parseActionData(rawData: any, type: ActionType, bone: BoneData | null, slot: SlotData | null): Array<ActionData>;
  28586. protected _parseTransform(rawData: any, transform: Transform, scale: number): void;
  28587. protected _parseColorTransform(rawData: any, color: ColorTransform): void;
  28588. protected _parseArray(rawData: any): void;
  28589. protected _modifyArray(): void;
  28590. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  28591. parseTextureAtlasData(rawData: any, textureAtlasData: TextureAtlasData, scale?: number): boolean;
  28592. private static _objectDataParserInstance;
  28593. /**
  28594. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  28595. * @deprecated
  28596. * @language en_US
  28597. */
  28598. /**
  28599. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  28600. * @deprecated
  28601. * @language zh_CN
  28602. */
  28603. static getInstance(): ObjectDataParser;
  28604. }
  28605. /**
  28606. * @internal
  28607. * @private
  28608. */
  28609. class ActionFrame {
  28610. frameStart: number;
  28611. readonly actions: Array<number>;
  28612. }
  28613. }
  28614. /**
  28615. * The MIT License (MIT)
  28616. *
  28617. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28618. *
  28619. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28620. * this software and associated documentation files (the "Software"), to deal in
  28621. * the Software without restriction, including without limitation the rights to
  28622. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28623. * the Software, and to permit persons to whom the Software is furnished to do so,
  28624. * subject to the following conditions:
  28625. *
  28626. * The above copyright notice and this permission notice shall be included in all
  28627. * copies or substantial portions of the Software.
  28628. *
  28629. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28630. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28631. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28632. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28633. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28634. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28635. */
  28636. declare namespace dragonBones {
  28637. /**
  28638. * @internal
  28639. * @private
  28640. */
  28641. class BinaryDataParser extends ObjectDataParser {
  28642. private _binaryOffset;
  28643. private _binary;
  28644. private _intArrayBuffer;
  28645. private _floatArrayBuffer;
  28646. private _frameIntArrayBuffer;
  28647. private _frameFloatArrayBuffer;
  28648. private _frameArrayBuffer;
  28649. private _timelineArrayBuffer;
  28650. private _inRange(a, min, max);
  28651. private _decodeUTF8(data);
  28652. private _getUTF16Key(value);
  28653. private _parseBinaryTimeline(type, offset, timelineData?);
  28654. protected _parseMesh(rawData: any, mesh: MeshDisplayData): void;
  28655. protected _parseAnimation(rawData: any): AnimationData;
  28656. protected _parseArray(rawData: any): void;
  28657. parseDragonBonesData(rawData: any, scale?: number): DragonBonesData | null;
  28658. private static _binaryDataParserInstance;
  28659. /**
  28660. * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}.
  28661. * @deprecated
  28662. * @language en_US
  28663. */
  28664. /**
  28665. * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。
  28666. * @deprecated
  28667. * @language zh_CN
  28668. */
  28669. static getInstance(): BinaryDataParser;
  28670. }
  28671. }
  28672. /**
  28673. * The MIT License (MIT)
  28674. *
  28675. * Copyright (c) 2012-2017 DragonBones team and other contributors
  28676. *
  28677. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  28678. * this software and associated documentation files (the "Software"), to deal in
  28679. * the Software without restriction, including without limitation the rights to
  28680. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  28681. * the Software, and to permit persons to whom the Software is furnished to do so,
  28682. * subject to the following conditions:
  28683. *
  28684. * The above copyright notice and this permission notice shall be included in all
  28685. * copies or substantial portions of the Software.
  28686. *
  28687. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28688. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  28689. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  28690. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  28691. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28692. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28693. */
  28694. declare namespace dragonBones {
  28695. /**
  28696. * - Base class for the factory that create the armatures. (Typically only one global factory instance is required)
  28697. * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances.
  28698. * 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.
  28699. * @see dragonBones.DragonBonesData
  28700. * @see dragonBones.TextureAtlasData
  28701. * @see dragonBones.ArmatureData
  28702. * @see dragonBones.Armature
  28703. * @version DragonBones 3.0
  28704. * @language en_US
  28705. */
  28706. /**
  28707. * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例)
  28708. * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。
  28709. * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。
  28710. * @see dragonBones.DragonBonesData
  28711. * @see dragonBones.TextureAtlasData
  28712. * @see dragonBones.ArmatureData
  28713. * @see dragonBones.Armature
  28714. * @version DragonBones 3.0
  28715. * @language zh_CN
  28716. */
  28717. abstract class BaseFactory {
  28718. /**
  28719. * @private
  28720. */
  28721. protected static _objectParser: ObjectDataParser;
  28722. /**
  28723. * @private
  28724. */
  28725. protected static _binaryParser: BinaryDataParser;
  28726. /**
  28727. * @private
  28728. */
  28729. autoSearch: boolean;
  28730. /**
  28731. * @private
  28732. */
  28733. protected readonly _dragonBonesDataMap: Map<DragonBonesData>;
  28734. /**
  28735. * @private
  28736. */
  28737. protected readonly _textureAtlasDataMap: Map<Array<TextureAtlasData>>;
  28738. /**
  28739. * @private
  28740. */
  28741. protected _dragonBones: DragonBones;
  28742. /**
  28743. * @private
  28744. */
  28745. protected _dataParser: DataParser;
  28746. /**
  28747. * - Create a factory instance. (typically only one global factory instance is required)
  28748. * @version DragonBones 3.0
  28749. * @language en_US
  28750. */
  28751. /**
  28752. * - 创建一个工厂实例。 (通常只需要一个全局工厂实例)
  28753. * @version DragonBones 3.0
  28754. * @language zh_CN
  28755. */
  28756. constructor(dataParser?: DataParser | null);
  28757. /**
  28758. * @private
  28759. */
  28760. protected _isSupportMesh(): boolean;
  28761. /**
  28762. * @private
  28763. */
  28764. protected _getTextureData(textureAtlasName: string, textureName: string): TextureData | null;
  28765. /**
  28766. * @private
  28767. */
  28768. protected _fillBuildArmaturePackage(dataPackage: BuildArmaturePackage, dragonBonesName: string, armatureName: string, skinName: string, textureAtlasName: string): boolean;
  28769. /**
  28770. * @private
  28771. */
  28772. protected _buildBones(dataPackage: BuildArmaturePackage, armature: Armature): void;
  28773. /**
  28774. * @private
  28775. */
  28776. protected _buildSlots(dataPackage: BuildArmaturePackage, armature: Armature): void;
  28777. /**
  28778. * @private
  28779. */
  28780. protected _buildChildArmature(dataPackage: BuildArmaturePackage | null, slot: Slot, displayData: DisplayData): Armature | null;
  28781. /**
  28782. * @private
  28783. */
  28784. protected _getSlotDisplay(dataPackage: BuildArmaturePackage | null, displayData: DisplayData, rawDisplayData: DisplayData | null, slot: Slot): any;
  28785. /**
  28786. * @private
  28787. */
  28788. protected abstract _buildTextureAtlasData(textureAtlasData: TextureAtlasData | null, textureAtlas: any): TextureAtlasData;
  28789. /**
  28790. * @private
  28791. */
  28792. protected abstract _buildArmature(dataPackage: BuildArmaturePackage): Armature;
  28793. /**
  28794. * @private
  28795. */
  28796. protected abstract _buildSlot(dataPackage: BuildArmaturePackage, slotData: SlotData, displays: Array<DisplayData | null> | null, armature: Armature): Slot;
  28797. /**
  28798. * - Parse the raw data to a DragonBonesData instance and cache it to the factory.
  28799. * @param rawData - The raw data.
  28800. * @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)
  28801. * @param scale - Specify a scaling value for all armatures. (Default: 1.0)
  28802. * @returns DragonBonesData instance
  28803. * @see #getDragonBonesData()
  28804. * @see #addDragonBonesData()
  28805. * @see #removeDragonBonesData()
  28806. * @see dragonBones.DragonBonesData
  28807. * @version DragonBones 4.5
  28808. * @language en_US
  28809. */
  28810. /**
  28811. * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。
  28812. * @param rawData - 原始数据。
  28813. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28814. * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0)
  28815. * @returns DragonBonesData 实例
  28816. * @see #getDragonBonesData()
  28817. * @see #addDragonBonesData()
  28818. * @see #removeDragonBonesData()
  28819. * @see dragonBones.DragonBonesData
  28820. * @version DragonBones 4.5
  28821. * @language zh_CN
  28822. */
  28823. parseDragonBonesData(rawData: any, name?: string | null, scale?: number): DragonBonesData | null;
  28824. /**
  28825. * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory.
  28826. * @param rawData - The raw texture atlas data.
  28827. * @param textureAtlas - The texture atlas object.
  28828. * @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)
  28829. * @param scale - Specify a scaling value for the map set. (Default: 1.0)
  28830. * @returns TextureAtlasData instance
  28831. * @see #getTextureAtlasData()
  28832. * @see #addTextureAtlasData()
  28833. * @see #removeTextureAtlasData()
  28834. * @see dragonBones.TextureAtlasData
  28835. * @version DragonBones 4.5
  28836. * @language en_US
  28837. */
  28838. /**
  28839. * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。
  28840. * @param rawData - 原始贴图集数据。
  28841. * @param textureAtlas - 贴图集对象。
  28842. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28843. * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0)
  28844. * @returns TextureAtlasData 实例
  28845. * @see #getTextureAtlasData()
  28846. * @see #addTextureAtlasData()
  28847. * @see #removeTextureAtlasData()
  28848. * @see dragonBones.TextureAtlasData
  28849. * @version DragonBones 4.5
  28850. * @language zh_CN
  28851. */
  28852. parseTextureAtlasData(rawData: any, textureAtlas: any, name?: string | null, scale?: number): TextureAtlasData;
  28853. /**
  28854. * @private
  28855. */
  28856. updateTextureAtlasData(name: string, textureAtlases: Array<any>): void;
  28857. /**
  28858. * - Get a specific DragonBonesData instance.
  28859. * @param name - The DragonBonesData instance cache name.
  28860. * @returns DragonBonesData instance
  28861. * @see #parseDragonBonesData()
  28862. * @see #addDragonBonesData()
  28863. * @see #removeDragonBonesData()
  28864. * @see dragonBones.DragonBonesData
  28865. * @version DragonBones 3.0
  28866. * @language en_US
  28867. */
  28868. /**
  28869. * - 获取特定的 DragonBonesData 实例。
  28870. * @param name - DragonBonesData 实例的缓存名称。
  28871. * @returns DragonBonesData 实例
  28872. * @see #parseDragonBonesData()
  28873. * @see #addDragonBonesData()
  28874. * @see #removeDragonBonesData()
  28875. * @see dragonBones.DragonBonesData
  28876. * @version DragonBones 3.0
  28877. * @language zh_CN
  28878. */
  28879. getDragonBonesData(name: string): DragonBonesData | null;
  28880. /**
  28881. * - Cache a DragonBonesData instance to the factory.
  28882. * @param data - The DragonBonesData instance.
  28883. * @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)
  28884. * @see #parseDragonBonesData()
  28885. * @see #getDragonBonesData()
  28886. * @see #removeDragonBonesData()
  28887. * @see dragonBones.DragonBonesData
  28888. * @version DragonBones 3.0
  28889. * @language en_US
  28890. */
  28891. /**
  28892. * - 将 DragonBonesData 实例缓存到工厂中。
  28893. * @param data - DragonBonesData 实例。
  28894. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28895. * @see #parseDragonBonesData()
  28896. * @see #getDragonBonesData()
  28897. * @see #removeDragonBonesData()
  28898. * @see dragonBones.DragonBonesData
  28899. * @version DragonBones 3.0
  28900. * @language zh_CN
  28901. */
  28902. addDragonBonesData(data: DragonBonesData, name?: string | null): void;
  28903. /**
  28904. * - Remove a DragonBonesData instance.
  28905. * @param name - The DragonBonesData instance cache name.
  28906. * @param disposeData - Whether to dispose data. (Default: true)
  28907. * @see #parseDragonBonesData()
  28908. * @see #getDragonBonesData()
  28909. * @see #addDragonBonesData()
  28910. * @see dragonBones.DragonBonesData
  28911. * @version DragonBones 3.0
  28912. * @language en_US
  28913. */
  28914. /**
  28915. * - 移除 DragonBonesData 实例。
  28916. * @param name - DragonBonesData 实例缓存名称。
  28917. * @param disposeData - 是否释放数据。 (默认: true)
  28918. * @see #parseDragonBonesData()
  28919. * @see #getDragonBonesData()
  28920. * @see #addDragonBonesData()
  28921. * @see dragonBones.DragonBonesData
  28922. * @version DragonBones 3.0
  28923. * @language zh_CN
  28924. */
  28925. removeDragonBonesData(name: string, disposeData?: boolean): void;
  28926. /**
  28927. * - Get a list of specific TextureAtlasData instances.
  28928. * @param name - The TextureAtlasData cahce name.
  28929. * @see #parseTextureAtlasData()
  28930. * @see #addTextureAtlasData()
  28931. * @see #removeTextureAtlasData()
  28932. * @see dragonBones.TextureAtlasData
  28933. * @version DragonBones 3.0
  28934. * @language en_US
  28935. */
  28936. /**
  28937. * - 获取特定的 TextureAtlasData 实例列表。
  28938. * @param name - TextureAtlasData 实例缓存名称。
  28939. * @see #parseTextureAtlasData()
  28940. * @see #addTextureAtlasData()
  28941. * @see #removeTextureAtlasData()
  28942. * @see dragonBones.TextureAtlasData
  28943. * @version DragonBones 3.0
  28944. * @language zh_CN
  28945. */
  28946. getTextureAtlasData(name: string): Array<TextureAtlasData> | null;
  28947. /**
  28948. * - Cache a TextureAtlasData instance to the factory.
  28949. * @param data - The TextureAtlasData instance.
  28950. * @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)
  28951. * @see #parseTextureAtlasData()
  28952. * @see #getTextureAtlasData()
  28953. * @see #removeTextureAtlasData()
  28954. * @see dragonBones.TextureAtlasData
  28955. * @version DragonBones 3.0
  28956. * @language en_US
  28957. */
  28958. /**
  28959. * - 将 TextureAtlasData 实例缓存到工厂中。
  28960. * @param data - TextureAtlasData 实例。
  28961. * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称)
  28962. * @see #parseTextureAtlasData()
  28963. * @see #getTextureAtlasData()
  28964. * @see #removeTextureAtlasData()
  28965. * @see dragonBones.TextureAtlasData
  28966. * @version DragonBones 3.0
  28967. * @language zh_CN
  28968. */
  28969. addTextureAtlasData(data: TextureAtlasData, name?: string | null): void;
  28970. /**
  28971. * - Remove a TextureAtlasData instance.
  28972. * @param name - The TextureAtlasData instance cache name.
  28973. * @param disposeData - Whether to dispose data.
  28974. * @see #parseTextureAtlasData()
  28975. * @see #getTextureAtlasData()
  28976. * @see #addTextureAtlasData()
  28977. * @see dragonBones.TextureAtlasData
  28978. * @version DragonBones 3.0
  28979. * @language en_US
  28980. */
  28981. /**
  28982. * - 移除 TextureAtlasData 实例。
  28983. * @param name - TextureAtlasData 实例的缓存名称。
  28984. * @param disposeData - 是否释放数据。
  28985. * @see #parseTextureAtlasData()
  28986. * @see #getTextureAtlasData()
  28987. * @see #addTextureAtlasData()
  28988. * @see dragonBones.TextureAtlasData
  28989. * @version DragonBones 3.0
  28990. * @language zh_CN
  28991. */
  28992. removeTextureAtlasData(name: string, disposeData?: boolean): void;
  28993. /**
  28994. * - Get a specific armature data.
  28995. * @param name - The armature data name.
  28996. * @param dragonBonesName - The cached name for DragonbonesData instance.
  28997. * @see dragonBones.ArmatureData
  28998. * @version DragonBones 5.1
  28999. * @language en_US
  29000. */
  29001. /**
  29002. * - 获取特定的骨架数据。
  29003. * @param name - 骨架数据名称。
  29004. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  29005. * @see dragonBones.ArmatureData
  29006. * @version DragonBones 5.1
  29007. * @language zh_CN
  29008. */
  29009. getArmatureData(name: string, dragonBonesName?: string): ArmatureData | null;
  29010. /**
  29011. * - Clear all cached DragonBonesData instances and TextureAtlasData instances.
  29012. * @param disposeData - Whether to dispose data.
  29013. * @version DragonBones 4.5
  29014. * @language en_US
  29015. */
  29016. /**
  29017. * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。
  29018. * @param disposeData - 是否释放数据。
  29019. * @version DragonBones 4.5
  29020. * @language zh_CN
  29021. */
  29022. clear(disposeData?: boolean): void;
  29023. /**
  29024. * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances.
  29025. * @param armatureName - The armature data name.
  29026. * @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)
  29027. * @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)
  29028. * @returns The armature.
  29029. * @example
  29030. * <pre>
  29031. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  29032. * armature.clock = factory.clock;
  29033. * </pre>
  29034. * @see dragonBones.DragonBonesData
  29035. * @see dragonBones.ArmatureData
  29036. * @see dragonBones.Armature
  29037. * @version DragonBones 3.0
  29038. * @language en_US
  29039. */
  29040. /**
  29041. * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。
  29042. * @param armatureName - 骨架数据名称。
  29043. * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架)
  29044. * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据(如果未设置,则使用默认的皮肤数据)。
  29045. * @returns 骨架。
  29046. * @example
  29047. * <pre>
  29048. * let armature = factory.buildArmature("armatureName", "dragonBonesName");
  29049. * armature.clock = factory.clock;
  29050. * </pre>
  29051. * @see dragonBones.DragonBonesData
  29052. * @see dragonBones.ArmatureData
  29053. * @see dragonBones.Armature
  29054. * @version DragonBones 3.0
  29055. * @language zh_CN
  29056. */
  29057. buildArmature(armatureName: string, dragonBonesName?: string, skinName?: string, textureAtlasName?: string): Armature | null;
  29058. /**
  29059. * @private
  29060. */
  29061. replaceDisplay(slot: Slot, displayData: DisplayData, displayIndex?: number): void;
  29062. /**
  29063. * - Replaces the current display data for a particular slot with a specific display data.
  29064. * Specify display data with "dragonBonesName/armatureName/slotName/displayName".
  29065. * @param dragonBonesName - The DragonBonesData instance cache name.
  29066. * @param armatureName - The armature data name.
  29067. * @param slotName - The slot data name.
  29068. * @param displayName - The display data name.
  29069. * @param slot - The slot.
  29070. * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data)
  29071. * @example
  29072. * <pre>
  29073. * let slot = armature.getSlot("weapon");
  29074. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  29075. * </pre>
  29076. * @version DragonBones 4.5
  29077. * @language en_US
  29078. */
  29079. /**
  29080. * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。
  29081. * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。
  29082. * @param dragonBonesName - DragonBonesData 实例的缓存名称。
  29083. * @param armatureName - 骨架数据名称。
  29084. * @param slotName - 插槽数据名称。
  29085. * @param displayName - 显示对象数据名称。
  29086. * @param slot - 插槽。
  29087. * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据)
  29088. * @example
  29089. * <pre>
  29090. * let slot = armature.getSlot("weapon");
  29091. * factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
  29092. * </pre>
  29093. * @version DragonBones 4.5
  29094. * @language zh_CN
  29095. */
  29096. replaceSlotDisplay(dragonBonesName: string, armatureName: string, slotName: string, displayName: string, slot: Slot, displayIndex?: number): boolean;
  29097. /**
  29098. * @private
  29099. */
  29100. replaceSlotDisplayList(dragonBonesName: string | null, armatureName: string, slotName: string, slot: Slot): boolean;
  29101. /**
  29102. * - Share specific skin data with specific armature.
  29103. * @param armature - The armature.
  29104. * @param skin - The skin data.
  29105. * @param isOverride - Whether it completely override the original skin. (Default: false)
  29106. * @param exclude - A list of slot names that do not need to be replace.
  29107. * @example
  29108. * <pre>
  29109. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29110. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29111. * if (armatureDataB && armatureDataB.defaultSkin) {
  29112. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  29113. * }
  29114. * </pre>
  29115. * @see dragonBones.Armature
  29116. * @see dragonBones.SkinData
  29117. * @version DragonBones 5.6
  29118. * @language en_US
  29119. */
  29120. /**
  29121. * - 将特定的皮肤数据共享给特定的骨架使用。
  29122. * @param armature - 骨架。
  29123. * @param skin - 皮肤数据。
  29124. * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false)
  29125. * @param exclude - 不需要被替换的插槽名称列表。
  29126. * @example
  29127. * <pre>
  29128. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29129. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29130. * if (armatureDataB && armatureDataB.defaultSkin) {
  29131. * factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
  29132. * }
  29133. * </pre>
  29134. * @see dragonBones.Armature
  29135. * @see dragonBones.SkinData
  29136. * @version DragonBones 5.6
  29137. * @language zh_CN
  29138. */
  29139. replaceSkin(armature: Armature, skin: SkinData, isOverride?: boolean, exclude?: Array<string> | null): boolean;
  29140. /**
  29141. * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data.
  29142. * This enables you to make a armature template so that other armature without animations can share it's animations.
  29143. * @param armature - The armtaure.
  29144. * @param armatureData - The armature data.
  29145. * @param isOverride - Whether to completely overwrite the original animation. (Default: false)
  29146. * @example
  29147. * <pre>
  29148. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29149. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29150. * if (armatureDataB) {
  29151. * factory.replaceAnimation(armatureA, armatureDataB);
  29152. * }
  29153. * </pre>
  29154. * @see dragonBones.Armature
  29155. * @see dragonBones.ArmatureData
  29156. * @version DragonBones 5.6
  29157. * @language en_US
  29158. */
  29159. /**
  29160. * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。
  29161. * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。
  29162. * @param armature - 骨架。
  29163. * @param armatureData - 骨架数据。
  29164. * @param isOverride - 是否完全覆盖原来的动画。(默认: false)。
  29165. * @example
  29166. * <pre>
  29167. * let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
  29168. * let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
  29169. * if (armatureDataB) {
  29170. * factory.replaceAnimation(armatureA, armatureDataB);
  29171. * }
  29172. * </pre>
  29173. * @see dragonBones.Armature
  29174. * @see dragonBones.ArmatureData
  29175. * @version DragonBones 5.6
  29176. * @language zh_CN
  29177. */
  29178. replaceAnimation(armature: Armature, armatureData: ArmatureData, isOverride?: boolean): boolean;
  29179. /**
  29180. * @private
  29181. */
  29182. getAllDragonBonesData(): Map<DragonBonesData>;
  29183. /**
  29184. * @private
  29185. */
  29186. getAllTextureAtlasData(): Map<Array<TextureAtlasData>>;
  29187. /**
  29188. * - An Worldclock instance updated by engine.
  29189. * @version DragonBones 5.7
  29190. * @language en_US
  29191. */
  29192. /**
  29193. * - 由引擎驱动的 WorldClock 实例。
  29194. * @version DragonBones 5.7
  29195. * @language zh_CN
  29196. */
  29197. readonly clock: WorldClock;
  29198. /**
  29199. * @private
  29200. */
  29201. readonly dragonBones: DragonBones;
  29202. /**
  29203. * - Deprecated, please refer to {@link #replaceSkin}.
  29204. * @deprecated
  29205. * @language en_US
  29206. */
  29207. /**
  29208. * - 已废弃,请参考 {@link #replaceSkin}。
  29209. * @deprecated
  29210. * @language zh_CN
  29211. */
  29212. changeSkin(armature: Armature, skin: SkinData, exclude?: Array<string> | null): boolean;
  29213. /**
  29214. * - Deprecated, please refer to {@link #replaceAnimation}.
  29215. * @deprecated
  29216. * @language en_US
  29217. */
  29218. /**
  29219. * - 已废弃,请参考 {@link #replaceAnimation}。
  29220. * @deprecated
  29221. * @language zh_CN
  29222. */
  29223. copyAnimationsToArmature(toArmature: Armature, fromArmatreName: string, fromSkinName?: string, fromDragonBonesDataName?: string, replaceOriginalAnimation?: boolean): boolean;
  29224. }
  29225. /**
  29226. * @internal
  29227. * @private
  29228. */
  29229. class BuildArmaturePackage {
  29230. dataName: string;
  29231. textureAtlasName: string;
  29232. data: DragonBonesData;
  29233. armature: ArmatureData;
  29234. skin: SkinData | null;
  29235. }
  29236. }
  29237. declare namespace sp.spine {
  29238. class Animation {
  29239. name: string;
  29240. timelines: Array<Timeline>;
  29241. timelineIds: Array<boolean>;
  29242. duration: number;
  29243. constructor(name: string, timelines: Array<Timeline>, duration: number);
  29244. hasTimeline(id: number): boolean;
  29245. apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29246. static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
  29247. static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
  29248. }
  29249. interface Timeline {
  29250. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29251. getPropertyId(): number;
  29252. }
  29253. enum MixBlend {
  29254. setup = 0,
  29255. first = 1,
  29256. replace = 2,
  29257. add = 3
  29258. }
  29259. enum MixDirection {
  29260. mixIn = 0,
  29261. mixOut = 1
  29262. }
  29263. enum TimelineType {
  29264. rotate = 0,
  29265. translate = 1,
  29266. scale = 2,
  29267. shear = 3,
  29268. attachment = 4,
  29269. color = 5,
  29270. deform = 6,
  29271. event = 7,
  29272. drawOrder = 8,
  29273. ikConstraint = 9,
  29274. transformConstraint = 10,
  29275. pathConstraintPosition = 11,
  29276. pathConstraintSpacing = 12,
  29277. pathConstraintMix = 13,
  29278. twoColor = 14
  29279. }
  29280. abstract class CurveTimeline implements Timeline {
  29281. static LINEAR: number;
  29282. static STEPPED: number;
  29283. static BEZIER: number;
  29284. static BEZIER_SIZE: number;
  29285. private curves;
  29286. abstract getPropertyId(): number;
  29287. constructor(frameCount: number);
  29288. getFrameCount(): number;
  29289. setLinear(frameIndex: number): void;
  29290. setStepped(frameIndex: number): void;
  29291. getCurveType(frameIndex: number): number;
  29292. setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  29293. getCurvePercent(frameIndex: number, percent: number): number;
  29294. abstract apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29295. }
  29296. class RotateTimeline extends CurveTimeline {
  29297. static ENTRIES: number;
  29298. static PREV_TIME: number;
  29299. static PREV_ROTATION: number;
  29300. static ROTATION: number;
  29301. boneIndex: number;
  29302. frames: ArrayLike<number>;
  29303. constructor(frameCount: number);
  29304. getPropertyId(): number;
  29305. setFrame(frameIndex: number, time: number, degrees: number): void;
  29306. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29307. }
  29308. class TranslateTimeline extends CurveTimeline {
  29309. static ENTRIES: number;
  29310. static PREV_TIME: number;
  29311. static PREV_X: number;
  29312. static PREV_Y: number;
  29313. static X: number;
  29314. static Y: number;
  29315. boneIndex: number;
  29316. frames: ArrayLike<number>;
  29317. constructor(frameCount: number);
  29318. getPropertyId(): number;
  29319. setFrame(frameIndex: number, time: number, x: number, y: number): void;
  29320. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29321. }
  29322. class ScaleTimeline extends TranslateTimeline {
  29323. constructor(frameCount: number);
  29324. getPropertyId(): number;
  29325. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29326. }
  29327. class ShearTimeline extends TranslateTimeline {
  29328. constructor(frameCount: number);
  29329. getPropertyId(): number;
  29330. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29331. }
  29332. class ColorTimeline extends CurveTimeline {
  29333. static ENTRIES: number;
  29334. static PREV_TIME: number;
  29335. static PREV_R: number;
  29336. static PREV_G: number;
  29337. static PREV_B: number;
  29338. static PREV_A: number;
  29339. static R: number;
  29340. static G: number;
  29341. static B: number;
  29342. static A: number;
  29343. slotIndex: number;
  29344. frames: ArrayLike<number>;
  29345. constructor(frameCount: number);
  29346. getPropertyId(): number;
  29347. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
  29348. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29349. }
  29350. class TwoColorTimeline extends CurveTimeline {
  29351. static ENTRIES: number;
  29352. static PREV_TIME: number;
  29353. static PREV_R: number;
  29354. static PREV_G: number;
  29355. static PREV_B: number;
  29356. static PREV_A: number;
  29357. static PREV_R2: number;
  29358. static PREV_G2: number;
  29359. static PREV_B2: number;
  29360. static R: number;
  29361. static G: number;
  29362. static B: number;
  29363. static A: number;
  29364. static R2: number;
  29365. static G2: number;
  29366. static B2: number;
  29367. slotIndex: number;
  29368. frames: ArrayLike<number>;
  29369. constructor(frameCount: number);
  29370. getPropertyId(): number;
  29371. setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number): void;
  29372. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29373. }
  29374. class AttachmentTimeline implements Timeline {
  29375. slotIndex: number;
  29376. frames: ArrayLike<number>;
  29377. attachmentNames: Array<string>;
  29378. constructor(frameCount: number);
  29379. getPropertyId(): number;
  29380. getFrameCount(): number;
  29381. setFrame(frameIndex: number, time: number, attachmentName: string): void;
  29382. apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29383. }
  29384. class DeformTimeline extends CurveTimeline {
  29385. slotIndex: number;
  29386. attachment: VertexAttachment;
  29387. frames: ArrayLike<number>;
  29388. frameVertices: Array<ArrayLike<number>>;
  29389. constructor(frameCount: number);
  29390. getPropertyId(): number;
  29391. setFrame(frameIndex: number, time: number, vertices: ArrayLike<number>): void;
  29392. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29393. }
  29394. class EventTimeline implements Timeline {
  29395. frames: ArrayLike<number>;
  29396. events: Array<Event>;
  29397. constructor(frameCount: number);
  29398. getPropertyId(): number;
  29399. getFrameCount(): number;
  29400. setFrame(frameIndex: number, event: Event): void;
  29401. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29402. }
  29403. class DrawOrderTimeline implements Timeline {
  29404. frames: ArrayLike<number>;
  29405. drawOrders: Array<Array<number>>;
  29406. constructor(frameCount: number);
  29407. getPropertyId(): number;
  29408. getFrameCount(): number;
  29409. setFrame(frameIndex: number, time: number, drawOrder: Array<number>): void;
  29410. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29411. }
  29412. class IkConstraintTimeline extends CurveTimeline {
  29413. static ENTRIES: number;
  29414. static PREV_TIME: number;
  29415. static PREV_MIX: number;
  29416. static PREV_SOFTNESS: number;
  29417. static PREV_BEND_DIRECTION: number;
  29418. static PREV_COMPRESS: number;
  29419. static PREV_STRETCH: number;
  29420. static MIX: number;
  29421. static SOFTNESS: number;
  29422. static BEND_DIRECTION: number;
  29423. static COMPRESS: number;
  29424. static STRETCH: number;
  29425. ikConstraintIndex: number;
  29426. frames: ArrayLike<number>;
  29427. constructor(frameCount: number);
  29428. getPropertyId(): number;
  29429. setFrame(frameIndex: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean): void;
  29430. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29431. }
  29432. class TransformConstraintTimeline extends CurveTimeline {
  29433. static ENTRIES: number;
  29434. static PREV_TIME: number;
  29435. static PREV_ROTATE: number;
  29436. static PREV_TRANSLATE: number;
  29437. static PREV_SCALE: number;
  29438. static PREV_SHEAR: number;
  29439. static ROTATE: number;
  29440. static TRANSLATE: number;
  29441. static SCALE: number;
  29442. static SHEAR: number;
  29443. transformConstraintIndex: number;
  29444. frames: ArrayLike<number>;
  29445. constructor(frameCount: number);
  29446. getPropertyId(): number;
  29447. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number, scaleMix: number, shearMix: number): void;
  29448. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29449. }
  29450. class PathConstraintPositionTimeline extends CurveTimeline {
  29451. static ENTRIES: number;
  29452. static PREV_TIME: number;
  29453. static PREV_VALUE: number;
  29454. static VALUE: number;
  29455. pathConstraintIndex: number;
  29456. frames: ArrayLike<number>;
  29457. constructor(frameCount: number);
  29458. getPropertyId(): number;
  29459. setFrame(frameIndex: number, time: number, value: number): void;
  29460. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29461. }
  29462. class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {
  29463. constructor(frameCount: number);
  29464. getPropertyId(): number;
  29465. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29466. }
  29467. class PathConstraintMixTimeline extends CurveTimeline {
  29468. static ENTRIES: number;
  29469. static PREV_TIME: number;
  29470. static PREV_ROTATE: number;
  29471. static PREV_TRANSLATE: number;
  29472. static ROTATE: number;
  29473. static TRANSLATE: number;
  29474. pathConstraintIndex: number;
  29475. frames: ArrayLike<number>;
  29476. constructor(frameCount: number);
  29477. getPropertyId(): number;
  29478. setFrame(frameIndex: number, time: number, rotateMix: number, translateMix: number): void;
  29479. apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
  29480. }
  29481. }
  29482. declare namespace sp.spine {
  29483. class AnimationState {
  29484. static emptyAnimation: Animation;
  29485. static SUBSEQUENT: number;
  29486. static FIRST: number;
  29487. static HOLD: number;
  29488. static HOLD_MIX: number;
  29489. static NOT_LAST: number;
  29490. data: AnimationStateData;
  29491. tracks: TrackEntry[];
  29492. timeScale: number;
  29493. events: Event[];
  29494. listeners: AnimationStateListener[];
  29495. queue: EventQueue;
  29496. propertyIDs: IntSet;
  29497. animationsChanged: boolean;
  29498. trackEntryPool: Pool<TrackEntry>;
  29499. constructor(data: AnimationStateData);
  29500. update(delta: number): void;
  29501. updateMixingFrom(to: TrackEntry, delta: number): boolean;
  29502. apply(skeleton: Skeleton): boolean;
  29503. applyMixingFrom(to: TrackEntry, skeleton: Skeleton, blend: MixBlend): number;
  29504. applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
  29505. queueEvents(entry: TrackEntry, animationTime: number): void;
  29506. clearTracks(): void;
  29507. clearTrack(trackIndex: number): void;
  29508. setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
  29509. setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
  29510. setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
  29511. addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;
  29512. addAnimationWith(trackIndex: number, animation: Animation, loop: boolean, delay: number): TrackEntry;
  29513. setEmptyAnimation(trackIndex: number, mixDuration: number): TrackEntry;
  29514. addEmptyAnimation(trackIndex: number, mixDuration: number, delay: number): TrackEntry;
  29515. setEmptyAnimations(mixDuration: number): void;
  29516. expandToIndex(index: number): TrackEntry;
  29517. trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
  29518. disposeNext(entry: TrackEntry): void;
  29519. _animationsChanged(): void;
  29520. computeHold(entry: TrackEntry): void;
  29521. computeNotLast(entry: TrackEntry): void;
  29522. getCurrent(trackIndex: number): TrackEntry;
  29523. addListener(listener: AnimationStateListener): void;
  29524. removeListener(listener: AnimationStateListener): void;
  29525. clearListeners(): void;
  29526. clearListenerNotifications(): void;
  29527. }
  29528. class TrackEntry {
  29529. animation: Animation;
  29530. next: TrackEntry;
  29531. mixingFrom: TrackEntry;
  29532. mixingTo: TrackEntry;
  29533. listener: AnimationStateListener;
  29534. trackIndex: number;
  29535. loop: boolean;
  29536. holdPrevious: boolean;
  29537. eventThreshold: number;
  29538. attachmentThreshold: number;
  29539. drawOrderThreshold: number;
  29540. animationStart: number;
  29541. animationEnd: number;
  29542. animationLast: number;
  29543. nextAnimationLast: number;
  29544. delay: number;
  29545. trackTime: number;
  29546. trackLast: number;
  29547. nextTrackLast: number;
  29548. trackEnd: number;
  29549. timeScale: number;
  29550. alpha: number;
  29551. mixTime: number;
  29552. mixDuration: number;
  29553. interruptAlpha: number;
  29554. totalAlpha: number;
  29555. mixBlend: MixBlend;
  29556. timelineMode: number[];
  29557. timelineHoldMix: TrackEntry[];
  29558. timelinesRotation: number[];
  29559. reset(): void;
  29560. getAnimationTime(): number;
  29561. setAnimationLast(animationLast: number): void;
  29562. isComplete(): boolean;
  29563. resetRotationDirections(): void;
  29564. }
  29565. class EventQueue {
  29566. objects: Array<any>;
  29567. drainDisabled: boolean;
  29568. animState: AnimationState;
  29569. constructor(animState: AnimationState);
  29570. start(entry: TrackEntry): void;
  29571. interrupt(entry: TrackEntry): void;
  29572. end(entry: TrackEntry): void;
  29573. dispose(entry: TrackEntry): void;
  29574. complete(entry: TrackEntry): void;
  29575. event(entry: TrackEntry, event: Event): void;
  29576. drain(): void;
  29577. clear(): void;
  29578. }
  29579. enum EventType {
  29580. start = 0,
  29581. interrupt = 1,
  29582. end = 2,
  29583. dispose = 3,
  29584. complete = 4,
  29585. event = 5
  29586. }
  29587. interface AnimationStateListener {
  29588. start(entry: TrackEntry): void;
  29589. interrupt(entry: TrackEntry): void;
  29590. end(entry: TrackEntry): void;
  29591. dispose(entry: TrackEntry): void;
  29592. complete(entry: TrackEntry): void;
  29593. event(entry: TrackEntry, event: Event): void;
  29594. }
  29595. abstract class AnimationStateAdapter implements AnimationStateListener {
  29596. start(entry: TrackEntry): void;
  29597. interrupt(entry: TrackEntry): void;
  29598. end(entry: TrackEntry): void;
  29599. dispose(entry: TrackEntry): void;
  29600. complete(entry: TrackEntry): void;
  29601. event(entry: TrackEntry, event: Event): void;
  29602. }
  29603. }
  29604. declare namespace sp.spine {
  29605. class AnimationStateData {
  29606. skeletonData: SkeletonData;
  29607. animationToMixTime: Map<number>;
  29608. defaultMix: number;
  29609. constructor(skeletonData: SkeletonData);
  29610. setMix(fromName: string, toName: string, duration: number): void;
  29611. setMixWith(from: Animation, to: Animation, duration: number): void;
  29612. getMix(from: Animation, to: Animation): number;
  29613. }
  29614. }
  29615. declare namespace sp.spine {
  29616. class AssetManager implements Disposable {
  29617. private pathPrefix;
  29618. private textureLoader;
  29619. private assets;
  29620. private errors;
  29621. private toLoad;
  29622. private loaded;
  29623. constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
  29624. private static downloadText;
  29625. private static downloadBinary;
  29626. loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, error: string) => void): void;
  29627. loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
  29628. loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  29629. loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
  29630. loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, error: string) => void): void;
  29631. get(path: string): any;
  29632. remove(path: string): void;
  29633. removeAll(): void;
  29634. isLoadingComplete(): boolean;
  29635. getToLoad(): number;
  29636. getLoaded(): number;
  29637. dispose(): void;
  29638. hasErrors(): boolean;
  29639. getErrors(): Map<string>;
  29640. }
  29641. }
  29642. declare namespace sp.spine {
  29643. class AtlasAttachmentLoader implements AttachmentLoader {
  29644. atlas: TextureAtlas;
  29645. constructor(atlas: TextureAtlas);
  29646. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  29647. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  29648. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  29649. newPathAttachment(skin: Skin, name: string): PathAttachment;
  29650. newPointAttachment(skin: Skin, name: string): PointAttachment;
  29651. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  29652. }
  29653. }
  29654. declare namespace sp.spine {
  29655. enum BlendMode {
  29656. Normal = 0,
  29657. Additive = 1,
  29658. Multiply = 2,
  29659. Screen = 3
  29660. }
  29661. }
  29662. declare namespace sp.spine {
  29663. class Bone implements Updatable {
  29664. data: BoneData;
  29665. skeleton: Skeleton;
  29666. parent: Bone;
  29667. children: Bone[];
  29668. x: number;
  29669. y: number;
  29670. rotation: number;
  29671. scaleX: number;
  29672. scaleY: number;
  29673. shearX: number;
  29674. shearY: number;
  29675. ax: number;
  29676. ay: number;
  29677. arotation: number;
  29678. ascaleX: number;
  29679. ascaleY: number;
  29680. ashearX: number;
  29681. ashearY: number;
  29682. appliedValid: boolean;
  29683. a: number;
  29684. b: number;
  29685. c: number;
  29686. d: number;
  29687. worldY: number;
  29688. worldX: number;
  29689. sorted: boolean;
  29690. active: boolean;
  29691. constructor(data: BoneData, skeleton: Skeleton, parent: Bone);
  29692. isActive(): boolean;
  29693. update(): void;
  29694. updateWorldTransform(): void;
  29695. updateWorldTransformWith(x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number): void;
  29696. setToSetupPose(): void;
  29697. getWorldRotationX(): number;
  29698. getWorldRotationY(): number;
  29699. getWorldScaleX(): number;
  29700. getWorldScaleY(): number;
  29701. updateAppliedTransform(): void;
  29702. worldToLocal(world: Vector2): Vector2;
  29703. localToWorld(local: Vector2): Vector2;
  29704. worldToLocalRotation(worldRotation: number): number;
  29705. localToWorldRotation(localRotation: number): number;
  29706. rotateWorld(degrees: number): void;
  29707. }
  29708. }
  29709. declare namespace sp.spine {
  29710. class BoneData {
  29711. index: number;
  29712. name: string;
  29713. parent: BoneData;
  29714. length: number;
  29715. x: number;
  29716. y: number;
  29717. rotation: number;
  29718. scaleX: number;
  29719. scaleY: number;
  29720. shearX: number;
  29721. shearY: number;
  29722. transformMode: TransformMode;
  29723. skinRequired: boolean;
  29724. color: Color;
  29725. constructor(index: number, name: string, parent: BoneData);
  29726. }
  29727. enum TransformMode {
  29728. Normal = 0,
  29729. OnlyTranslation = 1,
  29730. NoRotationOrReflection = 2,
  29731. NoScale = 3,
  29732. NoScaleOrReflection = 4
  29733. }
  29734. }
  29735. declare namespace sp.spine {
  29736. abstract class ConstraintData {
  29737. name: string;
  29738. order: number;
  29739. skinRequired: boolean;
  29740. constructor(name: string, order: number, skinRequired: boolean);
  29741. }
  29742. }
  29743. declare namespace sp.spine {
  29744. class Event {
  29745. data: EventData;
  29746. intValue: number;
  29747. floatValue: number;
  29748. stringValue: string;
  29749. time: number;
  29750. volume: number;
  29751. balance: number;
  29752. constructor(time: number, data: EventData);
  29753. }
  29754. }
  29755. declare namespace sp.spine {
  29756. class EventData {
  29757. name: string;
  29758. intValue: number;
  29759. floatValue: number;
  29760. stringValue: string;
  29761. audioPath: string;
  29762. volume: number;
  29763. balance: number;
  29764. constructor(name: string);
  29765. }
  29766. }
  29767. declare namespace sp.spine {
  29768. class IkConstraint implements Updatable {
  29769. data: IkConstraintData;
  29770. bones: Array<Bone>;
  29771. target: Bone;
  29772. bendDirection: number;
  29773. compress: boolean;
  29774. stretch: boolean;
  29775. mix: number;
  29776. softness: number;
  29777. active: boolean;
  29778. constructor(data: IkConstraintData, skeleton: Skeleton);
  29779. isActive(): boolean;
  29780. apply(): void;
  29781. update(): void;
  29782. apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
  29783. apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
  29784. }
  29785. }
  29786. declare namespace sp.spine {
  29787. class IkConstraintData extends ConstraintData {
  29788. bones: BoneData[];
  29789. target: BoneData;
  29790. bendDirection: number;
  29791. compress: boolean;
  29792. stretch: boolean;
  29793. uniform: boolean;
  29794. mix: number;
  29795. softness: number;
  29796. constructor(name: string);
  29797. }
  29798. }
  29799. declare namespace sp.spine {
  29800. class PathConstraint implements Updatable {
  29801. static NONE: number;
  29802. static BEFORE: number;
  29803. static AFTER: number;
  29804. static epsilon: number;
  29805. data: PathConstraintData;
  29806. bones: Array<Bone>;
  29807. target: Slot;
  29808. position: number;
  29809. spacing: number;
  29810. rotateMix: number;
  29811. translateMix: number;
  29812. spaces: number[];
  29813. positions: number[];
  29814. world: number[];
  29815. curves: number[];
  29816. lengths: number[];
  29817. segments: number[];
  29818. active: boolean;
  29819. constructor(data: PathConstraintData, skeleton: Skeleton);
  29820. isActive(): boolean;
  29821. apply(): void;
  29822. update(): void;
  29823. computeWorldPositions(path: PathAttachment, spacesCount: number, tangents: boolean, percentPosition: boolean, percentSpacing: boolean): number[];
  29824. addBeforePosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
  29825. addAfterPosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
  29826. 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;
  29827. }
  29828. }
  29829. declare namespace sp.spine {
  29830. class PathConstraintData extends ConstraintData {
  29831. bones: BoneData[];
  29832. target: SlotData;
  29833. positionMode: PositionMode;
  29834. spacingMode: SpacingMode;
  29835. rotateMode: RotateMode;
  29836. offsetRotation: number;
  29837. position: number;
  29838. spacing: number;
  29839. rotateMix: number;
  29840. translateMix: number;
  29841. constructor(name: string);
  29842. }
  29843. enum PositionMode {
  29844. Fixed = 0,
  29845. Percent = 1
  29846. }
  29847. enum SpacingMode {
  29848. Length = 0,
  29849. Fixed = 1,
  29850. Percent = 2
  29851. }
  29852. enum RotateMode {
  29853. Tangent = 0,
  29854. Chain = 1,
  29855. ChainScale = 2
  29856. }
  29857. }
  29858. declare namespace sp.spine {
  29859. class SharedAssetManager implements Disposable {
  29860. private pathPrefix;
  29861. private clientAssets;
  29862. private queuedAssets;
  29863. private rawAssets;
  29864. private errors;
  29865. constructor(pathPrefix?: string);
  29866. private queueAsset;
  29867. loadText(clientId: string, path: string): void;
  29868. loadJson(clientId: string, path: string): void;
  29869. loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
  29870. get(clientId: string, path: string): any;
  29871. private updateClientAssets;
  29872. isLoadingComplete(clientId: string): boolean;
  29873. dispose(): void;
  29874. hasErrors(): boolean;
  29875. getErrors(): Map<string>;
  29876. }
  29877. }
  29878. declare namespace sp.spine {
  29879. class Skeleton {
  29880. data: SkeletonData;
  29881. bones: Array<Bone>;
  29882. slots: Array<Slot>;
  29883. drawOrder: Array<Slot>;
  29884. ikConstraints: Array<IkConstraint>;
  29885. transformConstraints: Array<TransformConstraint>;
  29886. pathConstraints: Array<PathConstraint>;
  29887. _updateCache: Updatable[];
  29888. updateCacheReset: Updatable[];
  29889. skin: Skin;
  29890. color: Color;
  29891. time: number;
  29892. scaleX: number;
  29893. scaleY: number;
  29894. x: number;
  29895. y: number;
  29896. constructor(data: SkeletonData);
  29897. updateCache(): void;
  29898. sortIkConstraint(constraint: IkConstraint): void;
  29899. sortPathConstraint(constraint: PathConstraint): void;
  29900. sortTransformConstraint(constraint: TransformConstraint): void;
  29901. sortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone): void;
  29902. sortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone): void;
  29903. sortBone(bone: Bone): void;
  29904. sortReset(bones: Array<Bone>): void;
  29905. updateWorldTransform(): void;
  29906. setToSetupPose(): void;
  29907. setBonesToSetupPose(): void;
  29908. setSlotsToSetupPose(): void;
  29909. getRootBone(): Bone;
  29910. findBone(boneName: string): Bone;
  29911. findBoneIndex(boneName: string): number;
  29912. findSlot(slotName: string): Slot;
  29913. findSlotIndex(slotName: string): number;
  29914. setSkinByName(skinName: string): void;
  29915. setSkin(newSkin: Skin): void;
  29916. getAttachmentByName(slotName: string, attachmentName: string): Attachment;
  29917. getAttachment(slotIndex: number, attachmentName: string): Attachment;
  29918. setAttachment(slotName: string, attachmentName: string): void;
  29919. findIkConstraint(constraintName: string): IkConstraint;
  29920. findTransformConstraint(constraintName: string): TransformConstraint;
  29921. findPathConstraint(constraintName: string): PathConstraint;
  29922. getBounds(offset: Vector2, size: Vector2, temp?: Array<number>): void;
  29923. update(delta: number): void;
  29924. }
  29925. }
  29926. declare namespace sp.spine {
  29927. class SkeletonBinary {
  29928. static AttachmentTypeValues: number[];
  29929. static TransformModeValues: TransformMode[];
  29930. static PositionModeValues: PositionMode[];
  29931. static SpacingModeValues: SpacingMode[];
  29932. static RotateModeValues: RotateMode[];
  29933. static BlendModeValues: BlendMode[];
  29934. static BONE_ROTATE: number;
  29935. static BONE_TRANSLATE: number;
  29936. static BONE_SCALE: number;
  29937. static BONE_SHEAR: number;
  29938. static SLOT_ATTACHMENT: number;
  29939. static SLOT_COLOR: number;
  29940. static SLOT_TWO_COLOR: number;
  29941. static PATH_POSITION: number;
  29942. static PATH_SPACING: number;
  29943. static PATH_MIX: number;
  29944. static CURVE_LINEAR: number;
  29945. static CURVE_STEPPED: number;
  29946. static CURVE_BEZIER: number;
  29947. scale: number;
  29948. attachmentLoader: AttachmentLoader;
  29949. private linkedMeshes;
  29950. constructor(attachmentLoader: AttachmentLoader);
  29951. readSkeletonData(binary: Uint8Array): SkeletonData;
  29952. private readSkin;
  29953. private readAttachment;
  29954. private readVertices;
  29955. private readFloatArray;
  29956. private readShortArray;
  29957. private readAnimation;
  29958. private readCurve;
  29959. setCurve(timeline: CurveTimeline, frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
  29960. }
  29961. }
  29962. declare namespace sp.spine {
  29963. class SkeletonBounds {
  29964. minX: number;
  29965. minY: number;
  29966. maxX: number;
  29967. maxY: number;
  29968. boundingBoxes: BoundingBoxAttachment[];
  29969. polygons: ArrayLike<number>[];
  29970. private polygonPool;
  29971. update(skeleton: Skeleton, updateAabb: boolean): void;
  29972. aabbCompute(): void;
  29973. aabbContainsPoint(x: number, y: number): boolean;
  29974. aabbIntersectsSegment(x1: number, y1: number, x2: number, y2: number): boolean;
  29975. aabbIntersectsSkeleton(bounds: SkeletonBounds): boolean;
  29976. containsPoint(x: number, y: number): BoundingBoxAttachment;
  29977. containsPointPolygon(polygon: ArrayLike<number>, x: number, y: number): boolean;
  29978. intersectsSegment(x1: number, y1: number, x2: number, y2: number): BoundingBoxAttachment;
  29979. intersectsSegmentPolygon(polygon: ArrayLike<number>, x1: number, y1: number, x2: number, y2: number): boolean;
  29980. getPolygon(boundingBox: BoundingBoxAttachment): ArrayLike<number>;
  29981. getWidth(): number;
  29982. getHeight(): number;
  29983. }
  29984. }
  29985. declare namespace sp.spine {
  29986. class SkeletonClipping {
  29987. private triangulator;
  29988. private clippingPolygon;
  29989. private clipOutput;
  29990. clippedVertices: number[];
  29991. clippedTriangles: number[];
  29992. private scratch;
  29993. private clipAttachment;
  29994. private clippingPolygons;
  29995. clipStart(slot: Slot, clip: ClippingAttachment): number;
  29996. clipEndWithSlot(slot: Slot): void;
  29997. clipEnd(): void;
  29998. isClipping(): boolean;
  29999. clipTriangles(vertices: ArrayLike<number>, verticesLength: number, triangles: ArrayLike<number>, trianglesLength: number, uvs: ArrayLike<number>, light: Color, dark: Color, twoColor: boolean): void;
  30000. clip(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, clippingArea: Array<number>, output: Array<number>): boolean;
  30001. static makeClockwise(polygon: ArrayLike<number>): void;
  30002. }
  30003. }
  30004. declare namespace sp.spine {
  30005. class SkeletonData {
  30006. name: string;
  30007. bones: BoneData[];
  30008. slots: SlotData[];
  30009. skins: Skin[];
  30010. defaultSkin: Skin;
  30011. events: EventData[];
  30012. animations: Animation[];
  30013. ikConstraints: IkConstraintData[];
  30014. transformConstraints: TransformConstraintData[];
  30015. pathConstraints: PathConstraintData[];
  30016. x: number;
  30017. y: number;
  30018. width: number;
  30019. height: number;
  30020. version: string;
  30021. hash: string;
  30022. fps: number;
  30023. imagesPath: string;
  30024. audioPath: string;
  30025. findBone(boneName: string): BoneData;
  30026. findBoneIndex(boneName: string): number;
  30027. findSlot(slotName: string): SlotData;
  30028. findSlotIndex(slotName: string): number;
  30029. findSkin(skinName: string): Skin;
  30030. findEvent(eventDataName: string): EventData;
  30031. findAnimation(animationName: string): Animation;
  30032. findIkConstraint(constraintName: string): IkConstraintData;
  30033. findTransformConstraint(constraintName: string): TransformConstraintData;
  30034. findPathConstraint(constraintName: string): PathConstraintData;
  30035. findPathConstraintIndex(pathConstraintName: string): number;
  30036. }
  30037. }
  30038. declare namespace sp.spine {
  30039. class SkeletonJson {
  30040. attachmentLoader: AttachmentLoader;
  30041. scale: number;
  30042. private linkedMeshes;
  30043. constructor(attachmentLoader: AttachmentLoader);
  30044. readSkeletonData(json: string | any): SkeletonData;
  30045. readAttachment(map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment;
  30046. readVertices(map: any, attachment: VertexAttachment, verticesLength: number): void;
  30047. readAnimation(map: any, name: string, skeletonData: SkeletonData): void;
  30048. readCurve(map: any, timeline: CurveTimeline, frameIndex: number): void;
  30049. getValue(map: any, prop: string, defaultValue: any): any;
  30050. static blendModeFromString(str: string): BlendMode;
  30051. static positionModeFromString(str: string): PositionMode;
  30052. static spacingModeFromString(str: string): SpacingMode;
  30053. static rotateModeFromString(str: string): RotateMode;
  30054. static transformModeFromString(str: string): TransformMode;
  30055. }
  30056. }
  30057. declare namespace sp.spine {
  30058. class SkinEntry {
  30059. slotIndex: number;
  30060. name: string;
  30061. attachment: Attachment;
  30062. constructor(slotIndex: number, name: string, attachment: Attachment);
  30063. }
  30064. class Skin {
  30065. name: string;
  30066. attachments: Map<Attachment>[];
  30067. bones: BoneData[];
  30068. constraints: ConstraintData[];
  30069. constructor(name: string);
  30070. setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
  30071. addSkin(skin: Skin): void;
  30072. copySkin(skin: Skin): void;
  30073. getAttachment(slotIndex: number, name: string): Attachment;
  30074. removeAttachment(slotIndex: number, name: string): void;
  30075. getAttachments(): Array<SkinEntry>;
  30076. getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
  30077. clear(): void;
  30078. attachAll(skeleton: Skeleton, oldSkin: Skin): void;
  30079. }
  30080. }
  30081. declare namespace sp.spine {
  30082. class Slot {
  30083. data: SlotData;
  30084. bone: Bone;
  30085. color: Color;
  30086. darkColor: Color;
  30087. private attachment;
  30088. private attachmentTime;
  30089. deform: number[];
  30090. constructor(data: SlotData, bone: Bone);
  30091. getSkeleton(): Skeleton;
  30092. getAttachment(): Attachment;
  30093. setAttachment(attachment: Attachment): void;
  30094. setAttachmentTime(time: number): void;
  30095. getAttachmentTime(): number;
  30096. setToSetupPose(): void;
  30097. }
  30098. }
  30099. declare namespace sp.spine {
  30100. class SlotData {
  30101. index: number;
  30102. name: string;
  30103. boneData: BoneData;
  30104. color: Color;
  30105. darkColor: Color;
  30106. attachmentName: string;
  30107. blendMode: BlendMode;
  30108. constructor(index: number, name: string, boneData: BoneData);
  30109. }
  30110. }
  30111. declare namespace sp.spine {
  30112. abstract class Texture {
  30113. protected _image: HTMLImageElement;
  30114. constructor(image: HTMLImageElement);
  30115. getImage(): HTMLImageElement;
  30116. abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  30117. abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  30118. abstract dispose(): void;
  30119. static filterFromString(text: string): TextureFilter;
  30120. static wrapFromString(text: string): TextureWrap;
  30121. }
  30122. enum TextureFilter {
  30123. Nearest = 9728,
  30124. Linear = 9729,
  30125. MipMap = 9987,
  30126. MipMapNearestNearest = 9984,
  30127. MipMapLinearNearest = 9985,
  30128. MipMapNearestLinear = 9986,
  30129. MipMapLinearLinear = 9987
  30130. }
  30131. enum TextureWrap {
  30132. MirroredRepeat = 33648,
  30133. ClampToEdge = 33071,
  30134. Repeat = 10497
  30135. }
  30136. class TextureRegion {
  30137. renderObject: any;
  30138. u: number;
  30139. v: number;
  30140. u2: number;
  30141. v2: number;
  30142. width: number;
  30143. height: number;
  30144. rotate: boolean;
  30145. offsetX: number;
  30146. offsetY: number;
  30147. originalWidth: number;
  30148. originalHeight: number;
  30149. }
  30150. class FakeTexture extends Texture {
  30151. setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
  30152. setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
  30153. dispose(): void;
  30154. }
  30155. }
  30156. declare namespace sp.spine {
  30157. class TextureAtlas implements Disposable {
  30158. pages: TextureAtlasPage[];
  30159. regions: TextureAtlasRegion[];
  30160. constructor(atlasText: string, textureLoader: (path: string) => any);
  30161. private load;
  30162. findRegion(name: string): TextureAtlasRegion;
  30163. dispose(): void;
  30164. }
  30165. class TextureAtlasPage {
  30166. name: string;
  30167. minFilter: TextureFilter;
  30168. magFilter: TextureFilter;
  30169. uWrap: TextureWrap;
  30170. vWrap: TextureWrap;
  30171. texture: Texture;
  30172. width: number;
  30173. height: number;
  30174. }
  30175. class TextureAtlasRegion extends TextureRegion {
  30176. page: TextureAtlasPage;
  30177. name: string;
  30178. x: number;
  30179. y: number;
  30180. index: number;
  30181. rotate: boolean;
  30182. degrees: number;
  30183. texture: Texture;
  30184. }
  30185. }
  30186. declare namespace sp.spine {
  30187. class TransformConstraint implements Updatable {
  30188. data: TransformConstraintData;
  30189. bones: Array<Bone>;
  30190. target: Bone;
  30191. rotateMix: number;
  30192. translateMix: number;
  30193. scaleMix: number;
  30194. shearMix: number;
  30195. temp: Vector2;
  30196. active: boolean;
  30197. constructor(data: TransformConstraintData, skeleton: Skeleton);
  30198. isActive(): boolean;
  30199. apply(): void;
  30200. update(): void;
  30201. applyAbsoluteWorld(): void;
  30202. applyRelativeWorld(): void;
  30203. applyAbsoluteLocal(): void;
  30204. applyRelativeLocal(): void;
  30205. }
  30206. }
  30207. declare namespace sp.spine {
  30208. class TransformConstraintData extends ConstraintData {
  30209. bones: BoneData[];
  30210. target: BoneData;
  30211. rotateMix: number;
  30212. translateMix: number;
  30213. scaleMix: number;
  30214. shearMix: number;
  30215. offsetRotation: number;
  30216. offsetX: number;
  30217. offsetY: number;
  30218. offsetScaleX: number;
  30219. offsetScaleY: number;
  30220. offsetShearY: number;
  30221. relative: boolean;
  30222. local: boolean;
  30223. constructor(name: string);
  30224. }
  30225. }
  30226. declare namespace sp.spine {
  30227. class Triangulator {
  30228. private convexPolygons;
  30229. private convexPolygonsIndices;
  30230. private indicesArray;
  30231. private isConcaveArray;
  30232. private triangles;
  30233. private polygonPool;
  30234. private polygonIndicesPool;
  30235. triangulate(verticesArray: ArrayLike<number>): Array<number>;
  30236. decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
  30237. private static isConcave;
  30238. private static positiveArea;
  30239. private static winding;
  30240. }
  30241. }
  30242. declare namespace sp.spine {
  30243. interface Updatable {
  30244. update(): void;
  30245. isActive(): boolean;
  30246. }
  30247. }
  30248. declare namespace sp.spine {
  30249. interface Map<T> {
  30250. [key: string]: T;
  30251. }
  30252. class IntSet {
  30253. array: number[];
  30254. add(value: number): boolean;
  30255. contains(value: number): boolean;
  30256. remove(value: number): void;
  30257. clear(): void;
  30258. }
  30259. interface Disposable {
  30260. dispose(): void;
  30261. }
  30262. interface Restorable {
  30263. restore(): void;
  30264. }
  30265. class Color {
  30266. r: number;
  30267. g: number;
  30268. b: number;
  30269. a: number;
  30270. static WHITE: Color;
  30271. static RED: Color;
  30272. static GREEN: Color;
  30273. static BLUE: Color;
  30274. static MAGENTA: Color;
  30275. constructor(r?: number, g?: number, b?: number, a?: number);
  30276. set(r: number, g: number, b: number, a: number): this;
  30277. setFromColor(c: Color): this;
  30278. setFromString(hex: string): this;
  30279. add(r: number, g: number, b: number, a: number): this;
  30280. clamp(): this;
  30281. static rgba8888ToColor(color: Color, value: number): void;
  30282. static rgb888ToColor(color: Color, value: number): void;
  30283. }
  30284. class MathUtils {
  30285. static PI: number;
  30286. static PI2: number;
  30287. static radiansToDegrees: number;
  30288. static radDeg: number;
  30289. static degreesToRadians: number;
  30290. static degRad: number;
  30291. static clamp(value: number, min: number, max: number): number;
  30292. static cosDeg(degrees: number): number;
  30293. static sinDeg(degrees: number): number;
  30294. static signum(value: number): number;
  30295. static toInt(x: number): number;
  30296. static cbrt(x: number): number;
  30297. static randomTriangular(min: number, max: number): number;
  30298. static randomTriangularWith(min: number, max: number, mode: number): number;
  30299. }
  30300. abstract class Interpolation {
  30301. protected abstract applyInternal(a: number): number;
  30302. apply(start: number, end: number, a: number): number;
  30303. }
  30304. class Pow extends Interpolation {
  30305. protected power: number;
  30306. constructor(power: number);
  30307. applyInternal(a: number): number;
  30308. }
  30309. class PowOut extends Pow {
  30310. constructor(power: number);
  30311. applyInternal(a: number): number;
  30312. }
  30313. class Utils {
  30314. static SUPPORTS_TYPED_ARRAYS: boolean;
  30315. static arrayCopy<T>(source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number): void;
  30316. static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
  30317. static ensureArrayCapacity<T>(array: Array<T>, size: number, value?: any): Array<T>;
  30318. static newArray<T>(size: number, defaultValue: T): Array<T>;
  30319. static newFloatArray(size: number): ArrayLike<number>;
  30320. static newShortArray(size: number): ArrayLike<number>;
  30321. static toFloatArray(array: Array<number>): number[] | Float32Array;
  30322. static toSinglePrecision(value: number): number;
  30323. static webkit602BugfixHelper(alpha: number, blend: MixBlend): void;
  30324. static contains<T>(array: Array<T>, element: T, identity?: boolean): boolean;
  30325. }
  30326. class DebugUtils {
  30327. static logBones(skeleton: Skeleton): void;
  30328. }
  30329. class Pool<T> {
  30330. private items;
  30331. private instantiator;
  30332. constructor(instantiator: () => T);
  30333. obtain(): T;
  30334. free(item: T): void;
  30335. freeAll(items: ArrayLike<T>): void;
  30336. clear(): void;
  30337. }
  30338. class Vector2 {
  30339. x: number;
  30340. y: number;
  30341. constructor(x?: number, y?: number);
  30342. set(x: number, y: number): Vector2;
  30343. length(): number;
  30344. normalize(): this;
  30345. }
  30346. class TimeKeeper {
  30347. maxDelta: number;
  30348. framesPerSecond: number;
  30349. delta: number;
  30350. totalTime: number;
  30351. private lastTime;
  30352. private frameCount;
  30353. private frameTime;
  30354. update(): void;
  30355. }
  30356. interface ArrayLike<T> {
  30357. length: number;
  30358. [n: number]: T;
  30359. }
  30360. class WindowedMean {
  30361. values: Array<number>;
  30362. addedValues: number;
  30363. lastValue: number;
  30364. mean: number;
  30365. dirty: boolean;
  30366. constructor(windowSize?: number);
  30367. hasEnoughData(): boolean;
  30368. addValue(value: number): void;
  30369. getMean(): number;
  30370. }
  30371. }
  30372. declare namespace sp.spine {
  30373. interface VertexEffect {
  30374. begin(skeleton: Skeleton): void;
  30375. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30376. end(): void;
  30377. }
  30378. }
  30379. interface Math {
  30380. fround(n: number): number;
  30381. }
  30382. declare namespace sp.spine {
  30383. abstract class Attachment {
  30384. name: string;
  30385. constructor(name: string);
  30386. abstract copy(): Attachment;
  30387. }
  30388. abstract class VertexAttachment extends Attachment {
  30389. private static nextID;
  30390. id: number;
  30391. bones: Array<number>;
  30392. vertices: ArrayLike<number>;
  30393. worldVerticesLength: number;
  30394. deformAttachment: VertexAttachment;
  30395. constructor(name: string);
  30396. computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  30397. copyTo(attachment: VertexAttachment): void;
  30398. }
  30399. }
  30400. declare namespace sp.spine {
  30401. interface AttachmentLoader {
  30402. newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
  30403. newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
  30404. newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
  30405. newPathAttachment(skin: Skin, name: string): PathAttachment;
  30406. newPointAttachment(skin: Skin, name: string): PointAttachment;
  30407. newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
  30408. }
  30409. }
  30410. declare namespace sp.spine {
  30411. enum AttachmentType {
  30412. Region = 0,
  30413. BoundingBox = 1,
  30414. Mesh = 2,
  30415. LinkedMesh = 3,
  30416. Path = 4,
  30417. Point = 5,
  30418. Clipping = 6
  30419. }
  30420. }
  30421. declare namespace sp.spine {
  30422. class BoundingBoxAttachment extends VertexAttachment {
  30423. color: Color;
  30424. constructor(name: string);
  30425. copy(): Attachment;
  30426. }
  30427. }
  30428. declare namespace sp.spine {
  30429. class ClippingAttachment extends VertexAttachment {
  30430. endSlot: SlotData;
  30431. color: Color;
  30432. constructor(name: string);
  30433. copy(): Attachment;
  30434. }
  30435. }
  30436. declare namespace sp.spine {
  30437. class MeshAttachment extends VertexAttachment {
  30438. region: TextureRegion;
  30439. path: string;
  30440. regionUVs: ArrayLike<number>;
  30441. uvs: ArrayLike<number>;
  30442. triangles: Array<number>;
  30443. color: Color;
  30444. width: number;
  30445. height: number;
  30446. hullLength: number;
  30447. edges: Array<number>;
  30448. private parentMesh;
  30449. tempColor: Color;
  30450. constructor(name: string);
  30451. updateUVs(): void;
  30452. getParentMesh(): MeshAttachment;
  30453. setParentMesh(parentMesh: MeshAttachment): void;
  30454. copy(): Attachment;
  30455. newLinkedMesh(): MeshAttachment;
  30456. }
  30457. }
  30458. declare namespace sp.spine {
  30459. class PathAttachment extends VertexAttachment {
  30460. lengths: Array<number>;
  30461. closed: boolean;
  30462. constantSpeed: boolean;
  30463. color: Color;
  30464. constructor(name: string);
  30465. copy(): Attachment;
  30466. }
  30467. }
  30468. declare namespace sp.spine {
  30469. class PointAttachment extends VertexAttachment {
  30470. x: number;
  30471. y: number;
  30472. rotation: number;
  30473. color: Color;
  30474. constructor(name: string);
  30475. computeWorldPosition(bone: Bone, point: Vector2): Vector2;
  30476. computeWorldRotation(bone: Bone): number;
  30477. copy(): Attachment;
  30478. }
  30479. }
  30480. declare namespace sp.spine {
  30481. class RegionAttachment extends Attachment {
  30482. static OX1: number;
  30483. static OY1: number;
  30484. static OX2: number;
  30485. static OY2: number;
  30486. static OX3: number;
  30487. static OY3: number;
  30488. static OX4: number;
  30489. static OY4: number;
  30490. static X1: number;
  30491. static Y1: number;
  30492. static C1R: number;
  30493. static C1G: number;
  30494. static C1B: number;
  30495. static C1A: number;
  30496. static U1: number;
  30497. static V1: number;
  30498. static X2: number;
  30499. static Y2: number;
  30500. static C2R: number;
  30501. static C2G: number;
  30502. static C2B: number;
  30503. static C2A: number;
  30504. static U2: number;
  30505. static V2: number;
  30506. static X3: number;
  30507. static Y3: number;
  30508. static C3R: number;
  30509. static C3G: number;
  30510. static C3B: number;
  30511. static C3A: number;
  30512. static U3: number;
  30513. static V3: number;
  30514. static X4: number;
  30515. static Y4: number;
  30516. static C4R: number;
  30517. static C4G: number;
  30518. static C4B: number;
  30519. static C4A: number;
  30520. static U4: number;
  30521. static V4: number;
  30522. x: number;
  30523. y: number;
  30524. scaleX: number;
  30525. scaleY: number;
  30526. rotation: number;
  30527. width: number;
  30528. height: number;
  30529. color: Color;
  30530. path: string;
  30531. rendererObject: any;
  30532. region: TextureRegion;
  30533. offset: ArrayLike<number>;
  30534. uvs: ArrayLike<number>;
  30535. tempColor: Color;
  30536. constructor(name: string);
  30537. updateOffset(): void;
  30538. setRegion(region: TextureRegion): void;
  30539. computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
  30540. copy(): Attachment;
  30541. }
  30542. }
  30543. declare namespace sp.spine {
  30544. class JitterEffect implements VertexEffect {
  30545. jitterX: number;
  30546. jitterY: number;
  30547. constructor(jitterX: number, jitterY: number);
  30548. begin(skeleton: Skeleton): void;
  30549. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30550. end(): void;
  30551. }
  30552. }
  30553. declare namespace sp.spine {
  30554. class SwirlEffect implements VertexEffect {
  30555. static interpolation: PowOut;
  30556. centerX: number;
  30557. centerY: number;
  30558. radius: number;
  30559. angle: number;
  30560. private worldX;
  30561. private worldY;
  30562. constructor(radius: number);
  30563. begin(skeleton: Skeleton): void;
  30564. transform(position: Vector2, uv: Vector2, light: Color, dark: Color): void;
  30565. end(): void;
  30566. }
  30567. }
  30568. /**
  30569. * API for jsb module
  30570. * Author: haroel
  30571. * Homepage: https://github.com/haroel/creatorexDTS
  30572. */
  30573. declare namespace jsb{
  30574. export module reflection{
  30575. /**
  30576. * https://docs.cocos.com/creator/manual/zh/advanced-topics/java-reflection.html
  30577. * call OBJC/Java static methods
  30578. *
  30579. * @param className
  30580. * @param methodName
  30581. * @param methodSignature
  30582. * @param parameters
  30583. */
  30584. export function callStaticMethod (className: string, methodName: string, methodSignature: string, ...parameters:any): any;
  30585. }
  30586. /**
  30587. * 下载任务对象
  30588. */
  30589. export type DownloaderTask = { requestURL: string, storagePath: string, identifier: string };
  30590. /**
  30591. * Http file downloader for jsb!
  30592. */
  30593. export class Downloader{
  30594. /**
  30595. * create a download task
  30596. * @param requestURL
  30597. * @param storagePath
  30598. * @param identifier
  30599. */
  30600. createDownloadFileTask (requestURL:string, storagePath:string, identifier?:string): DownloaderTask;
  30601. setOnFileTaskSuccess (onSucceed: (task: DownloaderTask) => void): void;
  30602. setOnTaskProgress (onProgress: (task: DownloaderTask, bytesReceived: number, totalBytesReceived: number, totalBytesExpected: number) => void): void;
  30603. setOnTaskError (onError: (task: DownloaderTask, errorCode: number, errorCodeInternal: number, errorStr: string) => void): void;
  30604. }
  30605. export interface ManifestAsset {
  30606. md5: string;
  30607. path: string;
  30608. compressed: boolean;
  30609. size: number;
  30610. downloadState: number;
  30611. }
  30612. export class Manifest {
  30613. constructor (manifestUrl: string);
  30614. constructor (content: string, manifestRoot: string);
  30615. parseFile (manifestUrl: string): void;
  30616. parseJSONString (content: string, manifestRoot: string): void;
  30617. getManifestRoot (): string;
  30618. getManifestFileUrl (): string;
  30619. getVersionFileUrl (): string;
  30620. getSearchPaths (): [string];
  30621. getVersion (): string;
  30622. getPackageUrl (): boolean;
  30623. setUpdating (isUpdating: boolean): void;
  30624. isUpdating (): boolean;
  30625. isVersionLoaded (): boolean;
  30626. isLoaded (): boolean;
  30627. }
  30628. export class EventAssetsManager {
  30629. // EventCode
  30630. static ERROR_NO_LOCAL_MANIFEST: number;
  30631. static ERROR_DOWNLOAD_MANIFEST: number;
  30632. static ERROR_PARSE_MANIFEST: number;
  30633. static NEW_VERSION_FOUND: number;
  30634. static ALREADY_UP_TO_DATE: number;
  30635. static UPDATE_PROGRESSION: number;
  30636. static ASSET_UPDATED: number;
  30637. static ERROR_UPDATING: number;
  30638. static UPDATE_FINISHED: number;
  30639. static UPDATE_FAILED: number;
  30640. static ERROR_DECOMPRESS: number;
  30641. constructor (eventName: string, manager: AssetsManager, eventCode: number,
  30642. assetId?: string, message?: string, curleCode?: number, curlmCode?: number);
  30643. getAssetsManagerEx (): AssetsManager;
  30644. isResuming (): boolean;
  30645. getDownloadedFiles (): number;
  30646. getDownloadedBytes (): number;
  30647. getTotalFiles (): number;
  30648. getTotalBytes (): number;
  30649. getPercent (): number;
  30650. getPercentByFile (): number;
  30651. getEventCode (): number;
  30652. getMessage (): string;
  30653. getAssetId (): string;
  30654. getCURLECode (): number;
  30655. getCURLMCode (): number;
  30656. }
  30657. export module AssetsManager {
  30658. export enum State {
  30659. UNINITED,
  30660. UNCHECKED,
  30661. PREDOWNLOAD_VERSION,
  30662. DOWNLOADING_VERSION,
  30663. VERSION_LOADED,
  30664. PREDOWNLOAD_MANIFEST,
  30665. DOWNLOADING_MANIFEST,
  30666. MANIFEST_LOADED,
  30667. NEED_UPDATE,
  30668. READY_TO_UPDATE,
  30669. UPDATING,
  30670. UNZIPPING,
  30671. UP_TO_DATE,
  30672. FAIL_TO_UPDATE,
  30673. }
  30674. }
  30675. export class AssetsManager {
  30676. constructor (manifestUrl: string, storagePath: string, versionCompareHandle?: (versionA: string, versionB: string) => number);
  30677. static create (manifestUrl: string, storagePath: string): AssetsManager;
  30678. getState (): AssetsManager.State;
  30679. getStoragePath (): string
  30680. getMaxConcurrentTask (): number;
  30681. // setMaxConcurrentTask (max: number): void; // actually not supported
  30682. checkUpdate (): void;
  30683. prepareUpdate (): void;
  30684. update (): void;
  30685. isResuming (): boolean;
  30686. getDownloadedFiles (): number;
  30687. getDownloadedBytes (): number;
  30688. getTotalFiles (): number;
  30689. getTotalBytes (): number;
  30690. downloadFailedAssets (): void;
  30691. getLocalManifest (): Manifest;
  30692. loadLocalManifest (manifestUrl: string): boolean;
  30693. loadLocalManifest (localManifest: Manifest, storagePath: string): boolean;
  30694. getRemoteManifest (): Manifest;
  30695. loadRemoteManifest (remoteManifest: Manifest): boolean;
  30696. /**
  30697. * Setup your own version compare handler, versionA and B is versions in string.
  30698. * if the return value greater than 0, versionA is greater than B,
  30699. * if the return value equals 0, versionA equals to B,
  30700. * if the return value smaller than 0, versionA is smaller than B.
  30701. */
  30702. setVersionCompareHandle (versionCompareHandle?: (versionA: string, versionB: string) => number): void;
  30703. /**
  30704. * Setup the verification callback, Return true if the verification passed, otherwise return false
  30705. */
  30706. setVerifyCallback (verifyCallback: (path: string, asset: ManifestAsset) => boolean): void;
  30707. setEventCallback (eventCallback: (event: EventAssetsManager) => void): void;
  30708. }
  30709. /**
  30710. * FileUtils Helper class to handle file operations.
  30711. */
  30712. export module fileUtils{
  30713. /**
  30714. * Checks whether the path is an absolute path.
  30715. *
  30716. * @note On Android, if the parameter passed in is relative to "@assets/", this method will treat it as an absolute path.
  30717. * Also on Blackberry, path starts with "app/native/Resources/" is treated as an absolute path.
  30718. *
  30719. * @param path The path that needs to be checked.
  30720. * @return True if it's an absolute path, false if not.
  30721. */
  30722. export function isAbsolutePath (path:string):boolean;
  30723. /** Returns the fullpath for a given filename.
  30724. First it will try to get a new filename from the "filenameLookup" dictionary.
  30725. If a new filename can't be found on the dictionary, it will use the original filename.
  30726. Then it will try to obtain the full path of the filename using the FileUtils search rules: resolutions, and search paths.
  30727. The file search is based on the array element order of search paths and resolution directories.
  30728. For instance:
  30729. We set two elements("/mnt/sdcard/", "internal_dir/") to search paths vector by setSearchPaths,
  30730. and set three elements("resources-ipadhd/", "resources-ipad/", "resources-iphonehd")
  30731. to resolutions vector by setSearchResolutionsOrder. The "internal_dir" is relative to "Resources/".
  30732. If we have a file named 'sprite.png', the mapping in fileLookup dictionary contains `key: sprite.png -> value: sprite.pvr.gz`.
  30733. Firstly, it will replace 'sprite.png' with 'sprite.pvr.gz', then searching the file sprite.pvr.gz as follows:
  30734. /mnt/sdcard/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30735. /mnt/sdcard/resources-ipad/sprite.pvr.gz (if not found, search next)
  30736. /mnt/sdcard/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30737. /mnt/sdcard/sprite.pvr.gz (if not found, search next)
  30738. internal_dir/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30739. internal_dir/resources-ipad/sprite.pvr.gz (if not found, search next)
  30740. internal_dir/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30741. internal_dir/sprite.pvr.gz (if not found, return "sprite.png")
  30742. If the filename contains relative path like "gamescene/uilayer/sprite.png",
  30743. and the mapping in fileLookup dictionary contains `key: gamescene/uilayer/sprite.png -> value: gamescene/uilayer/sprite.pvr.gz`.
  30744. The file search order will be:
  30745. /mnt/sdcard/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30746. /mnt/sdcard/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  30747. /mnt/sdcard/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30748. /mnt/sdcard/gamescene/uilayer/sprite.pvr.gz (if not found, search next)
  30749. internal_dir/gamescene/uilayer/resources-ipadhd/sprite.pvr.gz (if not found, search next)
  30750. internal_dir/gamescene/uilayer/resources-ipad/sprite.pvr.gz (if not found, search next)
  30751. internal_dir/gamescene/uilayer/resources-iphonehd/sprite.pvr.gz (if not found, search next)
  30752. internal_dir/gamescene/uilayer/sprite.pvr.gz (if not found, return "gamescene/uilayer/sprite.png")
  30753. If the new file can't be found on the file system, it will return the parameter filename directly.
  30754. This method was added to simplify multiplatform support. Whether you are using cocos2d-js or any cross-compilation toolchain like StellaSDK or Apportable,
  30755. you might need to load different resources for a given file in the different platforms.
  30756. @since v2.1
  30757. */
  30758. export function fullPathForFilename (filename:string):string;
  30759. /**
  30760. * Gets string from a file.
  30761. */
  30762. export function getStringFromFile (filename:string):string;
  30763. /**
  30764. * Removes a file.
  30765. *
  30766. * @param filepath The full path of the file, it must be an absolute path.
  30767. * @return True if the file have been removed successfully, false if not.
  30768. */
  30769. export function removeFile (filepath:string):boolean;
  30770. /**
  30771. * Checks whether the path is a directory.
  30772. *
  30773. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30774. * @return True if the directory exists, false if not.
  30775. */
  30776. export function isDirectoryExist (dirPath:string):boolean;
  30777. /**
  30778. * Normalize: remove . and ..
  30779. * @param filepath
  30780. */
  30781. export function normalizePath (filepath:string):string;
  30782. /**
  30783. * Get default resource root path.
  30784. */
  30785. export function getDefaultResourceRootPath ():string;
  30786. /**
  30787. * Loads the filenameLookup dictionary from the contents of a filename.
  30788. *
  30789. * @note The plist file name should follow the format below:
  30790. *
  30791. * @code
  30792. * <?xml version="1.0" encoding="UTF-8"?>
  30793. * <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  30794. * <plist version="1.0">
  30795. * <dict>
  30796. * <key>filenames</key>
  30797. * <dict>
  30798. * <key>sounds/click.wav</key>
  30799. * <string>sounds/click.caf</string>
  30800. * <key>sounds/endgame.wav</key>
  30801. * <string>sounds/endgame.caf</string>
  30802. * <key>sounds/gem-0.wav</key>
  30803. * <string>sounds/gem-0.caf</string>
  30804. * </dict>
  30805. * <key>metadata</key>
  30806. * <dict>
  30807. * <key>version</key>
  30808. * <integer>1</integer>
  30809. * </dict>
  30810. * </dict>
  30811. * </plist>
  30812. * @endcode
  30813. * @param filename The plist file name.
  30814. *
  30815. @since v2.1
  30816. * @js loadFilenameLookup
  30817. * @lua loadFilenameLookup
  30818. */
  30819. export function loadFilenameLookup (filepath:string):void;
  30820. /** Checks whether to pop up a message box when failed to load an image.
  30821. * @return True if pop up a message box when failed to load an image, false if not.
  30822. */
  30823. export function isPopupNotify ():boolean;
  30824. /**
  30825. * Sets whether to pop-up a message box when failed to load an image.
  30826. */
  30827. export function setPopupNotify (notify:boolean):void;
  30828. // Converts the contents of a file to a ValueVector.
  30829. // This method is used internally.
  30830. export function getValueVectorFromFile (filepath:string):Array<any>;
  30831. /**
  30832. * Gets the array of search paths.
  30833. *
  30834. * @return The array of search paths which may contain the prefix of default resource root path.
  30835. * @note In best practise, getter function should return the value of setter function passes in.
  30836. * But since we should not break the compatibility, we keep using the old logic.
  30837. * Therefore, If you want to get the original search paths, please call 'getOriginalSearchPaths()' instead.
  30838. * @see fullPathForFilename(const char*).
  30839. * @lua NA
  30840. */
  30841. export function getSearchPaths ():Array<string>;
  30842. /**
  30843. *
  30844. * @param filepath
  30845. */
  30846. export function getFileDir (filepath:string):string;
  30847. /**
  30848. * write a ValueMap into a plist file
  30849. *
  30850. *@param dict the ValueMap want to save (key,value)
  30851. *@param fullPath The full path to the file you want to save a string
  30852. *@return bool
  30853. */
  30854. export function writeToFile ( valueMap:any ):boolean;
  30855. /**
  30856. * Gets the original search path array set by 'setSearchPaths' or 'addSearchPath'.
  30857. * @return The array of the original search paths
  30858. */
  30859. export function getOriginalSearchPaths ():Array<string>;
  30860. /**
  30861. * List all files in a directory.
  30862. *
  30863. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  30864. * @return File paths in a string vector
  30865. */
  30866. export function listFiles (filepath:string):Array<string>;
  30867. /**
  30868. * Converts the contents of a file to a ValueMap.
  30869. * @param filename The filename of the file to gets content.
  30870. * @return ValueMap of the file contents.
  30871. * @note This method is used internally.
  30872. */
  30873. export function getValueMapFromFile (filepath:string):any;
  30874. /**
  30875. * Retrieve the file size.
  30876. *
  30877. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  30878. * @param filepath The path of the file, it could be a relative or absolute path.
  30879. * @return The file size.
  30880. */
  30881. export function getFileSize (filepath:string):number;
  30882. /** Converts the contents of a file to a ValueMap.
  30883. * This method is used internally.
  30884. */
  30885. export function getValueMapFromData (filedata:string,filesize:number):any;
  30886. /**
  30887. * Removes a directory.
  30888. *
  30889. * @param dirPath The full path of the directory, it must be an absolute path.
  30890. * @return True if the directory have been removed successfully, false if not.
  30891. */
  30892. export function removeDirectory (dirPath:string):boolean;
  30893. /**
  30894. * Sets the array of search paths.
  30895. *
  30896. * You can use this array to modify the search path of the resources.
  30897. * If you want to use "themes" or search resources in the "cache", you can do it easily by adding new entries in this array.
  30898. *
  30899. * @note This method could access relative path and absolute path.
  30900. * If the relative path was passed to the vector, FileUtils will add the default resource directory before the relative path.
  30901. * For instance:
  30902. * On Android, the default resource root path is "@assets/".
  30903. * If "/mnt/sdcard/" and "resources-large" were set to the search paths vector,
  30904. * "resources-large" will be converted to "@assets/resources-large" since it was a relative path.
  30905. *
  30906. * @param searchPaths The array contains search paths.
  30907. * @see fullPathForFilename(const char*)
  30908. * @since v2.1
  30909. * In js:var setSearchPaths(var jsval);
  30910. * @lua NA
  30911. */
  30912. export function setSearchPaths ( searchPath:Array<string>):void;
  30913. /**
  30914. * write a string into a file
  30915. *
  30916. * @param dataStr the string want to save
  30917. * @param fullPath The full path to the file you want to save a string
  30918. * @return bool True if write success
  30919. */
  30920. export function writeStringToFile (dataStr:string,fullPath:string):boolean;
  30921. /**
  30922. * Sets the array that contains the search order of the resources.
  30923. *
  30924. * @param searchResolutionsOrder The source array that contains the search order of the resources.
  30925. * @see getSearchResolutionsOrder(), fullPathForFilename(const char*).
  30926. * @since v2.1
  30927. * In js:var setSearchResolutionsOrder(var jsval)
  30928. * @lua NA
  30929. */
  30930. export function setSearchResolutionsOrder (searchResolutionsOrder:Array<string>):void;
  30931. /**
  30932. * Append search order of the resources.
  30933. *
  30934. * @see setSearchResolutionsOrder(), fullPathForFilename().
  30935. * @since v2.1
  30936. */
  30937. export function addSearchResolutionsOrder (order:string,front:boolean):void;
  30938. /**
  30939. * Add search path.
  30940. *
  30941. * @since v2.1
  30942. */
  30943. export function addSearchPath (path:string,front:boolean):void;
  30944. /**
  30945. * write ValueVector into a plist file
  30946. *
  30947. *@param vecData the ValueVector want to save
  30948. *@param fullPath The full path to the file you want to save a string
  30949. *@return bool
  30950. */
  30951. export function writeValueVectorToFile (vecData:Array<any>,fullPath:string):boolean;
  30952. /**
  30953. * Checks whether a file exists.
  30954. *
  30955. * @note If a relative path was passed in, it will be inserted a default root path at the beginning.
  30956. * @param filename The path of the file, it could be a relative or absolute path.
  30957. * @return True if the file exists, false if not.
  30958. */
  30959. export function isFileExist (filename:string):boolean;
  30960. /**©∫
  30961. * Purges full path caches.
  30962. */
  30963. export function purgeCachedEntries ():void;
  30964. /**
  30965. * Gets full path from a file name and the path of the relative file.
  30966. * @param filename The file name.
  30967. * @param relativeFile The path of the relative file.
  30968. * @return The full path.
  30969. * e.g. filename: hello.png, pszRelativeFile: /User/path1/path2/hello.plist
  30970. * Return: /User/path1/path2/hello.pvr (If there a a key(hello.png)-value(hello.pvr) in FilenameLookup dictionary. )
  30971. *
  30972. */
  30973. export function fullPathFromRelativeFile (filename:string,relativeFile:string):string;
  30974. /**
  30975. * Windows fopen can't support UTF-8 filename
  30976. * Need convert all parameters fopen and other 3rd-party libs
  30977. *
  30978. * @param filenameUtf8 std::string name file for conversion from utf-8
  30979. * @return std::string ansi filename in current locale
  30980. */
  30981. export function getSuitableFOpen (filenameUtf8:string):string;
  30982. /**
  30983. * write ValueMap into a plist file
  30984. *
  30985. *@param dict the ValueMap want to save
  30986. *@param fullPath The full path to the file you want to save a string
  30987. *@return bool
  30988. */
  30989. export function writeValueMapToFile (dict:any,fullPath:string):string;
  30990. /**
  30991. * Gets filename extension is a suffix (separated from the base filename by a dot) in lower case.
  30992. * Examples of filename extensions are .png, .jpeg, .exe, .dmg and .txt.
  30993. * @param filePath The path of the file, it could be a relative or absolute path.
  30994. * @return suffix for filename in lower case or empty if a dot not found.
  30995. */
  30996. export function getFileExtension (filePath:string):string;
  30997. /**
  30998. * Sets writable path.
  30999. */
  31000. export function setWritablePath (writablePath:string):void;
  31001. /**
  31002. * Set default resource root path.
  31003. */
  31004. export function setDefaultResourceRootPath (filepath:string):void;
  31005. /**
  31006. * Gets the array that contains the search order of the resources.
  31007. *
  31008. * @see setSearchResolutionsOrder(const std::vector<std::string>&), fullPathForFilename(const char*).
  31009. * @since v2.1
  31010. * @lua NA
  31011. */
  31012. export function getSearchResolutionsOrder ():Array<string>;
  31013. /**
  31014. * Creates a directory.
  31015. *
  31016. * @param dirPath The path of the directory, it must be an absolute path.
  31017. * @return True if the directory have been created successfully, false if not.
  31018. */
  31019. export function createDirectory (dirPath:string):string;
  31020. /**
  31021. * List all files recursively in a directory.
  31022. *
  31023. * @param dirPath The path of the directory, it could be a relative or an absolute path.
  31024. * @return File paths in a string vector
  31025. */
  31026. export function listFilesRecursively (dirPath:string, files:Array<string>):void;
  31027. /**
  31028. * Gets the writable path.
  31029. * @return The path that can be write/read a file in
  31030. */
  31031. export function getWritablePath ():string;
  31032. }
  31033. }
  31034. /** Running in the editor. */
  31035. declare const CC_EDITOR: boolean;
  31036. /** Preview in browser or simulator. */
  31037. declare const CC_PREVIEW: boolean;
  31038. /** Running in the editor or preview. */
  31039. declare const CC_DEV: boolean;
  31040. /** Running in the editor or preview, or build in debug mode. */
  31041. declare const CC_DEBUG: boolean;
  31042. /** Running in published project. */
  31043. declare const CC_BUILD: boolean;
  31044. /** Running in native platforms (mobile app, desktop app, or simulator). */
  31045. declare const CC_JSB: boolean;
  31046. /** Running in runtime environments. */
  31047. declare const CC_RUNTIME: boolean;
  31048. /** Running in the engine's unit test. */
  31049. declare const CC_TEST: boolean;
  31050. /** Running in the WeChat Mini Game. */
  31051. declare const CC_WECHATGAME: boolean;