Skip to content

Living DNA Card

The card features a DNA double helix that twists while idle. Hovering causes strands to partially unwind revealing genetic data. Clicking cycles through Coiled, Unwinding, Expressing, and Complete stages.

Living DNA Card

by FreeCsStyles Dev's

CardsLiving DNA
🌐🎨⚛️

Embed this component

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

<iframe src="/embed/living-dna-card" sandbox="allow-scripts" loading="lazy" title="Living DNA Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Living DNA 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="dna-card" onclick="cycleDNA(this)">
  <div class="dna-helix"></div>
  <div class="dna-bases"></div>
  <div class="dna-content">
    <div class="dna-header">
      <div><div class="dna-title">Homo Sapiens</div><div class="dna-sub">3.2B bp genome</div></div>
      <div class="dna-status" id="dna-status">COILED</div>
    </div>
    <div class="dna-divider"></div>
    <div class="dna-grid">
      <div class="dna-stat"><div class="dna-stat-val">46</div><div class="dna-stat-lbl">Chromosomes</div></div>
      <div class="dna-stat"><div class="dna-stat-val">1953</div><div class="dna-stat-lbl">Discovered</div></div>
    </div>
    <div class="dna-hint" id="dna-hint">[▼ click to sequence]</div>
  </div>
</div>
<script>
const stages = ['COILED', 'UNWINDING', 'EXPRESSING', 'COMPLETE'];
let dnaStage = 0;
function cycleDNA(el) {
  dnaStage = (dnaStage + 1) % 4;
  el.className = 'dna-card';
  el.classList.add(`dna-${stages[dnaStage].toLowerCase()}`);
  document.getElementById('dna-status').textContent = stages[dnaStage];
  document.getElementById('dna-hint').textContent = dnaStage >= 3 ? '[▼ restart cycle]' : '[▼ click to sequence]';
}
</script>
CSS
.dna-card {
  position: relative;
  width: 220px;
  min-height: 300px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #0a1208, #060e06);
  border: 1.5px solid rgba(74,222,128,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.4s ease;
}

.dna-card:hover {
  box-shadow: 0 0 30px rgba(74,222,128,0.08), 0 15px 40px rgba(0,0,0,0.4);
}

.dna-helix {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 140px;
  border: 2px solid rgba(74,222,128,0.15);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  animation: helixSpin 6s linear infinite;
}

.dna-bases {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.dna-content {
  position: absolute;
  inset-x: 0;
  bottom: 0;
  z-index: 10;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(0deg, rgba(0,0,0,0.6), transparent);
}

.dna-header { display: flex; justify-content: space-between; align-items: center; }
.dna-title { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); }
.dna-sub { font-size: 9px; color: rgba(74,222,128,0.44); }
.dna-status { padding: 2px 8px; border-radius: 2px; font-size: 7px; font-weight: 700; letter-spacing: 0.1em; color: #4ade80; background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.12); }
.dna-divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(74,222,128,0.08), transparent); }
.dna-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dna-stat { text-align: center; padding: 6px 4px; border-radius: 8px; background: rgba(74,222,128,0.02); border: 1px solid rgba(74,222,128,0.06); }
.dna-stat-val { font-size: 10px; font-weight: 600; color: #4ade80; }
.dna-stat-lbl { font-size: 7px; margin-top: 2px; color: rgba(255,255,255,0.2); }
.dna-hint { text-align: center; font-size: 7px; font-family: monospace; color: rgba(74,222,128,0.2); }

@keyframes helixSpin {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .dna-card { transition: none; }
  .dna-helix { animation: none; }
}
Tailwind CSS
<div class="group relative w-[220px] min-h-[300px] rounded-2xl overflow-hidden border border-green-400/20 shadow-lg group-hover:shadow-[0_0_30px_rgba(74,222,128,0.08),0_15px_40px_rgba(0,0,0,0.4)] bg-gradient-to-br from-[#0a1208] to-[#060e06] cursor-pointer">
  <div class="absolute top-[10%] left-1/2 -translate-x-1/2 w-[120px] h-[140px] border-2 border-green-400/20 rounded-full pointer-events-none z-1 animate-[helixSpin_6s_linear_infinite]"></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">Homo Sapiens</p><p class="text-[9px] text-green-400/50">3.2B bp genome</p></div>
      <div class="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest text-green-400 bg-green-500/10 border border-green-500/20">COILED</div>
    </div>
    <div class="h-px bg-gradient-to-r from-transparent via-green-400/20 to-transparent"></div>
    <div class="grid grid-cols-2 gap-2">
      <div class="text-center py-1.5 rounded-lg bg-green-500/10 border border-green-500/20"><p class="text-[10px] font-semibold text-green-400">46</p><p class="text-[7px] mt-0.5 text-white/20">Chromosomes</p></div>
      <div class="text-center py-1.5 rounded-lg bg-green-500/10 border border-green-500/20"><p class="text-[10px] font-semibold text-green-400">1953</p><p class="text-[7px] mt-0.5 text-white/20">Discovered</p></div>
    </div>
    <div class="text-center"><span class="text-[7px] font-mono text-green-400/30">[▼ click to sequence]</span></div>
  </div>
</div>
React
import React, { useState, useRef } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';

export function LivingDNACard() {
  const [isHovered, setIsHovered] = useState(false);
  const [stage, setStage] = useState(0);
  const ref = useRef(null);
  const x = useMotionValue(0);
  const y = useMotionValue(0);
  const rotateX = useSpring(y, { damping: 25, stiffness: 200 });
  const rotateY = useSpring(x, { damping: 25, stiffness: 200 });
  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)) * 6);
    y.set(((e.clientY - cy) / (rect.height / 2)) * 6);
  };
  const stageLabels = ['COILED', 'UNWINDING', 'EXPRESSING', 'COMPLETE'];
  return (
    <div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
      <motion.div ref={ref} onMouseMove={handleMouseMove} onClick={() => setStage((prev) => (prev + 1) % 4)} style={{ rotateX, rotateY, transformStyle: 'preserve-3d', cursor: 'pointer' }}>
        <motion.div className="relative overflow-hidden rounded-2xl" style={{ width: 220, minHeight: 300, background: 'linear-gradient(160deg, #0a1208, #060e06)', border: '1.5px solid rgba(74,222,128,0.08)' }}
          animate={{ boxShadow: isHovered ? '0 0 30px rgba(74,222,128,0.08), 0 15px 40px rgba(0,0,0,0.4)' : '0 10px 30px rgba(0,0,0,0.3)' }} transition={{ type: 'spring', stiffness: 280, damping: 20 }}>
          <div className="absolute top-[10%] left-1/2 -translate-x-1/2 text-2xl pointer-events-none z-[3]">🧬</div>
          <div className="absolute inset-x-0 bottom-0 z-10 p-5 space-y-2" style={{ background: 'linear-gradient(0deg, rgba(0,0,0,0.6), transparent)' }}>
            <div className="flex items-center justify-between">
              <div><p className="text-sm font-bold text-white/90">Homo Sapiens</p><p className="text-[9px]" style={{ color: 'rgba(74,222,128,0.44)' }}>3.2B bp</p></div>
              <motion.div className="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest" style={{ background: 'rgba(74,222,128,0.1)', border: '1px solid rgba(74,222,128,0.12)', color: '#4ade80' }}>{stageLabels[stage]}</motion.div>
            </div>
            <div className="h-px" style={{ background: 'linear-gradient(90deg, transparent, rgba(74,222,128,0.08), transparent)' }} />
            <div className="grid grid-cols-2 gap-2">
              <div className="text-center py-1.5 rounded-lg" style={{ background: 'rgba(74,222,128,0.02)', border: '1px solid rgba(74,222,128,0.06)' }}><p className="text-[10px] font-semibold" style={{ color: '#4ade80' }}>46</p><p className="text-[7px] mt-0.5 text-white/20">Chromosomes</p></div>
              <div className="text-center py-1.5 rounded-lg" style={{ background: 'rgba(74,222,128,0.02)', border: '1px solid rgba(74,222,128,0.06)' }}><p className="text-[10px] font-semibold" style={{ color: '#4ade80' }}>1953</p><p className="text-[7px] mt-0.5 text-white/20">Discovered</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(74,222,128,0.2)' }}>{stage >= 3 ? '[▼ restart cycle]' : '[▼ click to sequence]'}</span>
            </motion.div>
          </div>
        </motion.div>
      </motion.div>
    </div>
  );
}

Interaction states & animations

  • Hover