Frozen Breath On Window




Description of this video.

It was made with Processing and Kdenlive.
It's my first animation and I've learned 2D noise with this example.

Thanks to nice music:
Coloured Blanks by Unheard Music Concepts
2016/11/12
http://freemusicarchive.org/music/Unheard_Music_Concepts/Industry/12_Coloured_Blanks
Coloured Blanks by Unheard Music Concepts is licensed under a Attribution License.
クリエイティブ・コモンズ・ライセンス


Processing code examples.


// Frozen Breath On Window
// 2016.11.13

float xstart, xnoise, ystart, ynoise;
float xstart_seed, ystart_seed;
float size_factor, size_min;

void setup() {
  size(1280, 720, OPENGL);
  //  size(1280, 720); not worked on my environment.
  smooth(8);
  background(255);
  frameRate(30);

  size_factor = 30;
  size_min = 18;

  xstart_seed = 15.9;
  ystart_seed = 1.7;
  xstart = 2.3;
  ystart = 6.4;

  /*
    xstart_seed = 9.663968;
    ystart_seed = 16.404024;
    xstart = 17.681702;
    ystart = 13.134335;
  */

  /*  
    xstart_seed = 12.98462;
    ystart_seed = 9.380171;
    xstart_seed = 4.417633;
    ystart = 5.497389;
  */

  /*
    xstart_seed = random(20);
    ystart_seed = random(20);
    xstart = random(20);
    ystart = random(20);
  */
}

void draw() {

  background(255);

  // change canvas move speed
  xstart_seed += size_factor / 1000;
  ystart_seed += size_factor / 1000;

  // canvas move
  xstart += (noise(xstart_seed) - 0.5) * 0.3 / size_factor;
  ystart += (noise(ystart_seed) - 0.5) * 0.5 / size_factor;
  xnoise = xstart;
  ynoise = ystart;

  // plot x,y, draw circle
  for (float ypoint = 0; ypoint <= height + size_factor; ypoint += size_factor) {
    ynoise += size_factor / 1000;
    xnoise = xstart;
    for (float xpoint = 0; xpoint <= width + size_factor; xpoint += size_factor) {
      xnoise += size_factor / 1000;
      draw_circle(xpoint, ypoint, xnoise, ynoise);
    }
  }

  // shrink circle size
  if (size_factor > size_min) {
    size_factor -= 0.005;
  }

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

void draw_circle(float xp, float yp, float xn, float yn) {
  float cicle = (frameCount % 361); cicle = sin(radians(cicle));
  float xyn = noise(xn, yn);
  float xcn = noise(xyn * xn + cicle);
  float ycn = noise(xcn * yn);
  float rsize = size_factor / 2 + size_factor * 1.5 * pow(xyn, 2);

  pushMatrix();
  translate(xp, yp, 0);
  strokeWeight(size_factor / 4 * xcn);
  stroke(200,  120 * (xyn + pow(cicle, 3) / 3));
  fill(220, 100 * ycn);
  ellipse(0, 0, rsize, rsize);
  popMatrix();
}

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


2 comments :