Skip to content

Add configurable animation overrides and smooth transitions#46

Merged
mrkai77 merged 2 commits into
mrkai77:mainfrom
Abeansits:feature/configurable-animations
Feb 18, 2026
Merged

Add configurable animation overrides and smooth transitions#46
mrkai77 merged 2 commits into
mrkai77:mainfrom
Abeansits:feature/configurable-animations

Conversation

@Abeansits
Copy link
Copy Markdown
Contributor

@Abeansits Abeansits commented Feb 13, 2026

Summary

  • Adds optional openingAnimation, closingAnimation, conversionAnimation properties to DynamicNotch — when set, they override the style's default animations. When nil (the default), behavior is unchanged.
  • Adds smoothTransition boolean — when true, expand() and compact() skip the intermediate hide step, converting directly between states for a faster, more fluid transition.
  • Makes isHovering publicly readable (public private(set)) so consumers can react to hover state changes.

All changes are additive and backwards-compatible. Existing consumers see no behavior change.

Motivation

When building an app that lives in the notch and toggles between compact/expanded on hover, the default expand() → hide → re-expand flow adds ~250ms of unnecessary delay. smoothTransition = true skips this, and custom animation durations allow tuning the feel for different use cases (e.g., snappier for interactive UIs, slower for notifications).

Making isHovering public enables reactive patterns like expand-on-hover without resorting to workarounds like NSEvent monitors.

Test Plan

  • swift build passes with no warnings
  • Verify default behavior unchanged (no properties set)
  • Verify smoothTransition = true skips hide step on compact↔expanded
  • Verify custom animation overrides are applied
  • Verify isHovering is readable from consuming modules

Add public properties to DynamicNotch for customizing animations:
- openingAnimation, closingAnimation, conversionAnimation: optional
  overrides that fall back to the style's defaults when nil
- smoothTransition: skips the intermediate hide step when converting
  between compact and expanded, for faster direct transitions
- isHovering: now publicly readable (was internal)

All changes are backwards-compatible — existing behavior is unchanged
when the new properties are left at their defaults.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Abeansits
Copy link
Copy Markdown
Contributor Author

@mrkai77 lemme know if you're open for this change, I think it gives users nice control over the animation

Copy link
Copy Markdown
Owner

@mrkai77 mrkai77 left a comment

Choose a reason for hiding this comment

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

Hey @Abeansits, this is definitely a welcome change!

The only thing I’d suggest is that, instead of providing an override for each animation individually, we introduce a dedicated struct called DynamicNotchTransitionConfiguration, with a default animation for each transition set in its initializer. I think that would help keep things more organized and make the API a bit cleaner.

I’d also recommend renaming smoothTransition to skipIntermediateHides, as that's a bit more descriptive of what it controls (and this can also move into DynamicNotchTransitionConfiguration).

Let me know if you’d like me to elaborate on any of this!

Replace individual animation properties and smoothTransition boolean
with a dedicated DynamicNotchTransitionConfiguration struct for a
cleaner API surface. Rename smoothTransition to skipIntermediateHides
for clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Abeansits
Copy link
Copy Markdown
Contributor Author

@mrkai77 those were reasonable comments! let me know your thoughts

@Abeansits
Copy link
Copy Markdown
Contributor Author

you good to merge now @mrkai77 ?

Copy link
Copy Markdown
Owner

@mrkai77 mrkai77 left a comment

Choose a reason for hiding this comment

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

Sorry I missed your comment! Yes, this is all good to merge now.

@mrkai77 mrkai77 merged commit cd0b3e5 into mrkai77:main Feb 18, 2026
@Abeansits Abeansits deleted the feature/configurable-animations branch March 5, 2026 08:23
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.

2 participants