Repository navigation
Expand file tree
/
Copy pathpvotlib.html
More file actions
265 lines (253 loc) · 14.1 KB
/
Copy pathpvotlib.html
File metadata and controls
265 lines (253 loc) · 14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
---
layout: base
permalink: /pvotlib/
title: PvotLib
description: "PvotLib is the Jetpack Compose design system behind every Pvot app. Its liquid glass is a real lens, and this page runs the same shader in your browser."
seo_title: "PvotLib · Liquid glass design system for Jetpack Compose"
og_image: /assets/og/pvotlib.jpg
---
<section class="stage lab" data-stage data-live data-seed="0.6" data-recede>
<div class="wrap" data-plane>
<div class="lab-grid">
<div class="lab-copy">
<div class="hero-top" data-paint="rich"><span class="eyebrow">PvotLib 1.0. Jetpack Compose.</span><span class="lens-hint"><span class="ms">pan_tool</span> Drag the glass. Tune it in the panel.</span></div>
<div class="hero-title" style="margin-top:20px">
<h1 class="display">
<span class="hero-line" data-paint>Liquid glass,</span>
<span class="hero-line" data-paint>for Android.</span>
</h1>
<div class="lens" id="lab-lens" data-glass="clear" data-glass-lift data-drag data-idle data-idle-x="0.16" tabindex="0" role="img"
aria-label="A piece of PvotLib glass. Drag it, or move it with the arrow keys, and tune it with the panel."></div>
</div>
<p class="lede hero-meta" data-paint="rich">The design system every Pvot app is built on. Its glass is a real lens, and this is it: the shader from <code class="mono">PvotGlass.kt</code>, running in your browser.</p>
<div class="btn-row hero-meta">
<span class="install-chip"><code id="dep">implementation("com.prauga.pvot:design-system:1.0.0")</code><button class="copy" data-copy="#dep" aria-label="Copy dependency"><span class="ms">content_copy</span></button></span>
<a class="btn btn-glass" data-glass="clear" data-glass-press href="{{ site.social.pvotlib }}" target="_blank" rel="noopener"><span class="ms">code</span> Source</a>
</div>
</div>
<form class="panel hero-meta" data-glass="thick" data-glass-fixed id="lab-panel" aria-label="Glass controls" onsubmit="return false">
<h2>The glass <button type="button" id="lab-reset">Reset</button></h2>
<div class="seg" role="tablist" aria-label="Material" data-material>
<span class="seg-ind" aria-hidden="true"></span>
<button type="button" role="tab" aria-selected="true" data-value="clear">Clear</button>
<button type="button" role="tab" aria-selected="false" data-value="regular">Regular</button>
<button type="button" role="tab" aria-selected="false" data-value="thick">Thick</button>
</div>
<div class="knob"><label for="k-strength">Bend <output data-for="k-strength"></output></label><input id="k-strength" type="range" min="0" max="30" step="0.5" value="11" data-param="strength"></div>
<div class="knob"><label for="k-aberration">Split <output data-for="k-aberration"></output></label><input id="k-aberration" type="range" min="0" max="10" step="0.25" value="3" data-param="aberration"></div>
<div class="knob"><label for="k-reflection">Mirror <output data-for="k-reflection"></output></label><input id="k-reflection" type="range" min="0" max="1" step="0.01" value="0.85" data-param="reflection"></div>
<div class="knob"><label for="k-glow">Light <output data-for="k-glow"></output></label><input id="k-glow" type="range" min="0" max="0.8" step="0.01" value="0.22" data-param="glow"></div>
<div class="knob"><label for="k-blur">Frost <output data-for="k-blur"></output></label><input id="k-blur" type="range" min="0" max="20" step="0.5" value="1" data-param="blur"></div>
<div class="knob"><label for="k-intensity">Intensity, whole page <output data-for="k-intensity"></output></label><input id="k-intensity" type="range" min="0" max="1" step="0.01" value="1" data-intensity></div>
<p class="panel-note">Values are PvotGlassStyle's, in dp for a glass 46dp across. Intensity is LocalPvotGlassIntensity: 1 is glass, 0.1 frosted, 0 solid.</p>
</form>
</div>
</div>
</section>
<section class="section" style="padding-bottom:40px">
<div class="wrap">
<div class="section-head">
<span class="eyebrow rv">How it works</span>
<h2 class="h2 rv">A lens, not a blur.<br><span class="dim">Four things at the rim.</span></h2>
</div>
<div class="stack">
<div class="stack-row rv"><span class="n">01</span><h3>Bend</h3><p>Near the edge, the glass reads what lies just outside it and pulls it in, eased so the middle stays calm.</p><span></span></div>
<div class="stack-row rv"><span class="n">02</span><h3>Split</h3><p>Red and blue are read a little apart along the edge's normal, the fringe real glass gives.</p><span></span></div>
<div class="stack-row rv"><span class="n">03</span><h3>Mirror</h3><p>The rim reflects what sits as far outside the edge as the point is inside it, and vivid colors bleed further in.</p><span></span></div>
<div class="stack-row rv"><span class="n">04</span><h3>Light</h3><p>A soft light on the side facing the light. On the phone it follows the tilt. Here it follows your pointer.</p><span></span></div>
</div>
</div>
</section>
<section class="stage section" id="components" data-stage data-live data-seed="3.3" data-dim="0.85">
<div class="wrap" data-plane="0.6">
<div class="section-head">
<span class="eyebrow">Components</span>
<h2 class="h2">Hold them.<br><span class="dim">They turn to glass.</span></h2>
<p class="lede">A few of PvotLib's components, rebuilt for the web on the same glass. The code under each is the real Compose API.</p>
</div>
<div class="comp-grid">
<div class="comp">
<div class="comp-demo" data-glow>
<div class="navbar" data-glass="regular" role="tablist" aria-label="Demo navigation" data-navbar>
<button role="tab" aria-selected="true"><span class="ms">home</span><span class="lbl">Home</span></button>
<button role="tab" aria-selected="false"><span class="ms">search</span><span class="lbl">Search</span></button>
<button role="tab" aria-selected="false"><span class="ms">photo_library</span><span class="lbl">Library</span></button>
<button role="tab" aria-selected="false"><span class="ms">settings</span><span class="lbl">Settings</span></button>
</div>
</div>
<div class="comp-info">
<h3>PvotNavBar</h3>
<p>A glass bar whose chosen item grows into a pill.</p>
<pre class="code"><span class="f">PvotNavBar</span>(
selectedTab = tab,
onTabClick = { tab = it },
tabs = tabs,
)</pre>
</div>
</div>
<div class="comp">
<div class="comp-demo" data-glow>
<div class="seg seg-glass" role="tablist" aria-label="Range" data-paint="box" data-paint-clip>
<span class="seg-ind" aria-hidden="true" data-glass="clear" data-glass-rest="#ffffff2e" data-glass-ref="30" data-glass-blur="0.3"></span>
<button data-paint role="tab" aria-selected="false">Day</button>
<button data-paint role="tab" aria-selected="true">Week</button>
<button data-paint role="tab" aria-selected="false">Month</button>
</div>
</div>
<div class="comp-info">
<h3>PvotSegmentedControl</h3>
<p>Options in a capsule, the selection sliding between them.</p>
<pre class="code"><span class="f">PvotSegmentedControl</span>(
options = listOf(<span class="s">"Day"</span>, <span class="s">"Week"</span>, <span class="s">"Month"</span>),
selectedIndex = range,
onSelect = { range = it },
)</pre>
</div>
</div>
<div class="comp">
<div class="comp-demo" data-glow>
<div class="g-slider" role="slider" tabindex="0" aria-label="Brightness" aria-valuemin="0" aria-valuemax="100" aria-valuenow="62" data-lift-host style="--v:62">
<span class="g-slider-track" data-paint="box"></span>
<span class="g-slider-fill" data-paint="box"></span>
<span class="g-slider-knob" data-glass="clear" data-glass-lift data-glass-rest="#ffffff"></span>
</div>
</div>
<div class="comp-info">
<h3>PvotSlider</h3>
<p>Hold the knob and it lifts into a lens over the track.</p>
<pre class="code"><span class="f">PvotSlider</span>(
value = brightness,
onValueChange = { brightness = it },
)</pre>
</div>
</div>
<div class="comp">
<div class="comp-demo" data-glow>
<button class="g-switch" role="switch" aria-checked="true" aria-label="Bluetooth" data-lift-host>
<span class="g-switch-track" data-paint="box"></span>
<span class="g-switch-knob" data-glass="clear" data-glass-lift data-glass-rest="#ffffff"></span>
</button>
</div>
<div class="comp-info">
<h3>PvotSwitchRow</h3>
<p>The knob turns to glass while you hold it.</p>
<pre class="code"><span class="f">PvotSwitchRow</span>(
title = <span class="s">"Bluetooth"</span>,
checked = on,
onCheckedChange = { on = it },
)</pre>
</div>
</div>
<div class="comp">
<div class="comp-demo" data-glow>
<div class="g-icons">
<button class="g-icon" data-glass="clear" data-glass-press aria-label="Flash"><span class="ms">flash_on</span></button>
<button class="g-icon" data-glass="clear" data-glass-press aria-label="Timer"><span class="ms">timer</span></button>
<button class="g-icon" data-glass="clear" data-glass-press aria-label="Switch camera"><span class="ms">cameraswitch</span></button>
</div>
</div>
<div class="comp-info">
<h3>PvotGlassIconButton</h3>
<p>Round glass for an icon floating over content, like the camera's controls.</p>
<pre class="code"><span class="f">PvotGlassIconButton</span>(onClick = flip) {
<span class="f">Icon</span>(flipIcon, <span class="s">"Switch camera"</span>)
}</pre>
</div>
</div>
<div class="comp">
<div class="comp-demo" data-glow>
<div class="glass-card" data-glass="regular" data-glass-press data-glass-ref="80">
<b>Next up</b>
<span>Design review at 4:30. Room 2, or join from your phone.</span>
</div>
</div>
<div class="comp-info">
<h3>PvotGlassCard</h3>
<p>A card of glass, with a rim of light that follows the tilt.</p>
<pre class="code"><span class="f">PvotGlassCard</span>(onClick = open) {
<span class="f">Text</span>(<span class="s">"Next up"</span>)
}</pre>
</div>
</div>
</div>
</div>
</section>
<section class="section mat-intro">
<div class="wrap">
<div class="section-head">
<span class="eyebrow rv">Materials</span>
<h2 class="h2 rv">Pick the glass<br><span class="dim">by what sits on it.</span></h2>
<p class="lede rv">The same words run behind all three. Clear lets them through, Regular softens them, Thick keeps text on top readable.</p>
</div>
</div>
</section>
<section class="stage mat-stage" data-stage data-base="#000000">
<div class="mat-wall" aria-hidden="true">
<span data-paint>Messages Camera Phone</span>
<span data-paint>Photos Music Calendar</span>
<span data-paint>Weather Maps Notes</span>
<span data-paint>Files Browser Clock</span>
<span data-paint>Health Journal Ledger</span>
<span data-paint>Backup Mail Contacts</span>
<span data-paint>Compass Reminders</span>
<span data-paint>Recorder Equalizer</span>
</div>
<div class="wrap" data-plane="1.8">
<div class="mats">
<div class="mat" data-glass="clear" data-glass-ref="90" data-glass-blur="0.6">
<div><h3>Clear</h3><p>A faint haze. For icon-only controls, where nothing needs reading.</p></div>
<code>PvotGlassMaterial.Clear</code>
</div>
<div class="mat" data-glass="regular" data-glass-ref="90">
<div><h3>Regular</h3><p>A half-strength tint and a deeper blur. For bars, search fields, titled cards.</p></div>
<code>PvotGlassMaterial.Regular</code>
</div>
<div class="mat" data-glass="thick" data-glass-ref="90">
<div><h3>Thick</h3><p>Nearly opaque, the deepest blur. For sheets and dialogs with body text.</p></div>
<code>PvotGlassMaterial.Thick</code>
</div>
</div>
</div>
</section>
<section class="section">
<div class="wrap">
<div class="section-head">
<span class="eyebrow rv">Install</span>
<h2 class="h2 rv">No account.<br><span class="dim">No token.</span></h2>
<p class="lede rv">PvotLib is published from its own repository. Add the Maven repo, then the libraries. It builds in AOSP too, as <code class="mono">PvotDesignSystem</code>.</p>
</div>
<div class="install">
<div class="install-step rv">
<h3>settings.gradle.kts</h3>
<pre class="code">dependencyResolutionManagement {
repositories {
<span class="f">google</span>()
<span class="f">mavenCentral</span>()
<span class="f">maven</span>(<span class="s">"https://pvot-oss.github.io/PvotLib/maven"</span>) {
content { <span class="f">includeGroup</span>(<span class="s">"com.prauga.pvot"</span>) }
}
}
}</pre>
</div>
<div class="install-step rv">
<h3>Glass over your content</h3>
<pre class="code"><span class="k">val</span> backdrop = <span class="f">rememberPvotGlassBackdrop</span>()
<span class="f">Box</span> {
<span class="f">LazyColumn</span>(Modifier.<span class="f">pvotGlassBackdrop</span>(backdrop)) { <span class="c">/* … */</span> }
<span class="f">Box</span>(
Modifier
.<span class="f">height</span>(46.dp)
.<span class="f">fillMaxWidth</span>()
.<span class="f">pvotGlass</span>(backdrop)
.<span class="f">pvotGlassRim</span>()
)
}</pre>
</div>
</div>
<div class="btn-row rv" style="margin-top:40px">
<a class="btn btn-solid" href="{{ site.social.pvotlib }}" target="_blank" rel="noopener">PvotLib on GitHub</a>
<a class="btn btn-line" href="{{ site.social.pvotlib }}/blob/main/docs/GUIDE.md" target="_blank" rel="noopener">Read the guide</a>
<a class="btn btn-line" href="{{ '/apps/whats-in-pvot/' | relative_url }}">Try the catalog app</a>
</div>
</div>
</section>