Skip to content

Animation framework + Window open/close animations#131

Open
corradedied wants to merge 1 commit into
deividcomsono:mainfrom
corradedied:animations
Open

Animation framework + Window open/close animations#131
corradedied wants to merge 1 commit into
deividcomsono:mainfrom
corradedied:animations

Conversation

@corradedied

Copy link
Copy Markdown
Contributor

Animation Framework

Adds Library.Animations (default false), a single global toggle gating all UI animation in Obsidian, set via CreateWindow({ Animations = true }). This is meant to be the on/off switch for every animation added going forward, not just one feature — each future animation checks Library.Animations before tweening and falls back to the current instant behavior when it's off, so there's one flag for the user instead of one per animation. This PR only adds the window open/close fade. At a later date, more animations will be added in a different PR, including:

  • Tab Switch: Fade In/Wipe
  • Dropdown: Down/Up Animation
  • Groupbox Resized
  • Element Hidden/Revealed or Interface/Layout Modified
  • Notifications Layout Reorganized/Modified, etc.

Window Open/Close

When Library.Animations is enabled, toggling the window cross-fades every visible element instead of snapping Visible instantly — same technique as Linoria's toggle fade (per-descendant transparency tween, with a cached value to restore to on open).

Why a per-descendant cache instead of a flat tween: BackgroundTransparency/TextTransparency already vary per element (selected tab, slider fill, hover state), so fade-in can't target a flat 0 — it has to restore each element's actual prior value.

Why the cache refreshes on every close, not just once: dynamic elements like the selected tab change after the first capture. Caching once and reusing forever could restore stale state on reopen — wrong tab shown as "selected," or the active tab's highlight failing to fade because the cache thought it was already transparent. Fixed by re-capturing the live value every close.

Why backgrounds needed handling on TextButton/ImageButton too: buttons, sliders, and tabs are built on TextButton bases with real BackgroundColor3 fills, not just text containers — treating "has background" and "is text/image" as mutually exclusive silently skipped fading their backgrounds.
Window Open   Close

Implemented animation toggle framework and added support for animation toggling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant