The creative coding animation comes from another dimension

Weird shape with my custom noise function.


Fear of the Vector Field...

It's a creative coding animation made with the 'Processing'. It draws something fearful thing with the Vector Field.

I used my custom noise function, not noise() function this time. This custom noise returns almost random values but it is interesting.

 return pow(sin(_x), 3) * cos(pow(_y, 2));







 

The 'Processing' example code.

This code does not display any images on the screen but generates image files in frames directory. You can make an animation with these files.

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.




/**
 * Dimension Intrusion.
 * It draws something fearful thing with the Vector Field.
 *
 * Processing 3.5.3
 * @author @deconbatch
 * @version 0.1
 * created 0.1 2020.03.22
 */

void setup() {

  size(720, 720);
  colorMode(HSB, 360, 100, 100, 100);
  smooth();
  noStroke();

}

void draw() {

  int   frmMax  = 24 * 6; // for 24fps x 6sec animation
  float baseHue = random(360.0);
  float baseBri = 70.0;
  float baseSiz = min(width, height) * 0.05;

  // shape parameters
  float plotDiv = 0.0004;
  float paramA  = random(1.0, 1.5);
  float paramB  = random(3.5, 4.5);
  float initDiv = random(0.04, 0.05);

  for (int frmCnt = 0; frmCnt < frmMax; ++frmCnt) {

    background((baseHue + 90.0) % 360.0, 40.0, 40.0, 100);
    pushMatrix();
    translate(width * 0.5, -height * 0.4);  
    rotate(HALF_PI * 0.5);

    // draw vector field with custom noise
    int   plotMax = floor(map(frmCnt, 0, frmMax, 20.0, 850.0));
    for (float xInit = 0.2; xInit <= 0.8; xInit += initDiv) {
      for (float yInit = 0.2; yInit <= 0.8; yInit += initDiv) {
        float xPoint = xInit;
        float yPoint = yInit;
        for (int plotCnt = 0; plotCnt < plotMax; ++plotCnt) {

          float plotRatio = map(plotCnt, 0, plotMax, 0.0, 1.0);
          float eHue = baseHue + plotRatio * 30.0 + floor(((xInit * yInit) * 10000.0) % 4.0) * 30.0;;
          float eSat = map(sin(PI * plotRatio), 0.0, 1.0, 60.0, 40.0);
          float eBri = baseBri * (1.5 - sin(PI * plotRatio));
          float eSiz = baseSiz * sin(PI * plotRatio);

          float xPrev = xPoint;
          float yPrev = yPoint;
          xPoint += plotDiv * pow(cos(TWO_PI * customNoise(xPrev * paramA, yPrev * paramB)), 2);
          yPoint += plotDiv * pow(cos(TWO_PI * customNoise(yPrev * paramA, xPrev * paramB)), 2);

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

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

  }

  // for Twitter thumb nail
  saveFrame("frames/00.0000.png");
  for (int i = 0; i < 24 * 2; i++) {
    saveFrame("frames/02." + String.format("%04d", i) + ".png");
  }
  exit();

}

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

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


/*
Copyright (C) 2020- 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.

Weird shape with my custom noise function.

 

Next Post Previous Post
No Comment
Add Comment
comment url