| 首页 | 新闻 | 网页 | 设计 | 色彩 | 原创 | 视觉 | 素材 | 动漫 | 酷站 | 策划 | 文案 | 访谈 | 运营 | 编程 | 数据库 | 服务器 | 下载 | 图库 | 
您的位置: 幽幽天空 > 网页 > 网页制作 > Flash教程 > ActionScript教程 > 文章正文 用户登录
谈谈BLOG营销中的
[征文]6年站长风雨
[征文]6年站长风雨
美女主持陈鲁豫眼
浅谈个人网站的发
网站推荐机制中的
Flash MX2004中的
Flash中的电影艺术
视频文件在FLASH中
读取XML当中的HTM

风雨中的树—AS效果的实际应用           

风雨中的树—AS效果的实际应用

作者:佚名 来源:不详 更新:2007-1-13 20:48:13 错误报告 我要投稿

风雨中的树——AS效果的实际应用
 数学公式是自然美的原型?:) 
  
  
 这个程序是以前做的,很不完善。分下面几块 
 1.造雨: 
 amount = _parent.strong*2; 
 j = amount/40; 
 //雨量控制 
 drop._visible = false; 
 do { 
 duplicateMovieClip("drop", "d"+i, i); 
 setProperty("d"+i, _x, random(800)-100); 
 setProperty("d"+i, _y, random(50)); 
 setProperty("d"+i, _xscale, 30+random(70)); 
 setProperty("d"+i, _yscale, 70+random(40)); 
 setProperty("d"+i, _alpha, random(50)+35); 
 i1 = i-200; 
 removeMovieClip("d"+i1); 
 i = i+1; 
 j = j-1; 
 } while (j>=0); 
 //制造随机的雨 

 2.造风 
 onClipEvent (load) { 
 t0 = getTimer(); 
 tt0 = getTimer(); 
 tinterval = 10000; 
 interval = 1000; 
 wind = new Sound("windsound"); 
 rain = new Sound("rainsound"); 
 } 
 onClipEvent (enterFrame) { 
 t1 = getTimer(); 
 t = t1-t0; 
 tt = t1-tt0; 
 if (tt>=tinterval) { 
 tt0 = getTimer(); 
 } 
 if (t>=interval) { 
 strong = 20+random(9)*10; 
 rain.setVolume(strong); 
 direction = random(2); 
 if (direction == 1) { 
 pan = strong; 
 } else { 
 if (direction == 0) { 
 pan = -strong; 
 } 
 } 
 wind.setPan(pan); 
 volume = 0; 
 wind.setVolume(volume); 
 windsound.gotoAndPlay("start"); 
 t0 = getTimer(); 
 tt0 = getTimer(); 
 interval = strong*100; 
 } 
 now = Math.sin(((1-(t/interval)*2)*Math.PI)/2); 
 //from 1~-1 
 if (direction == 1) { 
 pan = strong*now; 
 } else { 
 if (direction == 0) { 
 pan = -strong*now; 
 } 
 } 
 wind.setPan(pan); 
 if (t>=interval/2) { 
 volume = strong*(now+1); 
 } else { 
 if (t<=100) { 
 volume = 0; 
 } else { 
 if (t<=interval/2) { 
 volume = strong*(1-now); 
 } 
 } 
 } 
 if (volume<0) { 
 volume = 0; 
 windsound.gotoAndStop("stop"); 
 } 
 wind.setVolume(volume); 
 if (direction == 1) { 
 setProperty("rain.drop", _rotation, -volume/3); 
 } else { 
 if (direction == 0) { 
 setProperty("rain.drop", _rotation, volume/3); 
 } 
 } 
 } 

 3.树的摇摆 
 onClipEvent (enterFrame) { 
 nowt = (Math.sin(((1-(tt/tinterval)*2)*Math.PI*Math.exp(t/interval))*2)*Math.exp((-t/interval)*5); 
 //周期衰变大阻尼震荡 
 direction = _parent.direction; 
 if (direction == 1) { 
 _rotation = -nowt*40; 
 } else { 
 if (direction == 0) { 
 _rotation = nowt*40; 
 } 
 } 
 }
文章录入:skyuu    责任编辑:skyuu 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    发表评论:
    姓名:  评 分: 1分 2分 3分 4分 5分
     
  • 严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
  • 用户需对自己在使用幽幽天空服务过程中的行为承担法律责任。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表机友个人观点,与本网站立场无关。