Flash 特效脚本实例怎样应用?
Flash 特效脚本实例,语句精练,表现能力丰富。通过改编,熟 练掌握它们的用法,对于提高自己的应用水平很有好处。我想从一个 实例入手,将一个小球下落的动画,改成一幅下雪的动画. 我想配上一幅红梅,使之成为一幅美丽的《落雪红梅图》,可能 很富有诗意。 那幅小球下落动画,从它库里,看不到一张图片;主场景和主影 片剪辑的帧数都只有3帧,和我们平时作动画时通常几十帧的方法不 大相同。 问:Flash 特效脚本实例怎样应用? 答:Flash 特效脚本实例,包括FlashMX 自带的约20个实例,以及 常见的"超级特效50例","精品特效25例","动画大赛"等一批特效实 例程序,确实是一个很丰富的资源。 借鉴这些技巧,无疑为提高我们的编程技巧提供捷径,使我们能创 造更多更好的动画。 现以小球下落动画为例,说明改编步骤。 小球下落实例原程序 n01.swf 详见: 小球下落实例原程序 n01.swf 1.找一张雪花的图形代替小球。 Photoshop的多角形图形中,有雪花的样图。下载是白底蓝花, 用画图软件如PhotoShop改为灰底白花。底色应改为和背景颜色一 致。一般用灰色到黑色才能看出下雪来。 2.将下落的速度改慢。 调整 gravity 的值,使保持合适的下降速度。 3.将小球碰击桌面时的反弹改掉。 将碰击语句删去还是改掉? 4.将原来水平无移动,改为水平稍有漂移,以表现雪景。 水平漂移的语句怎样设置比较合适? 用Flash 脚本做下雪的雪景风光 n02.swf 详见: 雪景风光 n02.swf 5.进而配上一幅红梅作背景,使之成为一幅《落雪红梅图》。 很富有诗意。可是雪花也得改成透明才能把美景体现出来。 雪花怎样才能变得透明(只是灰色框架透明,雪花不能透明)? 也请将那个小盘用鼠标移动一下试一试。 《落雪红梅图》 n04.swf 详见: 《落雪红梅图》n04.swf 改编详情如下: 主场景各帧的脚本可以不改变 MainMovie.txt // Action script... // 第 1 帧 [Action in Frame 1] depth = 1; this.node._visible = false; this.node.stop(); // 第 2 帧 [Action in Frame 2] //random()括号内的值减小,可使雪花变多 if (random(10) == 0) { newnode = "node" + depth; this.node.duplicateMovieClip(newnode, depth++); } // end if // 第 3 帧 [Action in Frame 3] gotoAndPlay(2); 影片剪辑 node 的改变 Sprite1.txt: // Action script... // 第 1 帧 [Action in Frame 1] //scale 的值决定雪花的大小及变化 // determine random size (5-12%) var scale=random(8)+5; this._xscale=scale; this._yscale=scale; // start anywhere along the top this._x=random(600); this._y=0; // 原来水平无移动,改为水平稍有漂移,以表现雪景。 vx=random(4)-2; // a small amount of vertical acceleration vy=random(4)-2; if (vx>-1 & vx<1) { vx = 1; } if (vy>-1 & vy<1) { vy = 1; } // 第 2 帧 [Action in Frame 2] // gravity 重力加速度由0.6 改为 0.1,使下落变慢。 vy=vy+.1; // vector velocities this._x=this._x+vx; this._y=this._y+vy; // bound checking if (this._y>200 & this._y<0) { // free fall to eternity this.removeMovieClip(); } // 原来的平台小球弹性回跳改为雪花堆积。 if (this._x<0) { vx=-vx*.9; this._x=0; } else if (this._x>600) { vx=-vx*.9; this._x=600; } // wow. hitTest. if (hitTest(_parent.mousecatch)) { // this node has hit the plank // bounce up, not so high vy= 0; // adjust to psuedo camber in the plank vx= 0; // this is the material world this._y=_parent.mousecatch._y-(this._height/2); } // 第 3 帧 [Action in Frame 3] gotoAndPlay(2); 平台用鼠标移动可以玩使雪花不落到平台上的游戏 Bottom1.txt: // Action script... on (press) { this.startDrag(); } on (release, releaseOutside) { this.stopDrag(); } 《落雪红梅图》 n04.fla 浏览: 《落雪红梅图》n04.swf Flash 特效脚本实例应用下载 wy04021.zip 下载: 特效脚本应用 wy04021.zip KB 河石 /编 2003.12.7 黄河之滨 网站 : http://hhstone.vip.sina.com : http://www.hhstone.com