Published
Edited
Jan 31, 2021
19 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
animationBefore = {
function mySvg(contents) {
// Note that this svg is 1x1. It is not a giant overlay.
// See http://simblob.blogspot.com/2016/10/outside-box.html
return svg`<svg width=1 height=1 style="overflow:visible;position:absolute;left:0;top:0;z-index:5">${contents}</svg>`;
}
// There's a cycle here: in order to build the SVG I need to know its
// position. But I can't know its position until I return it. And I can't
// return it until I build it. Checkmate. But no! @mbostock gave me this
// clever trick: yield the partial svg, grab its position, then yield the
// full svg. Haha!
let element = mySvg("");
yield element;
// Here's where I grab the positions of the other SVGs as well as myself,
// and then I can calculate the positions of the other SVGs relative to
// myself, and that lets me position elements so that they will sit on top
// of or in between the other SVGs on the page.
let fromRect = terrainBefore.getBoundingClientRect();
let toRect = distributionBefore.getBoundingClientRect();
let myRect = element.parentNode.getBoundingClientRect();
yield mySvg(svgAnimatedMarkers(sortedTerrain, fromRect, toRect, myRect));
}

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more