We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey, I want a circle to grow per second and reach a limit. I don't want to set the framrate down, because it seems to affect the mousePressed section, which I also want to use. How can I make the circle grow step by step and then reset the count variable? Maybe I messed up a little..
int startTime;
float a=30;
float count;
boolean start=false;
void setup()
{
size(800,800);
background(0);
startTime=millis()/1000;
}
void draw()
{
println(count);
if(start)
{
count=millis()/1000 - startTime;
a=a+count*10;
}
if(a>=290);
{
start=false;
//startTime=millis()/1000;
}
ellipse(width/2,height/2,a,a);
// println(a);
}
void mousePressed()
{
start=true;
}
Answers
Edit your post and format your code selecting it and hitting ctrl+o. Also make sure there is an empty line above and below your code.
Kf
aah thanks a lot
When do you want to reset your count variable? After the circle reaches certain size?
CHECK you line 21... bug bug bug
Kf
thank you soooo much. can you also explain me, how to resest the radius with a second click instead of a key after the endradius is reached?
First click stops. Second click reset radius and restarts the effect.
void mousePressed() { start=!start;
if(start==true) rad=initradius; }
Kf