天天看點

Flash AS生成飄動的雲和風吹動的草

 Flash 的AS是非常神奇的,今天通過本例大家就體會出來了!可以直接用代碼生成雲飄動,草被風吹的左右搖擺的動畫。至于動畫效果,[1b]因為AS總是運算,是以你的機器是會越來越慢的![/1b]我這裡就不提供線上效果了!給大家截個圖。提供源檔案給大家下載下傳。

[img]/Files/BeyondPic/2007-10/24/20071024113410648.jpg[/img]

[img]/Files/BeyondPic/2007-10/24/rar.gif[/img]

[url=http://www2.flash8.net/UploadTeach/200710/20071024113656563.rar]as動畫.rar[/url]

(壓縮包裡包括Fla和SWF)

簡單描述下制作方法。

首先建立兩個空的影片剪輯cloud和grass。先建立雲的影片剪輯(裡面什麼都不畫)

[img]/Files/BeyondPic/2007-10/24/20071024113410315.jpg[/img]

選擇該元件的第一幀,添加如下代碼:

//Number of clouds

clouds=6;

//These are just general boundaries. 

//To use exact boundaries, create a mask in the parent level of the size desired

//Height of the sky

skyheight=Stage.height;

//Width of the sky

skywidth=Stage.width;

//Max size of a cloud

cloudsize=300;

//Amount of blur applied to the shapes to make them cloud-like

blursize=40;

//Clouds move at a random speed. this is the minimum speed

cloudminspeed=.5;

//Variance in speed from cloud to cloud

cloudspeedvariance=1;

//Create the clouds

for(c=1;c

本文轉自:http://www.5uflash.com/flashjiaocheng/Flashaschengxu/544.html