https://slides.com/ahmadmoussa-3/creative-coding-generative-art
by https://x.com/gorillasu
https://timeline.lerandom.art Generative Art Timeline
https://x.com/gorillasu/status/1857444190910664749 example with p5js
https://openprocessing.org/sketch/2320206
example on fxHash https://www.fxhash.xyz/marketplace/generative/15063
colors palette : https://ronikaufman.github.io/color_pals/
colors manipulation js library : https://gka.github.io/chroma.js/
+ https://encycolorpedia.com/2b3c00
https://iquilezles.org/articles/distfunctions/ shapes and math
doc on fxHash : https://docs.fxhash.xyz/
Tricks :
- when playing with RGB, start from the median value 127.5 and move around +/- 127.5
- RGB + 2 chars => 2 chars of transparency
- cos/sin/tan [0..1] with frameCount native variable of p5js : use pi to divide values and have the last frame coincide with the first frame of the loop.
--- first example
let a = 1;
var b;
const windowWidth = 800;
const windowHeitgh = 800;
function setup() {
// attach a canvas element to the dom
createCanvas(windowWidth, windowHeitgh);
}
// runs continously for each frame of the video, unless noLoop() inside
function draw() {
// "#efface"
// "#decede"
background("#decede");
ellipse(100, 150, 100)
fill ("#efface")
rect (300, 200, 200)
noStroke()
stroke("blue")
}
-- animated
let a = 1;
var b;
const windowWidth = 400;
const windowHeitgh = windowWidth;
function setup() {
// attach a canvas element to the dom
createCanvas(windowWidth, windowHeitgh);
}
// runs continously for each frame of the video, unless noLoop() inside
function draw() {
// "#efface"
// "#decede"
background("#decede");
noStroke()
let t = frameCount
// for (let y = 0; y < 400; y=y+1){
// ellipse (200, y, 5)
// }
// console.log(frameCount/50)
for (let y = 0; y < 400; y=y+1){
fill(127.5 + sin (-frameCount/50 + y/20) * 127.5,
127.5 + sin (-frameCount/50 + y/20) * 127.5,
127.5 + sin (-frameCount/50 + y/20) * 127.5)
ellipse (200 + sin (-frameCount/50 + y/20) * 20,
y,
20 + cos (frameCount/30 + y/10) * 10)
}
}
--- moving, and colors changing (by me, inspired by GorillaSun)
let a = 1;
var b;
const windowWidth = 400;
const windowHeitgh = windowWidth;
let variation = 0
let variation2 = 2
function setup() {
// attach a canvas element to the dom
createCanvas(windowWidth, windowHeitgh);
frameRate(50) // frame / s
randomSeed(0) // so that random always does the same
variation = random(0, 80)
variation2 = random(100, 80)
}
let loopLength = 75
// runs continously for each frame of the video, unless noLoop() inside
function draw() {
// "#efface"
// "#decede"
background("#decede");
// trick to
let t = ( frameCount % loopLength ) / loopLength * 2 * PI;
// console.log(sin(PI))
// noStroke()
// for (let y = 0; y < 400; y=y+1){
// ellipse (200, y, 5)
// }
// console.log(frameCount/50)
for (let y = 0; y < 400; y=y+1){
stroke (127.5 + sin (-t + y/variation) * 127.5,
127.5 + sin (-t + y/20) * 127.5,
127.5 + sin (-t + y/variation2) * 127.5)
// fill(127.5 + sin (-t/50 + y/20) * 127.5,
// 127.5 + sin (-t/50 + y/20),
// 127.5 + sin (-t/50 + y/20) * 127.5)
noFill()
square (200 + sin (-t/50 + y/variation) * 20,
200 + tan (-t/50 + y/variation) * variation*variation/3,
20 + cos (t/30 + y/variation) * variation)
}
}
function keyPressed(){
console.log(keyCode)
if (keyCode == 56){
saveGif('annimation', 4)
}
}
--- other links and code from the presentation
(with : <script src="https://openprocessing.org/openprocessing_sketch.js"></script>