Shades of Grey.

I use blendMode(DIFFERENCE) in this code.



About this creative coding animation.

A creative coding animation made with Processing.

I found a new toy 'blendMode(DIFFERENCE)'.
At the same time, I was troubled by the Twitter compression problem. I think Twitter compression would kill color and alpha. So I made grayscale animation to survive.

Processing example code.

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


// Shades of Grey.
// Processing 3.2.1
// 2018.03.25

void setup() {

  size(900, 900);
  colorMode(HSB, 360, 100, 100, 100);
  blendMode(DIFFERENCE); // this is the KEY
  smooth();
  noLoop();
  noFill();
  rectMode(CENTER);

}

void draw() {

  float spaceXStart = random(100);
  float spaceYStart = random(100);
  int   frmCount    = 150; // number of image frames
  
  for (int i = 0; i < frmCount; ++i) {

    // eternal looping animation generating system values
    spaceXStart += sin(radians(i * 360 / frmCount)) * 0.004;
    spaceYStart += cos(radians(i * 360 / frmCount)) * 0.004;
    float spaceX = spaceXStart;
    float spaceY = spaceYStart;

    background(0, 0, 0, 100);

    for (int j = 0; j < 30; ++j) {

      stroke(
             0,
             0,
             j * 1.5 + 55,
             100
             );

      pushMatrix();
      translate(
                map(noise(spaceX), 0, 1, 0, width),
                map(noise(spaceY), 0, 1, 0, height)
                );
      float multi = 1.0 + noise(spaceX, spaceY) * 20;
      strokeWeight(5.0 * multi);
      rect(
           0,
           0,
           15 * multi,
           15 * multi
           );
      popMatrix();

      spaceX += 1.0;
      spaceY += 1.0;

    }

    // save image
    saveFrame("frames/" + String.format("%05d", i) + ".png");

  }

  exit();

}

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





Yet another example result.


I use blendMode(DIFFERENCE) in this code.

No comments :

Post a Comment