Menu

moveflower

2016. 5. 22. 00:47

안개핑 Flash study

 

 

 

    actions-1 var left = this.frame_mc._x; var right = left + this.frame_mc._width; var top = this.frame_mc._y; var bottom = top + this.frame_mc._height; actions-3 // var total = 0; var depth = 300; var iter = 0; // function setQuality(thisSpeed) { if (thisSpeed == 1) { total = 5; iter = 15; } else if (thisSpeed == 2) { total = 5; iter = 25; } else { total = 5; iter = 35; } } setQuality(_global.speed); // function chase(mc, x, y, a) { mc._x += (x-mc._x)/(a+mc.d); mc._y += (y-mc._y)/(a+mc.d); } // function flex(mc, homex, homey) { var spring = 0.55; var decay = 0.9; var r = ele.ball._width/2; // var y = mc._y; var x = mc._x; mc.dify = (((homey-y)/30)*spring)+(mc.dify*decay); mc.difx = (((homex-x)/45)*spring)+(mc.difx*decay); var tempx = mc._x+mc.difx; var tempy = mc._y+mc.dify; // if (tempxright-mc._width/2) { tempx = right-mc._width/2-Math.random()*15; } if (tempybottom-mc._height/2) { tempy = bottom-mc._height/2-Math.random()*10; } var bx = ele.ball._x; var by = ele.ball._y; var angle = findAngle(mc, bx, by); if (Math.abs(tempx-bx)this.obj.tcount) { this.obj.count = 0; this.obj.tcount = Math.random()*10; this.obj.targetx = ball._x+Math.random()*1200-600; this.obj.targety = ball._y+Math.random()*1200-600; } this.obj.x += (this.obj.targetx-this.obj.x)/59; this.obj.y += (this.obj.targety-this.obj.y)/80; }; } } // function createBall() { this.ele.attachMovie("ball", "ball", 10000); var clip = this.ele["ball"]; clip.r = clip._width/2; clip.active = true; clip.ang1 = Math.random()*360; clip.mag1 = Math.random()*6-3; clip.ang2 = 0; clip.mag2 = 0; clip._x = Math.random()*550+150; clip._y = Math.random()*225+150; clip._xscale = 1; clip._yscale = 1; clip.onEnterFrame = function() { this.r = this._width/2; if (this.active) { this._xscale += (100-this._xscale)/3.5; this._yscale = this._xscale; if (this._xscale>99) { this._xscale = 100; this._yscale = 100; this.active = false; } } else { var oldx = this._x; var oldy = this._y; var x1 = this.mag1*Math.sin(this.ang1*Math.PI/180); var y1 = this.mag1*Math.cos(this.ang1*Math.PI/180); var x2 = this.mag2*Math.sin(this.ang2*Math.PI/180); var y2 = this.mag2*Math.cos(this.ang2*Math.PI/180); var movx = x1+x2; var movy = y1+y2; // find where ball could be var x = this._x+movx; var y = this._y+movy; if (xright-this.r) { this.ang1 = 360-this.ang1; this.ang2 = 360-this.ang2; this._x -= movx; this._y += movy; } else if (ybottom-this.r) { if (oldxactions-6 clearAll(); stop();

'Flash study' 카테고리의 다른 글

간단한 액션으로 움직이는 막대 만들기  (0) 2016.05.22
aurora  (0) 2016.05.22
lightsmany2  (0) 2016.05.22
lightsmany1  (0) 2016.05.22
greatmask  (0) 2016.05.22