I realized noise(x) == noise(-x), and made some creative coding artworks.

Creative coding example image made with Processing in this article.
Shining Mountain.

Creative coding example image made with Processing in this article.
Stumbling Block.

Creative coding example image made with Processing in this article.
Welcome to the Machine.

Creative coding example image made with Processing in this article.
Sign of the Times.

 

The artworks of my 'Accidental Programming Method'.

These are creative coding artworks made with the 'Processing'.

I tried to make it creates four image patterns by the parameter from standard input.


  if (args == null) {
    ms = new Mountains();
  } else {
    if (args[0].equals("Mountains")) {
      ms = new Mountains();
    } else if (args[0].equals("Block")) {
      ms = new Block();
    } else if (args[0].equals("Machine")) {
      ms = new Machine();
    } else if (args[0].equals("Sign")) {
      ms = new Sign();
    } else {
      ms = new Mountains();
    }
  }

By chance, I realized noise(x) == noise(-x)!
This is the product of my 'Accidental Programming Method'.







 

The 'Processing' code 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.

// Shining Mountain.
// Stumbling Block.
// Welcome to the Machine.
// Sign of the Times.
// Processing 3.2.1
// 2018.03.17

abstract class Mesh {

  int fctSpacing;
  float brightSmall;
  float brightBig;

  Mesh() {
    fctSpacing = 0;
    brightSmall = 0;
    brightBig = 0;
  }

  abstract void drawCell(float sizeRate);
  
  void drawMesh() {
   
    float nxStart = random(100);
    float nyStart = random(100);

    float hueBase = random(360);
    float hueDiv = 30;
    if (hueBase > 50 && hueBase < 160) {
      // yellow and green
      hueDiv = 60;
    }
  
    noStroke();
    for (int spacing = 3 * fctSpacing; spacing >= fctSpacing; spacing -= fctSpacing) {
      for (int sizeRate = 1; sizeRate < spacing; ++sizeRate) {
        float nx = nxStart;
        for (int x = -width / 2; x <= width / 2; x += spacing) {
          float ny = nyStart;
          for (int y = -height / 2; y <= height / 2; y += spacing) {

            fill(
                 (hueBase + map(noise(x, y), 0, 1, -hueDiv, hueDiv) + map(noise(nx, ny), 0, 1, -10, 10)) % 360,
                 map(noise(x, y), 0, 1, 10, map(spacing, fctSpacing, 3 * fctSpacing, 40, 80)),
                 map(noise(y, x), 0, 1, 0, map(spacing, fctSpacing, 3 * fctSpacing, brightSmall, brightBig)) / fctSpacing,
                 100
                 );
            
            pushMatrix();
            translate(x, y);
            drawCell(sizeRate);
            popMatrix();

            ny += 0.005 * fctSpacing;

          }

          nx += 0.005 * fctSpacing;

        }
      }
    }

  }

}

// Shining Mountain.
class Mountains extends Mesh {

  Mountains() {
    super();
    fctSpacing = 30;
    if (random(1) < 0.5) {
      brightSmall = 50;
      brightBig = 80;
    } else {
      brightSmall = 120;
      brightBig = 40;
    }
  }

  void drawCell(float sizeRate) {
    rotate(radians(45));
    rect(0, 0, sizeRate, sizeRate);
  }

}

// Stumbling Block.
class Block extends Mesh {

  Block() {
    super();
    if (random(1) < 0.5) {
      fctSpacing = 10;
      brightSmall = 80;
      brightBig = 60;
    } else {
      fctSpacing = 30;
      brightSmall = 50;
      brightBig = 80;
    }
  }

  void drawCell(float sizeRate) {
    rect(0, 0, sizeRate, sizeRate);
  }

}

// Welcome to the Machine.
class Machine extends Mesh {

  Machine() {
    super();
    float selector = random(1);
    if (selector < 0.33) {
      fctSpacing = 10;
      brightSmall = 160;
      brightBig = 30;
    } else if (selector < 0.66) {
      fctSpacing = 30;
      brightSmall = 160;
      brightBig = 40;
    } else {
      fctSpacing = 50;
      brightSmall = 160;
      brightBig = 40;
    }
  }

  void drawCell(float sizeRate) {
    ellipse(0, 0, sizeRate, sizeRate);
  }

}

// Sign of the Times.
class Sign extends Mesh {

  Sign() {
    super();
    if (random(1) < 0.5) {
      fctSpacing = 10;
      brightSmall = 20;
      brightBig = 80;
    } else {
      fctSpacing = 50;
      brightSmall = 20;
      brightBig = 120;
    }
  }

  void drawCell(float sizeRate) {
    ellipse(0, 0, sizeRate, sizeRate);
  }

}

/* ---------------------------------------------------------------------- */
Mesh ms;

void setup() {

  size(900, 900);
  colorMode(HSB, 360, 100, 100, 100);
  smooth(8);
  noLoop();
  //  frameRate(1);

  if (args == null) {
    ms = new Mountains();
  } else {
    if (args[0].equals("Mountains")) {
      ms = new Mountains();
    } else if (args[0].equals("Block")) {
      ms = new Block();
    } else if (args[0].equals("Machine")) {
      ms = new Machine();
    } else if (args[0].equals("Sign")) {
      ms = new Sign();
    } else {
      ms = new Mountains();
    }
  }

}

void draw() {

  background(0, 0, 0, 100);
  translate(width / 2, height / 2);

  blendMode(ADD);
  ms.drawMesh();

  blendMode(BLEND);
  casing();

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

}

void casing() {

  fill(0, 0, 100, 0);
  strokeWeight(50);
  stroke(0, 0, 100, 100);
  rect(-width / 2, -height / 2, width, height);

}



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