Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Proga 0706

1,005 views

Published on

  • Be the first to comment

Proga 0706

  1. 1. /* time01.pde*/ Clock myClock = new Clock(); void setup() { colorMode(HSB, 360, 100, 100, 100); size(600,300); stroke(0); } void draw() { myClock.getTime(); myClock.display(); }
  2. 2. /* Clock.pde */ class Clock { int s, m, h; int lastSecond = 0; void getTime(){ s = second(); m = minute(); h = hour()%12; } void display(){ if(s != lastSecond){ background(0); fill(200,100,50); for(int i = 0; i < s; i++){ float rectWidth = width/60; float pos_s = rectWidth*i; rect(pos_s, 0, rectWidth, height/3); }
  3. 3. for(int i = 0; i < m; i++){ float rectWidth = width/60; float pos_m = rectWidth*i; rect(pos_m, height/3, rectWidth, height/3); } for(int i = 0; i < h; i++){ float rectWidth = width/24; float pos_h = rectWidth * i; rect(pos_h,height/3*2,rectWidth,height/3); } lastSecond = s; } } }
  4. 4. /* time02.pde*/ Clock myClock = new Clock(); void setup() { size(800,200); frameRate(30); noStroke(); colorMode(HSB, 360, 100, 100, 100); } void draw() { myClock.getTime(); myClock.display(); }
  5. 5. class Clock { float ms, s, m, h; void getTime(){ ms = millis()%1000; s = second(); m = minute(); h = hour(); } void display(){ background(0); fill(200, 100, 100*(ms/1000)); rect(width/4*3,0,width/4,height); fill(200, 100, 100*(s/60)); rect(width/4*2,0,width/4,height); fill(200, 100, 100*(m/60)); rect(width/4,0,width/4,height); fill(200, 100, 100*(h/24)); rect(0,0,width/4,height); } }
  6. 6. /* time03.pde*/ Clock myClock = new Clock(); void setup() { size(800,200); frameRate(30); noStroke(); colorMode(HSB, 360, 100, 100, 100); } void draw() { myClock.getTime(); myClock.display(); }
  7. 7. class Clock { float ms, s, m, h; void getTime(){ ms = millis()%1000; s = second(); m = minute(); h = hour()%12; } void display(){ fill(360*(ms/1000),50, 100); rect(width/4*3,0,width/4,height); fill(360*(s/60), 50, 100); rect(width/4*2,0,width/4,height); fill(360*(m/60), 50, 100); rect(width/4,0,width/4,height); fill(360*(h/12), 50, 100); rect(0,0,width/4,height); } }
  8. 8. /* time04.pde */ Clock myClock = new Clock(); PFont font; void setup() { font = loadFont("clock.vlw"); textFont(font); colorMode(HSB, 360, 100, 100, 100); size(400,400); frameRate(30); smooth(); noStroke(); background(0); } void draw() { myClock.getTime(); myClock.display(); }
  9. 9. /* time04.pde */ Clock myClock = new Clock(); PFont font; void setup() { font = loadFont("clock.vlw"); textFont(font); colorMode(HSB, 360, 100, 100, 100); size(400,400); frameRate(30); smooth(); noStroke(); background(0); } void draw() { myClock.getTime(); myClock.display(); }
  10. 10. class Clock { int s, m, h; int lastSecond=0; void getTime(){ s = second(); m = minute(); h = hour()%12; } void display(){ if(lastSecond != s){ textAlign(CENTER); fill(0,0,0,20); rect(0, 0, width, height); fill(0,0,100,100); String t = nf(s,2) + "n" + nf(m, 2)+ "n" + nf(h, 2); pushMatrix(); translate(width/2, height/2); rotate(radians(6.0*s)); text(t, 0, -height/2.5); popMatrix(); lastSecond = s; } } }
  11. 11. /* time05.pde */ Clock myClock = new Clock(); PFont font; void setup() { font = loadFont("clock.vlw"); textFont(font); colorMode(HSB, 360, 100, 100, 100); size(400,400); frameRate(30); smooth(); noStroke(); } void draw() { myClock.getTime(); myClock.display(); }
  12. 12. class Clock { int s, m, h; int lastSecond=0; void getTime(){ s = second(); m = minute(); h = hour()%12; } void display(){ if(lastSecond != s){ background(0,0,100); translate(width/2, height/2); // fill(0,100,100,30); String ts = nf(s,2); pushMatrix(); rotate(radians(6.0*s)); textAlign(CENTER); text(ts, 0, 40); popMatrix();
  13. 13. // fill(120,100,100,30); String tm = nf(m,2); pushMatrix(); rotate(radians(6.0*m)); textAlign(CENTER); text(tm, 0, 40); popMatrix(); // fill(240,100,100,30); String th = nf(h,2); pushMatrix(); rotate(radians(30*h)); textAlign(CENTER); text(th, 0, 40); popMatrix(); lastSecond = s; } } }
  14. 14. /* time06.pde */ Clock myClock = new Clock(); void setup() { colorMode(HSB, 360, 100, 100, 100); size(600,400); frameRate(30); smooth(); noStroke(); } void draw() { myClock.getTime(); myClock.display(); }
  15. 15. class Clock { int s, m, h; int lastSecond=0; void getTime(){ s = second(); m = minute(); h = hour()%12; } void display(){ if(lastSecond != s){ background(0); String bs = nf(int(binary(s)), 6); String bm = nf(int(binary(m)), 6); String bh = nf(int(binary(h)), 6); float radius = width/12; for(int i = 0; i < 6; i++){ if(bs.charAt(i) == '1'){ fill(0, 50, 50);
  16. 16. } else { fill(0, 0, 20); } float locX = width/7.0*(i+1); float locY = height/4.0; ellipse(locX, locY, radius, radius); } for(int i = 0; i < 6; i++){ if(bm.charAt(i) == '1'){ fill(0, 50, 50); } else { fill(0, 0, 20); } float locX = width/7.0*(i+1); float locY = height/4.0*2; ellipse(locX, locY, radius, radius); } for(int i = 0; i < 6; i++){ if(bh.charAt(i) == '1'){ fill(0, 50, 50);
  17. 17. } else { fill(0, 0, 20); } float locX = width/7.0*(i+1); float locY = height/4.0*3; ellipse(locX, locY, radius, radius); } lastSecond = s; } } }
  18. 18. /* time07.pde */ Clock myClock; void setup() { colorMode(HSB, 360, 100, 100, 100); size(400,400); frameRate(30); smooth(); myClock = new Clock(); } void draw() { myClock.getTime(); myClock.display(); }
  19. 19. /* Clock.pde */ class Clock { float s, m, h; float lastSecond=0; Ring[] rings; int numRings = 60; int currentRing = 0; Clock(){ rings = new Ring[numRings]; for(int i = 0; i < numRings; i++){ rings[i] = new Ring(); } } void getTime(){ s = second(); m = minute(); h = hour()%12; }
  20. 20. void display(){ background(0); for(int i = 0; i < numRings; i++){ rings[i].grow(); rings[i].display(); } if(lastSecond != s){ float r = width/4.0; float posX = r * cos(radians(s*6.0)) + width/2; float posY = r * sin(radians(s*6.0)) + height/2; rings[int(s)].start(posX, posY); lastSecond = s; } } }
  21. 21. /* Ring.pde */ class Ring { float x, y, diameter; boolean on = false; color col; void start(float _x, float _y){ x = _x; y = _y; on = true; diameter = 1; col = color(random(360), 50, 100, 50); } void grow() { if(on) { diameter+=0.1; if(diameter > width){ on = false; } } }
  22. 22. void display(){ if(on){ noFill(); stroke(col); strokeWeight(2); ellipse(x, y, diameter, diameter); } } }

×