最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
flash9飘雪效果
时间:2022-07-02 17:12:05 编辑:袖梨 来源:一聚教程网
9飘雪效果
1、在flash中制作一个影片剪辑雪花
2、使用如下类:
package {
import flash.display.*;
import flash.events.*;
public class Snow extends MovieClip {
var speedx=0;
var speedy=0;
public function Snow() {
speedx=.8 * Math.random() - 0.4;
speedy=5 * Math.random();
this.addEventListener(Event.ENTER_FRAME,Mot);
}
function Mot(e:Event) {
this.x+= speedx;
this.y+= speedy;
if (this.y >400) {
init();
}
}
function init() {
this.y=0;
this.x=Math.random() * 550;
}
}
}
在flash中右键选中库中的雪花影片剪辑,在类中输入Snow
在flash中加入如下代码:
function DisplaySnows() {
for (var i:int = 0; i var newSnow:Snow = new Snow();
this.addChild(newSnow);
newSnow.x = Math.random()*500;
newSnow.y =-Math.random()*300;
newSnow.alpha = .3+Math.random()*.7;
var scale:Number = .3+Math.random();
newSnow.scaleX = newSnow.scaleY = scale;
}
}
DisplaySnows();
2、使用如下类:
package {
import flash.display.*;
import flash.events.*;
public class Snow extends MovieClip {
var speedx=0;
var speedy=0;
public function Snow() {
speedx=.8 * Math.random() - 0.4;
speedy=5 * Math.random();
this.addEventListener(Event.ENTER_FRAME,Mot);
}
function Mot(e:Event) {
this.x+= speedx;
this.y+= speedy;
if (this.y >400) {
init();
}
}
function init() {
this.y=0;
this.x=Math.random() * 550;
}
}
}
在flash中右键选中库中的雪花影片剪辑,在类中输入Snow
在flash中加入如下代码:
function DisplaySnows() {
for (var i:int = 0; i var newSnow:Snow = new Snow();
this.addChild(newSnow);
newSnow.x = Math.random()*500;
newSnow.y =-Math.random()*300;
newSnow.alpha = .3+Math.random()*.7;
var scale:Number = .3+Math.random();
newSnow.scaleX = newSnow.scaleY = scale;
}
}
DisplaySnows();
相关文章
- QQ经典版下载安装最新版-QQ经典版轻量版app官方正式版下载 12-17
- 豆包网页版官方入口-豆包网页版一键直达官网 12-17
- 抖音网页版官方入口-在线畅玩douyin.com 12-17
- 土豪漫画官方下载入口-安卓/iOS一键安装APP 12-17
- QQ经典版最新版本下载安装-QQ经典版app官方正版下载地址 12-17
- 漫蛙官网入口网页直达-漫蛙官网入口官方认证链接 12-17