Last active
August 29, 2015 14:23
-
-
Save ningunaparte/f22aa3a87ea07d02cd55 to your computer and use it in GitHub Desktop.
D3 transition "onComplete"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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