Cosmic Gobstoppers
Cosmic Gobstoppers
This little effect is based on Rainbow Storm by mathisvdr.
I converted the dweet to p5js. I have NO IDEA how the maths works! For a creative coder, my maths skills leave a lot to be desired! But, with a little bit of tweaking and research, I managed to create a nice sketch.
Dweets are interesting. They're golfed code. Golfed code comes from the game of golf, where you try to complete a hole in as little moves (par) as possible. Golfed code takes a block of code and strips it down to the bare minimum.
This is mathisvdr's golfed code, which would fit in a tweet as it is 138 characters long:
function u(t) {
c.style.filter='invert()';for(i=836;i--;x.fillRect(i%38*50+5,~~(i/38)*52+2,45,45))x.fillStyle=`hsl(${i*S(t)},99%,${S(i**3+t)**33*90+10}%)`
}
let t = 0;
function setup() {
createCanvas(400, 415);
colorMode(HSL, 360, 100, 100);
}
function draw() {
//background(220);
for (let i = 836; i > 0; i--) {
let hue = i * sin(t);
let light = pow(sin(pow(i, 3) + t), 33) * 90 + 10;
fill(hue, 99, light);
ellipse(20+(i % 8) * 50 + 5, 21+floor(i / 38) * 52 + 2, 45, 45);
}
t+=0.02;
Comments
Post a Comment