Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

processing draw circle


void setup() 
{
  size(400, 400);
  background(255,255,255);
}

void draw()
{  
  float step=(2*PI)/120;
  int posX = width/2;
  int posY = height/2;
  float radius = 100;
  int xOld=0, yOld=0;
  for(float theta=0;theta<=(2*PI)+step;theta+=step)
  {
    stroke(0,0,255);
    int x = int(radius*sin(theta) + posX);
    int y = int(radius*cos(theta) + posY);
    if(theta>0)
    {
      line(x,y,xOld,yOld);
    }
    xOld = x;
    yOld = y;
  }

}

Source by coders911.org #
 
PREVIOUS NEXT
Tagged: #processing #draw #circle
ADD COMMENT
Topic
Name
1+6 =