The creative coding swampland with the Vector field.

The vector field with the Perlin noise.

The vector field with the Perlin noise makes this digital artwork.

It's a digital artwork made with the Vector field with the Perlin noise. The code is written in the 'Processing' programing language.


Reference
Drawing vector field | GenerateMe

I devised initial points thicker in the center of the canvas. I love this swamp river landscape.

This code does not display any images on the screen but just generates image files.







 

The 'Processing' code art example.

Please feel free to use this code under the terms of the GPL. To see other works based on my code is my pleasure. And my honor.


/**
 * Swamp River Days.
 * one of the vector field pattern with perlin noise.
 * 
 * @author @deconbatch
 * @version 0.1
 * Processing 3.2.1
 * 2019.05.19
 */

void setup() {

  size(1080, 1080);
  colorMode(HSB, 360, 100, 100, 100);
  smooth();
  noLoop();

}

void draw() {

  noiseSeed(floor(random(100)));

  // shape
  float plotDiv = 0.001;
  float initDiv = 0.01;
  int   plotMax = 20000;

  // color
  float baseHue = random(360.0);
  float baseSat = 70.0;
  float baseBri = 80.0;
  float baseAlp = 10.0;
  float baseSiz = 1.0;

  background(0.0, 0.0, 90.0, 100);
  noStroke();

  // initial points makes squre shape
  float xDiv = initDiv;
  float yDiv = initDiv;
  for (float xInit = 0.0; xInit <= 1.0; xInit += xDiv) {
    xDiv = map(sin(PI * xInit), 0.0, 1.0, initDiv * 5.0, initDiv);

    for (float yInit = 0.0; yInit <= 1.0; yInit += yDiv) {
      yDiv = map(sin(PI * yInit), 0.0, 1.0, initDiv * 5.0, initDiv);

      int   sparse = floor((xInit + yInit) * 100.0) % 4;  // make 0, 1, 2, 3 with initial point

      // draw vector field
      float xPoint = xInit;
      float yPoint = yInit;
      float rPoint = 0.0;
      for (int plotCnt = 0; plotCnt < plotMax; ++plotCnt) {

        float pRatio = map(plotCnt, 0, plotMax, 0.0, 1.0);

        // vector field calculation
        float xPrev = xPoint;
        float yPrev = yPoint;
        float rPrev = rPoint;
        rPoint += map(noise(xPrev * 10.0, yPrev * 10.0), 0.0, 1.0, -1.0, 1.0);
        xPoint += plotDiv * cos(TWO_PI * rPoint) * pRatio;
        yPoint += plotDiv * sin(TWO_PI * rPoint) * pRatio;

        float pHue   = baseHue + pRatio * 60.0 + sparse * 10.0;
        float pSat   = baseSat * map(sin(PI * pRatio), 0.0, 1.0, 1.0, 0.1);
        float pBri   = baseBri * sin(PI * pRatio) * (sparse + 6.0) / 9.0;
        float pSiz   = baseSiz * sin(PI * pRatio);
        fill(pHue % 360.0, pSat, pBri, baseAlp);
        ellipse(xPoint * width, yPoint * height, pSiz, pSiz);

      }
    }
  }
  
  casing();
  saveFrame("frames/####.png");
  exit();

}

/**
 * casing : draw fancy casing
 */
private void casing() {
  blendMode(BLEND);
  fill(0.0, 0.0, 0.0, 0.0);
  strokeWeight(60.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);
}

/*
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/>
*/


 

Next Post Previous Post
No Comment
Add Comment
comment url