Processing – My first sketch

After much procrastination, I finally sat down and actually started to write some code, as opposed to skimming the books that I have brought. I was surprised at how intuitive it is at this basic level….here is one of my first sketches in which you move your mouse around to create the graphics and push a mouse button to restart/ I guess it took about an hour and a half to get this far:

[applet code=”Ben_1_1_4.ClassName” file=”http://metier.co/?attachment_id=780/Ben_1_1_4.jar”]

void setup() {
size(600,600);
background(255);

}
int circlesize = 10;
int circlecolour = 255;

void draw () {
ellipseMode(CENTER);
stroke (0);
fill(mouseY, mouseX, circlecolour);
ellipse(mouseX, mouseY,circlesize,circlesize);

}

void mouseMoved() {
circlesize = circlesize + 2;
if (circlesize > 50) {
circlesize = 10;
}
circlecolour = circlecolour – 2;
if (circlecolour < 1) { circlecolour = 255; } } void mousePressed(){ background(255); }

Leave a comment