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.
Page Index Toggle Pages: 1
HELP! (Read 1039 times)
HELP!
Nov 24th, 2009, 8:22am
 
help!  I need 3 objects that change color(RGB) randomly every 20 sec and move quickly on the screen.

Help help... someone can you help me... Cry Cry
how can I add time
Thanks, Nathalia
Re: HELP! time-speed of moving....
Reply #1 - Nov 24th, 2009, 8:35am
 
Hi,
Code:
float lastTimeCheck = 0.0;
float interval = 1000.0;

void setup() {
 size(320, 240);
 smooth();
 noStroke();
}

void draw() {
 background(50);
 
 if (millis() > lastTimeCheck + interval) {
   lastTimeCheck = millis();
   changeColor();
 }
 
 ellipse(100, 100, 50, 50);
}

void changeColor() {
 fill((int)random(255), (int)random(255), (int)random(255));
 
}


Hope that helps
rS

moving object
Reply #2 - Nov 24th, 2009, 8:51am
 
FANTASTIC!
THANKS A LOT! perfect-
Now, I will have to work on making them move quickly or slowly and be able to spiral
any suggestions....
nathalia
Re: HELP!
Reply #3 - Nov 24th, 2009, 9:00am
 
For the motion, check out the Nature of Code by Daniel Shiffman

http://www.shiffman.net/teaching/nature/

Lots of sample code

Cheers
rS
Re: HELP!
Reply #4 - Nov 24th, 2009, 11:55am
 
yes, and do your homework like you are supposed to do, dont ask poor  guys to help you Wink
Re: HELP!
Reply #5 - Nov 24th, 2009, 1:52pm
 
+1 on that
Page Index Toggle Pages: 1