pulsating ellipse
in
Programming Questions
•
1 year ago
hey there!,
I just started out programming and need a little help.
i'm trying to pulsate an ellipse between a min. and a max. value.
the sketch i made sort of does what i want it to do except for the minimum size i've set.
i'm probably doing it all wrong, but that's why i came here.
best case scenario:
i would be able to control the speed of the pulse and the min/max values between which it pulsates.
here's the sketch:
int growth=50;
void setup()
{
size(500, 350);
background(127);
stroke(127);
smooth();
}
void draw()
{
fill(0,200,200);
if(mousePressed)
{
ellipse(mouseX, mouseY, growth, growth);
}
growth++;
if(growth<50) {growth=growth*+1;}
if(growth>70) {growth=growth*-1;}
}
thanks in advance!
1