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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more