Last active
April 6, 2017 13:19
Star
You must be signed in to star a gist
function for crossfade transition of text using d3 based on this block: https://bl.ocks.org/mbostock/f7dcecb19c4af317e464
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
function transition_text(element_id, display_text, t_duration){ | |
// base off of https://bl.ocks.org/mbostock/f7dcecb19c4af317e464 | |
svg.select(element_id) | |
.transition() | |
.duration(t_duration) | |
.on("start", function () { | |
var t = d3.active(this) | |
.style("opacity", 0) | |
.remove(); | |
svg.select(element_id) | |
.style("opacity", 0) | |
.text(display_text) | |
.transition(t) | |
.style("opacity", 1) | |
.transition() | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment