We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › How to Increase An Arc From 0 To Fill Circle
Page Index Toggle Pages: 1
How to Increase An Arc From 0 To Fill Circle (Read 456 times)
How to Increase An Arc From 0 To Fill Circle
Dec 14th, 2009, 9:12pm
 
Hi I was wondering if anyone is able to help me work out how to make an arc start from 0 and increase in width/height to fill a circle.

I'm trying to use a for loop at the moment to gradually increase but I'm unsure which parameters to increase. I've tried the width and height of the arc and also now tried the start and end angle of the arc but haven't had any results.

Thanks so much for any help.

Here's my code:

float arcW=0;
float arcH=0;
float angleTurn=0;
float angleTurnH=0;

float deg = 1;
float rad = radians(deg);
//println(deg + " degrees is " + rad + " radians");


void setup()
{
 size(500,500);
 background(210);
 smooth();
 noLoop();
 
}

void draw()
{
 strokeWeight(18);
 stroke(255,14);
 fill(255,24);
 ellipse(250,250,15,15);
 //globe();
 arcRotate();
 
/*if (mousePressed == true)    //had this in draw before for other parameters of arc
 {
   if (mouseButton == LEFT)
   {
 for(arcW=0;arcW<=150;arcW=arcW+10);
 {
   for(arcH=0;arcH<=150;arcH=arcH+10);
   {
     fill(100);
     arc(250, 100, arcW, arcH, PI/2, TWO_PI-PI/2);//TWO_PI);
   }
 }
   }
 }*/
}

 
void globe()
{
 stroke(255,80);
 strokeWeight(2);
 fill(255,80);
 ellipse(250,100,150,150);
}

void arcRotate()
{
 for(angleTurn=0;angleTurn<=TWO_PI/2;angleTurn=angleTurn+rad);
 {
   for(angleTurnH=0;angleTurnH<=TWO_PI/2;angleTurnH=angleTurnH+rad);
   {
     fill(0);
     arc(250, 100, 150, 150, angleTurn, angleTurnH);//TWO_PI);
 }
 }
 
}
Re: How to Increase An Arc From 0 To Fill Circle
Reply #1 - Dec 14th, 2009, 11:30pm
 
Like so?

Code:


void setup()
{
size(500,500);
background(210);
smooth();
}

void draw()
{

background(0);
stroke(255,14);
fill(255,24);
ellipse(250,250,150,150);
fill(255);
arc(250,250,150,150,0, (millis()/1000.0)%TWO_PI);
}

Page Index Toggle Pages: 1