MandaRipple

Creative coding artwork made with Processing programming language.
Creative coding artwork made with Processing programming language.
Creative coding artwork made with Processing programming language.



About this video.

It's creative coding artwork video made with Processing and Kdenlive.
Many circles seem Mandala images or ripples on the water.

Thanks to nice music.

Interlude 4 by Quiet Music for Tiny Robots

2015/05/26
http://freemusicarchive.org/music/Quiet_Music_for_Tiny_Robots/The_February_Album/08_Interlude_4
nterlude 4 by Quiet Music for Tiny Robots is licensed under a Attribution License.
For more permissions:
contact artist
クリエイティブ・コモンズ・ライセンス

Processing example code.


// MandaRipple
// Processing 3.2.1
// 2017.07.08

/* ---------------------------------------------------------------------- */
abstract class PshapeElement {

  PShape anElement;
  float elementColor, elementSaturation, elementBright, elementAlpha;
  
  PshapeElement() {
    anElement = pscreateElement();
    elementColor = 0;
    elementSaturation = 0;
    elementBright = 0;
    elementAlpha = 0;
  }

  abstract PShape pscreateElement();

  void setElementFill(float pcolor, float psaturation, float pbright, float palpha) {
    elementColor = pcolor;
    elementSaturation = psaturation;
    elementBright = pbright;
    elementAlpha = palpha;
    resetColor();
  }

  void resetColor() {
    anElement.setStroke(color(elementColor, elementSaturation, elementBright, elementAlpha));
  }

  void changeColor(float scolor) {
    elementColor = scolor;
    resetColor();
  }

  void changeBright(float sbright) {
    elementBright = sbright;
    resetColor();
  }

  void resetSize() {
    anElement.resetMatrix();
  }

  void changeSize(float scaleX, float scaleY) {
    anElement.scale(scaleX, scaleY);
  }

  void rotate(float radX) {
    anElement.rotate(radX);
  }

  void show() {
    shape(anElement);
  }

}

/* ---------------------------------------------------------------------- */
class CircleBrush extends PshapeElement {
  
  CircleBrush() {
    super();
  }

  PShape pscreateElement() {

    stroke(0.0, 0.0, 0.0, 0.0);
    noFill();
    PShape psDp = createShape(ELLIPSE, 0.0, 0.0, 5.0, 5.0);
    return psDp;

  }

}

/* ---------------------------------------------------------------------- */

PshapeElement pCircle;

float canvasW, canvasH;
float rateSize;

float noiseSizWStarter;
float noiseHueWStarter;
float noiseSatWStarter;
float noiseBriWStarter;
float noiseAlpWStarter;

float baseColor;
float circleBase;
float circleMult;

void setup() {

  size(504, 504);
  colorMode(HSB, 360, 100, 100, 100);
  blendMode(SCREEN);
  strokeWeight(0.008);
  smooth(8);
  frameRate(12);

  pCircle = new CircleBrush();
  
  noiseSizWStarter = random(50.0);
  noiseHueWStarter = random(50.0);
  noiseSatWStarter = random(50.0);
  noiseBriWStarter = random(50.0);
  noiseAlpWStarter = random(50.0);
 
  baseColor = random(170, 360); // yellow-green are no good for me.
  circleBase = width / 10.0 + map(random(1.0), 0.0, 1.0, 0.0, width / 20.0);
  circleMult = map(random(1.0), 0.0, 1.0, 2.0, 3.0);

}

void draw() {

  background(0, 0, 0);
  drawPixels();

  noiseSizWStarter += 0.002;
  noiseHueWStarter += 0.015;
  noiseSatWStarter += 0.008;
  noiseBriWStarter += 0.004;
  noiseAlpWStarter += 0.006;

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

}

void drawPixels() {

  float noiseSizW = noiseSizWStarter;
  float noiseHueW = noiseHueWStarter;
  float noiseSatW = noiseSatWStarter;
  float noiseBriW = noiseBriWStarter;
  float noiseAlpW = noiseAlpWStarter;

  int drawCntMax = round(min(30.0, max(2.0, map(frameCount, 10, 100, 2.0, 30.0))));
  float idxDiv = width / min(4.0, max(1.0, map(frameCount, 10, 130, 1.0, 4.0)));

  for (int drawCnt = 0; drawCnt < drawCntMax; ++drawCnt) {
  
    for (float idxW = 0; idxW < width + idxDiv; idxW += idxDiv) {
      for (float idxH = 0; idxH < height + idxDiv; idxH += idxDiv) {

        float valSize = map(noise(noiseSizW), 0.0, 1.0, circleBase, circleMult * circleBase);
        float valHue = (baseColor + map(noise(noiseHueW), 0.0, 1.0, -60.0, 60.0)) % 360.0;
        float valSat = map(noise(noiseSatW), 0.0, 1.0, 60.0, 100.0);
        float valBri = map(noise(noiseBriW), 0.0, 1.0, 40.0, 100.0);
        float valAlp = map(noise(noiseAlpW), 0.0, 1.0, 50.0, 100.0);
        
        pushMatrix();
        translate(idxW, idxH);
        pCircle.resetSize();
        pCircle.changeSize(valSize, valSize);
        pCircle.setElementFill(valHue, valSat, valBri, valAlp);
        pCircle.show();
        popMatrix();
        
      }
    }

    noiseSizW += 10.0;
    noiseHueW += 10.0;
    noiseSatW += 10.0;
    noiseBriW += 10.0;
    noiseAlpW += 10.0;

  }
}

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



Next Post Previous Post
No Comment
Add Comment
comment url