LoginSignup
0

More than 5 years have passed since last update.

processingでellipseを使わないで円を書く

Posted at
sketch.pde
size(500,300);
background(255);
strokeWeight(5);
smooth();

float radius = 100;
int centX = 250;
int centY = 150;

stroke(0,30);
noFill();
ellipse(centX,centY,radius*2, radius*2);

stroke(220,50,70);
radius = 10;
float x,y;
float lastX = -999;
float lastY = -999;
for (float ang = 0; ang <= 1440; ang += 5){
    radius += 0.5;
    float rad = radians(ang);
    x = centX + (radius*cos(rad));
    y = centY + (radius*sin(rad));
    if (lastX > -999){
        line(x,y,lastX,lastY);
    }
    lastX = x;
    lastY = y;
    lastY = y;
}

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0