World in My Eyes.

Creative coding works with Perlin noise.

Creative coding works with Perlin noise.


Description.

My creative coding work that is made with Processing.

It's a by-product of Sounds From the Street.
I used my custom noise (almost a random), I made this weird wave shape animation.

My custom noise is an unruly boy. Need a perfect parameter to draw a formed shape.
And it's so fun to find these parameters.

Processing code examples.

Please feel free to use it, if you like it.
To see other works based on my code is my pleasure. And my honor.


// World in My Eyes.
// Processing 3.2.1
// 2018.03.12

int waveCnt;
float seedExpand;
float seedShape[];

void setup() {

  size(900, 900);
  colorMode(HSB, 360, 100, 100, 100);
  blendMode(BLEND);
  smooth(8);
  //  noLoop();

  waveCnt = 9;
  seedExpand = random(100);

  seedShape = new float[waveCnt];
  float rndDegree = random(20, 70);
  for (int i = 0; i < waveCnt; ++i) {
    seedShape[i] = map(sin(radians(rndDegree * (i + 1))), -1, 1, 8000, 50000); // I want various value
  }

}

void draw() {

  background(0, 0, 100, 100);
  noStroke();

  // rotate canvas
  translate(width / 2, height / 2);
  rotate(-radians(10));
  translate(-width / 2, -height / 2);
  
  drawWaves();
  drawScope();
  /*
  saveFrame("frames/####.png");
  if (frameCount > 30 * 15) {
    exit ();
  }
  */
}

void drawWaves() {

  int lineIndex = 0;
    
  for (int x = 0; x <= width; x += width / (waveCnt - 1)) {

    float lastX = x;
    float seedWave = seedShape[lineIndex]  + frameCount * 0.005; // wave shape

    for (float y = 0; y < height * 2; y += 0.2) {

      float currentY = y * (0.5 + noise(seedShape[lineIndex] + seedExpand) * 1.5);
      float divX = customNoise(seedWave) * 50.0;
      float currentX = x + divX;

      if (abs(divX) < 0.5 &&  abs(currentX - lastX) < 0.2) {
        // do no draw such a straight line
      } else {
        fill(240, 50, 20, map(abs(currentX - lastX), 0, 100, 10.0, 100.0));
        ellipse(currentX, currentY, 6, 6);
      }

      lastX = currentX;
      seedWave += 0.45; // make a shape, important value

    }

    ++lineIndex;

  }

  seedExpand += 0.001;

}

void drawScope() {

  pushMatrix();
  translate(width / 2, height / 2);
  strokeWeight(200.0);
  stroke(0.0, 0.0, 0.0, 100.0);
  fill(0.0, 0.0, 0.0, 0.0);
  ellipse(0.0, 0.0, 1100.0, 1100.0);
  popMatrix();

}

float customNoise(float value) {

  value *= map(sin(radians(value * 0.01)), -1, 1, 0.004, 0.002);
  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 
*/



No comments :

Post a Comment