브라운 운동 함수
function brownMove(){ //브라운 운동 처리
for(var i =0; i < numDots; i++){
var dot:Ball = dots[i];
if(drawLine){ graphics.moveTo(dot.x, dot.y); }
dot.vx += Math.random() * 0.2 - 0.1;
dot.vy += Math.random() * 0.2 - 0.1;
dot.x += dot.vx;
dot.y += dot.vy;
dot.vx *= friction; //friction = 0.92
dot.vy *= friction;
if(drawLine){ graphics.lineTo(dot.x, dot.y); }
//경계선 나가면 반대편으로
if(dot.x > stage.stageWidth){ dot.x = 0;
}else if(dot.x < 0){ dot.x = stage.stageWidth; }
if(dot.y > stage.stageHeight){ dot.x = 0;
}else if(dot.y < 0){ dot.x = stage.stageHeight; }
}
}
행렬 회전, 기울기 처리 함수
function matrixRotate(){ //회전 처리
angle += .05;
var cos:Number = Math.cos(angle);
var sin:Number = Math.sin(angle);
mov1.transform.matrix =
new Matrix(cos,sin,-sin,cos,mouseX,mouseY);
}
function matrixSkew(){ //마우스에 따라 기울기 변화처리
var skewX:Number = (mouseX - stage.stageWidth / 2) * .01;
var skewY:Number = (mouseY - stage.stageHeight / 2) * .01;
mov2.transform.matrix = new Matrix(1,skewY,skewX,1,
stage.stageWidth/2,stage.stageHeight/2);
}
|