详细内容
 
当前位置
Flash动画制作飘出的水泡效果
作者:管理员    发布于:2012-07-25 23:14:48    文字:【】【】【

Flash动画制作飘出的水泡效果

 

Flash动画制作步骤: 

1.开flash中新建一文档。并适当修改文档属性(400×300,蓝色背景) 。

2.建一个影片剪辑,命名为“h2o”。进入编辑区以后,利用绘图工具,渐变填充绘制一个水泡。

3.回到主场景,把图层1命名为“h2o”。从库中把“h2o”影片剪辑拖放到场景的下方,在下面的属性面板中命名它的分身名为“h2o”。

4.主场景中新建一个图层,命名为“as”。在第1帧添加AS:

i=1  
while(i<=30){  
       duplicateMovieClip("h2o","h2o"+i,i);  
       setProperty("h2o"+i,_x,random(400));  
       setProperty("h2o"+i,_y,random(100)+300);  
       setProperty("h2o"+i,_xscale,random(60)+40);  
       setProperty("h2o"+i,_yscale,getProperty(eval("h2o"+i),_xscale));  
       setProperty("h2o"+i,_alpha,random(30)+70);  
       i++  
 
_root.h2o._visible=0 

5.具体解释如下: 

i=1                                  //初始化变量  
while(i<=30){                             //用来控制水珠的数量  
duplicateMovieClip("h2o","h2o"+i,i);         //复制水珠  
setProperty("h2o"+i,_x,random(400));        //在X轴上随机分布复制出的水珠  
setProperty("h2o"+i,_y,random(100)+300);   //同上,只是换成了Y轴  
setProperty("h2o"+i,_xscale,random(60)+40);  
setProperty("h2o"+i,_yscale,getProperty(eval("h2o"+i),_xscale));  
                                     //以上两条AS是用来控制水珠大小的。  
setProperty("h2o"+i,_alpha,random(30)+70);//用来控制水珠的透明度  
i++  
 
_root.h2o._visible=0                      //将主场景中的水珠隐藏。 

6.选中影片剪辑“H2O”,添加AS: 

onClipEvent (load) {  
speed = random(5)+3;  
 
onClipEvent (enterFrame) {  
this._y -= speed;  
this._x += random(3)-random(3);  
if (this._y<-15) {  
  this._y = random(100)+315;  
 

7.上面的AS语句的意思是: 

onClipEvent (load) {                 //用来随机赋于水珠的速度,让水珠运动更加真实。  
speed = random(5)+3;  
 
onClipEvent (enterFrame) {  
this._y -= speed;                  //用来改变水珠Y轴的坐标,这样我们看起来水珠是在不断在上升。  
this._x += random(3)-random(3);   //为了上水珠运动更真实些,我们上水珠左右晃动一下。  
if (this._y<-15) {                  //此IF语句的作用是当水珠移出屏幕时,重新放回屏幕中来。  
  this._y = random(100)+315;  
 

8.保存测试吧!

脚注信息
版权所有 Copyright(C)2008-2015 龙腾动画(北京龙腾创星科技有限公司) 京ICP备16063988号-3       本站关键词:flash动画制作 

 
QQ在线咨询
咨询热线
010-57477990
7*24咨询热线
13701141129