Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created March 31, 2013 03:05
Show Gist options
  • Save enjalot/5279342 to your computer and use it in GitHub Desktop.
Save enjalot/5279342 to your computer and use it in GitHub Desktop.
#352 Orbital
{"description":"#352 Orbital","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":true,"loop":true,"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/FXFJkvZ.png"}
//http://geometrydaily.tumblr.com/post/38147826501/352-orbital-this-is-so-simple-just-a-bunch-of
//@tilman
var svg = d3.select("svg");
var n = 13;
var xoffset = 32;
tributary.loop_type = "pingpong";
tributary.duration = 3000
var cx = tributary.sw/2;
var cy = tributary.sh/2;
var radius = 200;
var defs = svg.append("defs")
defs.append("clipPath")
.attr("id", "circleclip")
.append("circle")
.attr({
cx: cx,
cy: cy,
r: radius + 2
})
tributary.init = function(g, j) {
var circleg = g.append("g")
.attr("clip-path", "url(#circleclip)")
circleg.selectAll("circle.circle")
.data(d3.range(n))
.enter()
.append("circle")
.classed("circle", true)
.attr({
cx: function(d,i) { return cx + (i+1) * xoffset },
cy: cy,
r: radius
// "stroke-width": j+1
})
}
tributary.run = function(g,t,j) {
g.selectAll("circle.circle")
.attr({
cx: function(d,i) { return cx + (i+1) * (xoffset * t) },
cy: cy,
r: radius
})
}
circle {
fill: none;
stroke: #170053;
stroke-width: 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment