Digital art of the beans changing colors

An example image of the digital art of the beans.

The simple design of the creative coding colorful beans.

It's the digital art of color-changing beans placed on the matrix. It's my creative coding artwork written in the 'Processing' programming language.

I've been learning about the color harmony law described by Deane B. Judd. And I tried to apply 'Hexad' and 'Intermediate' color palettes in this digital art.

I drew color gradation with many ellipses that have low alpha values.

An example image of color gradation.

This code does not display any images on the screen but generates image files in frames directory.







 

The 'Processing' code example.

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.

// Sweet Seasons.
// Processing 3.2.1
// 2018.04.18

void setup() {
  size(1080, 1080);
  colorMode(HSB, 360, 100, 100, 100);
  smooth();
  noLoop();
  background(0.0, 0.0, 90.0, 100.0);
}

void draw() {
  int   countX  = 6;
  int   countY  = 6;
  float baseBri = 70;
  float baseDeg = random(360);
  float baseHue = random(360);

  blendMode(BLEND);
  casing();
  
  for (int x = 0; x < countX; ++x) {

    baseBri += 80 / (countX - 1);
    baseHue += 60; // Hexad color

    // proceed x
    translate(width / (countX + 1), 0);

    for (int y = 0; y < countY; ++y) {
      // proceed y
      translate(0, height / (countY + 1));
      drawBean(
               baseHue % 360,
               50, // fix saturation may be better
               max(10, min(90, baseBri - (y * 80 / (countY - 1)))),   //10 - 90
               (baseDeg + y * 360 / countY) % 360
               );
    }

    // back y
    translate(0, -height * countY / (countY + 1));
  
  }


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

void drawBean(
              float applyHue,  // bean color
              float applySat,  // bean saturation
              float darkBri,   // dark coating brightness
              float applyDeg   // bean rotation degree
              ) {

  float applyBri   = 0;
  float beanRadius = 28;
  float beanWidth  = 60;
  float underBri   = 90;
  float topBri     = 10;
  float baseNoise  = random(100);

  for (int blendSelect = 0; blendSelect < 3; ++blendSelect) {

    if (blendSelect % 3 == 0) {
      blendMode(BLEND);
      applyBri = underBri;
    } else if (blendSelect % 3 == 1) {
      blendMode(DARKEST);
      applyBri = darkBri;
    } else {
      blendMode(SCREEN);
      applyBri = topBri;
    }
    /* also interesting effect set
       blendMode(DIFFERENCE);
       blendMode(SCREEN);

       blendMode(MULTIPLY);
       blendMode(ADD);
    */
    
    float noiseStep = baseNoise;
    float step      = 0;
    for (int i = 0; i < 180; ++i) {

      step += 0.4 + noise(noiseStep);
      //      step += 1.0;
      
      fill(
           (applyHue + i / 2.0) % 360,  // Intermediate color
           applySat,
           applyBri,
           10
           );
      pushMatrix();
      translate(
                sin(radians(applyDeg + applyHue + step)) * beanRadius,
                cos(radians(applyDeg + applyHue + step)) * beanRadius
                );
      ellipse(0, 0, beanWidth, beanWidth);
      popMatrix();

      noiseStep += 0.005;

    }
    
  }
  
}

void casing() {
  stroke(0, 0, 95, 100);
  fill(0, 0, 100, 0);
  strokeWeight(60);
  rect(0, 0, width, height);

  noStroke();
}

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