Skip to content

✨ [bento][amp-sidebar] Update animations to obey APIs mid-animation#32584

Merged
krdwan merged 14 commits intoampproject:masterfrom
krdwan:sidebar-animations
Feb 12, 2021
Merged

✨ [bento][amp-sidebar] Update animations to obey APIs mid-animation#32584
krdwan merged 14 commits intoampproject:masterfrom
krdwan:sidebar-animations

Conversation

@krdwan
Copy link
Copy Markdown
Contributor

@krdwan krdwan commented Feb 10, 2021

Sidebar tracker: #31366


open, close, toggle should update / reverse animations mid-animation

Prior to this change, if close was called while the sidebar was animating open, it would snap to a fully opened state and begin closing. Now, it will begin animating closed from whatever position it was in (so it will reverse from the current position). This can be done multiple times in a single animation by repeatedly calling close, open, close, ... or toggle, toggle, toggle....

Works in both directions: opening and closing.

How it works:

  1. Tracks the animation object (in a state variable) while animating and calls reverse() on it when the sidebar is told to animate in a different direction.

to do:

  • update tests (animation tests will need to be updated)

@krdwan krdwan requested a review from dvoytenko February 10, 2021 21:22
Copy link
Copy Markdown
Contributor

@caroqliu caroqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few questions

@krdwan krdwan merged commit 6130ded into ampproject:master Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants