The Vector field using the De Jong attractor calculation.

The storm in the Ukiyoe style.

A vector field calculated with the De Jong attractor formula.

I made this creative coding work with the 'Processing'. It creates an image of the storm in the Ukiyoe style.

It draws a Vector field with the De Jong attractor formula. I tried to use the De Jong attractor formula as an angle of calculating the coordinates of the Vector field.

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







 

The 'Processing' code example.

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

/**
 * Couldn't Stand The Weather.
 * draw vector field with De Jong attractor formula.
 * 
 * @author @deconbatch
 * @version 0.1
 * Processing 3.2.1
 * 2019.05.19
 */

void setup() {

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

}

void draw() {

  float hueInit     = random(360.0);
  float plotDiv     = 0.0005;
  int   paintCntMax = 2;

  for (int imgCnt = 1; imgCnt <= 3; ++imgCnt) {

    // shape parameters
    float paramA = random(5.0, 8.0);
    float paramB = random(1.0, 3.0);
    float paramC = random(5.0, 8.0);
    float paramD = random(1.0, 3.0);

    hueInit += 90.0;

    background(0.0, 0.0, 90.0, 100);
    for (int paintCnt = 1; paintCnt <= paintCntMax; ++paintCnt) {

      float paintRatio = map(paintCnt, 1, paintCntMax, 0.0, 1.0);

      int   plotCntMax = floor(map(paintRatio, 0.0, 1.0, 10.0, 200.0));
      float initDiv    = map(paintRatio, 0.0, 1.0, 0.0005, 0.005);
      float baseHue    = hueInit;
      float baseSat    = 100.0;
      float baseBri    = 60.0;
      float baseAlp    = map(paintRatio, 0.0, 1.0, 100.0, 70.0);
      float baseSiz    = 1.0;
     
      // draw vector field
      for (float xInit = 0.1; xInit <= 0.9; xInit += initDiv) {
        for (float yInit = 0.1; yInit <= 0.9; yInit += initDiv) {
          float xPoint = xInit;
          float yPoint = yInit;
          for (int plotCnt = 0; plotCnt < plotCntMax; ++plotCnt) {

            float plotRatio = map(plotCnt, 0, plotCntMax, 0.0, 1.0);
            float eHue      = baseHue + plotRatio * 60.0 + customNoise(xInit, yInit) * 30.0;
            float eSat      = baseSat * map(sin(PI * plotRatio), 0.0, 1.0, 1.0, 0.1);
            float eBri      = baseBri * sin(PI * plotRatio);
            float eSiz      = baseSiz * sin(PI * plotRatio);

            // De Jong attractors fromula
            float xPrev = xPoint;
            float yPrev = yPoint;
            xPoint += plotDiv * cos(TWO_PI * (sin(TWO_PI * paramA * yPrev) - cos(TWO_PI * paramB * xPrev)));
            yPoint += plotDiv * sin(TWO_PI * (sin(TWO_PI * paramC * xPrev) - cos(TWO_PI * paramD * yPrev)));

            fill(eHue % 360.0, eSat, eBri, baseAlp);
            ellipse(xPoint * width, yPoint * height, eSiz, eSiz);

          }
        }
      }
    }

    saveFrame("frames/" + String.format("%04d", imgCnt) + ".png");

  }

  exit();

}

/**
 * customNoise : returns -1.0 .. 1.0 almost random but interesting value
 */
float customNoise(float _x, float _y) {
  return pow(sin(TWO_PI * _x), 3) * cos(TWO_PI * pow(_y, 2));
}


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


 

Yet another example image.


The storm in the Ukiyoe style.

 

Next Post Previous Post
No Comment
Add Comment
comment url