
標題: Flash AS2製作逼真的蜜蜂漫天飛舞效 [打印本頁]
作者: 若隱若現 時間: 2013-10-3 22:10 標題: Flash AS2製作逼真的蜜蜂漫天飛舞效
[flash]http://www.fscyd.com/upFiles/infoImg/2011121039652249.swf[/flash]
此教程轉自
作者:不老草
本帖隱藏的內容需要積分高於 100 才可瀏覽
作者: 若隱若現 時間: 2013-10-3 22:12
打開Flash軟件(我用的是Flash cs4),新建AS2文檔;
1、打開一個動態的飛舞蜜蜂的透明素材:
[attach]1329[/attach]
2、把透明素材中的動態蜜蜂影片剪輯拖到新建的AS2文檔舞台上,然後在舞台上再剪切掉這個蜜蜂元件;
3、打開庫面板,給這個動態的蜜蜂影片剪輯重命名為:abc, 然後鼠標右鍵單擊該影片剪輯的圖標,彈出菜單中點擊:屬性,把屬性面板中的兩個鏈接項打勾,點擊:確定,見圖1,
作者: 若隱若現 時間: 2013-10-3 22:30
4、再打開庫面板,abc元件的後邊鏈接欄目就會顯示:導出:abc,見圖2:
[attach]1330[/attach]
5、新建一個影片剪輯,命名為:蜜蜂,第一幀上打開動作面板,輸入最後邊完整的AS腳本;- var mc = this.createEmptyMovieClip("mc", 0);
- for (var i = 0; i<40; i++) {
- var abc = mc.attachMovie("abc", "abc"+i, i);
- abc.vr = 0;
- abc.vy = 0;
- abc.sdy = Math.random()/2;
- abc.sdx = Math.random();
- abc.vx = 0;
- random(2) == 0 ? abc.sj=1 : abc.sj=-1;
- abc._x = random(550);
- abc._y = random(300);
- abc._xscale = abc._yscale=random(70)+20;
- abc.sj<0 && (abc._xscale *= -1);
- abc.mcl = 0.8;
- abc.swapDepths(abc._xscale*1000+i);
- abc.onEnterFrame = function() {
- this.vr += 0.03;
- this._y += Math.cos(this.vr)*this.vy*this.sj;
- this._x -= this.vx*this.sj;
- this.vy *= this.mcl;
- this.vx *= this.mcl;
- this.vy += this.sdy;
- this.vx += this.sdx;
- var ID = Math.random()*30 >> 0;
- ID == 1 && (this.mcl=0.9);
- ID == 2 && (this.mcl=0.7);
- ID == 3 && (this.mcl=0.5);
- ID == 4 && (this.yj.play());
- this._x<0 && (this._x=550);
- this._x>550 && (this._x=0);
- };
- }
複製代碼 6、回到場景1,圖層1第一幀導入一張花草圖片到舞台,調整大小,做全居中。
[attach]1332[/attach]
7、插入圖層2,在第一針上,把庫中蜜蜂影片剪輯拖到舞台左上角,調整位置,見圖3:
歡迎光臨 多姿多采 創作與製圖論壇 (http://colorful.joinbbs.net/) |
Powered by Discuz! 7.2 |