Skip to content

Instantly share code, notes, and snippets.

@zellyn
Created June 11, 2014 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zellyn/e881ac86e0b636984bdf to your computer and use it in GitHub Desktop.
Save zellyn/e881ac86e0b636984bdf to your computer and use it in GitHub Desktop.
tinkerbell
{"description":"tinkerbell","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/7qOj72z.png"}
// http://en.wikipedia.org/wiki/Tinkerbell_map
var svg = d3.select("svg");
var data = [];
var iterations = 20000;
var xscale = d3.scale.linear().domain([-1.3, 0.5]).range([0, tributary.sw]);
var yscale = d3.scale.linear().domain([-1.6, 0.6]).range([tributary.sh, 0]);
var x = -0.72, y = -0.64;
var a = 0.9, b = -0.6013, c = 2.0, d = 0.5;
for (var i = 0; i < iterations; i++) {
var oldX = x;
x = Math.pow(x,2) - Math.pow(y,2) + a*x + b*y;
y = 2*oldX*y + c*oldX + d*y;
data.push({ x: x, y: y});
}
svg.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("cx", function(d) { return xscale(d.x); })
.attr("cy", function(d) { return yscale(d.y); })
.attr("r", 1.5)
.attr("fill", "darkblue")
.attr("opacity", 0.3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment