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 & HelpPrograms › Simple Rendering Stops While Program Continues
Page Index Toggle Pages: 1
Simple Rendering Stops While Program Continues? (Read 168 times)
Simple Rendering Stops While Program Continues?
Oct 31st, 2008, 7:12pm
 
Is this possible?

I'm fairly new to visual programming and began with Processing this week, and I'm already stuck on some code that was merely a learning experiment.

The idea is to have Lines drawn from the center point to the edges of the window and then for the colors to rotate around that center point. The program prints correct numbers, but the render doesn't change regardless of smooth or noSmooth (or if I let it sit for a long time, it sometimes changes once to a bit uglier).

So my question is, what am I doing wrong, and is there a way to test for the render running like the print() function does to make sure program is running? Is my hardware just terrible (though when I changed the j*speed to just a mouseX it renders just fine)?

Code:

void setup(){
size (400,250);
}

void draw(){
colorMode(HSB, 360,100,100);
background(0,0,100);
noSmooth();
float x = 0; //end x of each line
float y = 0; //end y of each line
float s = 0; //color of each line
float speed = 10; //speed of color rotation
for (float j = 0; j < 360; j++) {
noStroke();
fill(0,0,100);
rect(0,0,width,height);
for (float i = 0; i < 360; i++) {
float iw1 = map(i, 0, 90, 0, width);
float ih1 = map(i, 270, 360, height, 0);
float iw2 = map(i, 180, 270, width, 0);
float ih2 = map(i, 90, 180, 0, height);
if (i<90) {
x = iw1;
y = 0;
}
else if (i<180){
x = width;
y = ih2;
}
else if (i<270){
x = iw2;
y = height;
}
else {
x = 0;
y = ih1;
}
s = ((i+j*speed) % 360);
stroke(s,70,80);
line((width/2),(height/2),x,y);
}
println(s); //print these just to see if variable are changing.
println(j); //If s is changing, final color rendered should.
}
}



On Build 0148.
Page Index Toggle Pages: 1