Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying my hand at Processing, the "Logo" for grown-ups
#1
This processing.
   

Code isn't too complicated
Code:
[align=left]float startAngle=0;

void setup() {
  size(800,800);
  colorMode(HSB,360,100,100);
}

void drawSquare(float radius,float angle,float size) {
    float squareX=width/2+radius*cos(angle);
    float squareY=height/2+radius*sin(angle);
    pushMatrix();
    translate(squareX,squareY);
    rotate(angle+radians(5)); // Compensate "slope"of log spiral
    rect(0,0,size,size,size/8);
    popMatrix();
}

void draw() {
  noStroke();
  background(255);
  float radius=height/2-50.;
  float size=radius/10;
  float squareAngle=startAngle;
  float shrink=.9975;
  float shiftAngle=7;
  float hue=360;
  float brightness=100;
  while (radius > 2) {
    fill(hue,80,brightness);
    drawSquare(radius,radians(squareAngle),size);
    radius*=shrink;
    size*=shrink;
    squareAngle+=shiftAngle;
    hue*=shrink;
    brightness*=shrink;
  }  
  startAngle-=.5; // For animation
}
Reply


Messages In This Thread
Trying my hand at Processing, the "Logo" for grown-ups - by Ofnuts - 06-22-2024, 12:32 PM

Forum Jump: