Skip to main content
100%

Non-Computed Style Tween

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Oct 9, 2013

This example demonstrates how to animate a non-computed style property using D3 v3’s transition system. It changes the page background from brown to steelblue to black over two sequential 750-millisecond transitions. The code defines a custom `styleTween` function that calls `transition.styleTween` with `d3.interpolate`, reading the current style value directly from `this.style[name]` instead of relying on computed styles. This approach keeps the tween targeted and efficient, showing a pattern for interpolating inline CSS values during animations.

AI-generated description

An example of using transition.styleTween to avoid using the computed style value, and instead use the style value as-set.

gpl-3.0 Licensed

Similar vizzes