现在时间是:
| 综合资源导航: |
Flash AS动画实例:风吹云飘草动
作者:转载 发布时间:2007-12-10 18:01:28 浏览次数:1257我们可以直接用Flash的ASAS代码生成风吹云飘,风吹着青草左右摇摆的动画。因为AS的运算会拖慢机器,所以这里就不提供效果演示了,给大家截个图。

制作方法如下。
首先建立两个空的影片剪辑cloud和grass。
先建立云的影片剪辑(里面什么都不画)

选择该元件的第一帧,添加如下代码。
| //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<=clouds;c++){ //create an empty movie clip to hold the cloud this.createEmptyMovieClip("cloud"+c,this.getNextHighestDepth()); //generate a cloud. Pass in the instance name of the newly created cloud shapecloud("cloud"+c); //Set the x position to a random position within the boundaries eval("cloud"+c)._x=Math.random()*skywidth-eval("cloud"+c)._x/2; //Set the y position to a random position within the boundaries eval("cloud"+c)._y=Math.random()*(skyheight)-eval("cloud"+c)._height; } //Run at the start of each frame onEnterFrame=function(){ //Run for each cloud for(c=1;c<=clouds;c++){ //Move the cloud to the left according to its speed eval("cloud"+c)._x-=eval("cloud"+c).cloudspeed; //If the cloud is past the stage to the left, reset it to the right. Create a new shape and color if(eval("cloud"+c)._x+(eval("cloud"+c)._width/2)+cloudsize<0){ //Reset the x position eval("cloud"+c)._x=skywidth; //Reshape and recolor the cloud shapecloud("cloud"+c); } } } //This function creates the shape and color of a cloud function shapecloud(cloudid){ //Clear the current contents of the cloud eval(cloudid).clear(); //Set the new shade between 224 and 255. This number is used for the red, green, and blue, to create a grayscale color cloudcolor=Math.round(Math.random()*31)+224; //Use no line eval(cloudid).lineStyle(undefined, (cloudcolor+cloudcolor*0x100+cloudcolor*0x10000), 100, false, "none", "none", "none", 1); //Set the fill color. cloudcolor is used 3 times, for red, green, and blue eval(cloudid).beginFill((cloudcolor+cloudcolor*0x100+cloudcolor*0x10000)); //Set a starting coordinate for the cloud eval(cloudid).moveTo(Math.random()*cloudsize,Math.random()*cloudsize); //Draw an invisible line to another point the combined lines form shapes, which are the clouds. //They don't look much like clouds until the blur is applied eval(cloudid).lineTo(Math.random()*cloudsize,Math.random()*cloudsize); eval(cloudid).lineTo(Math.random()*cloudsize,Math.random()*cloudsize); eval(cloudid).lineTo(Math.random()*cloudsize,Math.random()*cloudsize); eval(cloudid).lineTo(Math.random()*cloudsize,Math.random()*cloudsize); eval(cloudid).lineTo(Math.random()*cloudsize,Math.random()*cloudsize); //Apply a blur to the shape eval(cloudid).filters = [new flash.filters.BlurFilter(blursize,blursize,2)]; //Set a new cloud speed eval(cloudid).cloudspeed=Math.random()*cloudspeedvariance+cloudminspeed; } |
同样办法再新建立一个草的影片剪辑

Flash MX 入门视频教程 |
如何制作透明FLASH |
模糊滤镜绘制逼真青翠竹林 |
加载外部文件的各种方法与技巧 |
flash 基础知识 |
flash经典20问答 |
Flash SWF转换为GIF动画 |
动漫欣赏网址集锦 |
|
![]() · 大 话 陆 军 专 栏 · |
![]() · 大 话 空 军 专 栏 · |
![]() · 大 话 海 军 专 栏 · |
![]() · 军 史 回 眸 专 栏 · |
|
![]() 最新99G坦克现身 |
![]() 中国变相承认歼18!(图) |
![]() 应对肢解中国的大危机 |
![]() 中国军事强大就安全了吗 |
![]() 朝鲜战争:立国之战 |
![]() 中国对西方十大迷信 |
![]() 中美战略博弈演义 |
![]() • 亲 历 现 代 战 争 • |
![]() • Q Q 聊 天 表 情 • |
• 经 典 影 视 赏 析 • |
![]() • 音 画 朗 诵 鉴 赏 • |
|
江青的另类评判 |
![]() 李敖:审判华盛顿 |
![]() QQ2011模块套装 |
![]() 恶趣十足QQ色表情 |
![]() 恐怖QQ表情大全 |
![]() 真人搞笑QQ表情大全 |
![]() 十大样板戏全集观看 |
| 网站首页 | 关于本站 | 广告服务 | 免责声明 | 意见反馈 | 申请链接 | 推荐信息 | 官方论坛 | QQ宝典 | 收录查询 | 加入收藏 | 设为首页 |




































