• 【设为首页】
  • 【收藏闪客居】
当前位置:主页>FLASH AS 编程>AS高手篇>文章内容
  • 超强的粒子特效
  • 来源:闪吧 作者:yinggoing 2007-05-28 【

 超强的粒子特效,效果非常好,和大家分享:



#initclip 1
function PoolClass()
{
    this.stick = {x: 300, y: 169};
    this.onEnterFrame = this.dragStick;
} // End of the function
PoolClass.prototype = new MovieClip();
PoolClass.prototype.dragStick = function ()
{
    if (this.stick.x < 0)
    {
        this.stick.vx = this.stick.vx + 4 * Math.random();
    }
    else if (this.stick.x > 600)
    {
        this.stick.vx = this.stick.vx - 4 * Math.random();
    }
    else
    {
        this.stick.vx = this.stick.vx + (Math.random() - Math.random()) * 4;
    } // end else if
    if (this.stick.y < 0)
    {
        this.stick.vy = this.stick.vy + 4 * Math.random();
    }
    else if (this.stick.y > 337)
    {
        this.stick.vy = this.stick.vy - 4 * Math.random();
    }
    else
    {
        this.stick.vy = this.stick.vy + (Math.random() - Math.random()) * 4;
    } // end else if
    this.stick.x = this.stick.x + this.stick.vx;
    this.stick.y = this.stick.y + this.stick.vy;
    this.stick.vx = this.stick.vx * 8.000000E-001;
    this.stick.vy = this.stick.vy * 8.000000E-001;
    this.createNode(random(600), random(337), this.stick.x, this.stick.y, 7 + random(13));
};
PoolClass.prototype.createRandomNode = function ()
{
    var x = random(600);
    var y = random(337);
    var dx = this._xmouse;
    var dy = this._ymouse;
    var ds = 10 + random(20);
    this.createNode(x, y, dx, dy, ds);
};
PoolClass.prototype.createNode = function (x, y, dx, dy, ds)
{
    var nombre = "nd" + String(this.depth++);
    var neo = this.attachMovie("node", nombre, this.depth);
    neo._x = x;
    neo._y = y;
    neo.dx = dx;
    neo.dy = dy;
    neo.body._xscale = ds;
    neo.body._yscale = ds;
};
Object.registerClass("pool", PoolClass);
#endinitclip
源文件下载: 粒子特效.rar



上一篇:Flash CS3 colorpicks (7行代码)   下一篇:写给想做flv播放器的朋友
  • 用户名:新注册) 密码: 匿名评论
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
推荐内容

Copyright © 2006-2008 flashas.net All Rights Reserved.
网站内容咨询: admin#flashas.net (#为@) 联系QQ:40777822 浙ICP备06033001号
(本网站最佳浏览解析度为1024*768, 建议使用IE 6.0或以上版本浏览器。)