feat(capsule): AudioBars 用 cubic-bezier 缓动 + 加长 transition#283
Merged
Conversation
用户反馈:录音胶囊的语音条 UI 跳转有问题——目前是圆形跳成矩形, 视觉效果不自然,且存在卡顿,动效不够优雅、速度太快。 根因:AudioBars 每个 bar 的 height 跟随 audio level 在 2~24px 之间 变化(width=3 + borderRadius:999,height=2 像圆点、height=24 像 长条),但 transition 只有 0.08s。audio level 来自后端 RMS 回调, 60Hz 高频更新;每次 React re-render 修改 inline style.height 都重启 transition 动画。0.08s 在持续 retrigger 场景下永远在动画前段, 视觉上是阶梯式跳变("圆形跳成矩形"+ 卡顿)。 修复:transition 0.08s → 0.18s + cubic-bezier(0.22, 1, 0.36, 1) (easeOutExpo-like),让多次 update 在曲线内平滑混合,圆→长条 的形变变得自然顺滑。0.18s 仍跟得上音量节奏,不影响响应感。
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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.
User description
用户反馈
录音胶囊的语音条 UI 跳转有问题——目前是圆形跳成矩形,视觉效果不自然,且存在卡顿;动效不够优雅、速度太快。
根因
AudioBars 每个 bar 的 `height` 跟随 audio level 在 `2~24px` 间变化(`width=3`、`borderRadius:999`,height=2 视觉为圆点、height=24 为长条),但 transition 只有 `0.08s`。
audio level 由后端 RMS 回调驱动 ~60Hz 更新,每次 React re-render 修改 `inline style.height` 都重启 transition 动画——`0.08s` 在持续 retrigger 下永远卡在动画前段,视觉上是阶梯式跳变("圆形跳成矩形" + 卡顿)。
修复
`Capsule.tsx:48` 的 transition:
```diff
```
Test plan
PR Type
Bug fix, Enhancement
Description
延长 transition 至 0.18s,避免高频 update 中断动画
改用 cubic-bezier 缓动实现平滑圆形→长条形变
添加注释记录根因与修复思路
Diagram Walkthrough
File Walkthrough
Capsule.tsx
延长过渡并改用 cubic-bezier 缓动平滑动画openless-all/app/src/components/Capsule.tsx