跪拜 Guibai
← All articles
Frontend

DeepSeek's Homepage Polish Comes Down to Three Techniques: Glassmorphism, a WebGL Fluid Shader, and Spring Physics

By cody的小屋 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

The techniques replace heavy animation libraries with a few hundred lines of CSS, GLSL, and vanilla JS, giving developers a direct path to a polished, performant site aesthetic. The spring-vs-class decoupling and the hover-only shader animation loop are specific, non-obvious fixes for timing bugs and GPU waste that commonly ship in production.

Summary

DeepSeek's homepage achieves its premium feel through three layered techniques: glassmorphism cards using semi-transparent backgrounds and backdrop-filter blur, a WebGL fragment shader that generates fractal-noise fluid patterns and stays static until hover triggers a slow wake-up animation, and a spring-physics model that drives the top bar's elastic width and padding changes on scroll. The spring's geometry interpolation is deliberately decoupled from the CSS class toggling that controls the background glass effect, preventing a visible lag where the background outlasts the bar's return to its original size. A custom cursor ring follows the mouse with exponential easing and uses mix-blend-mode: difference to stay visible on any background without theme-switching logic.

A set of design tokens unifies blur strengths, surface opacities, and border radii across the site. Three self-imposed constraints keep the result restrained: no hover displacement on cards, static text against a living background, and asymmetric animation timings where entrances are slow, hover feedback is fast, and scroll deformation uses a bouncy spring. The WebGL implementation draws only one frame for the static background and resumes the requestAnimationFrame loop solely during hover, keeping GPU usage near zero when idle.

Takeaways
Glassmorphism requires only background: rgba(255,255,255,0.3), backdrop-filter: blur(12px), and a semi-transparent border.
Safari still needs -webkit-backdrop-filter written alongside the standard property; setting it via JS fails TypeScript type checks.
A WebGL fluid background can be built from a hash function, smooth noise, and fractal Brownian motion layered at multiple frequencies.
Adding preserveDrawingBuffer: true to the WebGL context prevents the canvas from clearing to white after a tab switch or resize.
The shader draws only one static frame by default; a requestAnimationFrame loop starts on pointerenter and stops when hoverT falls below a threshold, keeping idle GPU usage at zero.
A spring animation for the top bar uses stiffness=180 and damping=28 with semi-implicit Euler integration, updating velocity before position to avoid energy accumulation.
The is-scrolled CSS class must be toggled directly from scrollY, not from the spring's interpolated value, or the background glass effect will visibly outlast the geometry reset.
A cursor ring that trails the mouse with exponential easing and mix-blend-mode: difference works on both light and dark backgrounds without separate themes.
Design tokens for blur (12px), surface opacities (0.3, 0.45), and border radii keep the look consistent and make site-wide changes a one-line edit.
Three design constraints preserve the premium feel: no translateY on hover, static text against an animated background, and asymmetric animation durations (1s entrance, 0.2s hover, spring-speed scroll).
Conclusions

The premium feel of DeepSeek's homepage is not a product of complex libraries but of restraint: the background shader is static by default, cards don't lift on hover, and text never animates.

Decoupling the spring-driven geometry from the CSS class toggle solves a timing bug where the visual glass effect lingers long after the bar has visually returned to its unscrolled state, a problem that would otherwise require matching two independent easing curves.

Running the shader's animation loop only during hover and stopping it entirely when idle is a practical power-saving pattern that most WebGL background implementations overlook, defaulting instead to a perpetual requestAnimationFrame.

Using mix-blend-mode: difference on the cursor ring eliminates the need for theme-aware styling, a single-property solution that handles any background color without JavaScript.

The insistence on asymmetric animation timing—slow entrance, fast hover response, spring-speed scroll—creates a rhythm that feels organic rather than mechanical, and this asymmetry is more responsible for the perceived quality than any individual effect.

Concepts & terms
Glassmorphism
A UI style that simulates frosted glass using a semi-transparent background, backdrop-filter blur, and a subtle semi-transparent border, letting background content show through while keeping foreground text readable.
Fractal Brownian Motion (fbm)
A technique that stacks multiple layers of noise at different frequencies and amplitudes; low-frequency layers create broad shapes while high-frequency layers add fine detail, producing natural-looking textures like clouds or fluid.
Semi-implicit Euler Integration
A numerical method for simulating springs where velocity is updated before position in each time step; reversing the order causes energy to accumulate and the spring to oscillate out of control.
mix-blend-mode: difference
A CSS blending mode that subtracts the darker color from the lighter one; a white element on any background inverts to the background's opposite color, making it visible on both light and dark surfaces without theme logic.
Design Tokens
CSS custom properties that encode design decisions—blur strengths, opacities, colors, radii—as named variables, ensuring visual consistency across a site and allowing site-wide changes by editing a single value.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗