@mizuui/liquid-glass-core 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/filter.js +1 -1
- package/src/glass.js +14 -4
- package/src/styles.js +1 -0
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/filter.js
CHANGED
package/src/glass.js
CHANGED
|
@@ -6,25 +6,27 @@ export const defaultOptions = {
|
|
|
6
6
|
/** Corner radius in px. Keep in sync with any border-radius you set yourself. */
|
|
7
7
|
radius: 30,
|
|
8
8
|
/** Thickness of the refracting bevel in px. */
|
|
9
|
-
depth:
|
|
9
|
+
depth: 100,
|
|
10
10
|
/** Maximum backdrop displacement in px. This is the strength of the lensing. */
|
|
11
|
-
strength:
|
|
11
|
+
strength: 15,
|
|
12
12
|
/** Falloff curve of the bevel. Higher = the bend is pushed closer to the edge. */
|
|
13
13
|
falloff: 2,
|
|
14
14
|
/** Per-channel offset in px. Gives the prism fringe real glass has. */
|
|
15
15
|
chromaticAberration: 0,
|
|
16
16
|
/** Backdrop blur in px. Leave at 0 — blur is frosted glass, not liquid glass. */
|
|
17
|
-
blur:
|
|
17
|
+
blur: 3,
|
|
18
18
|
/** Backdrop saturation multiplier. */
|
|
19
19
|
saturation: 1,
|
|
20
20
|
/** Backdrop brightness multiplier. */
|
|
21
21
|
brightness: 1,
|
|
22
22
|
/** Specular rim intensity, 0 disables it. */
|
|
23
|
-
specular: 0.
|
|
23
|
+
specular: 0.2,
|
|
24
24
|
/** Max pixel size of the generated displacement map. */
|
|
25
25
|
resolution: 512,
|
|
26
26
|
/** Blur used when the browser cannot run SVG filters in a backdrop-filter. */
|
|
27
27
|
fallbackBlur: 8,
|
|
28
|
+
/** Whether to show a shadow around the glass pane. */
|
|
29
|
+
shadow: true,
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
let uid = 0
|
|
@@ -72,6 +74,13 @@ export function createLiquidGlass(element, options = {}) {
|
|
|
72
74
|
element.style.setProperty('--lg-backdrop', layers.join(' ') || 'none')
|
|
73
75
|
element.style.setProperty('--lg-radius', `${config.radius}px`)
|
|
74
76
|
element.style.setProperty('--lg-specular', String(config.specular))
|
|
77
|
+
|
|
78
|
+
element.style.setProperty(
|
|
79
|
+
'--lg-shadow',
|
|
80
|
+
config.shadow
|
|
81
|
+
? '0 0 40px rgba(8, 7, 16, 0.6)'
|
|
82
|
+
: 'none',
|
|
83
|
+
)
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
function render() {
|
|
@@ -132,6 +141,7 @@ export function createLiquidGlass(element, options = {}) {
|
|
|
132
141
|
element.style.removeProperty('--lg-backdrop')
|
|
133
142
|
element.style.removeProperty('--lg-radius')
|
|
134
143
|
element.style.removeProperty('--lg-specular')
|
|
144
|
+
element.style.removeProperty('--lg-shadow');
|
|
135
145
|
},
|
|
136
146
|
}
|
|
137
147
|
}
|