New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transition "step" events. #46
Comments
A simple text tweening implementation I use: var textTweenID = 0; transition.textTween = function(tween, precision) { /** @this {Element} */ function textTween(d, i) { var f = tween.call(this, d, i, this.textContent); return function(t) { this.textContent = f(t); }; } tweens["text." + textTweenID] = textTween; textTweenID++; return transition; }; transition.text = function(value) { return transition.textTween(d3_transitionTween(value)); }; Btw: I would love to see transition "step" events! |
Thanks for the suggestion. Text transitions will be in the next release! See commit @222629a7a774ce15f3c8 for details. I haven't decided whether to add "step" events yet. I'm a bit worried about the overhead on dispatching every tick times every element, when in the common case there is no step event listener. If I can find a way around that, it should be a no-brainer to add. |
Fixed in 2.0.0, using custom tweens. |
Should I write custom tween as in example above to fire |
Something like this: transition.tween("name", function(d, i) {
return function(t) {
// this function is called with the easing parameter t in [0,1]
};
}); The name is used as an identifier so that you can replace the tween later. For example, attr("foo", "bar") uses the name "attr.foo". |
And possibly allowing "text" tweening.
The text was updated successfully, but these errors were encountered: