Skip to content
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

Adding a method to stack transitions in objects with several parts #149

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

carlosvpi
Copy link

What

This PR adds a call named stackTransition that enables composite shapes (like a pie chart or a stacked bar in a bar chart) have a coherent transition.

image

This solution allows to use any easing function (d3 or custom), and the composite object will transition, as a whole, the same way a simple one would, giving a smooth feeling to the overall animation.

Stacking.transitions._.Carlos.Vazquez._.Observable.mp4

How

stackTransition sets the delay, duration and easeVarying of each component inside the composite element.
They all start the transition at the same time as the overall figure (same delay) and take the same time for the transition (same duration).

The ease of each element varies, however, in such a way that t becomes 0 before their time to start, and 1 when they finished. All elements have the easing parameter (t) bound to [0, 1], except the first, which is open on the left (can go below 0) and the last, which is open on the right (can go above 1), in order to allow for any easing that goes beyond 0 or 1 at any point (like elastic easing)

Example

https://observablehq.com/@carlos-vazquez/stacking-transitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant