这完全是一个偶然。。。 本来是要研究如何取得一条曲线上的坐标点 结果就弄出了这个来 随便画条线看效果(不要横着画太长) 每次只能画一笔,看你能画出什么来
点击浏览该文件
点击浏览该文件
_______________完全AS(首帧)_____________________________
depth=10; this.createEmptyMovieClip("mybackground",depth++);//涂鸦层 this.createEmptyMovieClip("dot",depth++);//填充层 var x=1000; var fanwei; var ismove=false; var isdown=false; var isbeging=false; onMouseMove=function(){ismove=true;} onMouseDown=function(){isdown=true;} onMouseUp=function(){ isdown=false; isbeging=false; //准备重新填充 fanwei=getBounds(mybackground);//获取图形范围,尽量减小扫描区域 x=fanwei.xMin; } this.onEnterFrame=function(){ //开始填充(从上往下,从左到右扫描) if(x<fanwei.xMax){ for(var y=fanwei.yMin;y<fanwei.yMax;y+=1){ if(mybackground.hitTest(x,y,true)){ //其实关键就是这个 dot.lineStyle(1,random(0xffffff),random(70)+30); dot.moveTo(x-.5,y); dot.lineTo(x+15,y+Math.random()*10); } } x+=3; } //涂鸦 if(isdown){ if(!isbeging){ dot.clear(); mybackground.clear(); mybackground.lineStyle(random(10),0xaaaaaa); mybackground.moveTo(_xmouse,_ymouse); isbeging=true; }else if(ismove){ mybackground.lineTo(_xmouse,_ymouse); } } } // //
|