Skip to main content
100%

Custom Easing

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

Four orange squares fall onto a gray canvas, each using a custom parameterized bounce easing function with different heights. The example shows how to implement a custom easing function for D3 v3 transitions, where the function must return 1 when t ≥ 1 to end correctly. Using `d3.select`, `transition`, and `.ease()`, four squares animate sequentially with a delay, demonstrating SVG rendering and animation with `d3.scale.ordinal` for positioning.

AI-generated description

An example of how to implement a custom easing function, here a parameterized bounce. Custom easing functions must return 1 when t ≥ 1, or else transitions will not end on the desired value.

(Warning: many people believe “bounce” easing is gimmicky, and recommend you use the default “cubic-in-out” instead!)

gpl-3.0 Licensed

Similar vizzes