Add configurable animation overrides and smooth transitions#46
Conversation
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>
|
@mrkai77 lemme know if you're open for this change, I think it gives users nice control over the animation |
There was a problem hiding this comment.
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>
|
@mrkai77 those were reasonable comments! let me know your thoughts |
|
you good to merge now @mrkai77 ? |
mrkai77
left a comment
There was a problem hiding this comment.
Sorry I missed your comment! Yes, this is all good to merge now.
Summary
openingAnimation,closingAnimation,conversionAnimationproperties toDynamicNotch— when set, they override the style's default animations. Whennil(the default), behavior is unchanged.smoothTransitionboolean — whentrue,expand()andcompact()skip the intermediate hide step, converting directly between states for a faster, more fluid transition.isHoveringpublicly 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 = trueskips this, and custom animation durations allow tuning the feel for different use cases (e.g., snappier for interactive UIs, slower for notifications).Making
isHoveringpublic enables reactive patterns like expand-on-hover without resorting to workarounds like NSEvent monitors.Test Plan
swift buildpasses with no warningssmoothTransition = trueskips hide step on compact↔expandedisHoveringis readable from consuming modules