finishing UX updates on timer#8
Merged
Merged
Conversation
Call tick() at the top of start() so the clock displays immediately on initial load rather than after the first setTimeout fires at the next second boundary.
The timer panel starts hidden via the HTML 'hidden' attribute, so calling closePanel() at the end of init() was needlessly triggering the closing CSS animation on every page load.
- Drop position: absolute / top / left / transform: translateX(-50%) / z-index from #timer-panel so it stacks naturally below the toggle button inside the centered #clock-container. - Remove the matching translateX(-50%) terms from @Keyframes timer-panel-open and @Keyframes timer-panel-close. - Switch body overflow from 'hidden' to 'overflow-y: auto; overflow-x: hidden' so short viewports can still scroll to see the full panel.
Add a flipAnimateClockContainer helper that wraps the FLIP technique to smoothly slide #clock-container when the timer panel is added or removed (which re-centers the container in the body): - First: capture the container's current bounding rect. - Run the panel open/close mutation. - Last: capture the new rect, compute the delta, apply an inverted transform to keep the container visually pinned, then animate the transform back to identity in the next animation frame. - Lock body overflow during the transition so the page cannot scroll while the height changes (prevents a flash of the vertical scrollbar). - Clean up inline transition/transform/overflow on transitionend with a 400ms fallback. openPanel() and closePanel() now both delegate to the helper, so the clock slides down on open and up on close, making the toggle feel symmetric. The separate CSS timer-panel-close animation on the panel itself is no longer used (it was causing close to lag behind open).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
updates to presentation of the timer, including smoothing out the animations.