Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Last active June 8, 2024 03:56
Show Gist options
  • Save n1ckfg/aec8a770e26a320c5b6e2bccf46ac8e8 to your computer and use it in GitHub Desktop.
Save n1ckfg/aec8a770e26a320c5b6e2bccf46ac8e8 to your computer and use it in GitHub Desktop.
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0
Nick Fox-Gieg / @n1ckfg / fox-gieg.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
p = new P5({mode: 'WEBGL'}) // loads p5js library, comment this line after using it once
p.hide() // hide p5js canvas.
rot = 0
rotDelta = 0
rotDeltaDelta = 0.02
rotDeltaMax = 0.6
p.setup = () => {
p.background(0)
}
p.draw = () => {
p.rotateY(p.radians(rot))
if (rotDelta < rotDeltaMax) {
rotDelta += rotDeltaDelta
}
rot += rotDelta
p.stroke(63, 1)
p.strokeWeight(4)
p.noFill()
p.beginShape()
for (let i=0; i<100; i++) {
x = p.random(p.height) - p.height/4
y = p.random(-p.height) + p.height/12
z = p.random(p.height)
p.vertex(x, y, z)
}
p.endShape()
}
s0.init({src: p.canvas})
// CNDSD / http://malitzincortes.net / crazy squares
src(s0)
.mult(osc(2, 3).modulate(osc(5).rotate(1.4,1),3))
.color(1,2,4)
.saturate(0.2)
.luma(1.2,0.05, (5, ()=> 2 + a.fft[3]))
.scale(0.6, ()=> 0.9 + a.fft[3])
.diff(o0)// o0
.out(o0)// o1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment