最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
flash雪花飘啊飘(纯AS)
时间:2022-07-02 17:16:50 编辑:袖梨 来源:一聚教程网
insert into filecontent(title,content,filesendtime,filesendid,siteindex,systype,isown,z_type) value('雪花飘啊飘','
///////////////////////////////////////////////////////////////////////////
// 照着turbine前辈的早先的一个文件做的,他的用到了类,
// 本想也用类来写,无奈as2的类暂时用不熟,mx的类又不想再用,
// 所以只好凑合凑合,拼个效果出来先,里面好多代码看上去乱糟糟的
// 呵呵,先就这样了,看来得抓紧学习类的使用,呼呼呼呼
// 没做任何注释,对不起大家了,谁帮忙注释下,注释的好的加分哦嘎嘎...
// 源代码就不帖了,反正把这些代码全复制就可以了
// 运行环境flashMX2004
///////////////////////////////////////////////////////////////////////
var sceneWidth = scene;
var sideDisWidth = Stage.width/2-sceneWidth/2;
var sideDisHeight = Stage.height/2-sceneHeight/2;
var snowNum = 80;
var snowSpace:MovieClip = _root.createEmptyMovieClip("room", 1);
function addMasker() {
_root.createEmptyMovieClip("masker", 10000);
with (masker) {
beginFill(0x000550, 100);
moveTo(sideDisWidth, sideDisHeight);
lineTo(sideDisWidth+sceneWidth, sideDisHeight);
lineTo(sideDisWidth+sceneWidth, sideDisHeight+sceneHeight);
lineTo(sideDisWidth, sideDisHeight+sceneHeight);
lineTo(sideDisWidth, sideDisHeight);
endFill();
}
snowSpace.setMask(masker);
createSnow();
}
function snowProperty(snow, w, h) {
snow._x = sideDisWidth+Math.random()*w;
snow._y = sideDisHeight+Math.random()*h;
snow._rotation = Math.random()*120+30;
snow.stepX = Math.cos((snow._rotation*Math.PI)/180);
snow.stepY = Math.random()*2+1;
setInterval(snowFall, 30, snow);
}
function drawSnow(snow:MovieClip, radius:Number) {
var p = radius*.9;
with (snow) {
colors = [0xCCCCCC, 0xFFFFFF];
alphas = [100, 100];
ratios = [0, 255];
matrix = {matrixType:"box", x:-Math.random()*2*radius, y:-Math.random()*2*radius, w:2*radius, h:2*radius, r90/180)*Math.PI};
beginGradientFill("radial", colors, alphas, ratios, matrix);
moveTo(0, -radius);
curveTo(p, -p, radius, 0);
curveTo(p, p, 0, radius);
curveTo(-p, p, -radius, 0);
curveTo(-p, -p, 0, -radius);
endFill();
}
snowProperty(snow, sceneWidth, sceneHeight);
}
function createSnow() {
var n = 0;
while (n
var radius:Number = Math.random()*3;
drawSnow(snow, radius);
n++;
}
}
function snowFall(snow) {
snow._x += snow.stepX;
snow._y += snow.stepY;
if (snow._x
}
if (snow._x>sideDisWidth+sceneWidth) {
snow._x = sideDisWidth;
}
if (snow._y>sideDisHeight+sceneHeight) {
snow._y = sideDisHeight;
}
}
addMasker();
_root.createEmptyMovieClip("myMC", 10);
with (myMC) {
lineStyle(1, 0xcccccc, 100);
moveTo(sideDisWidth, sideDisHeight);
lineTo(sideDisWidth+sceneWidth, sideDisHeight);
lineTo(sideDisWidth+sceneWidth, sideDisHeight+sceneHeight);
lineTo(sideDisWidth, sideDisHeight+sceneHeight);
lineTo(sideDisWidth, sideDisHeight);
var infor:TextField = myMC.createTextField("infor", 1, sideDisWidth+sceneWidth-100, sideDisHeight+sceneHeight, 100, 20);
infor.autoSize="right";
infor.selectable=false;
infor.textColor = 0xcccccc;
infor.text = "by holybozo";
}
_root.createEmptyMovieClip("bg", -1);
with (bg) {
beginFill(0x999999, 100);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
endFill();
}
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22