130 likes | 211 Views
midterm Exam review. TECH 3601. Statistics. Average: 75.45 Highest: 95 >90: 4 >80: 6 >70: 6 >60: 3 <60: 3. RGB Color & Transparency. Each color has a value between 0 and 255 colorMode (RGB,100 ); colorMode (RGB,255,100,100) Transparency // 50% opacity fill(255,0,0,127 );
E N D
midterm Exam review TECH 3601
Statistics • Average: 75.45 • Highest: 95 • >90: 4 • >80: 6 • >70: 6 • >60: 3 • <60: 3
RGB Color & Transparency • Each color has a value between 0 and 255 • colorMode(RGB,100); • colorMode(RGB,255,100,100) • Transparency • // 50% opacity • fill(255,0,0,127); • // 25% opacity • fill(255,0,0,63); • rect(0,150,200,40);
Q2-Q4 • size(screen.width, screen.height); • line(pmouseX, pmouseY, mouseX, mouseY); • if (mouseX>x1 && mouseY>y1 && mouseX<x2 && mouseY<y2)
Q5(1) • line(width/2, height/2, width/2, 0); • line(width/2, height/2, 0, height); • line(width/2, height/2, width, height);
Q5(2) • fill(0); • rect(0, 0, width/2, height/2); • fill(150); • rect(width/2, height/2, width/2, height/2);
Q6(1) • int y = 25; • int speed = 1; • void setup() { • size(200,200); • } • void draw() { • background(255); • fill(175); • ellipse(width/2, y, 50, 50); • y = y + speed; • }
Q6(2) (3) • if (y > height – 25) { • y = height – 25; • } • y = constrain(y, 25, height-25);
Q6(4) • if (y > height – 25 || y < 25) { • speed = speed * -1; • }
Q7(1) • void setup() { • size(200,200); • } • void draw() { • background(255); • fill(175); • ellipse(mouseX, mouseY, 50, 50); • }
Q7(3) • void setup() { • size(200,200); • background(255); • } • void draw() { • if (mousePressed) { • fill(0); • } • else{ • fill(255); • } • ellipse(mouseX, mouseY, 50, 50); • }
Q7(4) • void setup() { • size(200,200); • background(255); • } • void draw() { • } • void mousePressed() { • fill(175); • ellipse(mouseX, mouseY, 50, 50); • }
Q8 • void setup() { • size(200,200); • } • void draw() { • for (inti = 0; i < width; i++) { • stroke(255-i); • line(i, 0, i, height); • } • }