Big Bang

It draws multi circles with straight lines.
It draws multi circles with straight lines.
It draws multi circles with straight lines.

About this creative coding work.

This creative coding art work was made with Processing Java mode.
It draws multi circles with straight lines.

It derived from Spiral Mandala.

Processing example code.

// Big Bang
// Processing 3.2.1
// 2017.07.23

import java.util.Random;

/* ---------------------------------------------------------------------- */
class Utils {

  Random obj_random;

  Utils() {
    obj_random = new Random();
  }

  float gaussdist(float pmean, float plimit, float pdevi) {
    /**
       Gaussian distribution
       1.parameters.
       pmean  : mean value
       plimit : max value of abs(deviation)
       ex. plimit >= 0
       pmean = 0.5, plimit = 0.5 -> return value = from 0.0 to 1.0
       pdevi  : standard deviation value
       ex. good value? -> pdevi = plimit / 2
       2.return.
       gaussian distribution
    **/

    if (plimit == 0) {
      return pmean;
    }

    float gauss = (float) obj_random.nextGaussian() * pdevi;
    // not good idea
    if (abs(gauss) > plimit) {
      gauss = pow(plimit, 2) / gauss;
    }

    return pmean + gauss;
    
  }
}

/* ---------------------------------------------------------------------- */
abstract class PshapeElement {

  PShape anElement;
  float elementColor, elementSaturation, elementBright, elementAlpha;
  
  PshapeElement() {
    anElement = pscreateElement();
    elementColor = 0;
    elementSaturation = 0;
    elementBright = 0;
    elementAlpha = 0;
  }

  abstract PShape pscreateElement();

  void setElementFill(float pcolor, float psaturation, float pbright, float palpha) {
    elementColor = pcolor;
    elementSaturation = psaturation;
    elementBright = pbright;
    elementAlpha = palpha;
    resetColor();
  }

  void resetColor() {
    anElement.setStroke(color(elementColor, elementSaturation, elementBright, elementAlpha));
  }

  void changeColor(float scolor) {
    elementColor = scolor;
    resetColor();
  }

  void changeBright(float sbright) {
    elementBright = sbright;
    resetColor();
  }

  void resetSize() {
    anElement.resetMatrix();
  }

  void changeSize(float scaleX, float scaleY) {
    anElement.scale(scaleX, scaleY);
  }

  void rotate(float radX) {
    anElement.rotate(radX);
  }

  void show() {
    shape(anElement);
  }

}

/* ---------------------------------------------------------------------- */
class CircleBrush extends PshapeElement {
  
  CircleBrush() {
    super();
  }

  PShape pscreateElement() {

    stroke(0.0, 0.0, 0.0, 0.0);
    noFill();
    PShape psDp = createShape(LINE, -80.0, -80.0, 80.0, 80.0);
    return psDp;

  }

}

/* ---------------------------------------------------------------------- */

Utils ut;
PshapeElement pCircle;

void setup() {
  size(900, 900);
  colorMode(HSB, 360, 100, 100, 100);
  blendMode(SCREEN);
  strokeWeight(0.00001);
  smooth(8);
  //  noLoop();
  frameRate(1);

  ut = new Utils();  
  pCircle = new CircleBrush();

}

void draw() {

  background(0, 0, 0);
  drawPixels();
  saveFrame("frames/####.png");
  exit();
  
}

void canvasRotation(float degrees) {

  translate(width/2, height/2);
  rotate(radians(degrees));
  translate(-width/2 + random(0.5), -height/2 + random(0.5));

}

void drawPixels() {

  float baseColor = random(150.0, 300.0);

  for (int divCnt = 1; divCnt <= 8; ++divCnt) { 

    int drawCntMax = round(ut.gaussdist(180.0, 150.0, 50.0));
    for (int drawCnt = 0; drawCnt < drawCntMax; ++drawCnt) {

      canvasRotation(divCnt * ut.gaussdist(10.0, 3.0, 2.0));
      float valHue = (baseColor + ut.gaussdist(30.0, 30.0, 20.0)) % 360.0;
      float valBri = map(random(1.0), 0.0, 1.0, 1.0, 100.0);

      float idxDiv = width / divCnt;
      for (float idxW = 0.0; idxW < width + idxDiv; idxW += idxDiv) {
        for (float idxH = 0.0; idxH < height + idxDiv; idxH += idxDiv) {
          
          float valSat = map(random(1.0), 0.0, 1.0, 30.0, 100.0);
          float valAlp = map(random(1.0), 0.0, 1.0, 40.0, 100.0);
          float valSize = map(random(1.0), 0.0, 1.0, 0.5, 2.0);

          pushMatrix();
          translate(idxW, idxH);
          pCircle.resetSize();
          pCircle.changeSize(valSize, valSize);
          pCircle.setElementFill(valHue, valSat, valBri, valAlp);
          pCircle.show();
          popMatrix();
        
        }
      }
    }
  }
}

/*
Copyright (C) 2017- deconbatch

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see 
*/




Next Post Previous Post
No Comment
Add Comment
comment url