The Helpless Battle
Description of this video.
I made these with Processing programming language and Kdenlive video editor. It consistes of two scripts.I inspired by the Duel on Mustafar from Star Wars.
Thanks to nice music:
Mettle by Pipe Choir
2016/01/01
http://freemusicarchive.org/music/Pipe_Choir/Pipe_Choir/Mettle
Mettle by Pipe Choir is licensed under a Attribution License.
Based on a work at www.pipechoir.com
Permissions beyond the scope of this license may be available at www.pipechoir.com or contact artist via email.
Processing code example.
// The Helpless Battle on Mustafar
// Processing 3.2.1
// 2017.02.25
import processing.opengl.*;
World wd;
Surface sf;
void setup() {
size(1280, 720, OPENGL);
colorMode(HSB, 3600, 100, 100, 100);
blendMode(SCREEN);
hint(DISABLE_DEPTH_TEST);
smooth();
frameRate(30);
wd = new World();
sf = new Surface();
}
void draw() {
wd.redraw();
// surface
sf.draw();
/*
saveFrame("frames/####.png");
if (frameCount >= 701) {
exit();
}
*/
}
class World {
float r_X;
float r_Y;
float r_Z;
World() {
r_X = 0;
r_Y = 0;
r_Z = 0;
}
void redraw() {
background(40);
ambientLight(0, 0, 100);
noStroke();
translate(width / 2, height / 2, 0);
// angle 1
camera(-320, -30, 0,
0, -200, 0,
0, 1, 0);
/*
// angle 2
camera(-290, -60, 0,
0, -150, 0,
0, 1, 0);
// angle 3
camera(-225, -135, 0,
0, -5, 0,
0, 1, 0);
*/
}
}
class Surface {
float nx_start, ny_start;
float ni_start, nk_start;
float radius_val;
float div_ido, div_kdo;
float ptsize_ido, ptsize_kdo;
float jx_start, jy_start;
Surface() {
nx_start = random(50);
ny_start = random(50);
ni_start = random(50);
nk_start = random(50);
jx_start = nx_start;
jy_start = ny_start;
radius_val = 200;
// div_ido = 0.5;
// ptsize_ido = div_ido * 3.51;
// ptsize_kdo = div_ido * 3.93;
div_ido = 0.2;
ptsize_ido = div_ido * 3.50;
ptsize_kdo = div_ido * 3.93;
div_kdo = 1.0; // dummy
}
float sigmoid(float x, float a, float b) {
float modx = a * (x - 1) + 1;
return (float)(1.0 / (1.0 + Math.exp(-modx * b)));
}
void draw() {
nx_start += 0.002;
ny_start += 0.001;
nk_start += 0.030;
ni_start += 0.020;
float ny = ny_start;
float ni = ni_start;
for (float ido = 40; ido <=140; ido += div_ido) {
float radian_ido = radians(ido);
div_kdo = 180 / max(160 / div_ido * sin(radian_ido), 1);
float nx = nx_start;
float nk = nk_start;
for (float kdo = 180; kdo <= 230; kdo += div_kdo) {
// noises
float noise_fluc = noise(ni, nk);
float noise_basecolor = noise(nx, ny);
float bright_pow2 = sigmoid(noise(ny, nx), 1.85, 10.0);
float bright_pow4 = sigmoid(noise(ny, nx), 3.2, 8.0);
float bright_pow8 = sigmoid(noise(ny, nx), 4.6, 9.5);
// particle point
float radian_kdo = radians(kdo);
float thisx = radius_val * cos(radian_kdo) * sin(radian_ido);
float thisy = radius_val * sin(radian_kdo) * sin(radian_ido);
float thisz = radius_val * cos(radian_ido);
pushMatrix();
translate(thisx, thisy, thisz);
rotateZ(radian_kdo);
rotateY(radian_ido);
// base surface
if (bright_pow2 > 0.2) {
fill(
80 * noise_basecolor,
100,
24 * bright_pow2,
100
);
paste(ptsize_ido, ptsize_kdo, noise_fluc);
}
// hot lava
if (bright_pow4 > 0.1) {
fill(
80 * (bright_pow2 + noise_fluc * 1),
100,
28 * bright_pow4,
100
);
paste(ptsize_ido, ptsize_kdo, noise_fluc);
}
// scalding hot lava
if (bright_pow8 > 0.05) {
fill(
400 + 250 * noise_basecolor,
100,
56 * bright_pow8 * (1 + pow(noise_fluc, 2)),
100
);
paste(ptsize_ido, ptsize_kdo, noise_fluc);
}
popMatrix();
nx += div_kdo / 6.2;
nk += div_kdo / 14.0;
}
// div_ido = 0.5;
// ny += 0.09;
// ni += 0.05;
// div_ido = 0.2;
ny += 0.03;
ni += 0.01;
}
// battle point
float radian_ido = radians(100 + (jy_start - ny_start) * 5);
float radian_kdo = radians(220 + (jx_start - nx_start) * 5);
// float radian_ido = radians(100 + (jy_start - ny_start) * 5);
// float radian_kdo = radians(208 + (jx_start - nx_start) * 5);
float thisx = radius_val * cos(radian_kdo) * sin(radian_ido);
float thisy = radius_val * sin(radian_kdo) * sin(radian_ido);
float thisz = radius_val * cos(radian_ido);
float njx = noise(nk_start) / 2.0;
float njy = noise(ni_start) / 2.0;
pushMatrix();
translate(thisx, thisy, thisz);
rotateZ(radian_kdo);
rotateY(radian_ido);
force(njx, njy, pow(njx+njy, 2), 2200);
force(- njx, - njy, pow(njx+njy, 2), 3600 - sigmoid((njx+njy)/2, 1.25, 9.0) * 1500);
popMatrix();
}
void paste(float w, float h, float n) {
float fluc = 0.2 + n;
rect(0, 0, w, h);
rect(fluc, fluc, w, h);
rect(-fluc, -fluc, w, h);
}
void force(float x, float y, float b, float c) {
for (int i = 1; i <= 5; ++i) {
fill(
c,
pow(i, 2) * 7,
30 - 30 * b,
100
);
ellipse(x, y, i/2.0, i/2.0);
}
}
}
/*
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
*/
** The Helpless Battle : Fall to the Dark Side
// The Helpless Battle : Fall to the Dark Side
// Processing 3.2.1
// 2017.02.26
import processing.opengl.*;
World wd;
Lightsaber ls;
void setup() {
size(1280, 720, OPENGL);
colorMode(HSB, 3600, 100, 100, 100);
blendMode(SCREEN);
hint(DISABLE_DEPTH_TEST);
smooth();
frameRate(30);
wd = new World();
ls = new Lightsaber();
}
void draw() {
wd.redraw();
// light saber
ls.draw();
/*
saveFrame("frames/####.png");
if (frameCount >= 701) {
exit();
}
*/
}
class World {
float r_X;
float r_Y;
float r_Z;
World() {
r_X = 0;
r_Y = 0;
r_Z = 0;
}
void redraw() {
background(40);
ambientLight(0, 0, 100);
noStroke();
translate(width / 2, height / 2, 0);
// angle
camera(0, 0, 300,
0, 0, 0,
0, 1, 0);
}
}
class Lightsaber {
float nf_start, nc_start;
float div_ido;
float lightside, darkside;
float holdout, falltodark;
Lightsaber() {
nc_start = random(50);
nf_start = random(50);
div_ido = 10.0;
lightside = 2300;
darkside = 3600;
holdout = 360 * 1;
falltodark = 0;
}
void draw() {
nc_start += 0.020;
nf_start += 0.080;
float nc = nc_start;
float nf = nf_start;
if (frameCount >= holdout && falltodark <= 0.99) {
falltodark = sin(radians(frameCount % 181));
}
float lightcolor = lightside + (darkside - lightside) * falltodark;
for (float ido = -10; ido <=10; ido += div_ido) {
float radian_ido = radians(ido);
pushMatrix();
rotateY(radian_ido);
for (float i = 1.0; i <= 10.0; i+=0.5) {
fill(
lightcolor - 50 * noise(nc),
100 - pow(10-i, 2),
(12 - i + 5 * noise(nf)) * 2,
100
);
rect(-i*3, -180, i*6, 360);
nc += 0.01;
nf += 0.02;
}
popMatrix();
}
}
}
/*
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
*/




