Skip to content

Instantly share code, notes, and snippets.

@andrusenn
Last active November 6, 2019 20:12
Show Gist options
  • Save andrusenn/c5557160e3b0bb6c0d3f87024e66b5f2 to your computer and use it in GitHub Desktop.
Save andrusenn/c5557160e3b0bb6c0d3f87024e66b5f2 to your computer and use it in GitHub Desktop.
EspiroNoise
/*
LeParc P5js Livecoder
snippet: espiro
class: EspinoNoise
*/
// Load Snippet
// Eval this first (Ctrl+Enter)
snip('espiro',()=>{
// using $ prefix to make it global
// utilizar $ para convertir la variable en global
$espiro = new EspiroNoise(width / 2, height / 2);
})
function draw() {
// zoom out
zoom(-0.005)
// EspiroNoise
if($espiro){
$espiro
.draw((x, y) => {
// Use x and y positions
stroke(255, 120)
strokeWeight(0.1)
point(x, y)
})
// Number of points / Catidad de puntos
.points(2000)
// Toggle friction [n * 0.992] to [n / 0.992]
// between parameters min 80px max 800px (distance to center)
// Invierte la friccion [n * 0.992] a [n / 0.992]
// entre los parametros 80px y 800px (distancia al centro)
.toggle(80, 800)
// set friction multiplier
.friction(0.992)
// Every 200 frames while 50 frames
if (gate(200, 50)) $espiro.radio(random(200, 800))
}
// mirroring image y axis
mirrorY()
// Frame to erase borders
rectMode(CORNER)
noFill()
stroke(0)
strokeWeight(8)
rect(0, 0, width, height)
}
@andrusenn
Copy link
Author

EspiroNoise

snippet for LeParc p5 Livecoder

load -> snip('espiro')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment