Skip to content

Bubble Chamber Card

A physics-inspired card simulating a particle bubble chamber. The background is filled with slowly rising iridescent bubbles each containing a piece of data. Hovering near bubbles attracts them to the cursor like a magnet. Clicking pops a bubble expanding its content into a full view. Popped bubbles leave behind a faint shimmering residue that records interaction history.

CardsScientific / Particle PhysicsExpertHTML/CSSTailwindReactVueAngularSvelteLWC
Bubble Chamber Card

by FreeCsStyles Dev's

CardsScientific / Particle Physics
🌐🎨⚛️💚🅰️🔥☁️
#bubble#chamber#particle#physics#science#lab#experiment#data#interactive#magnetic

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/bubble-chamber-card.

<iframe src="/embed/bubble-chamber-card" sandbox="allow-scripts" loading="lazy" title="Bubble Chamber Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Bubble Chamber 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="bubble-chamber-card" onclick="this.classList.toggle('popped')">
  <div class="chamber-tracks"></div>
  <div class="chamber-content">
    <div class="chamber-header">
      <p class="chamber-title">Bubble Chamber</p>
      <div class="chamber-divider"></div>
    </div>
    <div class="chamber-empty">
      <p class="chamber-hint">click a bubble to pop</p>
    </div>
    <div class="chamber-info">
      <div class="chamber-stat"><div class="chamber-stat-val">Muon</div><div class="chamber-stat-lbl">Particle</div></div>
      <div class="chamber-stat"><div class="chamber-stat-val">Dr. Fermi</div><div class="chamber-stat-lbl">Operator</div></div>
    </div>
    <p class="chamber-status">~ chamber active ~</p>
  </div>
</div>
CSS
.bubble-chamber-card {
  position: relative;
  width: 220px;
  min-height: 300px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #0a0e1a, #060810);
  border: 1.5px solid rgba(100,200,255,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: all 0.4s ease;
}

.bubble-chamber-card:hover {
  box-shadow: 0 0 40px rgba(100,200,255,0.05), 0 15px 40px rgba(0,0,0,0.5);
}

.chamber-tracks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: linear-gradient(rgba(100,200,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(100,200,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

.chamber-content {
  position: relative;
  z-index: 10;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chamber-header { display: flex; justify-content: space-between; align-items: center; }
.chamber-title { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; color: rgba(100,200,255,0.7); }
.chamber-divider { height: 1px; margin-top: 4px; background: linear-gradient(90deg, rgba(100,200,255,0.1), transparent); }

.chamber-empty {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chamber-hint { font-size: 8px; font-family: monospace; color: rgba(100,200,255,0.15); }

.chamber-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chamber-stat {
  text-align: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(100,200,255,0.03);
  border: 1px solid rgba(100,200,255,0.06);
}

.chamber-stat-val { font-size: 9px; font-weight: 600; color: rgba(100,200,255,0.6); }
.chamber-stat-lbl { font-size: 7px; margin-top: 2px; color: rgba(255,255,255,0.15); }

.chamber-status {
  text-align: center;
  font-size: 7px;
  font-family: monospace;
  color: rgba(100,200,255,0.15);
}

@media (prefers-reduced-motion: reduce) {
  .bubble-chamber-card { transition: none; }
}
Tailwind CSS
<div class="group relative w-[220px] min-h-[300px] rounded-2xl overflow-hidden border border-cyan-400/20 shadow-lg group-hover:shadow-[0_0_40px_rgba(100,200,255,0.05),0_15px_40px_rgba(0,0,0,0.5)] bg-gradient-to-br from-[#0a0e1a] to-[#060810] cursor-pointer">
  <div class="absolute inset-0 pointer-events-none z-1 opacity-20" style="background-image: linear-gradient(rgba(100,200,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(100,200,255,0.03) 1px, transparent 1px); background-size: 20px 20px;"></div>
  <div class="relative z-10 p-5 space-y-4">
    <div class="flex items-center justify-between">
      <p class="text-xs font-semibold tracking-wider text-cyan-300/70">Bubble Chamber</p>
      <span class="text-[8px] font-mono text-cyan-300/30">12 active</span>
    </div>
    <div class="h-px bg-gradient-to-r from-cyan-400/15 to-transparent"></div>
    <div class="min-h-[60px] flex items-center justify-center">
      <div class="text-center"><p class="text-2xl opacity-5">○</p><p class="text-[8px] font-mono mt-1 text-cyan-300/20">click a bubble to pop</p></div>
    </div>
    <div class="grid grid-cols-2 gap-2">
      <div class="text-center py-1.5 rounded-lg bg-cyan-400/5 border border-cyan-400/10"><p class="text-[9px] font-semibold text-cyan-300/60">Muon</p><p class="text-[7px] mt-0.5 text-white/20">Particle</p></div>
      <div class="text-center py-1.5 rounded-lg bg-cyan-400/5 border border-cyan-400/10"><p class="text-[9px] font-semibold text-cyan-300/60">Dr. Fermi</p><p class="text-[7px] mt-0.5 text-white/20">Operator</p></div>
    </div>
    <div class="text-center"><span class="text-[7px] font-mono text-cyan-300/20">~ chamber active ~</span></div>
  </div>
</div>
React
import React, { useState, useRef, useCallback } from 'react';
import { motion, useMotionValue, useSpring, AnimatePresence } from 'framer-motion';

export function BubbleChamberCard() {
  const [isHovered, setIsHovered] = useState(false);
  const [poppedData, setPoppedData] = useState([]);
  const ref = useRef(null);
  const x = useMotionValue(0);
  const y = useMotionValue(0);
  const rotateX = useSpring(y, { damping: 25, stiffness: 250 });
  const rotateY = useSpring(x, { damping: 25, stiffness: 250 });
  const stats = [{ label: 'Energy', value: '2.4 GeV' }, { label: 'Charge', value: '+1e' }, { label: 'Mass', value: '105.7 MeV' }, { label: 'Spin', value: '1/2' }];

  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 = () => {
    const item = stats[Math.floor(Math.random() * stats.length)];
    setPoppedData((prev) => [...prev.slice(-5), { ...item, id: Date.now() }]);
  };

  return (
    <div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
      <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: 220, minHeight: 300, background: 'linear-gradient(160deg, #0a0e1a, #060810)', border: '1.5px solid rgba(100,200,255,0.08)' }}
          animate={{ boxShadow: isHovered ? '0 0 40px rgba(100,200,255,0.05), 0 15px 40px rgba(0,0,0,0.5)' : '0 10px 30px rgba(0,0,0,0.4)' }}>
          <div className="absolute inset-0 opacity-[0.02] pointer-events-none" style={{ backgroundImage: 'linear-gradient(rgba(100,200,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(100,200,255,0.05) 1px, transparent 1px)', backgroundSize: '20px 20px' }} />
          <div className="relative z-10 p-5 space-y-4">
            <div className="flex items-center justify-between">
              <motion.p className="text-xs font-semibold tracking-wider" style={{ color: 'rgba(100,200,255,0.7)' }} animate={isHovered ? { opacity: [0.6,1,0.6] } : {}} transition={{ duration: 2, repeat: isHovered ? Infinity : 0 }}>Bubble Chamber</motion.p>
              <motion.span className="text-[8px] font-mono" style={{ color: 'rgba(100,200,255,0.2)' }} animate={isHovered ? { opacity: [0.2,0.5,0.2] } : {}} transition={{ duration: 1.5, repeat: isHovered ? Infinity : 0 }}>{12 - poppedData.length} active</motion.span>
            </div>
            <div className="h-px" style={{ background: 'linear-gradient(90deg, rgba(100,200,255,0.1), transparent)' }} />
            <div className="min-h-[60px]">
              {poppedData.length > 0 ? (
                <div className="space-y-1">
                  <p className="text-[7px] font-mono tracking-wider" style={{ color: 'rgba(100,200,255,0.2)' }}>RECENT EVENTS</p>
                  {poppedData.slice(-3).reverse().map((d) => (
                    <motion.div key={d.id} className="flex items-center gap-1.5 py-1 px-1.5 rounded" style={{ background: 'rgba(100,200,255,0.04)', border: '1px solid rgba(100,200,255,0.06)' }} initial={{ opacity: 0, x: -5 }} animate={{ opacity: 1, x: 0 }}>
                      <div className="w-1 h-1 rounded-full flex-shrink-0" style={{ background: 'rgba(100,200,255,0.4)' }} />
                      <div><p className="text-[7px] font-semibold" style={{ color: 'rgba(100,200,255,0.7)' }}>{d.value}</p><p className="text-[5px]" style={{ color: 'rgba(100,200,255,0.2)' }}>{d.label}</p></div>
                    </motion.div>
                  ))}
                </div>
              ) : (
                <div className="text-center py-3"><motion.p className="text-2xl" style={{ opacity: 0.05 }} animate={{ rotate: [0,3,-3,0] }} transition={{ duration: 4, repeat: Infinity }}>○</motion.p><p className="text-[8px] mt-1 font-mono" style={{ color: 'rgba(100,200,255,0.15)' }}>click to pop</p></div>
              )}
            </div>
            <div className="grid grid-cols-2 gap-2">
              <div className="text-center py-1.5 rounded-lg" style={{ background: 'rgba(100,200,255,0.03)', border: '1px solid rgba(100,200,255,0.06)' }}><motion.p className="text-[9px] font-semibold" style={{ color: 'rgba(100,200,255,0.6)' }} animate={isHovered ? { opacity: [0.5,0.9,0.5] } : {}} transition={{ duration: 2, repeat: isHovered ? Infinity : 0 }}>Muon</motion.p><p className="text-[7px] mt-0.5 text-white/20">Particle</p></div>
              <div className="text-center py-1.5 rounded-lg" style={{ background: 'rgba(100,200,255,0.03)', border: '1px solid rgba(100,200,255,0.06)' }}><motion.p className="text-[9px] font-semibold" style={{ color: 'rgba(100,200,255,0.6)' }} animate={isHovered ? { opacity: [0.5,0.9,0.5] } : {}} transition={{ duration: 2, repeat: isHovered ? Infinity : 0 }}>Dr. Fermi</motion.p><p className="text-[7px] mt-0.5 text-white/20">Operator</p></div>
            </div>
            <motion.div className="text-center" animate={isHovered ? { y: [0,-1,0] } : {}} transition={{ duration: 1.5, repeat: isHovered ? Infinity : 0 }}><span className="text-[7px] font-mono" style={{ color: 'rgba(100,200,255,0.15)' }}>{isHovered ? '~ bubbles attracted ~' : '~ chamber active ~'}</span></motion.div>
          </div>
        </motion.div>
      </motion.div>
    </div>
  );
}

Where Bubble Chamber Card fits

  • Science Education
  • Data Visualization
  • Physics Apps
  • Research Labs
  • Gaming Stats
  • Tech Dashboards

Interaction states & animations

  • Bubble rise
  • Magnetic attraction
  • Pop explosion
  • Residue shimmer
  • Particle trails

Topics

  • #bubble
  • #chamber
  • #particle
  • #physics
  • #science
  • #lab
  • #experiment
  • #data
  • #interactive
  • #magnetic

Accessibility notes

Bubble movement and pop animations should respect prefers-reduced-motion. Ensure popped data is still accessible via static fallback. No essential information in bubble visuals alone.

Browser support

  • Chrome 90+
  • Firefox 105+
  • Safari 15+
  • Edge 90+