大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 网络媒体 -> FLASH -> Flash5 画任意直线教程

Flash5 画任意直线教程

时间: 2021-07-31 作者:daque

    Flash5 画任意直线教程     第一步:兴建一个flash,而且创造一个mc(定名为line),并在library里输入为line mc内里是长度为100的水笔直线(确定是极细线),重心坐标是(50,0)

    第二步:创造连线普通类,而且创造几个树立的分子因变量,简直步调如次,请放在要画线的场景或mc的第一帧里,并独立放在一个名为class的层里,action如次:

function new_line(c_line){    this.c_line=c_line;}new_line.prototype.attach_line=function(c_deep){    this.deep=c_deep+0;    attachmovie(this.c_line,this.c_line+this.deep,this.deep);    return ++c_deep;};new_line.prototype.set_xy=function(c_x,c_y){    eval(this.c_line+this.deep)._x=c_x;    eval(this.c_line+this.deep)._y=c_y;};new_line.prototype.set_width=function(c_dx,c_dy){    this.dx=c_dx;    this.dy=c_dy;    this.l=math.sqrt(this.dx*this.dx+this.dy*this.dy);    eval(this.c_line+this.deep)._width=this.l;};new_line.prototype.set_angle=function(){    this.angle=180*math.atan(this.dx/this.dy)/math.pi;    if(this.dy>=0) this.angle+=180;    eval(this.c_line+this.deep)._rotation=90-this.angle;};new_line.prototype.set_color=function(c_color){    this.mycolor=new color(this.c_line+this.deep);    this.mycolor.setrgb(c_color);};new_line.prototype.delete_line=function(c_object){    removemovieclip(this.c_line+this.deep);    delete eval(c_object);}

    第三步:创造实行连线因变量,放在class层的基层,定名为function的层里,简直action如次:

function line(c_x1,c_y1,c_x2,c_y2,c_color){    this.myline=new new_line("line");    deep=this.myline.attach_line(deep);    this.myline.set_xy(c_x1,c_y1);    this.myline.set_width(c_x1-c_x2,c_y1-c_y2);    this.myline.set_angle();    this.myline.set_color(c_color);}line.prototype.delete_line=function(c_object){        this.myline.delete_line("myline");    delete eval(c_object);}

    第四步:连线步调的简直用法。它的用法的简直情势如次:

myline = new line(x1,y1,x2,y2,color);

    个中x1,y1为画线开始点的坐标,x2,y2为画线遏止的坐标,color为所画线的脸色简直情势为#0000ff等十六进制数,也不妨用十进制,但不简单看出脸色值。

    简略这条线:myline.delete_line("myline");

    用法举例:在class与function层的底下创造一action层,而且树立两个要害帧    第一帧的action是:

this["myline"+i]=new line(i,-50*math.sin(i/20),i+4,-50*math.sin((i+4)/20),0xff00ff);if(i>=500){    for(i;i>0;i--)    this["myline"+i].delete_line("myline"+i);}i +=4;if(ip!=1){ip=1myline = new line(0,0,500,0);}

    第二帧的action是:

gotoandplay(_currentframe -1);

    如许你就能画出一条规范的正弦弧线了

    源文献载入:http://www.blueidea.com/user/goldgoat/line.fla    之上这即是我在处事中归纳出来得画线步调,特殊有效,并且用法也特殊简单,我已经用它做过很多特出得大作,它最大得特性是不用商量线得深度题目,并且简略也很简单,断定你一见就会手不释卷得。

 

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.