xxxxxxxxxx
console.log("Lomz 2022");
console.log("https://www.lomz.net");
let wh;
let copyFromX;
let copyFromY;
let numberOfBgd = 5;
var bgd = [];
let bgd_tmp = [];
let randomBgd;
var glitchCopyX = 0;
var glitchCopyY = 0;
var pointX,
pointY,
pointX2,
pointY2 = 0;
var counter = 0;
var halfWH = 0;
var ranNubmer = 0;
var xStep = 0.004;
var yStep = 0.004;
var xNoise = 0;
var yNoise = 0;
var r,
t = 0;
var lineSize;
// **************************
// * Setup *
// **************************
function setup() {
wh = windowHeight;
createCanvas(wh, wh);
background(0);
for (var i = 0; i < numberOfBgd; i++) {
bgd_tmp[i] = createGraphics(wh, wh);
bgd_tmp[i].copy(bgd[i], 0, 0, bgd[i].width, bgd[i].height, 0, 0, wh, wh);
}
// Grain
p5grain.setup();
p5grain.setup({
ignoreWarnings: true,
ignoreErrors: true,
});
// noise seed
var mosaicSeed = fxrand() * 1000000;
noiseSeed(mosaicSeed);
console.log("Mosaic Seed: " + mosaicSeed);
randomBgd = int(get_random(0, 5));
console.log("Bgd: " + randomBgd);
let lineWidth = int(get_random(0.1, 0.02) * wh);
copyFromX = get_random(0, bgd_tmp[randomBgd].width);
copyFromY = get_random(0, bgd_tmp[randomBgd].height);
// layer 01
var hSize = 50;
for (var y = 0; y < width / 2; y = y + lineWidth) {
randomBgd = int(get_random(0, numberOfBgd));
for (var x = 0; x < height; x = x + hSize) {
copy(
bgd_tmp[randomBgd],
copyFromX,
copyFromY,
lineWidth,
hSize,
y,
x,
lineWidth,
hSize
);
}
copyFromX = get_random(0, bgd_tmp[randomBgd].width / 4);
copyFromY = get_random(0, bgd_tmp[randomBgd].height / 4);
}
// layer 02 - ??
// noprotect
var vStart = wh/get_random(3, 1.5);
for (i=0; i<6; i++) {
for (var y = 0; y < width / 2; y = y + lineWidth) {
randomBgd = int(get_random(0, numberOfBgd));
for (var x = vStart; x < height; x = x + hSize) {
copy(
bgd_tmp[randomBgd],
copyFromX,
copyFromY,
lineWidth,
hSize,
y,
x,
lineWidth,
hSize
);
}
copyFromX = get_random(0, bgd_tmp[randomBgd].width / 4);
copyFromY = get_random(0, bgd_tmp[randomBgd].height / 4);
}
//vStart = vStart + vStart;
}
for (i=0; i<10000; i++) {
push();
let cX = int(get_random(0, wh/2));
let cY = int(get_random(0, wh));
let c = get(cX, cY);
noStroke();
fill(c[0],c[1],c[2],200);
circle(cX, cY, int(get_random(0, wh/70)));
pop();
}
for (i=0; i<10000; i++) {
push();
let cX = int(get_random(0, wh/2));
let cY = int(get_random(0, wh));
let c = get(cX, cY);
noStroke();
fill(c[0],c[1],c[2],200);
circle(cX, cY, int(get_random(0, wh/100)));
pop();
}
// Flip
push();
scale(-1, 1);
copy(0, 0, wh / 2, wh, -wh, 0, wh / 2, wh);
pop();
// End flip
// Grain
granulateChannels(50);
// END
}
// **************************
// * Draw *
// **************************
function draw() {
}
// **************************
// * Save png *
// **************************
function keyTyped() {
if (key == "s" || key == "S")
save("Glitchy lines by Lomz: " + int(random(0, 1000)) + ".png");
}
// **************************
// * Random *
// **************************
function get_random(min, max) {
return min + fxrand() * (max - min);
}
// **************************
// * Preload *
// **************************
function preload() {
for (var i = 0; i < numberOfBgd; i++) {
bgd[i] = loadImage("bgd" + i + ".png");
}
}