Back to CSS Number Counter Animations Bioluminescent Health Tracker CSS + JS
Share
HTML
<div class="cnc-bio">
  <div class="cnc-bio-container">
    <div class="cnc-bio-card">
      <div class="cnc-bio-metric-tag"><span class="cnc-bio-dot"></span> Cardiac</div>
      <div class="cnc-bio-number-row">
        <span class="cnc-bio-num cnc-num" data-target="72">0</span>
        <span class="cnc-bio-unit">bpm</span>
      </div>
      <div class="cnc-bio-label">Resting Heart Rate</div>
      <div class="cnc-bio-sparkline">
        <svg width="100%" height="40" viewBox="0 0 200 40" fill="none" preserveAspectRatio="none">
          <path d="M0 20 L20 20 L30 5 L40 35 L50 10 L60 20 L80 20 L95 8 L110 32 L125 15 L140 20 L160 20 L170 12 L180 28 L190 18 L200 20"
            stroke="#00ff8c" stroke-width="2" fill="none"
            style="filter: drop-shadow(0 0 4px #00ff8c);"/>
        </svg>
      </div>
      <span class="cnc-bio-delta cnc-bio-delta-up">↓ 3 bpm vs last week</span>
    </div>
    <div class="cnc-bio-card">
      <div class="cnc-bio-metric-tag"><span class="cnc-bio-dot"></span> Recovery</div>
      <div class="cnc-bio-number-row">
        <span class="cnc-bio-num cnc-num" data-target="7" data-decimals="1">0</span>
        <span class="cnc-bio-unit">hrs</span>
      </div>
      <div class="cnc-bio-label">Deep Sleep Duration</div>
      <div class="cnc-bio-bars">
        <div class="cnc-bio-bar-row">
          <span class="cnc-bio-bar-label">REM</span>
          <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c1" style="width:72%"></div></div>
          <span class="cnc-bio-bar-val">72%</span>
        </div>
        <div class="cnc-bio-bar-row">
          <span class="cnc-bio-bar-label">DEEP</span>
          <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c2" style="width:58%"></div></div>
          <span class="cnc-bio-bar-val">58%</span>
        </div>
        <div class="cnc-bio-bar-row">
          <span class="cnc-bio-bar-label">LIGHT</span>
          <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c3" style="width:85%"></div></div>
          <span class="cnc-bio-bar-val">85%</span>
        </div>
      </div>
    </div>
    <div class="cnc-bio-card">
      <div class="cnc-bio-metric-tag"><span class="cnc-bio-dot"></span> Aerobic</div>
      <div class="cnc-bio-number-row">
        <span class="cnc-bio-num cnc-num" data-target="54" data-decimals="1">0</span>
        <span class="cnc-bio-unit">ml/kg</span>
      </div>
      <div class="cnc-bio-label">VO₂ Max · Excellent</div>
      <div class="cnc-bio-bars">
        <div class="cnc-bio-bar-row">
          <span class="cnc-bio-bar-label">30D</span>
          <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c4" style="width:82%"></div></div>
          <span class="cnc-bio-bar-val">52.1</span>
        </div>
        <div class="cnc-bio-bar-row">
          <span class="cnc-bio-bar-label">60D</span>
          <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c5" style="width:76%"></div></div>
          <span class="cnc-bio-bar-val">51.3</span>
        </div>
        <div class="cnc-bio-bar-row">
          <span class="cnc-bio-bar-label">90D</span>
          <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c6" style="width:70%"></div></div>
          <span class="cnc-bio-bar-val">49.8</span>
        </div>
      </div>
    </div>
    <div class="cnc-bio-card">
      <div class="cnc-bio-metric-tag"><span class="cnc-bio-dot"></span> Nervous System</div>
      <div class="cnc-bio-number-row">
        <span class="cnc-bio-num cnc-num" data-target="89">0</span>
        <span class="cnc-bio-unit">ms</span>
      </div>
      <div class="cnc-bio-label">Heart Rate Variability</div>
      <div class="cnc-bio-sparkline">
        <svg width="100%" height="40" viewBox="0 0 200 40" fill="none" preserveAspectRatio="none">
          <path d="M0 25 Q25 10 50 22 Q75 34 100 18 Q125 8 150 20 Q175 30 200 15"
            stroke="#b06eff" stroke-width="2" fill="none"
            style="filter: drop-shadow(0 0 4px #b06eff);"/>
        </svg>
      </div>
      <span class="cnc-bio-delta cnc-bio-delta-up">↑ 12ms vs baseline</span>
    </div>
    <div class="cnc-bio-card cnc-bio-wide">
      <div class="cnc-bio-ring-wrap">
        <svg width="130" height="130" viewBox="0 0 130 130">
          <circle class="cnc-bio-ring-bg" cx="65" cy="65" r="55"/>
          <circle class="cnc-bio-ring-fill" cx="65" cy="65" r="55"/>
        </svg>
        <div class="cnc-bio-ring-label">
          <span class="cnc-bio-ring-pct cnc-num" data-target="80">0</span>
          <span class="cnc-bio-ring-sub">score</span>
        </div>
      </div>
      <div class="cnc-bio-wide-text">
        <div class="cnc-bio-metric-tag"><span class="cnc-bio-dot"></span> Overall Recovery</div>
        <div class="cnc-bio-number-row">
          <span class="cnc-bio-num cnc-num" style="font-size: 52px;" data-target="80">0</span>
          <span class="cnc-bio-unit">/ 100</span>
        </div>
        <div class="cnc-bio-label">Body is ready · Optimal Training Zone</div>
        <div class="cnc-bio-bars">
          <div class="cnc-bio-bar-row">
            <span class="cnc-bio-bar-label" style="width:60px">STRAIN</span>
            <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c1" style="width:65%"></div></div>
            <span class="cnc-bio-bar-val">6.5</span>
          </div>
          <div class="cnc-bio-bar-row">
            <span class="cnc-bio-bar-label" style="width:60px">CALORIES</span>
            <div class="cnc-bio-bar-track"><div class="cnc-bio-bar-fill cnc-bio-c7" style="width:88%"></div></div>
            <span class="cnc-bio-bar-val">2,840</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
CSS
.cnc-bio {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
  background: #05120f;
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
}
.cnc-bio::before {
  content: ''; position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,255,140,0.06) 0%, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  pointer-events: none;
}
.cnc-bio-container {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 20px; width: 760px;
}
.cnc-bio-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(0,255,140,0.12);
  border-radius: 24px; padding: 36px 32px;
  position: relative; overflow: hidden;
  backdrop-filter: blur(10px);
  transition: border-color 0.4s, transform 0.3s;
  opacity: 0; animation: cnc-bio-fadeUp 0.7s ease forwards;
}
.cnc-bio-card:hover {
  border-color: rgba(0,255,140,0.35);
  transform: translateY(-3px);
}
.cnc-bio-card::before {
  content: ''; position: absolute;
  width: 200px; height: 200px; border-radius: 50%;
  filter: blur(60px); opacity: 0.12;
  pointer-events: none; bottom: -60px; right: -60px;
  animation: cnc-bio-breathe 6s ease-in-out infinite;
}
.cnc-bio-card:nth-child(1)::before { background: #00ff8c; }
.cnc-bio-card:nth-child(2)::before { background: #00c2ff; animation-delay: -2s; }
.cnc-bio-card:nth-child(3)::before { background: #ff6b35; animation-delay: -4s; }
.cnc-bio-card:nth-child(4)::before { background: #b06eff; animation-delay: -1s; }
@keyframes cnc-bio-breathe {
  0%, 100% { transform: scale(1); opacity: 0.12; }
  50% { transform: scale(1.3); opacity: 0.2; }
}
.cnc-bio-card.cnc-bio-wide {
  grid-column: span 2;
  display: flex; align-items: center; gap: 48px;
  padding: 40px;
}
.cnc-bio-metric-tag {
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.cnc-bio-dot {
  width: 6px; height: 6px; border-radius: 50%;
  animation: cnc-bio-pulse 2s ease-in-out infinite;
}
@keyframes cnc-bio-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.cnc-bio-card:nth-child(1) .cnc-bio-dot { background: #00ff8c; box-shadow: 0 0 8px #00ff8c; }
.cnc-bio-card:nth-child(2) .cnc-bio-dot { background: #00c2ff; box-shadow: 0 0 8px #00c2ff; animation-delay: -1s; }
.cnc-bio-card:nth-child(3) .cnc-bio-dot { background: #ff6b35; box-shadow: 0 0 8px #ff6b35; animation-delay: -0.5s; }
.cnc-bio-card:nth-child(4) .cnc-bio-dot { background: #b06eff; box-shadow: 0 0 8px #b06eff; animation-delay: -1.5s; }
.cnc-bio-card.cnc-bio-wide .cnc-bio-dot { background: #00ff8c; box-shadow: 0 0 8px #00ff8c; }
.cnc-bio-number-row {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px;
}
.cnc-bio-num {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(52px, 6vw, 72px);
  color: #fff; line-height: 1; letter-spacing: -2px;
}
.cnc-bio-wide .cnc-bio-num { font-size: clamp(64px, 8vw, 96px); }
.cnc-bio-unit {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300; font-style: italic;
  font-size: 1.4em; color: rgba(255,255,255,0.45); letter-spacing: 1px;
}
.cnc-bio-label {
  font-size: 13px; color: rgba(255,255,255,0.4);
  font-weight: 300; letter-spacing: 0.5px; margin-bottom: 20px;
}
.cnc-bio-ring-wrap {
  flex-shrink: 0; position: relative;
  width: 130px; height: 130px;
}
.cnc-bio-ring-wrap svg { transform: rotate(-90deg); }
.cnc-bio-ring-bg {
  fill: none; stroke: rgba(255,255,255,0.05); stroke-width: 8;
}
.cnc-bio-ring-fill {
  fill: none; stroke: #00ff8c; stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 345; stroke-dashoffset: 345;
  animation: cnc-bio-ringFill 2s ease forwards 0.5s;
  filter: drop-shadow(0 0 8px #00ff8c);
}
@keyframes cnc-bio-ringFill { to { stroke-dashoffset: 69; } }
.cnc-bio-ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #fff;
}
.cnc-bio-ring-pct {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 600; line-height: 1;
}
.cnc-bio-ring-sub {
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(255,255,255,0.35); margin-top: 4px;
}
.cnc-bio-wide-text { flex: 1; }
.cnc-bio-bars {
  display: flex; flex-direction: column; gap: 10px; margin-top: 18px;
}
.cnc-bio-bar-row { display: flex; align-items: center; gap: 12px; }
.cnc-bio-bar-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 2px;
  color: rgba(255,255,255,0.3); width: 28px; flex-shrink: 0;
}
.cnc-bio-bar-track {
  flex: 1; height: 4px; background: rgba(255,255,255,0.06);
  border-radius: 2px; overflow: hidden;
}
.cnc-bio-bar-fill {
  height: 100%; border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  animation: cnc-bio-barIn 1.2s ease forwards;
}
.cnc-bio-c1 { background: linear-gradient(90deg, #00ff8c, #00c2ff); animation-delay: 0.8s; }
.cnc-bio-c2 { background: linear-gradient(90deg, #00c2ff, #b06eff); animation-delay: 1.0s; }
.cnc-bio-c3 { background: linear-gradient(90deg, #b06eff, #ff6b35); animation-delay: 1.2s; }
.cnc-bio-c4 { background: linear-gradient(90deg, #ff6b35, #ff2d7a); animation-delay: 1.4s; }
.cnc-bio-c5 { background: linear-gradient(90deg, #00ff8c, #00c2ff); animation-delay: 1.6s; }
.cnc-bio-c6 { background: linear-gradient(90deg, #00c2ff, #b06eff); animation-delay: 1.8s; }
.cnc-bio-c7 { background: linear-gradient(90deg, #b06eff, #00ff8c); animation-delay: 2.0s; }
@keyframes cnc-bio-barIn { to { transform: scaleX(1); } }
.cnc-bio-bar-val {
  font-size: 11px; color: rgba(255,255,255,0.35);
  width: 32px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.cnc-bio-sparkline { margin-top: 20px; }
.cnc-bio-sparkline svg path {
  stroke-dasharray: 500; stroke-dashoffset: 500;
  animation: cnc-bio-drawLine 2s ease forwards 0.8s;
}
@keyframes cnc-bio-drawLine { to { stroke-dashoffset: 0; } }
.cnc-bio-card:nth-child(1) { animation-delay: 0.0s; }
.cnc-bio-card:nth-child(2) { animation-delay: 0.15s; }
.cnc-bio-card:nth-child(3) { animation-delay: 0.3s; }
.cnc-bio-card:nth-child(4) { animation-delay: 0.45s; }
.cnc-bio-card.cnc-bio-wide { animation-delay: 0.6s; }
@keyframes cnc-bio-fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.cnc-bio-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 10px;
  border-radius: 20px; margin-top: 6px;
}
.cnc-bio-delta-up { background: rgba(0,255,140,0.1); color: #00ff8c; }
.cnc-bio-delta-down { background: rgba(255,107,53,0.1); color: #ff6b35; }
@media (prefers-reduced-motion: reduce) {
  .cnc-bio-card::before, .cnc-bio-dot, .cnc-bio-bar-fill,
  .cnc-bio-ring-fill, .cnc-bio-sparkline svg path, .cnc-bio-card {
    animation: none;
  }
  .cnc-bio-card { opacity: 1; }
}
JS
(function () {
  function easeOut(t) { return 1 - Math.pow(1 - t, 3); }
  var root = document.querySelector('.cnc-bio');
  if (!root) return;
  var cards = [].slice.call(root.querySelectorAll('.cnc-bio-card'));
  root.querySelectorAll('.cnc-num[data-target]').forEach(function (el) {
    var target = parseFloat(el.dataset.target);
    var decimals = parseInt(el.dataset.decimals || 0, 10);
    var duration = 2000;
    var idx = cards.indexOf(el.closest('.cnc-bio-card'));
    var delay = (idx * 150 + 300);
    setTimeout(function () {
      var start = performance.now();
      function tick(now) {
        var t = Math.min((now - start) / duration, 1);
        var val = easeOut(t) * target;
        el.textContent = decimals > 0 ? val.toFixed(decimals) : Math.round(val);
        if (t < 1) requestAnimationFrame(tick);
      }
      requestAnimationFrame(tick);
    }, delay);
  });
})();