Made to satisfy multiple Genuary 2025 prompts: Draw one million of something (1/8--notched squares); Impossible day (1/11--algorithmic composition feels impossible to me!); Subdivision (1/12); Generative palette (1/16).
“Draw One Million Of Something, Genuary 2025” by Taupelink
https://openprocessing.org/sketch/2505147
License CreativeCommons Attribution NonCommercial ShareAlike
https://creativecommons.org/licenses/by-nc-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
Click to show a new variant
A fork of Layers Upon Layers Upon Layers, Genuary 2025 by Taupelink
CC Attribution NonCommercial ShareAlike
Draw One Million Of Something, Genuary 2025
xxxxxxxxxx
let ElapsedFrames = 0;
let MaxElapsedFrames = 0;
let ElapsedFills = 0;
let MyHue = 0;
let MyHueDelta = 1;
let MyWidth = 512;
let MyHeight = 512;
let MyMinDim = Math.min(MyWidth, MyHeight);
let MyR = 0;
let VertOverHoriz=0;
let DrawCountPerFrame = 250;
let MaxDrawCount = 1000000;
let MyObject = {};
let MyIndex = 0;
function RandomTweakScale(argX) {
return (0.95+0.1*random())**6*argX;
}
class MyRegion {
constructor(argLevel, argX, argY, argW, argH) {
let BigSubregionTowardBottom, BigSubregionTowardRight;
this.Level=argLevel;this.X=argX; this.Y=argY; this.W=argW; this.H=argH; this.Hue=MyHue; this.Index = MyIndex++;
fill(MyHue%360,80,50,15/0.9**argLevel);
stroke(0,0,0,3);
rect(argX,argY,argW,argH);
MyHue += MyHueDelta*1.01**this.Index;
if (argLevel<=2 || (argLevel<12 && argW >= 96 && argH >= 96)) {
BigSubregionTowardBottom = (random() > 0.5);
BigSubregionTowardRight = (random() > 0.5);
// process big subregion
MyObject.Regions.push(new MyRegion(
argLevel+1,
BigSubregionTowardRight?argX+argW/3:argX,BigSubregionTowardBottom?argY+argH/3:argY,
argW*2/3,argH*2/3));
if (argLevel<=1||random()>(VertOverHoriz?0.3:0.2)) {
// process horizontal neighbor of big subregion
MyObject.Regions.push(new MyRegion(
argLevel+(VertOverHoriz?1:2),
BigSubregionTowardRight?argX:argX+argW*2/3,BigSubregionTowardBottom?argY+argH/3:argY,
argW/3,argH*2/3));
}
if (argLevel<=1||random()>(VertOverHoriz?0.2:0.3)) {
// process vertical neighbor of big subregion
MyObject.Regions.push(new MyRegion(
argLevel+(VertOverHoriz?2:1),
BigSubregionTowardRight?argX+argW/3:argX,BigSubregionTowardBottom?argY:argY+argH*2/3,
argW*2/3,argH/3));
}
if (argLevel==0||random()>0.5) {
// process small subregion
MyObject.Regions.push(new MyRegion(
argLevel+2,
BigSubregionTowardRight?argX:argX+argW*2/3,BigSubregionTowardBottom?argY:argY+argH*2/3,
argW/3,argH/3));
}
} // if (level is OK and/or random draw succeeds) ...
} // constructor
} // class MyRegion
function StartNewImage() {
background(255);
VertOverHoriz=(random()>0.5);
MyHue = random()*360;
MyHueDelta = (random()>0.5?1:-1)*(1 + random()**20*2);
MyObject.Regions=[];
MyIndex = 0;
MyObject.Regions.push(new MyRegion(0,0,0,MyWidth,MyHeight));
MyObject.RegionCount=MyObject.Regions.length;
MyIndex = MyObject.RegionCount-1;
ElapsedFrames = 0;
MaxElapsedFrames = MaxDrawCount / MyObject.RegionCount / DrawCountPerFrame + 1 | 0;
// console.log("Count of regions: " + MyObject.RegionCount + ", max elapsed frames " + MaxElapsedFrames);
ElapsedFills = 0;
}
function setup() {
createCanvas(MyWidth, MyHeight);
colorMode(HSB, 360, 100, 100, 100);
StartNewImage();
}
function draw() {
if (MyIndex>=0) {
translate(MyObject.Regions[MyIndex].X,MyObject.Regions[MyIndex].Y);
let MyScaleW=MyObject.Regions[MyIndex].W/MyWidth;
let MyScaleH=MyObject.Regions[MyIndex].H/MyHeight;
let MyScale=min(MyScaleW,MyScaleH);
MyHue=MyObject.Regions[MyIndex].Hue;
for (i=DrawCountPerFrame;i--;) {
MyHue += (random() > 0.5 ? 1 : -1) * (0.05 + random()*0.045);
if (MyHue < 0) MyHue += 360;
fill(MyHue % 360, 40/0.95**MyIndex+10*random(), 65/0.991**ElapsedFills+30*random()**80,
0.3+20*random()**120*0.995**ElapsedFills);
if(random()>0.95) {
stroke(0,0,0,20*random()**(400-i|0)*0.992**ElapsedFills);
strokeWeight(0.75 + 20*0.6**(200-i/2|0)*0.985**MyObject.Regions[MyIndex].Level);
} else noStroke();
beginShape();
SQLeft = MyWidth*MyScaleW*(random()*0.8+0.02);
SQTop = MyHeight*MyScaleH*(random()*0.8+0.02);
SQSide = RandomTweakScale(MyMinDim*MyScale*(0.2-random()**8*0.1));
CSI = 4 * random() | 0; // Concave Side Index
vertex(SQLeft, SQTop);
if (CSI == 0) {
vertex(SQLeft+SQSide/2, SQTop);
vertex(SQLeft+SQSide/2, SQTop+SQSide/2);
}
vertex(SQLeft+SQSide, SQTop);
if (CSI == 1) {
vertex(SQLeft+SQSide, SQTop+SQSide/2);
vertex(SQLeft+SQSide/2, SQTop+SQSide/2);
}
vertex(SQLeft+SQSide, SQTop+SQSide);
if (CSI == 2) {
vertex(SQLeft+SQSide/2, SQTop+SQSide);
vertex(SQLeft+SQSide/2, SQTop+SQSide/2);
}
vertex(SQLeft, SQTop+SQSide);
if (CSI == 3) {
vertex(SQLeft, SQTop+SQSide/2);
vertex(SQLeft+SQSide/2, SQTop+SQSide/2);
}
endShape(CLOSE);
}
ElapsedFrames++;
if (ElapsedFrames == MaxElapsedFrames) {
ElapsedFills++;
MyIndex--;
ElapsedFrames = 0;
} // if (ElapsedFrames == MaxElapsedFrames)
} // if (MyIndex>0) ...
}
function mouseClicked() {
StartNewImage();
}
See More Shortcuts
Please verify your email to comment
Verify Email