Hiệu ứng tuyết rơi theo hướng di chuyển chuột
(Tài liệu chưa được thẩm định)
Nguồn:
Người gửi: Lê Trọng Nghĩa (trang riêng)
Ngày gửi: 11h:35' 25-02-2011
Dung lượng: 65.2 KB
Số lượt tải: 7
Mô tả:
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
endFill();
MovieClip.prototype.createSnow = function ()
{
this.clear();
this.lineStyle(2 + 3 * Math.random(), 16777215, 50 + 50 * Math.random());
this.x = 50 * (Math.random() - Math.random());
this.moveTo(this.x, 0);
this.lineTo(this.x, 5.000000E-001);
this.speed = 2 + 6 * Math.random();
this.spin = 7 * (Math.random() - Math.random());
this.wind = 3.000000E-002 * Math.random();
this._x = Stage.width * Math.random();
this._y = -20;
};
for (i = 0; i < 300; i++)
{
_root.createEmptyMovieClip("mc" + i, i).createSnow();
_root["mc" + i]._y = Stage.height * Math.random();
_root["mc" + i].onEnterFrame = function ()
{
this._y > Stage.height + 30 ? (this.createSnow()) : (this._y = this._y + this.speed);
this._x < -10 ? (this._x = Stage.width + 10) : (this._x = this._x % (Stage.width + 10));
this._rotation = this._rotation + this.spin;
this._x = this._x + this.wind * (_root._xmouse - Stage.width / 2);
};
} // end of for
Nguồn:
Người gửi: Lê Trọng Nghĩa (trang riêng)
Ngày gửi: 11h:35' 25-02-2011
Dung lượng: 65.2 KB
Số lượt tải: 7
Mô tả:
Tạo một layer/ nhấn F9/ Paste đoạn mã này .
beginFill(0, 100);lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
endFill();
MovieClip.prototype.createSnow = function ()
{
this.clear();
this.lineStyle(2 + 3 * Math.random(), 16777215, 50 + 50 * Math.random());
this.x = 50 * (Math.random() - Math.random());
this.moveTo(this.x, 0);
this.lineTo(this.x, 5.000000E-001);
this.speed = 2 + 6 * Math.random();
this.spin = 7 * (Math.random() - Math.random());
this.wind = 3.000000E-002 * Math.random();
this._x = Stage.width * Math.random();
this._y = -20;
};
for (i = 0; i < 300; i++)
{
_root.createEmptyMovieClip("mc" + i, i).createSnow();
_root["mc" + i]._y = Stage.height * Math.random();
_root["mc" + i].onEnterFrame = function ()
{
this._y > Stage.height + 30 ? (this.createSnow()) : (this._y = this._y + this.speed);
this._x < -10 ? (this._x = Stage.width + 10) : (this._x = this._x % (Stage.width + 10));
this._rotation = this._rotation + this.spin;
this._x = this._x + this.wind * (_root._xmouse - Stage.width / 2);
};
} // end of for
Nhấn vào đây để tải về
Nhắn tin cho tác giả
Báo tư liệu sai quy định
Xem toàn màn hình
Mở thư mục chứa tư liệu này
Nhắn tin cho tác giả
Báo tư liệu sai quy định
Xem toàn màn hình
Mở thư mục chứa tư liệu này
Số lượt thích:
0 người
 
Các ý kiến mới nhất