Advertisement
xeromino

PythSine

Oct 26th, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. float x, y;
  2. float sz, msz, big_sz;
  3. float theta;
  4. color bg = #334D5C;
  5. color sqcol = #EFC94C;
  6. color sqstr = #DF5A49;
  7.  
  8. void setup() {
  9.   size(500, 500);
  10.   background(255);
  11.   stroke(0);
  12.   sz = 100;
  13.   big_sz = 1.4*sz;
  14.   x = width/2;
  15.   y = height/2;
  16.   rectMode(CENTER);
  17. }
  18.  
  19. void draw() {
  20.   background(bg);
  21.   translate(x, y);
  22.   msz = map(sin(theta), -1, 1, sz, sz*2);
  23.  
  24.   fill(sqcol);
  25.   strokeWeight(25);
  26.   stroke(sqstr);
  27.  
  28.   rect(0, 0, msz, msz, 20);
  29.  
  30.   for (int i=0; i<4; i++)
  31.   {
  32.     pushMatrix();
  33.     rotate(i*radians(90));
  34.     rect(msz/2+big_sz/2, -msz/2+big_sz/2, big_sz-msz/2+sz/2, big_sz-msz/2+sz/2, 25);
  35.     popMatrix();
  36.   }
  37.  
  38.   theta += 0.0523;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement