Beyond the Universe.

It's a beautiful  multi-layered vector field.
Beautiful  multi-layered vector field.

Description of this generative art.

A generative art made with Processing on Java programming language.

I tried to draw a vector field without noise.
It was a little bit difficult but atan2 made it work.
I putted random value (vfldFactorX, vfldFactorY) for adding a variety of shapes.

This code does not display any images on the screen but generates image files in frames directory.

Processing example code (Java).

Please feel free to use this example code.
To see other works based on my code is my pleasure. And my honor.




/**
 * Beyond The Universe.
 * draw vector field with no noise.
 * 
 * @author @deconbatch
 * @version 0.1
 * Processing 3.2.1
 * created 2019.10.31
 */

void setup() {

  size(980, 980);
  colorMode(HSB, 360, 100, 100, 100);
  rectMode(CENTER);
  smooth();
  noStroke();
  noLoop();

}

void draw() {

  int   frmMax  = 3; // draw 3 images
  float initHue = random(360.0);
  translate(width * 0.5, height * 0.5);

  for (int frmCnt = 1; frmCnt <= frmMax; frmCnt++) {
    float frmRatio    = map(frmCnt, 1, frmMax, 1.0, 0.0);
    int   vfldMax     = floor(map(frmRatio * frmRatio, 0.0, 1.0, 3.0, 30.0)); // draw vfldMax count vector fields
    float vfldFactorX = random(1.0);
    float vfldFactorY = random(1.0);
    initHue += 90.0;

    background((initHue + 180.0) % 360.0, 5.0, 90.0, 100);
    blendMode(DIFFERENCE);

    pushMatrix();
    rotate(random(TWO_PI));
    for (int vfldCnt = 1; vfldCnt <= vfldMax; vfldCnt++) {
      float vfldRatio = map(vfldCnt, 1, vfldMax, 0.0, 1.0);
      int   plotMax   = floor(500 - vfldRatio * 400);
      float plotDiv   = 0.002 + vfldRatio * 0.001;
      float plotMult  = 1.0 + vfldRatio * map(frmRatio, 0.0, 1.0, 2.0, 15.0);
      float initDiv   = 0.02;
      float baseSiz   = map(frmRatio, 0.0, 1.0, 1.2, 0.8) - vfldRatio * 0.5;
      float baseHue   = initHue + vfldRatio * 30.0;
      float baseBri   = 1.0 + vfldRatio * 2.0;

      for (float xInit = -0.5; xInit <= 0.5; xInit += initDiv) {
        for (float yInit = -0.5; yInit <= 0.5; yInit += initDiv) {
          float xCurr = xInit;
          float yCurr = yInit;
          for (int plotCnt = 0; plotCnt < plotMax; plotCnt++) {
            float plotRatio = map(plotCnt, 0, plotMax, 0.0, 1.0);
            float eHue      = baseHue + plotRatio * 60.0 + floor(((xInit * yInit) * 10000.0) % 4.0) * 10.0;
            float eSat      = map(sin(PI * plotRatio), 0.0, 1.0, 40.0, 70.0);
            float eBri      = baseBri * (1.0 + sin(PI * plotRatio));
            float eSiz      = baseSiz * (1.0 + sin(PI * plotRatio));

            float xPrev = xCurr;
            float yPrev = yCurr;
            xCurr += plotDiv * cos((atan2(xPrev, yPrev) + (TWO_PI * (vfldFactorX + yPrev))) * plotMult);
            yCurr += plotDiv * sin((atan2(yPrev, xPrev) + (TWO_PI * (vfldFactorY + xPrev))) * plotMult);

            fill(eHue % 360.0, eSat, eBri, 100.0);
            ellipse(xCurr * width, yCurr * height, eSiz, eSiz);
          }
        }
      }
    }
    popMatrix();

    casing();
    saveFrame("frames/" + String.format("%04d", frmCnt) + ".png");
  }
  exit();
}

/**
 * casing : draw fancy casing
 */
private void casing() {
  blendMode(BLEND);
  fill(0.0, 0.0, 0.0, 0.0);
  strokeWeight(54.0);
  stroke(0.0, 0.0, 0.0, 100.0);
  rect(0.0, 0.0, width, height);
  strokeWeight(50.0);
  stroke(0.0, 0.0, 100.0, 100.0);
  rect(0.0, 0.0, width, height);
  noStroke();
  noFill();
}


/*
Copyright (C) 2019- 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 <http://www.gnu.org/licenses/>
*/




Vector Field without noise.
It's a beautiful  multi-layered vector field.



No comments :

Post a Comment