It's so hard to handle Gumowski-Mira.
Creative coding animation with Gumowski-Mira's attractor.
It's a creative coding animation work made with the 'Processing'.
Gumowski-Mira's attractor is so interesting. I was playing with it and wanted to make some animation with it. Attractor has characteristics of very high sensitivity about parameters. So I put some CATALYST in it, and animate with catalyst, not attractor parameters.
This code does not display any images on the screen but generates image files for animation. You can make an animation with these files.
The 'Processing' code example.
Please feel free to use this examplse code under the terms of the GPL.
To see other works based on my code is my pleasure. And my honor.
// Lets Dance. // @author @deconbatch // @version 0.1 // Processing 3.2.1 // 2018.12.01 void setup() { size(720, 720); colorMode(HSB, 360, 100, 100, 100); imageMode(CENTER); smooth(); noStroke(); noFill(); noLoop(); } void draw() { int frameCntMax = 30 * 6; float baseHue = random(360); GumowskiMira gm = new GumowskiMira(baseHue); background(0.0, 0.0, 0.0, 100.0); translate(width / 2 - 285, height / 2); for (int frameCnt = 0; frameCnt <= frameCntMax; ++frameCnt) { float frameRatio = map(frameCnt, 0, frameCntMax, 0.0, 1.0); blendMode(BLEND); backdrop(baseHue); blendMode(SCREEN); gm.draw(frameRatio); saveFrame("frames/" + String.format("%04d", frameCnt) + ".png"); } exit(); } /** * GumowskiMira calculate and draw points in style of Gumowski-Miradraw attractor. * @param baseHue 0.0 - 360.0 : color of draw points. */ private class GumowskiMira { // Gumowski-Mira parameters float pA; float pB; float pM; // original parameter, some catalyst float pC; // just a color float baseHue; GumowskiMira(float baseHue) { this.baseHue = baseHue; float pAmin = 0.00001; float pAmax = 0.01; float pBmin = 0.01; float pBmax = 0.7; float pMmin = 0.0001; float pMmax = 0.01; float pCmin = 0.00005; float pCmax = 0.0003; pA = -(pAmin + (pAmax - pAmin) * floor(random(3.0)) / 3.0); pB = -(pBmin + (pBmax - pBmin) * floor(random(5.0)) / 5.0); pM = -(pMmin + (pMmax - pMmin) * floor(random(5.0)) / 5.0); pC = +(pCmin + (pCmax - pCmin) * floor(random(3.0)) / 3.0); } /** * draw a shape base on Gumowski-Mira attractor. * @param frameRatio 0.0 - 1.0 : to use animate Gumowski-Mira attractor along frame. */ private void draw(float frameRatio) { noStroke(); float catalystDiv = map(frameRatio, 0.0, 1.0, TWO_PI * 0.56, TWO_PI * 0.71); // key of this code. make interesting shape float shapeRate = 1.0 - abs(map(frameRatio, 0.0, 1.0, -1.0, 1.0)); // 0.0 -> 1.0 -> 0.0 int drawCntMax = 80; int catalystCntMax = 400; for (int catalystCnt = 0; catalystCnt < catalystCntMax; ++catalystCnt) { catalystDiv += pC; float prevX = 0.0; float prevY = 0.0; float prevC = 0.0; for (int drawCnt = 0; drawCnt < drawCntMax; ++drawCnt) { // style of Gumowski-Mira attractor float x = (prevY + pA * (1 - pB * prevY * prevY) * prevY + calcFunc(prevX)) * map(sin(prevC), -1.0, 1.0, 0.96, 1.04); float y = (-prevX + calcFunc(x)) * map(sin(prevC), -1.0, 1.0, 1.04, 0.96); float c = prevC + catalystDiv; float size = map(catalystCnt, 0, catalystCntMax, 0.0, 4.0 + shapeRate * 8.0); fill( (baseHue + map(drawCnt, 0, drawCntMax, 0.0, 60.0)) % 360, map(drawCnt, 0, drawCntMax, 90.0, 0.0), map(catalystCnt, 0, catalystCntMax, 20.0, 0.0) * (1.5 - shapeRate), 100 ); ellipse( x * width * 0.14, y * height * 0.14, size, size ); prevX = x; prevY = y; prevC = c; } } } /** * main equation of Gumowski-Mira attractor. * @param x : just an input value of equation. */ private float calcFunc(float x) { return pM * x + 2 + (1 - pM) * x * x / (1 + x * x); } } /** * backdrop draw backdrop. * @param baseHue 0.0 - 360.0 : backdrop color. */ private void backdrop(float baseHue) { noFill(); strokeWeight(10.0); int radiusMin = 30; int radiusMax = ceil(width * 1.5); for (int radius = radiusMin; radius < radiusMax; radius += 5) { stroke( (baseHue + 30.0) % 360.0, 30, map(radius, radiusMin, radiusMax, 0.0, 20.0), 100 ); ellipse(280.0, 0.0, radius, radius); } } /* Copyright (C) 2018- 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/> */