[ Launch: those waves ] 6051808 by enjalot
[ Launch: those waves ] 6051794 by enjalot
-
-
Save enjalot/6051808 to your computer and use it in GitHub Desktop.
those waves
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":"those waves","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"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":false,"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/wfl8t6r.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
var svg = d3.select("svg"); | |
var num = 18; | |
var points = 50; | |
var yspace = 36; | |
var pi = Math.PI; | |
console.log(pi) | |
var waves = []; | |
d3.range(num).map(function(i) { | |
var wave = d3.range(points).map(function(p) { | |
var x = p; | |
var y = Math.random() * 12 * Math.sin(3.36*p/points) + 1; | |
return {x: x, y: y} | |
}) | |
waves.push(wave) | |
}) | |
var xscale = d3.scale.linear() | |
.domain([0, points]) | |
.range([50, tributary.sw - 50]) | |
var yscale = d3.scale.linear() | |
.domain([0, 10]) | |
.range([94,0]) | |
var line = d3.svg.line() | |
.x(function(d,i) { | |
return xscale(d.x); | |
}) | |
.y(function(d,i) { | |
return yscale(d.y); | |
}) | |
.interpolate("basis") | |
svg.selectAll("path.wave") | |
.data(waves) | |
.enter() | |
.append("path") | |
.classed("wave", true) | |
.attr("d", line) | |
.attr("transform", function(d,i) { | |
return "translate(" + [0, -1 + yspace * i] + ")" }); |
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
#display { | |
background-color: black; | |
} | |
.wave { | |
fill: #ffffff; | |
fill-opacity: 0.6; | |
stroke: #ACA7A7; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment