Talk:IAT 800 Weekly Study Groups
Jump to navigation
Jump to search
W1-01
int x = 0; void setup() { size(320, 320); background(0); stroke(255); strokeWeight(3); } void draw() { line(x, height/2, x+5, height/2); // x = x + 1; if (x > width) { x = 0; background(0); } }
W1-02
float x = 0; void setup() { size(320, 320); framerate(5); background(0); stroke(255); strokeWeight(3); } void draw() { line(x, height/2, x+5, height/2); // x = x + (width-x)*0.1; if (x > width-5) { x = 0; background(0); } }
W1-03
float x = 0; void setup() { size(320, 320); framerate(20); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); line(x, height/2, x+(mouseX-x)*0.1, height/2); // x = x + (mouseX-x)*0.1; }
W1-04
float x = 0; float y = 0; void setup() { size(320, 320); framerate(20); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); line(x, y, x+(mouseX-x)*0.1, y+(mouseY-y)*0.1); // x = x + (mouseX-x)*0.1; y = y + (mouseY-y)*0.1; }
W1-06
float x = 0; float y = 0; void setup() { size(320, 320); framerate(20); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); line(x, y, x+(mouseX-x)*0.1, y+(mouseY-y)*0.1); // x = x + (mouseX-x)*0.1; y = y + (mouseY-y)*0.1; if ( dist(x, y, mouseX, mouseY) < 10) { x = random(width); y = random(height); } }
W1-07
float x0 = 0; float y0 = 0; float x1 = 0; float y1 = 0; float x2 = 0; float y2 = 0; void setup() { size(320, 320); framerate(20); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); line(x0, y0, x0+(mouseX-x0)*0.1, y0+(mouseY-y0)*0.1); line(x1, y1, x1+(mouseX-x1)*0.1, y1+(mouseY-y1)*0.1); line(x2, y2, x2+(mouseX-x2)*0.1, y2+(mouseY-y2)*0.1); // x0 = x0 + (mouseX-x0)*0.1; y0 = y0 + (mouseY-y0)*0.1; x1 = x1 + (mouseX-x1)*0.1; y1 = y1 + (mouseY-y1)*0.1; x2 = x2 + (mouseX-x2)*0.1; y2 = y2 + (mouseY-y2)*0.1; if ( dist(x0, y0, mouseX, mouseY) < 10 ) { x0 = random(width); y0 = random(height); } if ( dist(x1, y1, mouseX, mouseY) < 10 ) { x1 = random(width); y1 = random(height); } if ( dist(x2, y2, mouseX, mouseY) < 10 ) { x2 = random(width); y2 = random(height); } }
W1-08
cLine aLine = new cLine(); void setup() { size(320, 320); framerate(20); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); aLine.drawMe(); } class cLine { float x = 0; float y = 0; cLine() { } void drawMe() { line(x, y, x+(mouseX-x)*0.1, y+(mouseY-y)*0.1); // x = x + (mouseX-x)*0.1; y = y + (mouseY-y)*0.1; if ( dist(x, y, mouseX, mouseY) < 10) { x = random(width); y = random(height); } } }
W1-09
cLine[] Lines = new cLine[3]; void setup() { size(320, 320); framerate(20); background(0); stroke(255); strokeWeight(3); Lines[0] = new cLine(); Lines[1] = new cLine(); Lines[2] = new cLine(); } void draw() { background(0); for (int i=0; i<Lines.length; i++) { Lines[i].drawMe(); } } class cLine { float x = 0; float y = 0; cLine() { } void drawMe() { line(x, y, x+(mouseX-x)*0.1, y+(mouseY-y)*0.1); // x = x + (mouseX-x)*0.1; y = y + (mouseY-y)*0.1; if ( dist(x, y, mouseX, mouseY) < 10) { x = random(width); y = random(height); } } }
W1-10
float x = 0; void setup() { size(320, 320); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); // x = second(); x = width * x / 60; line(x, height/2, x+5, height/2); }
W1-11
int nDegree = 0; int nRadius = 100; void setup() { size(320, 320); framerate(30); background(0); stroke(255); strokeWeight(3); } void draw() { background(0); pushMatrix(); translate(width*0.5, height*0.5); ellipse(0, 0, nRadius*sin(radians(nDegree)), nRadius*sin(radians(nDegree))); popMatrix(); nDegree = nDegree+1; if (nDegree>=360) { nDegree = 0; } }