In terms of learning process, the most important part I took away from the recitation is to be patient. In recitation exercise, I was unsatisfied with my original work, thinking that it’s too simple and ugly. However, I realized that a successful project has to be done little by little. As for the assignment, it took me a whole week to figure the code out, but I am so glad that I didn’t ask anyone else for help!And I realized that one has to be really good at math for coding.
Interesting functions include:
colorMode(HSB)—can create rainbow-like image, so pretty
mouseClick, pmouseX/pmouseY—I just love interactions
Homework
int r=20; int t=0; int n=0; int min=0; int c=0; void setup(){ size(600,600);} void draw(){ t=t+1; if ((t>=(300*(n)+min)) & (t<(300*(n+1)+min))){ //0<=t<300 r=r+1; } colorMode(HSB); background(255); stroke(t,t+1,255); strokeWeight(30); ellipse(width/2, height/2,r,r); if((t>=(300*(n+1)+min)) & (t<=(300*(n+2)+min))){//300<=t<600 r=r-1; } frameRate(800); println ("time",t,"r",r,"n",n); if(t%600==0){ n=0; t=0; } }
Recitation Exercise
void setup() { size(600, 600); background(255,255,255); } void draw(){ float c; float x=pmouseX; float y=pmouseY; ellipse(x,y,30,30); noStroke(); c = 244; fill(c,c, random(255),100); if(mousePressed){ background(random(255)); } }