Description
JAN. 4 (credit: Piter Pasma)
Prompt: Pixels.
Created with Hydra.
/*
Crazy Pixels
by Daniel Oropeza
*/
if ( random()<0.5 ) { y = 0 } else { y = 0.5 }
r=random(1,4)
r2=random(1,2)
x=random(1,6)/10
cor = random(0, 1)
cor1 = random(0, 1)
cor2 = random(0, 1)
p=random(80, 120)
A = ()=> window.innerHeight/window.innerWidth
d=0.001
R1 = random()*(30-10)+10
R2 = random()*(800-160)+160
R3 = random()*(15-1)+1
R4 = random()*(50-1)+1
RA5 = [2,3,4,300];
R5 = RA5[Math.floor(random() * RA5.length)]
R6 = random()*(10-5)+5
if (R5 == 300) {
R7 = Math.PI/3;
R8 = .625;
R9 = -.1
}
else {
R7 = 0;
R8 = 1;
R9 = 0
}
rn=()=>Math.random()*random()*(.15-.75)+1
n=()=>shape(R5,rn)
.scale(2)
.kaleid(2).colorama(3)
.mult(osc(20,0.1,1).modulateRotate(osc(15)).hue(()=>time/2),[0.2,0].fast(4)).thresh([0,0.7].smooth())
.add(
shape([3,4,3].fast(0.5),0.6).scale(1,A,1)
.scrollX(0,.05).scrollY(0,.05).repeat(2,2)
.scrollX(()=>Math.sin(time)*0.1)
.rotate([Math.PI,0,1.5].fast(0.3))
.rotate(()=>Math.sin(time/4)*0.1)
)
m=()=>n().scale(()=>(Math.sin(time*3)+20)*0.01)
.scrollX(0.151).rotate(()=>(time)/r2)
.scrollX(()=>Math.sin(time*r)/10)
.scale(_ => (new Date)
.getSeconds() / 60 * 2 * Math.PI)
n()
.diff(n().scale(0.98)).modulateRepeat(solid(R1,R2,R3).pixelate(p,p),R1,R2)
.add(n().scale(0.1))
.add(m())
.add(m().rotate((Math.PI/x)+(Math.PI/x)*x/(x/0)))
.add(m().rotate((Math.PI/x)+(Math.PI/x)*x/(x/1)))
.add(m().rotate((Math.PI/x)+(Math.PI/x)*x/(x/2)))
.add(m().rotate((Math.PI/x)+(Math.PI/x)*x/(x/3)))
.add(m().rotate((Math.PI/x)+(Math.PI/x)*x/(x/4)))
.scrollY(.2511).thresh().invert().luma()
.pixelate(p,p)
.scale(1.5,innerHeight/innerWidth)
.add(o0)
.color(()=>((Math.sin(time/2)+0.1+cor)/2)
,()=>((Math.sin(time/2.5)+.1+cor1)/2)
,()=>((Math.sin(time/3)+.1+cor2)/2))
.saturate(0.5).colorama(random(0.002,0.08))
.out()
render(o0)
function random(min, max) {
let rand = Math.random();
if (typeof min === "undefined") {
return rand;
} else if (typeof max === "undefined") {
if (min instanceof Array) {
return min[Math.floor(rand * min.length)];
} else {
return rand * min;
}
} else {
if (min > max) {
const tmp = min;
min = max;
max = tmp;
}
return rand * (max - min) + min;
}
}
function map(current, in_min, in_max, out_min, out_max) {
return (
((current - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min
);
}