
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@chronoslu/advanced-liquid-glass
Advanced tools
A highly customizable liquid glass effect component for React, supporting multiple presets and advanced visual effects.
一个高度可定制的React液体玻璃效果组件,支持多种预设和高级视觉效果,如扭曲、颗粒和色散。

npm install @chronoslu/advanced-liquid-glass
使用组件最简单的方法是选择一个内置预设。
import AdvancedLiquidGlass from '@chronoslu/advanced-liquid-glass';
function MyComponent() {
  return (
    <AdvancedLiquidGlass preset="vintage-lens" draggable={true}>
      <div style={{padding: '20px', color: 'white'}}>
        您的内容
      </div>
    </AdvancedLiquidGlass>
  );
}
我们的预设经过精心设计,提供多种开箱即用的美学风格。
| 预设 | 描述 | 
|---|---|
| default | 平衡干净的起始点,具有微妙的效果。 | 
| classic | 原始可拖拽模板,具有清晰的交互感。 | 
| strong-effect | 高对比度和饱和度,模仿早期JS演示的效果。 | 
| deep-polarizer | 模拟偏振滤镜,创造深邃色彩和深色调。 | 
| gentle-frost | 柔和、重度模糊的玻璃,非常适合模态框和覆盖层。 | 
| physical-grain | 厚重的磨砂玻璃,具有有形的凹凸纹理。 | 
| vintage-lens | 模拟老式相机镜头的色散和暖色调。 | 
| film-grain | 添加微妙的胶片质感,带来一丝怀旧感。 | 
为了完全控制,您可以覆盖任何预设参数或通过传递单独的属性从头构建自己的效果。
| 属性 | 类型 | 默认值 | 描述 | 
|---|---|---|---|
| preset | string | 'default' | 用作基础的预设名称。 | 
| width | number | 300 | 组件宽度(像素)。 | 
| height | number | 200 | 组件高度(像素)。 | 
| borderRadius | number | 30 | 组件边框圆角(像素)。 | 
| draggable | boolean | false | 如果为 true,组件变为可拖拽。 | 
| 属性 | 类型 | 默认值(来自预设) | 描述 | 
|---|---|---|---|
| blur | number | 0.25 | 高斯模糊强度。更高的值创造更磨砂的外观。 | 
| contrast | number | 120 | 对比度百分比。 100为正常。值 > 100 增加对比度。 | 
| brightness | number | 105 | 亮度百分比。 100为正常。 | 
| saturate | number | 110 | 饱和度百分比。 100为正常。 | 
| tintColor | string | '#ffffff' | 应用于玻璃的有色色调的十六进制颜色字符串。 | 
| tintOpacity | number | 0 | tintColor层的不透明度(从 0 到 1)。 | 
| distortion | number | 1.0 | 交互式扭曲效果的整体强度。 | 
| distortionRadius | number | 0.15 | 鼠标交互区域的半径,作为组件大小的百分比(0-1)。 | 
| distortionFalloff | number | 0.8 | 控制扭曲效果在半径边缘的衰减锐度。 | 
| grain | number | 0 | 添加简单的均匀噪声层。适用于基本磨砂效果(0-1)。 | 
| organicGrain | number | 0 | 添加高级的基于物理的颗粒,具有模拟光照。更真实但资源密集(0-1)。 | 
| chromaticAberration | number | 0 | 边缘颜色通道分离的强度,以像素为单位测量。 | 
import AdvancedLiquidGlass from '@chronoslu/advanced-liquid-glass';
function App() {
  return (
    <AdvancedLiquidGlass preset="gentle-frost" draggable={true}>
      <div style={{ padding: '20px', color: 'black' }}>
        <h3>柔和磨砂</h3>
        <p>这是一个使用柔和磨砂预设的示例。</p>
      </div>
    </AdvancedLiquidGlass>
  );
}
import AdvancedLiquidGlass from '@chronoslu/advanced-liquid-glass';
function App() {
  return (
    <AdvancedLiquidGlass
      preset="default"
      width={400}
      height={250}
      borderRadius={20}
      draggable={true}
      blur={0.5}
      contrast={150}
      brightness={110}
      saturate={120}
      tintColor="#ff6b6b"
      tintOpacity={0.1}
      distortion={1.5}
      organicGrain={0.3}
    >
      <div style={{ padding: '30px', color: 'white' }}>
        <h2>自定义玻璃效果</h2>
        <p>这个示例展示了如何自定义各种属性。</p>
      </div>
    </AdvancedLiquidGlass>
  );
}
import AdvancedLiquidGlass from '@chronoslu/advanced-liquid-glass';
function App() {
  const presets = ['default', 'classic', 'strong-effect', 'vintage-lens'];
  
  return (
    <div style={{ display: 'flex', gap: '20px', flexWrap: 'wrap' }}>
      {presets.map(preset => (
        <AdvancedLiquidGlass key={preset} preset={preset} draggable={true}>
          <div style={{ padding: '20px', color: 'white' }}>
            <strong>{preset}</strong>
          </div>
        </AdvancedLiquidGlass>
      ))}
    </div>
  );
}
MIT
chronos
欢迎提交 Issue 和 Pull Request!
FAQs
A highly customizable liquid glass effect component for React, supporting multiple presets and advanced visual effects.
The npm package @chronoslu/advanced-liquid-glass receives a total of 34 weekly downloads. As such, @chronoslu/advanced-liquid-glass popularity was classified as not popular.
We found that @chronoslu/advanced-liquid-glass demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.