Glass Fracture Card
A pristine pane of glass at rest. Clicking creates a beautiful, crystalline fracture pattern from the click point. Each fracture facet reflects light differently and reveals a different piece of content. Hovering over a fracture repairs it with a smooth annealing animation. Fully shattered cards reset after a period of inactivity.
by FreeCsStyles Dev's
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/glass-fracture-card.
<iframe src="/embed/glass-fracture-card" sandbox="allow-scripts" loading="lazy" title="Glass Fracture Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Glass Fracture Card, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<div class="glass-card">
<div class="glass-pane">
<div class="glass-reflection"></div>
<div class="glass-content">⬡<span>intact</span></div>
</div>
<div class="glass-footer">
<div class="gf-row"><span>Safety Glass</span><span class="gf-badge">INTACT</span></div>
<div class="gf-grid"><div>—<span>Fragments</span></div><div>CLEAR<span>Status</span></div></div>
<div class="gf-hint">[▼ click to fracture]</div>
</div>
</div>CSS
.glass-card { position: relative; width: 220px; min-height: 300px; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, #0a0c14, #060810); border: 1.5px solid rgba(180,220,255,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.3); cursor: pointer; }
.glass-card:hover { box-shadow: 0 0 30px rgba(180,220,255,0.08), 0 15px 40px rgba(0,0,0,0.4); }
.glass-pane { position: absolute; inset: 10%; bottom: 32%; z-index: 3; pointer-events: none; border-radius: 12px; border: 1px solid rgba(180,220,255,0.06); background: linear-gradient(135deg, rgba(180,220,255,0.04), rgba(180,220,255,0.01)); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; }
.glass-reflection { position: absolute; inset: 0; border-radius: 12px; background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.06) 45%, transparent 60%); }
.glass-content { text-align: center; color: rgba(180,220,255,0.4); font-size: 11px; }
.glass-content span { display: block; font-size: 7px; font-family: monospace; margin-top: 4px; color: rgba(180,220,255,0.15); }
.glass-footer { position: absolute; inset-x: 0; bottom: 0; z-index: 10; padding: 20px; background: linear-gradient(0deg, rgba(0,0,0,0.6), transparent); }
.gf-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gf-row span:first-child { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); }
.gf-badge { padding: 2px 8px; border-radius: 2px; font-size: 7px; font-weight: 700; letter-spacing: 0.1em; color: rgba(180,220,255,0.6); background: rgba(180,220,255,0.08); border: 1px solid rgba(180,220,255,0.12); }
.gf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.gf-grid div { text-align: center; padding: 6px 4px; border-radius: 8px; background: rgba(180,220,255,0.02); border: 1px solid rgba(180,220,255,0.04); font-size: 10px; font-weight: 600; color: rgba(180,220,255,0.6); }
.gf-grid div span { display: block; font-size: 7px; margin-top: 2px; font-weight: 400; color: rgba(255,255,255,0.2); }
.gf-hint { text-align: center; font-size: 7px; font-family: monospace; color: rgba(180,220,255,0.2); margin-top: 8px; }Tailwind CSS
<div class="group relative w-[220px] min-h-[300px] rounded-2xl overflow-hidden border border-blue-400/20 shadow-lg group-hover:shadow-[0_0_30px_rgba(180,220,255,0.08),0_15px_40px_rgba(0,0,0,0.4)] bg-gradient-to-b from-[#0a0c14] to-[#060810] cursor-pointer">
<div class="absolute inset-[10%] bottom-[32%] z-[3] pointer-events-none rounded-xl border border-blue-400/20 bg-gradient-to-br from-blue-500/10 to-blue-500/5 backdrop-blur flex items-center justify-center">
<div class="absolute inset-0 rounded-xl bg-gradient-to-r from-transparent via-white/10 to-transparent opacity-50"></div>
<div class="text-center text-blue-400/40 text-[11px]">⬡<span class="block text-[7px] font-mono mt-1 text-blue-400/20">intact</span></div>
</div>
<div class="absolute inset-x-0 bottom-0 z-10 p-5 space-y-2 bg-gradient-to-t from-black/60 to-transparent">
<div class="flex items-center justify-between"><div><p class="text-sm font-bold text-white/90">Safety Glass</p><p class="text-[9px] text-blue-400/50">Tempered</p></div><div class="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest text-blue-400 bg-blue-500/10 border border-blue-500/20">INTACT</div></div>
<div class="h-px bg-gradient-to-r from-transparent via-blue-500/10 to-transparent"></div>
<div class="grid grid-cols-2 gap-2"><div class="text-center py-1.5 rounded-lg bg-blue-500/10 border border-blue-500/20"><p class="text-[10px] font-semibold text-blue-400">—</p><p class="text-[7px] mt-0.5 text-white/20">Fragments</p></div><div class="text-center py-1.5 rounded-lg bg-blue-500/10 border border-blue-500/20"><p class="text-[10px] font-semibold text-blue-400">CLEAR</p><p class="text-[7px] mt-0.5 text-white/20">Status</p></div></div>
<div class="text-center"><span class="text-[7px] font-mono text-blue-400/30">[▼ click to fracture]</span></div>
</div>
</div>React
import React, { useRef, useState, useCallback } from 'react';
import { motion, useMotionValue, useSpring, AnimatePresence } from 'framer-motion';
export function GlassFractureCard({ label = 'Safety Glass', glassType = 'Tempered', width = 220, toughness = 5 }) {
const ref = useRef(null);
const [isHovered, setIsHovered] = useState(false);
const [shattered, setShattered] = useState(false);
const [fragments, setFragments] = useState([]);
const [clickPoint, setClickPoint] = useState({ x: 50, y: 50 });
const x = useMotionValue(0);
const y = useMotionValue(0);
const rotateX = useSpring(y, { damping: 22, stiffness: 220 });
const rotateY = useSpring(x, { damping: 22, stiffness: 220 });
const handleMouseMove = (e) => {
if (!ref.current) return;
const rect = ref.current.getBoundingClientRect();
const cx = rect.left + rect.width / 2;
const cy = rect.top + rect.height / 2;
x.set(-((e.clientX - cx) / (rect.width / 2)) * 8);
y.set(((e.clientY - cy) / (rect.height / 2)) * 8);
};
const handleClick = (e) => {
if (!ref.current || shattered) return;
const rect = ref.current.getBoundingClientRect();
const localX = ((e.clientX - rect.left) / rect.width) * 100;
const localY = ((e.clientY - rect.top) / rect.height) * 100;
setClickPoint({ x: localX, y: localY });
const numFrags = Math.min(8 + Math.floor(toughness * 2), 20);
const frags = Array.from({ length: numFrags }, (_, i) => ({
id: i, x: 50 + Math.cos((i / numFrags) * Math.PI * 2) * (15 + Math.random() * 50),
y: 45 + Math.sin((i / numFrags) * Math.PI * 2) * (15 + Math.random() * 50),
rotation: Math.random() * 360, scale: 0.3 + Math.random() * 0.7, opacity: 0.6 + Math.random() * 0.4,
color: ['rgba(180,220,255,0.15)','rgba(200,230,255,0.12)','rgba(160,210,250,0.1)','rgba(220,240,255,0.08)','rgba(140,200,240,0.18)'][i % 5],
content: ['⬡','⬢','✦','⟡','⬟','⬠','◆','◇','◈','⬦'][i % 10],
}));
setFragments(frags); setShattered(true);
setTimeout(() => { setShattered(false); setFragments([]); }, 5000);
};
return (
<div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); if (shattered) { setTimeout(() => { setShattered(false); setFragments([]); }, 3000); }}}>
<motion.div ref={ref} onMouseMove={handleMouseMove} onClick={handleClick} style={{ rotateX, rotateY, transformStyle: 'preserve-3d' }} className="relative cursor-pointer">
<motion.div className="relative overflow-hidden rounded-2xl" style={{ width, minHeight: 300, background: shattered ? 'linear-gradient(160deg, #080a12, #04060a)' : 'linear-gradient(160deg, #0a0c14, #060810)', border: shattered ? '1.5px solid rgba(180,220,255,0.04)' : '1.5px solid rgba(180,220,255,0.1)' }}
animate={{ boxShadow: isHovered && !shattered ? '0 0 30px rgba(180,220,255,0.08), 0 15px 40px rgba(0,0,0,0.4)' : shattered ? '0 0 20px rgba(180,220,255,0.04), 0 10px 30px rgba(0,0,0,0.3)' : '0 10px 30px rgba(0,0,0,0.3)' }}>
{!shattered && <div className="absolute inset-[10%] bottom-[32%] z-[3] pointer-events-none rounded-xl border border-blue-400/20 bg-gradient-to-br from-blue-500/10 to-blue-500/5 backdrop-blur flex items-center justify-center"><div className="text-center text-blue-400/40 text-[11px]">⬡<span className="block text-[7px] font-mono mt-1 text-blue-400/20">intact</span></div></div>}
<div className="absolute inset-x-0 bottom-0 z-10 p-5 space-y-2 bg-gradient-to-t from-black/60 to-transparent">
<div className="flex items-center justify-between"><div><p className="text-sm font-bold text-white/90">{label}</p><p className="text-[9px] text-blue-400/50">{glassType}</p></div><motion.div className="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest" style={{ background: shattered ? 'rgba(255,100,100,0.08)' : 'rgba(180,220,255,0.08)', border: shattered ? '1px solid rgba(255,100,100,0.12)' : '1px solid rgba(180,220,255,0.12)', color: shattered ? 'rgba(255,100,100,0.6)' : 'rgba(180,220,255,0.6)' }}>{shattered ? 'SHATTERED' : isHovered ? 'PRISTINE' : 'INTACT'}</motion.div></div>
<div className="text-center"><span className="text-[7px] font-mono text-blue-400/30">{shattered ? '[▼ hover fragments to repair]' : '[▼ click to fracture]'}</span></div>
</div>
</motion.div>
</motion.div>
</div>
);
}Where Glass Fracture Card fits
- Interactive Reveal UI
- Shatter Effects
- Security Dashboards
- Creative Transformations
Interaction states & animations
- Fracture propagation
- Fragment scatter
- Crack line growth
- Anneal repair
- Facet reflection
Topics
- #liquid-glass
- #fracture
- #shatter
- #crack
- #glass-pane
- #repair
- #anneal
- #crystalline
- #fragments
- #interactive
Accessibility notes
Shatter effect may be startling. Provide reduced motion alternative. Ensure text content remains readable on fractured surfaces. Auto-reset after inactivity helps prevent confusion.
Browser support
- Chrome 90+
- Firefox 105+
- Safari 15+
- Edge 90+