Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsscclr/67e06020cf16563badcde3b7cff2ada7 to your computer and use it in GitHub Desktop.
Save jsscclr/67e06020cf16563badcde3b7cff2ada7 to your computer and use it in GitHub Desktop.
pseudo-code for perlin-noise based generative impressionist paintings
render
for each particle
x, y = particle.position
color = sample( colorMap, x, y )
noise = sample( noiseMap, x, y )
angle = noise * PI * 2
particle.velocity.add( cos(angle), sin(angle) )
particle.velocity.normalize()
drawParticle( particle, color )
#a crude way of killing off particles ...
particle.life -= drain
if (particle.life < 0)
particle.life = 1
particle.resetPosition()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment