Build a 3D Liquid‑Glass Login Card with Vue: Full Step‑by‑Step Guide

This tutorial explains the liquid‑glass UI effect—its visual layers, SVG filter tricks, backdrop‑blur technique, and 3D tilt interaction—then walks you through the complete Vue component markup, CSS styling, and JavaScript logic needed to create a sleek, glass‑like login card.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Build a 3D Liquid‑Glass Login Card with Vue: Full Step‑by‑Step Guide

Effect Overview

Liquid Glass is a modern UI visual style that mimics the translucency, refraction and highlights of real glass using multiple layered effects, blur, tint, shine and SVG filters. Inspired by recent OS design updates, this guide shows how to build a 3D‑tilting liquid‑glass login card.

Result:

Liquid Glass login card demo
Liquid Glass login card demo

Technical Principles

1. Multi‑Layer Stacking

Blur layer : makes the background blurry to create a glass‑like transparency.

Tint layer : adds a subtle color tint for depth.

Shine layer : simulates edge highlights and inner shadows.

SVG filter : uses feTurbulence and feDisplacementMap to give the glass surface a gentle distortion and flow.

2. 3D Dynamic Tilt

By listening to mouse movement on the card, we calculate and set transform: perspective(...) rotateX(...) rotateY(...) so the card tilts responsively, enhancing interactivity.

3. Background Interaction

The background can be a gradient or an image. The glass card uses backdrop-filter to interact with the background, producing a realistic glass texture.

Implementation Steps

1. Structure

<template>
  <div class="login-container animated-background">
    <!-- SVG filter definitions -->
    <svg style="display:none">...</svg>
    <div class="glass-component login-card" ref="tiltCard" @mousemove="handleMouseMove" @mouseleave="handleMouseLeave">
      <div class="glass-effect"></div>
      <div class="glass-tint"></div>
      <div class="glass-shine"></div>
      <div class="glass-content">
        <h2 class="login-title">Welcome</h2>
        <form class="login-form">
          <div class="form-group"><input type="text" placeholder="Username" class="glass-input"></div>
          <div class="form-group"><input type="password" placeholder="Password" class="glass-input"></div>
          <button type="submit" class="glass-button">Login</button>
        </form>
      </div>
    </div>
  </div>
</template>

2. SVG Filter for Liquid Distortion

<svg style="display:none">
  <filter id="glass-distortion" x="0%" y="0%" width="100%" height="100%" filterUnits="objectBoundingBox">
    <feTurbulence type="fractalNoise" baseFrequency="0.001 0.005" numOctaves="1" seed="17" result="turbulence" />
    <feComponentTransfer in="turbulence" result="mapped">
      <feFuncR type="gamma" amplitude="1" exponent="10" offset="0.5" />
      <feFuncG type="gamma" amplitude="0" exponent="1" offset="0" />
      <feFuncB type="gamma" amplitude="0" exponent="1" offset="0.5" />
    </feComponentTransfer>
    <feGaussianBlur in="turbulence" stdDeviation="3" result="softMap" />
    <feSpecularLighting in="softMap" surfaceScale="5" specularConstant="1" specularExponent="100" lighting-color="white" result="specLight">
      <fePointLight x="-200" y="-200" z="300" />
    </feSpecularLighting>
    <feComposite in="specLight" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litImage" />
    <feDisplacementMap in="SourceGraphic" in2="softMap" scale="200" xChannelSelector="R" yChannelSelector="G" />
  </filter>
</svg>

3. Background Settings

.animated-background {
  width: 100vw;
  height: 100vh;
  background-image: url('your‑background‑image.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
}

4. Card Layer Styles

.login-card {
  width: 400px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1.5px 6px rgba(0,0,0,0.08);
  background: transparent;
  position: relative;
}
.glass-effect {
  position: absolute;
  inset: 0;
  z-index: 0;
  backdrop-filter: blur(5px);
  filter: url(#glass-distortion);
  isolation: isolate;
  border-radius: 24px;
}
.glass-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0,0,0,0.15);
  border-radius: 24px;
}
.glass-shine {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 24px;
  box-shadow: inset 1px 1px 8px rgba(255,255,255,0.18), inset -1px -1px 8px rgba(255,255,255,0.08);
  pointer-events: none;
}
.glass-content {
  position: relative;
  z-index: 3;
  padding: 2rem;
  color: #fff;
}

5. 3D Tilt Interaction

methods: {
  handleMouseMove(e) {
    const card = this.$refs.tiltCard;
    const rect = card.getBoundingClientRect();
    const x = e.clientX - rect.left;
    const y = e.clientY - rect.top;
    const centerX = rect.width / 2;
    const centerY = rect.height / 2;
    const maxTilt = 18;
    const rotateY = ((x - centerX) / centerX) * maxTilt;
    const rotateX = -((y - centerY) / centerY) * maxTilt;
    card.style.transform = `perspective(600px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(1.03)`;
  },
  handleMouseLeave() {
    const card = this.$refs.tiltCard;
    card.style.transform = 'perspective(600px) rotateX(0deg) rotateY(0deg) scale(1)';
  }
}

6. Detail Optimizations

Soft shadows : reduce box‑shadow opacity to avoid heavy black edges.

Highlight lines : use low‑opacity white borders and inner shadows for realistic glass shine.

Consistent border‑radius : ensure every layer shares the same radius to prevent visual gaps.

Form inputs : apply semi‑transparent backgrounds with blur to keep the overall glass aesthetic.

FAQ & Optimization Tips

Heavy shadows / black edges – lower opacity and blur radius.

Corner gaps – apply identical border-radius to all layers.

Background not translucent – ensure .glass-effect has both blur and the SVG filter.

Performance – backdrop-filter can be costly on low‑end devices; use sparingly.

Browser compatibility – modern browsers support backdrop-filter; IE and some Android browsers do not.

Key Takeaways

SVG filters create subtle surface distortion. backdrop-filter: blur achieves background translucency.

Layered composition (tint, shine, blur) forms authentic glass look.

3D transform adds interactive depth.

Fine‑tune shadows, borders, radii, and colors for a polished result.

Conclusion

The liquid‑glass effect is a hallmark of modern front‑end design. By understanding its principles—layered stacking, SVG filters, backdrop blur, and 3D transforms—any developer can recreate macOS‑ or Windows‑style glass interfaces. This guide provides all the code and tips needed to build your own stunning UI.

Liquid Glass illustration
Liquid Glass illustration
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

frontend developmentVue.jsCSS3D TransformLiquid Glass UISVG Filters
Rare Earth Juejin Tech Community
Written by

Rare Earth Juejin Tech Community

Juejin, a tech community that helps developers grow.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.