[ Launch: perlin circles ] 5110744 by enjalot
[ Launch: perlin worms ] 5062100 by enjalot
[ Launch: perlin noise ] 5062000 by enjalot
[ Launch: perlin noise ] 5061982 by enjalot
-
-
Save enjalot/5110744 to your computer and use it in GitHub Desktop.
perlin circles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"perlin circles","endpoint":"","display":"svg","public":true,"require":[{"name":"perlin","url":"https://raw.github.com/josephg/noisejs/master/perlin.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":true,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/KOrPW4A.png"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//playing with noise.js from Joseph Gentle | |
//https://github.com/josephg/noisejs | |
var n = 1000; | |
var period = 0.15; | |
var rbase = 5; | |
var r = tributary.sw/100; | |
var xspace = 25; | |
var nx = n/(r+xspace) | |
var yspace = 25; | |
var z = 0; | |
var zspeed = 0.01; | |
//noise.seed(Math.random()); | |
var particles = d3.range(n).map(function(i) { | |
return { | |
x: (i % nx) * (r + xspace), | |
y: Math.floor(i/nx) * (r + yspace), | |
r: r | |
} | |
}); | |
var svg = d3.select("svg"); | |
var parts = svg.selectAll("circle.particle") | |
.data(particles) | |
.enter() | |
.append("circle") | |
.classed("particle", true) | |
.attr({ | |
cx: function(d) { return d.x }, | |
cy: function(d) { return d.y }, | |
r: function(d) { return d.r } | |
}) | |
.style({ | |
"fill": "#198CB1", | |
"fill-opacity": 0.5, | |
"stroke": "#65119C", | |
"stroke-opacity": 0.91, | |
"stroke-width": 2.56 | |
}) | |
//v = noise.simplex2(p.x * period, p.y * period); | |
tributary.run = function(g,t) { | |
parts.attr({ | |
r: function(d,i) { | |
v = noise.simplex3(d.x * period, d.y * period, z); | |
return rbase + (r * v + 5); | |
} | |
}) | |
z += zspeed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment