This has a hot pink background and 2 stationary squares, one blue square in the upper left corner, and a slightly smaller black square, overlapping the blue square.
void setup() {
size(400, 400);
background(197,22,187);
}
void draw() {
background(197,22,187);
float m = millis();
fill(m % 194,46,182);
rect(mouseX, mouseY, 50, 50);
float n = millis();
fill(n % 238,231,41);
rect(30, 30, mouseX, mouseY);
float o = millis();
fill(o % 0);
rect(30, 30, 30, 30);
PFont fontA = loadFont("Ziggurat-HTF-Black-32.vlw");
textFont(fontA, 30);
int x = second();
fill(187,193,236);
text("Dawn", x, 60);
fill(230,203,25);
text("Morning", x, 95);
fill(244,113,8);
text("Afternoon", x, 130);
fill(112,19,228);
text("Dusk", x, 165);
fill(4,16,110);
text("Evening", x, 200);}
----------------------------------------------
This is a small white rectangle with a thin black stroke in the center of the page.
void setup() {
String bodyCountText[] = loadStrings("http://www.iraqbodycount.org/counters/min.txt");
println(bodyCountText[0]);
int s=int(bodyCountText[0]);
s=s / 10000 ;
println(s) ;
rect(20,20,40,s);
//the 20,20 are integers}
void draw() {}
----------------------------------------
ELSE STATEMENTS
This is just an example of a if /else statement:
void draw(){
if (second() <30){
println("hi");
}else{
println("bye");}}
//instead of printline you will us text and fill..etc
-----------------------------------
Sunday, April 20, 2008
Saturday, April 5, 2008
Processing #3 post
Here is what you need to type in and some comments explaining what they are.
// will comment out a single line of code
/* will comment out a whole paragraph of code*/
-----------------------------------------------
This is a red background with white line that you control and pull with mouse.
void setup() {
// comment: this stuff only runs one time
size(200, 200); // the size of the applet
smooth(); // make it anti-aliased
background(255, 0, 0); // make the background red color
stroke(255); // set the fill color to white
}
void draw() {
// this is stuff you want to loop all the time
background(255, 0, 0);
// make the background red color - what if I take this out?
line(0,0,mouseX,mouseY);
}
---------------------------
Variables
- mouseX and mouseY are a sort of a variable....
- You can make line art, word art, shape art.
-----------------------------
This is a white square that starts in the upper left corner and moves diagonally to the bottom right corner; as it travels it leaves a black trail. Does not repeat.
int myint = 0 ;
void setup() {
size (400,400) ;}
void draw() {
rect(myint,myint,50,50);
myint = myint + 1;}
------------------------------
This is a black line that starts in the upper left corner and moves diagonally to the bottom right corner; If you move the mouse onto the line a white square will form and reshape itself as you move the mouse around. As it travels it leaves a black trail. Does not repeat.
int myint = 0 ;
void setup() {
size (400,400) ;
}
void draw() {
rect(myint,myint,mouseX,mouseY);
myint = myint + 1;
}
---------------------------
This has a black background in the middle at the top, a white square drops down to the bottom of the page and disappears again. Does not repeat.
int myint = 0 ;
void setup() {
size (400,400) ; }
void draw() {
background(0,0,0);
rect(100,myint,50,50);
myint = myint + 2;
println(myint); }
-------------------------------------
This is a white square that starts in the upper left corner and moves diagonally to the bottom right corner; as it travels it leaves a black trail. It moves to Seconds and after a minute it repeats.
//time process: clock
void setup() {
size (200,200) ; }
void draw() {
rect(second(), second(), 20,20);
}
----------------------------
// will comment out a single line of code
/* will comment out a whole paragraph of code*/
-----------------------------------------------
This is a red background with white line that you control and pull with mouse.
void setup() {
// comment: this stuff only runs one time
size(200, 200); // the size of the applet
smooth(); // make it anti-aliased
background(255, 0, 0); // make the background red color
stroke(255); // set the fill color to white
}
void draw() {
// this is stuff you want to loop all the time
background(255, 0, 0);
// make the background red color - what if I take this out?
line(0,0,mouseX,mouseY);
}
---------------------------
Variables
- mouseX and mouseY are a sort of a variable....
- You can make line art, word art, shape art.
-----------------------------
This is a white square that starts in the upper left corner and moves diagonally to the bottom right corner; as it travels it leaves a black trail. Does not repeat.
int myint = 0 ;
void setup() {
size (400,400) ;}
void draw() {
rect(myint,myint,50,50);
myint = myint + 1;}
------------------------------
This is a black line that starts in the upper left corner and moves diagonally to the bottom right corner; If you move the mouse onto the line a white square will form and reshape itself as you move the mouse around. As it travels it leaves a black trail. Does not repeat.
int myint = 0 ;
void setup() {
size (400,400) ;
}
void draw() {
rect(myint,myint,mouseX,mouseY);
myint = myint + 1;
}
---------------------------
This has a black background in the middle at the top, a white square drops down to the bottom of the page and disappears again. Does not repeat.
int myint = 0 ;
void setup() {
size (400,400) ; }
void draw() {
background(0,0,0);
rect(100,myint,50,50);
myint = myint + 2;
println(myint); }
-------------------------------------
This is a white square that starts in the upper left corner and moves diagonally to the bottom right corner; as it travels it leaves a black trail. It moves to Seconds and after a minute it repeats.
//time process: clock
void setup() {
size (200,200) ; }
void draw() {
rect(second(), second(), 20,20);
}
----------------------------
Wednesday, April 2, 2008
Processing #2 post
//copy and paste into Processing and run it.
//This code is a time process (Clock)
void setup() {
size (200,200) ; }
void draw()
{
rect(mouseX, mouseY, second(), second() );
background(0,0,0);
int s = second(); // Values from 0 - 59
int m = minute(); // Values from 0 - 59
int h = hour(); // Values from 0 - 23
ellipse(s, 60, s, 60);
rect(m, 10, m,60);
rect(h, 60, h, 100);
}
//This code is a time process (Clock)
void setup() {
size (200,200) ; }
void draw()
{
rect(mouseX, mouseY, second(), second() );
background(0,0,0);
int s = second(); // Values from 0 - 59
int m = minute(); // Values from 0 - 59
int h = hour(); // Values from 0 - 23
ellipse(s, 60, s, 60);
rect(m, 10, m,60);
rect(h, 60, h, 100);
}
Subscribe to:
Posts (Atom)