[ Launch: Tributary inlet ] 5612571 by enjalot
-
-
Save enjalot/5612571 to your computer and use it in GitHub Desktop.
Tributary inlet
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
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.6316353887399463,"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,"description":"Tributary inlet","fileconfigs":{"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"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}},"fullscreen":false,"thumbnail":"http://i.imgur.com/g4krjJh.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 xscale = d3.scale.linear() | |
.domain([0, 1]) | |
.range([0, 300]); | |
var brush = d3.svg.brush() | |
.x(xscale) | |
var slider = svg.append("g") | |
.attr("transform", "translate(" + [100, 100] + ")"); | |
var move = 0.01; | |
d3.select('body').on("keydown", function(){ | |
var ext = brush.extent() | |
var key = String.fromCharCode(d3.event.keyCode); | |
if(key === "%") { //left arrow key | |
ext[0] -= move; | |
if(d3.event.shiftKey) { | |
ext[1] -= move; | |
} | |
} else if(key === "'") { //right arrow key | |
ext[0] += move; | |
if(d3.event.shiftKey) { | |
ext[1] += move; | |
} | |
} | |
brush.extent(ext); | |
brush(slider) | |
}); | |
brush.extent([0.4, 0.6]); | |
brush(slider); | |
slider.selectAll("rect") | |
.attr("height", 59); |
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
.background { | |
visibility: visible !important; | |
fill: #949494; | |
} | |
.extent { | |
visibility: visible !important; | |
fill: #006DC2; | |
} | |
.resize rect { | |
visibility: visible !important; | |
fill: #37CECE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment