It's a creative coding art of glass dishes.
Creative coding artwork of beautiful kaleidoscope or glass dish.
It's a creative coding artwork made with the 'Processing'. It draws a beautiful shape like a kaleidoscope or glass dish.
Many circle with the Perlin noise controlled radius form this shape. And the key of this shape is here.
int radDiv01 = 3 + floor(random(2.0)) * 2;
int radDiv02 = floor(random(6.0, 10.0));
An example code of the 'Processing'.
This code does not display any images on the screen but generates image files in frames directory.
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.
/**
* Strange Magic.
* It draws beautiful shape like a kaleidoscope.
*
* Processing 3.5.3
* @author @deconbatch
* @version 0.1
* created 0.1 2020.02.23
*/
void setup() {
size(800, 800);
noStroke();
colorMode(HSB, 360, 100, 100, 100);
noLoop();
}
void draw() {
int frmMax = 3; // draw 3 patterns
int boldMax = 150; // line boldness
int pointMax = 5000; // point number / line
int lineMax = 3; // line number
float minRad = min(width, height);
float baseHue = random(360.0);
translate(width * 0.5, height * 0.5);
for (int frmCnt = 0; frmCnt < frmMax; ++frmCnt) {
// shape factor 1
int radDiv01 = 3 + floor(random(2.0)) * 2; // 3 or 5
int radDiv02 = floor(random(6.0, 10.0));
baseHue += 120.0;
noiseSeed(floor(baseHue * random(100.0)));
blendMode(BLEND);
background(0.0, 0.0, 90.0, 100.0);
fill(0.0, 0.0, 100.0, 50.0);
ellipse(0.0, 0.0, minRad/2.0, minRad/2.0);
ellipse(0.0, 0.0, minRad/1.05, minRad/1.05);
blendMode(DIFFERENCE);
for (int boldCnt = 0; boldCnt < boldMax; ++boldCnt) {
float boldRate = map(boldCnt, 0, boldMax, 0.0, 1.0);
for (int lineCnt = 0; lineCnt < lineMax; lineCnt++) {
// shape factor 2
float phase01 = noise(lineCnt, boldRate);
float phase02 = noise(lineCnt + 100.0, boldRate);
for (int pointCnt = 0; pointCnt < pointMax; pointCnt++) {
float pointRate = map(pointCnt, 0, pointMax, 0.0, 1.0);
float eRad = map(lineCnt, 0, lineMax, minRad/8, minRad/2.25)
+ sin(TWO_PI * (phase01 + pointRate * radDiv01)) * 50.0
+ sin(TWO_PI * (phase02 + pointRate * radDiv02)) * 50.0;
float eX = eRad * cos(pointRate * TWO_PI);
float eY = eRad * sin(pointRate * TWO_PI);
float eSiz = sqrt(lineCnt + 0.5) * 0.5;
float eHue = baseHue + sin(PI * pointRate) * 150.0;
fill(eHue % 360.0, 50.0, 5.0, 100.0);
// draw symmetrically
for (int i = 0; i < 4; i++) {
rotate(HALF_PI);
ellipse(eX, eY, eSiz, eSiz);
}
}
}
}
saveFrame("frames/" + String.format("%04d", frmCnt) + ".png");
}
exit();
}
/*
Copyright (C) 2020- 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.