全部组件
Light Sphere
通过球面灯位、色温、强度和光束参数,为图片建立可视化布光方案。
正在加载交互演示正在加载交互演示…
安装
pnpm dlx media-rig@latest add light-sphere目标项目使用 React 19 / Tailwind CSS 4。没有 components.json 时先运行 pnpm dlx media-rig@latest init。CLI 需要 Node.js 22.12+ 和 npm/npx。
pnpm 11 项目在 pnpm-workspace.yaml 合并以下配置,跳过浏览器不需要的 canvas 原生构建并统一 Three.js 类型:
allowBuilds:
canvas: false
overrides:
'@types/three': '^0.168.0'保留项目已有配置;已有 Three.js 依赖时先检查兼容性。示例素材和业务接口由宿主提供。
使用示例
属性
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| imageUrl | string | "/assets/photo-texture2.png" | LightSpherePanel 与 LightSphere 的预览图片。 |
| value / defaultValue | Partial<LightSpherePanelValue> | 50% · 5600K · 前方 · 透视 · 轮廓光开启 | 面板的受控状态或初始状态。 |
| onChange | (value) => void | undefined | 滑杆、视角、方向预设、轮廓光和拖拽灯位的状态更新。 |
| onChangeEnd | (value) => void | undefined | 调节完成后提交完整状态。 |
| onClose | () => void | undefined | 提供时显示关闭按钮。 |
| onAction | ({ value, input }, event) => void | undefined | 应用当前打光方案;轮廓光作为输出参数传递。 |
| actionButton | ComponentType<LightSphereActionButtonProps> | 内置按钮 | 可注入自定义操作按钮,接收 value、input、disabled 和 loading。 |
| actionLoading / actionDisabled | boolean | false | 处理中状态和禁用状态。 |