Hi i'm actually playing around at work with some examples.
Actually i've end up with this code but i don't understand why it don't work as expected when i create the sketch with screen.width and screen.height size.
When i use a smaller size it seems to work but when i go on a bigger size the background is gray and the smooth() functions doesn't seems to work.
Here's the code.
Sorry it's messy but i'm @work.
Quote:
float r;
float theta;
float theta_vel;
float theta_acc;
int sized=2;
PFont font;
char[] val;
void setup(){
size(screen.width,screen.height);
//size(400,200);
frameRate(60);
background(0);
strokeWeight(1);
smooth();
noCursor();
font=loadFont("CourierNewPSMT-72.vlw");
theta=0.0f;
theta_vel = 0.0f;
theta_acc = 0.001f;
r = 100.0;
//noLoop();
}
void draw(){
//background(0);
textFont(font,12);
text("r :"+r, 10, 15);
//fill(0,20);
//rect(0, 0, 150, 20);
//r = random(50,width);
// Create an alpha blended background
//fill(255, 40);
//rect(0,0,width,height);
// Get a noise value based on xoff and scale it according to the window's width
noiseDetail(8, 0.75);
//float n = r*cos(random(noise(xoff)*width));
//float m = r*sin(random(noise(yoff)*height));
translate(mouseX, mouseY);
rotate(theta);
float n = r * cos(theta);
float m = r * sin(theta);
// With each cycle, increment xoff
//xoff += xincrement;
//yoff += yincrement;
//scale(mouseX/random(126,128));
// Draw the ellipse at the value produced by perlin noise
//fill(random(0,50), random(n), random(m),random(20,255));
//switching two colors according to odd and even seconds
int sec = second();
switch(sec%2) {
case 0:
stroke(180,20);
fill(random(0,2000),random(30,100));
break;
case 1:
stroke(#FFD024,20);
fill(#FFD024,90);
break;
}
float randomsize= random(sized, sized*5);
ellipse(n/2,m/2,randomsize,randomsize);
line(0,0,n/random(16,32),m/random(8,24));
noStroke(); // no stroke for the ellipse
theta_vel += theta_acc;
theta += theta_vel;
//keyboard user interaction
if (key == 's' || key == 'S'){
exit();
}
}
void keyPressed(){
if (key == '+'){
r += 1.0;
}
else if(key == '-') {
r -= 1.0;
}
else if((key >= '0') && (key <= '9')){
println(key);
}
}
void mousePressed() {
if (mouseButton == RIGHT){
background(0);
}
}
void mouseDragged() {
if (mouseButton == LEFT){
redraw();
}
}
Cheers.