Mirrored Easing
A click on the title triggers a one-second animated transition of its background color from white to red and back to white. The example shows how to construct a mirrored easing function by composing an existing cubic-in-out easing with itself, so that the transition reaches its destination at the halfway point and then returns to its origin. The `mirror` function accepts either a function or a named easing string by invoking `d3.ease`, and the animation is driven through the `transition` API’s `duration` and `ease` methods on a D3 selection.
AI-generated descriptionThis example demonstrates mirroring an easing function such that the transition returns to its starting point upon completion. The mirror function takes an easing function as input (or the name of an easing function, such as “cubic”) and returns a mirrored easing function; the mirrored function reaches the transition destination at t = 0.5, and then returns to the transition origin at t = 1.0.