玻璃搜索栏语音波纹
按住底部搜索栏,触发 1080ms 的双层渐变高光波纹,间距 200px,近处折射强、远处光效强。彩虹边光随波前升起,搜索栏变成毛玻璃。
灵感来自 X 上的一条帖子由 Now In Code 从零重建
import { Piece } from "./components";
export function Example() {
const progress = useSharedValue(0);
…
export function Example() {
const progress = useSharedValue(0);
…
Agent 提示词
Add the Now In Code component "glass-search-bar-voice-ripple" to this project. The full source is attached at the end of this prompt. Put the files under components/glass-search-bar-voice-ripple/, install the listed dependencies with `npx expo install`, and render it on a route I can open. Keep the timing and easing values documented in the source comments. Replace the sample copy and artwork with content from my app, or leave placeholders and list what I still need to supply. === Source files are attached here for paid plans ===
Pro 作品。提示词包含完整源码。开始使用
详情
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个媒体应用的首页,底部固定着一个玻璃搜索栏。点击该栏会从其中心向外发出一道圆形波纹,波纹填满屏幕时,语音面板随之打开。折射只出现在波前的窄环中,一旦波纹覆盖整个屏幕,就不再有任何扭曲的内容。按住麦克风按钮开始聆听,松开后结果以堆叠的海报卡片显示,卡片带有标题文字;关闭按钮则返回首页。演示模式会自动循环整个序列,互动模式则等待真实的按压。
实现方式
时间和几何由共享 JavaScript 文件中的一个纯函数决定。它接收当前时间以及打开、按下、松开、关闭事件的时刻,返回需要绘制的全部内容。组件用 react-native-svg 绘制形状、渐变和图标,并在 MaskedView 内使用 BlurView,使模糊仅作用于形状内部。requestAnimationFrame 循环提供时间,可通过时间缩放属性实现慢动作,通过冻结时间属性生成静态画面。仅着色的模式在不支持遮罩的环境中替代遮罩模糊。
适用场景
- 音乐、阅读或媒体应用中的搜索或语音助手入口
- 展开为全屏面板并带有触感揭示效果的底部栏
- 任何需要折射边缘而非普通淡入淡出的覆盖层过渡
依赖
react-native-svgexpo-blur@react-native-masked-view/masked-viewreact-native标签
AI 助手模糊过渡卡片卡片堆叠深色流体光效辉光渐变图标液态玻璃加载动画音乐音频霓虹科技按压反馈内容阅读搜索栏语音助手