반응형


rect(0, 0, 50, 50);   //White rectangle
pushMatrix();
//기준점으로 부터 30,20 만큼 이동하여 그려준다
translate(30, 20);
fill(0); 
rect(0, 0, 50, 50);   //Black rectangle
//다시 원점으로 부터 거리 계산하여 그려준다
popMatrix();
fill(102); 
rect(15, 10, 50, 50); //Gray rectangle

//푸시와 팝매트릭스는 결국 짝을 이루어야 사용가능
//아래는 푸시와 팝 매트릭스 설명
//Pops the current transformation matrix off the matrix stack.
//Understanding pushing and popping requires understanding the concept
//of a matrix stack.
//The pushMatrix() function saves the current coordinate system to the stack
//and popMatrix() restores the prior coordinate system. pushMatrix()
//and popMatrix() are used in conjuction with the other transformation
//methods and may be embedded to control the scope of the transformations

주석을 지웠다 써가며 테스트 해보는것이 도움이 될듯하다

반응형

+ Recent posts