[ActionScript 3.0] AS3.0 下雨及涟漪效果
生活随笔
收集整理的這篇文章主要介紹了
[ActionScript 3.0] AS3.0 下雨及涟漪效果
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
幀代碼:
stage.frameRate = 80;function init(x1:Number,y1:Number) {var mc:MovieClip=new MovieClip();addChild(mc);mc.x = x1;mc.y = y1;mc.graphics.lineStyle(0.5,0xbbffff,0.6);mc.graphics.drawEllipse(-1,-0.3,2,0.6);mc.addEventListener(Event.ENTER_FRAME,frame);var v0 = 0.5 + 0.3 * Math.random();function frame(e){mc.scaleX = mc.scaleY += v0;mc.alpha > 0 ? mc.alpha -= 0.02:[mc.removeEventListener(Event.ENTER_FRAME,frame),removeChild(mc),mc = null];}}function xiayu() {var timer:Timer = new Timer(200,2);timer.addEventListener(TimerEvent.TIMER,onTimer);var mc:MovieClip=new MovieClip();mc.graphics.beginFill(0xbbffff,0.8);mc.graphics.drawEllipse(-0.5,-2,1,4);addChild(mc);mc.scaleX = mc.scaleY = 0.7 + 0.3 * Math.random();var x0 = mc.x = 50 + Math.random() * 450;mc.y = -10 - 20 * Math.random();var y0 = 30 + 350 * Math.random();mc.addEventListener(Event.ENTER_FRAME,frameB);function frameB(e){if (mc.y < y0){mc.y += 5;}else{mc.removeEventListener(Event.ENTER_FRAME,frameB);removeChild(mc);mc = null;init(x0,y0);timer.start();}}function onTimer(e){init(x0,y0);}}var t:Timer = new Timer(100,0);t.addEventListener(TimerEvent.TIMER,onT);t.start();function onT(e) {xiayu();xiayu();}?
轉載于:https://www.cnblogs.com/frost-yen/p/5623801.html
總結
以上是生活随笔為你收集整理的[ActionScript 3.0] AS3.0 下雨及涟漪效果的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: u盘怎么解除写保护状态,u盘写保护怎么去
- 下一篇: cmd命令行查看windows版本