Stairway To Heaven


Description of this video.

It was made with Processing and Kdenlive.
I've learned camera and lights in Processing.

Thanks to nice music:
Long Lonely Nights by Unheard Music Concepts
2017/01/02
http://freemusicarchive.org/music/Unheard_Music_Concepts/Home_1808/17_Long_Lonely_Nights
Long Lonely Nights by Unheard Music Concepts is licensed under a Attribution License.
Based on a work at http://www.unheardmusicconcepts.com
Permissions beyond the scope of this license may be available at http://www.unheardmusicconcepts.com or contact artist via email.

クリエイティブ・コモンズ・ライセンス


Processing example code.


// Stairway To Heaven
// Processing 3.2.1
// 2017.02.04
import processing.opengl.*;

int radius_basic = 1200;
int divt_basic = 4;
int divs = 25;
float rotationZ = 0;
float start_noises = random(100);
float noisef = random(100);
int stairs_count = 4;

void setup() {
  size(1280, 720, OPENGL);
  background(40);
  smooth();
  frameRate(30);
}

void draw() {
  background(40);
  ambientLight(128, 128, 128);

  float noise_noisef = noise(noisef);
  float cicle_rotate = (frameCount % 3601) / 10.00 ; cicle_rotate = sin(radians(cicle_rotate));
  float noises = start_noises;
  float frame_count = frameCount / 2;
  if (frame_count > 1180) {
    frame_count = 1180;
  }
  
  translate(width / 2, height / 2, 0);
  directionalLight(255,255,255,1, 0, 1);
  pointLight(240,240,255,0, 0, height - frame_count / 2.5);
  camera(0, 0 - frame_count, height / 2 - frame_count / 2,
         0, 0, height - frame_count / 2.5,
         0, 1, 0);

  rotationZ += 0.002 + 0.005 * noise_noisef;
  rotateZ(rotationZ);

  for (int i = 1; i <= stairs_count; i++) {

    float radius = radius_basic;
    float divt = divt_basic;
    float s = i * 360 / stairs_count;

    for (float t = 0; t <= 180; t += divt) {

      divt = divt_basic * (sin(radians(t / 2)) + 0.5);
      float noises_val = noise(noises);
      float radianT = radians(t);
      radius -= radius_basic / (180.0 / divt) * (0.2 + pow(cos(radianT / 2),2));
      s += divs * (pow(cos(radians(t - 10)), 3) - pow(sin(radians(t + 60)), 2)) * 80/(t + 20);

      if (t >= (i - 1) * (180 / (stairs_count + 3))) {
        float radianS = radians(s + (180 - t) * noises_val * i * 2 / stairs_count);
        float thisx = radius * cos(radianS) * sin(radianT) / 2.3;
        float thisy = radius * sin(radianS) * sin(radianT) / 2.5;
        float thisz = radius * cos(radianT) - noises_val * (180 - t);

        pushMatrix();
        stroke(100, 40);
        line(0, 0, -200, thisx, thisy, thisz);
        translate(thisx, thisy, thisz);
        fill(140, 40);
        ellipse(0, 0, 3, 3);
        stroke(180, 10);
        if (t == 0) {
          fill(220, 180);
          box(30, 30, 3);
        } else {
          fill(160, 20 + 60 * i / stairs_count);
          box(30, 20, 3);
        }
        popMatrix();
        noises += 0.007;
      }

    }
  }

  start_noises += 0.002;
  noisef += 0.01;

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

}

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