情绪打卡渐变卡片轮播
衬线大标题询问心情,下方 Calm、Anxious、Happy 三张渐变卡可横向滑动吸附,选中时放大;底部有玻璃返回钮、输入条和麦克风。HTML 与 React Native 共用 core。
灵感来自 Pinterest 上的一条帖子由 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 "mood-check-in-gradient-card-carousel" to this project. The full source is attached at the end of this prompt. Put the files under components/mood-check-in-gradient-card-carousel/, 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 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个询问用户当前心情的问卷页面。温暖的桃色背景上,一个柔和模糊的人形剪影在底部渐变为橙色。居中的衬线标题下方是一排三张心情卡片,每张都是由柔和色块组成的抽象渐变,并带有文字标签。拖动这排卡片时,卡片跟随手指移动,到达两端时会拉伸,松手后吸附到最近的卡片。点按中间的卡片会将其选中,放大并增亮轮廓,其他卡片则缩小变暗;再点一次则取消选中。底部的玻璃条可以输入文字,两侧分别是返回按钮和麦克风按钮,按下时都会缩小。
实现方式
所有视觉元素都通过 react-native-svg 程序化绘制。背景和每张卡片都是由椭圆堆叠而成,其径向渐变的衰减近似广义高斯分布,因此没有模糊滤镜,也没有照片。共享 JavaScript 核心维护一个包含 init、step、act、settled 函数的小型状态机,并返回组件渲染的显示列表。requestAnimationFrame 循环只在状态稳定之前运行。PanResponder 处理轮播拖动和点按,一个透明的 TextInput 覆盖在玻璃条上以唤起键盘。文字按基线定位。
适用场景
- 心情、日记或身心健康的签到,选项数量有限
- 引导流程中的提问步骤,底部带有类似聊天的输入框
- 需要与分辨率无关、资源占用很小的渐变艺术
依赖
react-native-svgreact-native标签
卡片轮播情感陪伴渐变健康健身日记写作按压反馈柔和治愈状态切换输入框