Two Minutes To Midnight : Code till doomsday.

The Archimedean spiral animation with many Perlin noise effects.

A creative coding Doomsday clock.

It's a creative coding animation made with Processing on Java programming language.

I tried to make a clock with 1fps animation. And gave up. XP I just created an animation of the Archimedean spiral with many Perlin noise effects.







 

Code example written in Processing.

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.


// Two Minutes To Midnight.
// Processing 3.2.1
// @deconbatch
// 2018.05.29
// 1fps x 6s

/* ---------------------------------------------------------------------- */
class Dial {

  int cntWidthMax;
  int divRotate;
  int cntRotateMax;
  float basePetalSize;
  float baseColor;
  float petalBaseFrom, petalBaseTo, petalDivFrom, petalDivTo;

  Dial() {

    divRotate     = 91;                  // divide 360 degree
    cntRotateMax  = 5 * 360 * divRotate; // draw while rotating
    cntWidthMax   = 8;                   // repeat same shape with different ellipse size
    basePetalSize = 5000.0;              // radius of shape
    baseColor     = random(360);

  }

  void drawDial() {

    for (int cntWidth = 1; cntWidth <= cntWidthMax; ++cntWidth) {

      float noiseHue    = noiseHueStart + cntWidth / 300;
      float noiseSat    = noiseSatStart;
      float noiseBri    = noiseBriStart;
      float noiseAlp    = noiseAlpStart;
      float noiseShp    = noiseShpStart;
      float sumRotation = 0;

      for (int cntRotate = 0; cntRotate < cntRotateMax; ++cntRotate) {

        // rotate fixed degree and calculate the plot point
        float rotation = 1.0 / divRotate;
        rotate(radians(rotation));
        sumRotation += rotation;

        float position = basePetalSize * abs(sin(radians(sumRotation / 500.0)) * sin(radians(sumRotation * 500)));
        float brushHue = (baseColor + 360 + map(noise(noiseHue), 0.0, 1.0, 0.0, 60)) % 360;
        float brushSat = map(noise(noiseSat), 0.0, 1.0, 30.0, 90.0);
        float brushSiz = map(noise(noiseBri), 0.0, 1.0, 0.0, 1.0 * cntWidth * cntWidth);
        float brushBri = map(noise(noiseBri), 0.0, 1.0, 0.0, 100.0) / cntWidth / cntWidth;
        float brushAlp = map(noise(noiseAlp), 0.0, 1.0, 0.0, 100.0);

        pushMatrix();
        translate(0.0, position);
        fill(brushHue, brushSat, brushBri, brushAlp);
        ellipse(0.0, 0.0, brushSiz, brushSiz);
        popMatrix();

        noiseHue += 0.0003;
        noiseSat += 0.0002;
        noiseBri += 0.0001;
        noiseAlp += 0.0002;
        noiseShp += 0.0005;

      }

      rotate(radians(-cntRotateMax));

    }

  }

}

/* ---------------------------------------------------------------------- */
Dial  dial;
float noiseShpStart = random(100.0);
float noiseHueStart = random(100.0);
float noiseBriStart = random(100.0);
float noiseAlpStart = random(100.0);
float noiseSatStart = random(100.0);

void setup() {

  size(720, 720);
  colorMode(HSB, 360, 100, 100, 100);
  blendMode(SCREEN);
  smooth();
  noStroke();

  dial = new Dial();  

}

void draw() {

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

  dial.drawDial();

  noiseHueStart += 0.1;
  noiseSatStart += 0.5;
  noiseBriStart -= 0.4;
  noiseAlpStart -= 0.3;
  noiseShpStart += 0.8;

  saveFrame("frames/####.png");
  if (frameCount >= 7) {
    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 <http://www.gnu.org/licenses/>
*/


 

Yet another example images.

The Archimedean spiral animation with many Perlin noise effects.

 

Next Post Previous Post
No Comment
Add Comment
comment url