feat(navigation): add WinUI indicator transition animation #1086
+575
−6
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.
Navigation Indicator Animation - WinUI 导航指示器过渡动画(重制版)
参照 WinUI3 NavigationView,为 PyQt-Fluent-Widgets 的导航组件添加平滑的指示器过渡动画。
view.mp4
演示
主要改动
新增文件
NavigationIndicatorAnimator类:管理指示器动画状态和逻辑_lastSelectMarkTop/Bottom、_selectMarkTop/Bottom_isMovingDown()使用全局坐标判断移动方向drawIndicator()支持树状菜单的左边距调整两阶段动画:
第一阶段(收缩):
_lastSelectMarkTop: 10 → 0)_lastSelectMarkBottom: 10 → 0)第二阶段(展开):
_selectMarkBottom: 0 → 10)_selectMarkTop: 0 → 10)动画参数
QEasingCurve.InOutSinemapToGlobal()获取全局坐标API
完整的演示代码位于
examples/navigation/navigation_indicator_animation/demo.py参考