![AS30 3D旋轉(zhuǎn)木馬效果實(shí)例_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/28/8dfac740-855c-4956-a46d-dfe96593f6af/8dfac740-855c-4956-a46d-dfe96593f6af1.gif)
![AS30 3D旋轉(zhuǎn)木馬效果實(shí)例_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/28/8dfac740-855c-4956-a46d-dfe96593f6af/8dfac740-855c-4956-a46d-dfe96593f6af2.gif)
![AS30 3D旋轉(zhuǎn)木馬效果實(shí)例_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/28/8dfac740-855c-4956-a46d-dfe96593f6af/8dfac740-855c-4956-a46d-dfe96593f6af3.gif)
![AS30 3D旋轉(zhuǎn)木馬效果實(shí)例_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/28/8dfac740-855c-4956-a46d-dfe96593f6af/8dfac740-855c-4956-a46d-dfe96593f6af4.gif)
![AS30 3D旋轉(zhuǎn)木馬效果實(shí)例_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/28/8dfac740-855c-4956-a46d-dfe96593f6af/8dfac740-855c-4956-a46d-dfe96593f6af5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、AS3.0 3D旋轉(zhuǎn)木馬效果實(shí)例在這個(gè) 3D旋轉(zhuǎn)菜單教程中,將學(xué)習(xí)如何用 AS3 代碼創(chuàng)建一個(gè)垂直的 3D立體菜單效果。木馬將會(huì)根據(jù)鼠標(biāo)決定旋轉(zhuǎn)速度。演示:1、新建Flash文件,設(shè)置寬、高屬性為 550 400 。2、用圓角矩形工具,畫一個(gè) 158 35的長(zhǎng)方形。筆觸為8白色,填充色0 F7E 88。圖1下載 (22.67 KB)2010-3-17 08:203、將長(zhǎng)方形轉(zhuǎn)換成名為 Menu Item 的影片剪輯。設(shè)定注冊(cè)點(diǎn)為中心。圖2下載 (15.34 KB)2010-3-17 08:204、雙擊舞臺(tái)上的影片剪輯,進(jìn)入編輯狀態(tài)。創(chuàng)建動(dòng)態(tài)文本,在它里面輸入需要的本文。圖3下載 (7.57 K
2、B)2010-3-17 08:205、在屬性面板中輸入實(shí)例名字 menuItemText 。6、按下字符嵌入按鈕,插入下列字型。圖4下載 (44.37 KB)2010-3-17 08:207、切換回主場(chǎng)景1,刪除舞臺(tái)上的影片剪輯,實(shí)例將由代碼生成。8、打開庫(kù)元件面板,右鍵單擊影片剪輯,(CS3選鏈接、CS4選屬性)給元件添加一個(gè)綁定類。類名 MenuItem 。圖5下載 (23.04 KB)2010-3-17 08:209、選中第1幀,打開動(dòng)作面板輸入代碼: 1. /The total number of menu items2. const NUMBER_OF_ITEMS:uint = 20
3、;3.4. /This array will contain all the menu items5. var menuItems:Array = new Array();6.7. /Set the focal length8. var focalLength:Number = 350;9.10. /Set the vanishing point11. var vanishingPointX:Number = stage.stageWidth / 2;12. var vanishingPointY:Number = stage.stageHeight / 2;13.14. /We calcul
4、ate the angleSpeed in the ENTER_FRAME listener15. var angleSpeed:Number = 0;16.17. /Radius of the circle18. var radius:Number = 128;19.20. /Calculate the angle difference between the menu items (in radians)21. var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;22.23. /This loop cre
5、ates and positions the carousel items24. for (var i:uint = 0; i the smaller the scale ratio)41. var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);42.43. /Scale the menu item according to the scale ratio44. menuItem.scaleX = menuItem.scaleY = scaleRatio;45.46. /Position the menu item to th
6、e stage (from 3D to 2D coordinates)47. menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;48. menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;49.50. /Assign an initial alpha51. menuItem.alpha = 0.3;52.53. /Add a text to the menu item54. menuItem.menuItemText.text = Menu item + i
7、;55.56. /We dont want the text field to catch mouse events57. menuItem.mouseChildren = false;58.59. /Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item60. menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);61. menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem)
8、;62. menuItem.addEventListener(MouseEvent.CLICK, itemClicked);63.64. /Add the menu item to the menu items array65. menuItems.push(menuItem);66.67. /Add the menu item to the stage68. addChild(menuItem);69. 70.71. /Add an ENTER_FRAME listener for the animation72. addEventListener(Event.ENTER_FRAME, mo
9、veCarousel);73.74. /This function is called in each frame75. function moveCarousel(e:Event):void 76.77. /Calculate the angle speed according to mouseY position78. angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;79.80. /Loop through the menu items81. for (var i:uint = 0; i NUMBER_OF_ITEMS; i+)
10、 82.83. /Store the menu item to a local variable84. var menuItem:MenuItem = (MenuItem)(menuItemsi);85.86. /Update the current angle of the item87. menuItem.currentAngle += angleSpeed;88.89. /Calculate a scale ratio90. var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);91.92. /Scale the ite
11、m according to the scale ratio93. menuItem.scaleX=menuItem.scaleY=scaleRatio;94.95. /Set new 3D coordinates96. menuItem.xpos3D=- radius*Math.cos(menuItem.currentAngle)*0.5;97. menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);98. menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);99.100. /U
12、pdate the items coordinates.101. menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;102. menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;103. 104.105. /Call the function that sorts the items so they overlap each other correctly106. sortZ();107. 108.109. /This function sorts the items so the
13、y overlap each other correctly110. function sortZ():void 111.112. /Sort the array so that the item which has the highest 113. /z position (= furthest away) is first in the array114. menuItems.sortOn(zpos3D, Array.NUMERIC | Array.DESCENDING);115.116. /Set new child indexes for the images117. for (var
14、 i:uint = 0; i NUMBER_OF_ITEMS; i+) 118. setChildIndex(menuItemsi, i);119. 120. 121.122. /This function is called when a mouse is over an item123. function mouseOverItem(e:Event):void 124.125. /Change the alpha to 1126. e.target.alpha=1;127. 128.129. /This function is called when a mouse is out of an item130. function mouseOutItem(e:Event):void 131.132. /
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 生態(tài)經(jīng)濟(jì)在農(nóng)業(yè)現(xiàn)代化的作用
- 現(xiàn)代文閱讀教學(xué)策略研究進(jìn)展匯報(bào)-探索教育新紀(jì)元
- 生產(chǎn)現(xiàn)場(chǎng)的人性化管理與實(shí)踐
- 現(xiàn)代辦公環(huán)境下的金融服務(wù)優(yōu)化
- 公路交通安全設(shè)施施工方案
- 2023三年級(jí)數(shù)學(xué)下冊(cè) 六 認(rèn)識(shí)分?jǐn)?shù)第4課時(shí) 分一分(二)(2)說課稿 北師大版
- 2024年九年級(jí)語(yǔ)文下冊(cè) 第三單元 第11課 送東陽(yáng)馬生序說課稿 新人教版001
- 2023四年級(jí)數(shù)學(xué)上冊(cè) 一 認(rèn)識(shí)更大的數(shù)第4課時(shí) 國(guó)土面積說課稿 北師大版001
- Unit 2 Lesson 4 Againplease(說課稿)-2024-2025學(xué)年魯科版(五四學(xué)制)(三起)英語(yǔ)五年級(jí)上冊(cè)001
- 《2 叢林之美-電子相冊(cè)制作》說課稿-2023-2024學(xué)年清華版(2012)信息技術(shù)六年級(jí)上冊(cè)
- 骨科醫(yī)院感染控制操作流程
- 食材配送技術(shù)方案
- 中藥的臨床合理應(yīng)用
- 鑄鋁焊接工藝
- (正式版)HGT 6313-2024 化工園區(qū)智慧化評(píng)價(jià)導(dǎo)則
- 《社區(qū)康復(fù)》課件-第六章 骨關(guān)節(jié)疾病、損傷患者的社區(qū)康復(fù)實(shí)踐
- 南通市2024屆高三第二次調(diào)研測(cè)試(二模)地理試卷(含官方答案)
- 高標(biāo)準(zhǔn)農(nóng)田建設(shè)項(xiàng)目監(jiān)理計(jì)劃
- 2024年湖南省公務(wù)員考試行政職業(yè)能力測(cè)驗(yàn)真題
- 攀巖運(yùn)動(dòng)之繩結(jié)技巧課程
- 防打架毆斗安全教育課件
評(píng)論
0/150
提交評(píng)論