Author Archives: steve
Count up, Count down
This is a really simple bit of code that counts to 255, and back to 0 over and over again.
int count; // how many cycles have gone through int direction; //direction of the cycle, up or down void setup() { size(200,200); } void draw() { background(count); if (count >= 255) { direction = -1; } else if (count <= 0) { direction = 1; } count = count + 1*direction; println("count: " + count); } //end
See it work: Continue reading
Posting code on your site
You may have noticed that if you have greater than (>) and less than symbols (<) it can kind of screw up the way your code displays. Here’s some options.
You can also use these to embed code into your page: