Skip to main content
100%

Text Transition I

✓ Published0🌍 Public
FFrissAnalytics
Last edited Oct 5, 2018
Created on Oct 5, 2018

A large number in a heading transitions continuously between random values up to one million, using a tween to interpolate the numeric value and reformat it with comma separators via `d3.format`. The animation runs in a repeating loop, with each cycle lasting 2.5 seconds followed by a 1.5-second pause. The code uses D3 v4’s `transition.tween` and `d3.interpolateNumber` to smoothly change the text content, unlike `transition.text`, which only sets the value once.

AI-generated description

A demonstration of using transition.tween to interpolate text. The transition.text method doesn’t do this by default because it’s often distracting; instead, it just sets the new text value when the transition starts. Another way to transition text is to cross-fade.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/7004f92cac972edef365'>Text Transition I</a>

gpl-3.0 Licensed

Similar vizzes