|
Author |
Topic: can' t make the circle smaller (Read 238 times) |
|
kemo
|
can' t make the circle smaller
« on: Sep 23rd, 2003, 4:28pm » |
|
If i run this code the circle will increase in size, but it won' t decrease in size. But if you look in the println box you'll see that it decreases. Can somebody help me. void setup() { size(400,400); background(304,102,67); noStroke(); ellipseMode(CENTER_DIAMETER); } boolean circle_big = false; boolean groei = true; float a=1.0; int x; int y; void loop() { x=width/2; y=height/2; if(groei == true){ a=a*1.02; ellipse(x,y,a,a); if(a>300) { groei = false; } } else { a=a*0.98; ellipse(x,y,a,a); print(" a = " + a); } }
|
|
|
|
mKoser
|
Re: can' t make the circle smaller
« Reply #1 on: Sep 23rd, 2003, 4:59pm » |
|
what version are you using? i just tested your code on 0058 and 0059 and they both work just fine... BUT ...in case you are using 0060, you have hit some of the API changes! in the latest release (0060) background has changed. Before it set the background color - but now, you have to call it manually every time you wish for your drawing to be erased/refreshed... The reason you didn't see the circle growing smaller was that you were drawing smaller white circle on top of larger white circles... it did happen, you just couldn't see it. i've added a call to background(304,102,67) in the beginning of every loop to enable refreshing of your canvas! Code: void setup(){ size(400,400); background(304,102,67); noStroke(); ellipseMode(CENTER_DIAMETER); } boolean circle_big = false; boolean groei = true; float a = 1.0; int x; int y; void loop() { background(304,102,67); // this line was added x=width/2; y=height/2; if(groei == true){ a=a*1.02; ellipse(x,y,a,a); if(a>300) { groei = false; } } else { a=a*0.98; ellipse(x,y,a,a); } } |
| more reference on this: http://www.proce55ing.net/reference/background_.html + mikkel
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
kemo
|
Re: can' t make the circle smaller
« Reply #2 on: Sep 23rd, 2003, 7:15pm » |
|
I am using version 6.0. Thanks for your help.. i'm gonna check the reference
|
« Last Edit: Sep 23rd, 2003, 7:23pm by kemo » |
|
|
|
|
|