当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash AS2实例:跳动的小球动画效果

Flash动画制作
AS3.0实用代码:绘制各种各样三角形
AS代码研究实例:随即运动参数的传递应用
Flash制作3D类动画的教程
Flash AS3制作个性的旋转圆形网页导航
Flash AS2实例:跳动的小球动画效果
Flash交互动画制作技巧:按钮控制动画
Flash AS教程:详细讲解Math对象
Flash动画制作技巧:搞笑动画制作实例
Flash制作技巧:人物行走动画制作剖析
Flash AS3常用的关于MC的代码
Flash AS3.0教程:间隔循环的3种表现方式
Flash动画实例:简单的流星雨动画特效
Flash制作高级的人物行走动画
10个让你大饱眼福的创意Flash网站
Flash实例教程:吸管喝饮料动画
Flash CS4实例教程:漂亮的气泡动画
汇总网页传递参数到flex中的三种方法
AS教程:加载与被加载swf内部变量相互调用
Flash CS4教程:文字颜色缓动特效
Flash CS实例教程:幸运大抽奖动画

Flash动画制作 中的 Flash AS2实例:跳动的小球动画效果


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-04   浏览: 115 ::
收藏到网摘: n/a

效果显示:


详细代码:
//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();
                }
        }
};


源文件下载:跳跃的小球.rar