💧 Ripple Effect Generator
📐 计算公式 / 原理
颜色解析:#RRGGBB → rgba(R, G, B, 0.5);涟漪直径 = max(盒宽, 盒高);圆心定位 = 点击坐标 − 盒子偏移 − 半径;动画 scale(0) → scale(4) 后淡出,时长 dur 秒自动移除
涟漪动效 = 点击处生成圆形伪元素并放大 + 淡出(transform / opacity 过渡);参数化颜色、扩散半径与时长并导出 CSS / JS,用于 Material 风格按钮。
📚 深度解析:涟漪效果生成器
💡 常见使用场景
- 按钮反馈。
- 卡片点击。
- Material 风格。
生成水波点击
输入:色 #FF6B35、0.6s。
处理:生成扩散动画。
输出:代码与预览。
❓ 常见问题(FAQ)
- 要 JS 吗?
- 纯 CSS 难定位点击点,精准涟漪通常需少量 JS 驱动。
- 涟漪色怎么定?
- 取半透明主题色,浅底上更明显;可随组件配色调整。
- 会保存或上传我的内容吗?
- 结果以浏览器实时计算为准,纯前端本地处理、数据不上传;生成的样式与代码仅作快速产出参考,正式项目请以设计系统、规范与浏览器实测为准。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Ripple radius | radius spans the distance from the touch point to the farthest corner | Euclidean geometry |
| Compositor animation | animating transform and opacity stays on the compositor | CSS Transforms Level 1 |
| Motion preference | shorten or drop the ripple under reduced motion | WCAG 2.2 (2.3.3) |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准