Skip to content

Commit daa2c13

Browse files
authored
Merge pull request #8 from donny-son/claude/paper-design-shaders-a8grde
Add liquid-glass pause/play control to shader preview
2 parents 08b8ebf + b3c6c66 commit daa2c13

3 files changed

Lines changed: 88 additions & 1 deletion

File tree

src/App.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
import type { GradientType } from './lib/gradients';
3939
import { WallpaperCanvas } from './components/WallpaperCanvas';
4040
import { ShaderBackground } from './components/ShaderBackground';
41+
import { GlassTransportButton } from './components/GlassTransportButton';
4142
import { SHADER_DEFS, buildAllDefaultParamValues, getShaderDef } from './lib/shaders';
4243
import type { ShaderKind } from './lib/shaders';
4344
import { captureShaderSnapshot } from './lib/exportShader';
@@ -116,6 +117,7 @@ export default function App() {
116117
const [shaderScale, setShaderScale] = useState(1);
117118
const [shaderParams, setShaderParams] = useState(buildAllDefaultParamValues);
118119
const [isExporting, setIsExporting] = useState(false);
120+
const [isShaderPaused, setIsShaderPaused] = useState(false);
119121
const [device, setDevice] = useState<DeviceType>('desktop');
120122
const [grainScale, setGrainScale] = useState(10);
121123
const [bandWidth, setBandWidth] = useState(0);
@@ -776,9 +778,13 @@ export default function App() {
776778
kind={shaderKind}
777779
colors={colors}
778780
paramValues={shaderParams[shaderKind]}
779-
speed={shaderSpeed}
781+
speed={isShaderPaused ? 0 : shaderSpeed}
780782
scale={shaderScale}
781783
/>
784+
<GlassTransportButton
785+
isPaused={isShaderPaused}
786+
onToggle={() => setIsShaderPaused((prev) => !prev)}
787+
/>
782788
</div>
783789
)}
784790

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Pause, Play } from 'lucide-react';
2+
3+
interface GlassTransportButtonProps {
4+
isPaused: boolean;
5+
onToggle: () => void;
6+
}
7+
8+
export function GlassTransportButton({ isPaused, onToggle }: GlassTransportButtonProps) {
9+
return (
10+
<div className="glass-transport">
11+
<button
12+
type="button"
13+
onClick={onToggle}
14+
className="glass-transport-btn"
15+
aria-label={isPaused ? 'Play shader animation' : 'Pause shader animation'}
16+
aria-pressed={isPaused}
17+
>
18+
{isPaused ? <Play size={20} fill="currentColor" /> : <Pause size={20} fill="currentColor" />}
19+
</button>
20+
</div>
21+
);
22+
}

src/index.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,65 @@ input[type="range"]::-moz-range-thumb {
700700
background: var(--color-ink);
701701
}
702702

703+
/* ---- Liquid glass shader transport control ---- */
704+
705+
.glass-transport {
706+
position: absolute;
707+
bottom: 20px;
708+
left: 50%;
709+
z-index: 3;
710+
transform: translateX(-50%);
711+
}
712+
713+
.glass-transport-btn {
714+
position: relative;
715+
display: flex;
716+
height: 52px;
717+
width: 52px;
718+
align-items: center;
719+
justify-content: center;
720+
border-radius: 999px;
721+
border: 1px solid rgba(255, 255, 255, 0.35);
722+
background: rgba(255, 255, 255, 0.14);
723+
backdrop-filter: blur(14px) saturate(180%);
724+
-webkit-backdrop-filter: blur(14px) saturate(180%);
725+
color: rgba(255, 255, 255, 0.92);
726+
box-shadow:
727+
0 8px 24px rgba(15, 15, 20, 0.35),
728+
inset 0 1px 1px rgba(255, 255, 255, 0.65),
729+
inset 0 -1px 2px rgba(0, 0, 0, 0.18);
730+
cursor: pointer;
731+
transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
732+
overflow: hidden;
733+
}
734+
735+
.glass-transport-btn::before {
736+
content: '';
737+
position: absolute;
738+
inset: 0;
739+
border-radius: inherit;
740+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 42%);
741+
mix-blend-mode: overlay;
742+
pointer-events: none;
743+
}
744+
745+
.glass-transport-btn svg {
746+
position: relative;
747+
filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
748+
}
749+
750+
.glass-transport-btn:hover {
751+
transform: scale(1.06);
752+
background: rgba(255, 255, 255, 0.22);
753+
}
754+
755+
.glass-transport-btn:active {
756+
transform: scale(0.96);
757+
box-shadow:
758+
0 4px 12px rgba(15, 15, 20, 0.3),
759+
inset 0 1px 2px rgba(0, 0, 0, 0.25);
760+
}
761+
703762
/* ---- Caption placard under the canvas ---- */
704763

705764
.preview-status {

0 commit comments

Comments
 (0)