最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
flash 雪花飘代码
时间:2022-07-02 17:14:31 编辑:袖梨 来源:一聚教程网
flash 雪花飘代码
好现来看效果图片.
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();
}
相关文章
- 炉石传说兑换码大全 12-26
- 重返未来1999趋光性研究夜幕之外怎么玩 趋光性夜幕之外活动介绍 12-26
- 光遇12.26大蜡烛在哪里 光遇12月26日大蜡烛位置攻略 12-26
- 江南百景图金谷园怎么样 江南百景图金谷园建筑介绍 12-26
- 光遇12.26每日任务怎么做 光遇12月26日每日任务做法攻略 12-26
- 光遇12.26季节蜡烛在哪里 光遇12月26日季节蜡烛位置攻略 12-26