practicing Array and Class
drawCircle circle;
float[] ra = new float[2];
void setup(){
 size(400, 400);
}
void draw(){
 background(125);
 randomProcess();
 circle = new drawCircle(200, 200, ra[0], ra[1]);
 circle.drawC();
}
void randomProcess(){
 ra[0]=random(100, 200);
 ra[1]=random(150, 180);
}
class drawCircle{
 int x;
 int y;
 float vx;
 float hy;
 drawCircle(int locationX, int locationY, float verticalScale, float horizonalScale){
   x = locationX;
   y = locationY;
   vx = verticalScale;
   hy = horizonalScale;
 }
 void drawC(){
   ellipse(x, y, vx, hy);
 }
}
0 件のコメント:
コメントを投稿