Creative coding trick on the chess board.

Snapshot.

Generative art made with Processing.

 

An example animation.

 

About this creative coding.

It's a creative coding animation made with the 'Processing'.

It just draws waveforms lengthwise and breadthwise in the chess board. It does not draw the waves in each box. Chessboard background is my magic wand in this work. ;)

It's an applied version of Interstellar Overdrive.







 

The 'Processing' code example.

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

// Sounds From the Street.
// Processing 3.2.1
// created:2018.03.11
// updated:2019.05.01
// line -> ellipse

int   waveCnt;
int   frmCntMax;
float seedWaveInit;
float seedShape[];

void setup() {
  size(720, 720);
  colorMode(HSB, 360.0, 100.0, 100.0, 100.0);
  smooth();

  waveCnt      = 6;
  frmCntMax    = 24 * 9;
  seedWaveInit = random(100);
  seedShape    = new float[waveCnt];
  for (int i = 0; i < waveCnt; ++i) {
    seedShape[i] = random(0.0005, 0.05);
  }
}

void draw() {

  float sideLong = width / (waveCnt - 1);

  // background, chess board
  background(0, 0, 90, 100);
  noStroke();
  for (int x = 0; x <= width; x += sideLong) {
    for (int y = 0; y <= height; y += sideLong) {
      if ((x + y) % (sideLong * 2) == 0) {
        fill(0, 0, 90, 100);
      } else {
        fill(0, 0, 10, 100);
      }
      rect(x, y, 180, 180);
    }
  }

  // draw waves
  seedWaveInit += 0.0004;  // wave roll speed
  float seedWave  = seedWaveInit;
  int   lineIndex = 0;
    
  for (int x = 0; x <= width; x += sideLong) {
    float lastX = x;
    float lastY = -10; // out of screen
    for (int y = 0; y < height; ++y) {
      float currentY = y;
      
      for (int weightCnt = 1; weightCnt <= 12; ++weightCnt) {
        float currentX = x + customNoise(seedWave) * weightCnt * 6.0;
        fill(0, 0, 90, 100);
        ellipse(currentX, currentY, 2.0, 2.0);
        fill(0, 0, 10, 100);
        ellipse(width - currentY, currentX, 2.0, 2.0);
        lastX = currentX;
      }
      
      lastY = currentY;
      seedWave += seedShape[lineIndex]; // wave shape

    }

    ++lineIndex;

  }

  saveFrame("frames/####.png");
  if (frameCount > frmCntMax) {
    exit ();
  }

}

float customNoise(float value) {
  // from -1 to 1
  return pow(sin(value), 3) * cos(pow(value, 2));
}


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