Flash AS2实例 跳动的小球动画效果
程序员文章站
2022-10-06 15:33:47
Flash AS2实例:跳动的小球动画效果.... 09-11-30...
效果显示:
详细代码:
//as2.0 qq:31559783 2009.11.28
movieclip.prototype.zl = function() {
this.vg = 0.7;
this.vy = 0;
this.vx = 0;
this.an = true;
this.onenterframe = function() {
this.vy += this.vg;
this._y += this.vy;
this._x += this.vx;
if (this._x>550) {
this._x = 0;
}
if (this._x<0) {
this._x = 550;
}
if (this._y>300) {
this._y = 300;
this.vy *= -0.5;
this.vx *= 0.9;
}
if (this._y == 300 && this.an == true) {
ss(this._x, this._y);
}
if (this._y == 300 && math.abs(this.vy) >> 0 == 0) {
this.an = false;
}
};
this.tt = function() {
this.vg = 0.7;
this.vy = 0;
this.vx -= (this._x-_root._xmouse)/30;
this.dy = this._y-_root._ymouse;
this.vy -= this.dy/10;
};
};
function ss(x, y) {
var sj = (math.random()*10+20) >> 0;
for (var i = 0; i<sj; i++) {
var mc = this.createemptymovieclip("huaxian_mc", this.getnexthighestdepth());
mc._x = x;
mc._y = y;
mc.linestyle(math.random()*3, 0, 100);
mc.moveto(0, 0);
mc.lineto(1, 0);
mc.vx = random(20)-10;
mc.vy = random(20)-10;
mc.onenterframe = function() {
this._x += this.vx;
this._y += this.vy;
this.vy += 0.8;
this._alpha -= 2;
if (this._alpha<1 || this._y>=300) {
this.removemovieclip();
}
};
}
}
mc.zl();
mc1.zl();
this.onmousedown = function() {
if (mc.an == false) {
ss(mc._x, mc._y);
mc.an = true;
mc.tt();
}
};
this.onenterframe = function() {
if (random(50) == 0) {
if (mc1.an == false) {
ss(mc1._x, mc1._y);
mc1.an = true;
mc1.tt();
}
}
};
flv文件下载
详细代码:
复制代码
代码如下://as2.0 qq:31559783 2009.11.28
movieclip.prototype.zl = function() {
this.vg = 0.7;
this.vy = 0;
this.vx = 0;
this.an = true;
this.onenterframe = function() {
this.vy += this.vg;
this._y += this.vy;
this._x += this.vx;
if (this._x>550) {
this._x = 0;
}
if (this._x<0) {
this._x = 550;
}
if (this._y>300) {
this._y = 300;
this.vy *= -0.5;
this.vx *= 0.9;
}
if (this._y == 300 && this.an == true) {
ss(this._x, this._y);
}
if (this._y == 300 && math.abs(this.vy) >> 0 == 0) {
this.an = false;
}
};
this.tt = function() {
this.vg = 0.7;
this.vy = 0;
this.vx -= (this._x-_root._xmouse)/30;
this.dy = this._y-_root._ymouse;
this.vy -= this.dy/10;
};
};
function ss(x, y) {
var sj = (math.random()*10+20) >> 0;
for (var i = 0; i<sj; i++) {
var mc = this.createemptymovieclip("huaxian_mc", this.getnexthighestdepth());
mc._x = x;
mc._y = y;
mc.linestyle(math.random()*3, 0, 100);
mc.moveto(0, 0);
mc.lineto(1, 0);
mc.vx = random(20)-10;
mc.vy = random(20)-10;
mc.onenterframe = function() {
this._x += this.vx;
this._y += this.vy;
this.vy += 0.8;
this._alpha -= 2;
if (this._alpha<1 || this._y>=300) {
this.removemovieclip();
}
};
}
}
mc.zl();
mc1.zl();
this.onmousedown = function() {
if (mc.an == false) {
ss(mc._x, mc._y);
mc.an = true;
mc.tt();
}
};
this.onenterframe = function() {
if (random(50) == 0) {
if (mc1.an == false) {
ss(mc1._x, mc1._y);
mc1.an = true;
mc1.tt();
}
}
};
flv文件下载
下一篇: 真值了!65英寸版小米电视4A限时降价