资源描述:
《flash as基础教程(速度)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、FlashAS3基础教程(速度)FlashAS3basictutorial(speed)Thebasicpropertyofanobject'smotionisspeed.Manypeopleequatethevelocityvector(velocity)withthevelocity(speed),whichisincorrect,becausespeedisonlypartofthevelocityvector,andtheconceptofvelocityvectoralsoincludesaveryimportantfactor:thedi
2、rection.Asimpledefinitionofavelocityvectoristhevelocityinacertaindirection.Vectorsconsistoflengthanddirection.Invelocityvectors,lengthisspeed.Thevectorisrepresentedbyalinewithanarrow.Thelengthofthearrowisthelengthofthevector.Thedirectioninwhichthearrowispointingisthedirectionof
3、thevector.Itisimportanttonotethatthelengthisalwayspositive.Ifavectorofnegativelengthrepresentsonlytheoppositedirectionofthevector,theinversevelocityvectoristhevectorintheoppositedirection.Note:thevectordoesnothaveastartingpoint.Thevectordoesnotindicatewhereitisthestartingpointa
4、ndwhereitistheendpoint.Itonlyshowsthespeedanddirectionoftheobjectmoving.Therefore,ifthetwovectorsarethesameindirectionandlength,eveniftheyareindifferentpositions,thentheyarestilltwoequalvectors.SingleaxisvelocityvectorFirst,thevelocity(vector)isplacedononlyoneaxis:theXaxis(hori
5、zontalaxis).Movingobjectsfromtheleftsideofthescreentotheright,movingspeedisthepixelvalueofmovingeachframeoftheobject.So,ifthespeedvectoris5ontheXaxis,itmeansthattheobjectmoves5pixelstotherightateachframe.Similarly,ifthevelocityvectoris-5ontheXaxis,thentheobjectmoves5pixelstothe
6、leftateachframe.Wehavejustmentionedthatvectorlengthequalsnegative.Scientifically,thevelocityvectorshouldactuallybe5,andthedirectionshouldbe180degrees.Similarly,thevelocityvectoronthepositiveaxisoftheYaxisshouldbe90degrees(verticaldownward),andthenegativehalfaxisofthenegativeYax
7、isshouldbe270or90degrees(vertical).Infact,whenyoucalculatethecomponentsoftheXandyvelocityvectors,youcanusuallyrememberpositiveornegativenumbers,suchas"x,-5"".Theminussignas"left"indicatorontheXaxis,theYaxisisthe"indicatorup".UseVXtorepresentthevelocityvectoroftheXaxis,andusevyt
8、orepresentthevelocityvectoroftheYaxis.VXisapositivenum