Skip to content

Instantly share code, notes, and snippets.

@ningunaparte
Last active August 29, 2015 14:23
Show Gist options
  • Save ningunaparte/f22aa3a87ea07d02cd55 to your computer and use it in GitHub Desktop.
Save ningunaparte/f22aa3a87ea07d02cd55 to your computer and use it in GitHub Desktop.
D3 transition "onComplete"
//Cuando finalizan todas las animaciones ejecuta el callback
function endAll(transition, callback) {
var n = 0;
transition.each(function() { ++n; })
.each('end', function() {
if (!--n) callback.apply(this, arguments);
});
}
// Usage
// d3.selectAll('g').transition().call(endAll, allDone);
//via https://gist.github.com/miguelmota/3faa2a2954f5249f61d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment