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

Flash动画制作
Flash新手入门教程:AS2代码中duplicateMOvieClip的应用
Flash新手入门教程:AS代码实现漂亮的立体球旋转效果
Flash新手入门教程:AS代码打造漂亮的螺旋上升效果
Flash新手入门教程:初识Flash的开始页面、界面、工具栏
Flash新手入门教程:文件的导出和导入
Flash新手入门教程:AS入门第一课_认识编程环境
Flash cs3仿真艺术设计3.2:遮罩运用制作飘扬的旗帜
Flash AS3.0菜鸟学飞教程:创建Bitmap类
Flash AS 3.0入门教程:初识AS 3.0
Flash cs3仿真艺术设计3.3:遮罩运用打造光圈变换效果
Flash AS3.0菜鸟学飞教程:用反射动态创建实例
Flash cs3仿真艺术设计3.4:遮罩运用制作手写字效果
Flash cs3仿真艺术设计3.5:遮罩运用之聚光灯效果
Flash AS3.0菜鸟学飞教程:代码的位置
Flash实例教程:AS 3.0打造漂亮的水汶效果
Flash cs3仿真艺术设计3.6:运用遮罩打造焦点效果
Flash AS 3.0实例教程:Main类打造发散效果
Flash cs3仿真艺术设计4.1:阴影的基本运用
Flash cs3仿真艺术设计4.2:阴影之投影的应用
Flash cs3仿真艺术设计4.3:阴影之透视阴影

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-04   浏览: 116 ::
收藏到网摘: 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