[ Launch: Tributary inlet ] 5612014 by hemulin
-
-
Save hemulin/5612014 to your computer and use it in GitHub Desktop.
Tributary inlet
This file contains hidden or 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":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"css.css":{"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} |
This file contains hidden or 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
path { | |
cursor: pointer; | |
fill: #eee; | |
stroke: #666; | |
stroke-width: 1.5px; | |
} | |
circle { | |
fill: steelblue; | |
stroke: white; | |
stroke-width: 1.5px; | |
} |
This file contains hidden or 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 w = 960, | |
h = 500; | |
var svg = d3.select("svg").append("svg:svg") | |
.attr("width", w) | |
.attr("height", h) | |
.append("svg:g") | |
.attr("transform", "translate(" + w / 2 + "," + h / 2 + ")"); | |
var path = svg.append("svg:path") | |
.attr("d", d3.svg.arc() | |
.innerRadius(h / 12) | |
.outerRadius(h / 6) | |
.startAngle(12.55) | |
.endAngle(Math.PI*2)); | |
var circle = svg.append("svg:circle") | |
.attr("r", 6.5) | |
.attr("transform", "translate(0," + -h / 3 + ")"); | |
function transition() { | |
circle.transition() | |
.duration(5000) | |
.attrTween("transform", translateAlong(path.node())) | |
.each("end", transition); | |
} | |
transition(); | |
// Returns an attrTween for translating along the specified path element. | |
function translateAlong(path) { | |
var l = path.getTotalLength(); | |
return function(d, i, a) { | |
return function(t) { | |
var p = path.getPointAtLength(t * l); | |
return "translate(" + p.x + "," + p.y + ")"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment