A creative coding sea anemone made with the Perlin noise

Sea anemone made with my creative coding.


 

Sea anemone with Perlin noise.

I made this creative coding animation with the 'Processing'.

I wanted to make some animation using Perlin noise. I devised noise parameters to make interesting moving. And finally, my code created a sea anemone.

This code does not display any images on screen but just generates image files. You can make animation with these files.





 

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.


/**
 * Under the Sea.
 * Perlin noise sea anemone.
 * 
 * @author @deconbatch
 * @version 0.1
 * Processing 3.2.1
 * 2019.03.09
 */

void setup() {

  size(720, 720);
  colorMode(HSB, 360, 100, 100, 100);
  rectMode(CENTER);
  smooth();
  noStroke();
  noLoop();

}

void draw() {
 
  int   frameCntMax = 24 * 6;
  int   lineCntMax  = 180;
  int   plotCntMax  = 350;
  float plotDiv     = 0.003;
  float baseHue     = random(360.0);
  float baseBri     = 3.0;
  float baseSiz     = 10.0;

  translate(width * 0.5, height * 0.5);

  for (int frameCnt = 1; frameCnt <= frameCntMax; ++frameCnt) {
    float fRatio = map(frameCnt, 0, frameCntMax, 0.0, 1.0);
    background(baseHue, 100.0, 10.0, 100);
    blendMode(SCREEN);

    for (int lineCnt = 0; lineCnt < lineCntMax; ++lineCnt) {
      float lRatio = map(lineCnt, 0, lineCntMax, 0.0, 1.0);
      float xPoint = 0.05 * cos(TWO_PI * lRatio * 3.0);
      float yPoint = 0.05 * sin(TWO_PI * lRatio * 3.0);

      for (int plotCnt = 0; plotCnt < plotCntMax; ++plotCnt) {
        float pRatio = map(plotCnt, 0, plotCntMax, 0.0, 1.0);
        float eHue   = baseHue + pRatio * 60.0 + (floor(lRatio * 40.0) % 4.0) * 10.0;;
        float eSat   = map(sin(PI * pRatio), 0.0, 1.0, 100.0, 40.0);
        float eBri   = baseBri * (0.2 + sin(HALF_PI * pRatio));
        float eSiz   = baseSiz * sin(PI * pRatio);

        float xPrev = xPoint;
        float yPrev = yPoint;

        float tm0 = cos(TWO_PI * fRatio) * 0.1;
        float tm1 = sin(TWO_PI * fRatio) * 0.1;
        float np0 = xPrev + 0.5;
        float np1 = yPrev + 0.5;
        float np2 = lRatio * 100.0;
        float np3 = (np2 + np1) * 4.0;
        float np4 = (np2 - np0) * 4.0;
        xPoint += plotDiv * map(noise(np1 + tm0, np2, np3), 0.0, 1.0, -1.0, 1.0);
        yPoint += plotDiv * map(noise(np0 + tm1, np2, np4), 0.0, 1.0, -1.0, 1.0);

        fill(eHue % 360.0, eSat, eBri, 100.0);
        ellipse(xPoint * width, yPoint * height, eSiz, eSiz);
      }
    }
    casing();
    saveFrame("frames/" + String.format("%04d", frameCnt) + ".png");
  }
  exit();
}

/**
 * casing : draw fancy casing
 */
private void casing() {
  blendMode(BLEND);
  fill(0.0, 0.0, 0.0, 0.0);
  strokeWeight(60.0);
  stroke(0.0, 0.0, 0.0, 100.0);
  rect(0.0, 0.0, width, height);
  strokeWeight(50.0);
  stroke(0.0, 0.0, 100.0, 100.0);
  rect(0.0, 0.0, width, height);
  noStroke();
  noFill();
}

/*
Copyright (C) 2019- 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 image.

Blue sea anemone made with my creative coding.

 

Next Post Previous Post
No Comment
Add Comment
comment url