In the Curve.

Generative art made with code in this article.

Generative art made with code in this article.

About this creative coding.

It's a creative coding still image artwork made with Processing. It draws simple iteration circles with curveVertex.

Simple code and beautiful results! It draws a various pattern of curves. It's so fun to wait for the next drawing result! 🙂

Processing code example.

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


// In the Curve.
// @author @deconbatch
// @version 1.0
// Processing 3.2.1
// 2018.09.02

void setup() {

  size(1080, 1080);
  colorMode(HSB, 360, 100, 100, 100);
  smooth();
  rectMode(CENTER);

}

void draw() {

  float hueBase      = random(360.0);
  float vertexRadius = width * 0.01;
  float rotateDiv    = ceil(random(0.1, 6.0)) * (random(1.0) < 0.5 ? 10.0 : -10.0);
  int   pointCntMax  = ceil(random(0.1, 4.0)) * 3;
  int   rotateCntMax = ceil(random(40.0, 60.0));
  int   frameCnt     = 0;

  background(0.0, 0.0, 90.0, 100.0);
  translate(width / 2.0, height / 2.0);

  pushMatrix();
  rotate(random(TWO_PI));

  noFill();
  for (int rotateCnt = 0; rotateCnt < rotateCntMax; ++rotateCnt) {
    float rotateRate = rotateCnt * 1.0 / rotateCntMax;
    
    strokeWeight(rotateRate * 2.0);
    stroke((hueBase + 90.0 * rotateRate) % 360.0, 40.0, 60.0, 100.0);

    pushMatrix();
    rotate(TWO_PI * rotateRate * rotateRate * rotateDiv / rotateCntMax);
    translate(rotateRate * 100.0, 0.0);

    beginShape();
    for (int pointCnt = 0; pointCnt < pointCntMax + 3; ++pointCnt) {
      float pointRate = pointCnt * 1.0 / pointCntMax;
      float noiseVal = map(noise((pointCnt % pointCntMax) * 0.2), 0.0, 1.0, 0.6, 1.4);
      float x = vertexRadius * noiseVal * rotateRate * 30.0 * cos(TWO_PI * pointRate);
      float y = vertexRadius * noiseVal * rotateRate * 30.0 * sin(TWO_PI * pointRate);
      curveVertex(x, y);
    }
    endShape();

    popMatrix();
  }

  popMatrix();

  casing();
  saveFrame("frames/" + String.format("%04d", frameCount) + ".png");
  
  if (frameCount > 2) {
    exit();
  }
  
}


void casing() {

  fill(0.0, 0.0, 100.0, 0.0);
  strokeWeight(75);
  stroke(0.0, 0.0, 30.0, 100.0);
  rect(0.0, 0.0, width, height);
  strokeWeight(70.0);
  stroke(0.0, 0.0, 100.0, 100.0);
  rect(0.0, 0.0, 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 
*/





Generative art example made with Processing in this article.



No comments :

Post a Comment