Skip to content

Clock Tower Card

Rotating gears in the background with clock hands that animate. Hover speeds up time, click cycles through Ticking, Sped Up, Frozen, and Striking stages with bell ring animations.

Clock Tower Card

by FreeCsStyles Dev's

CardsClock Tower
🌐🎨⚛️

Embed this component

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

<iframe src="/embed/clock-tower-card" sandbox="allow-scripts" loading="lazy" title="Clock Tower Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Clock Tower 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="tower-card" onclick="cycleTower(this)">
  <div class="tower-clock" id="tower-clock">
    <div class="tower-hour" id="tower-hour"></div>
    <div class="tower-minute" id="tower-minute"></div>
  </div>
  <div class="tower-content">
    <div class="tower-header">
      <div><div class="tower-title">Big Ben</div><div class="tower-sub">GMT</div></div>
      <div class="tower-status" id="tower-status">Ticking</div>
    </div>
    <div class="tower-divider"></div>
    <div class="tower-grid">
      <div class="tower-stat"><div class="tower-stat-val">5</div><div class="tower-stat-lbl">Bells</div></div>
      <div class="tower-stat"><div class="tower-stat-val">96m</div><div class="tower-stat-lbl">Height</div></div>
    </div>
    <div class="tower-hint" id="tower-hint">[▼ click to adjust]</div>
  </div>
</div>
<script>
const states = ['Ticking', 'Sped Up', 'Frozen', 'Striking'];
let towerState = 0;
function cycleTower(el) {
  towerState = (towerState + 1) % 4;
  document.getElementById('tower-status').textContent = states[towerState];
  document.getElementById('tower-hint').textContent = towerState === 2 ? '[▼ click to resume]' : towerState === 3 ? '[▼ click to calm]' : '[▼ click to adjust]';
}
</script>
CSS
.tower-card {
  position: relative;
  width: 220px;
  min-height: 300px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #141012, #0e0a0c);
  border: 1.5px solid rgba(212,165,116,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.4s ease;
}

.tower-card:hover {
  box-shadow: 0 0 30px rgba(212,165,116,0.08), 0 15px 40px rgba(0,0,0,0.4);
}

.tower-clock {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1.5px solid rgba(212,165,116,0.12);
  background: rgba(212,165,116,0.02);
  z-index: 2;
  pointer-events: none;
}

.tower-hour {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 2px;
  height: 25px;
  background: rgba(212,165,116,0.4);
  transform-origin: bottom center;
  animation: hourTick 30s linear infinite;
}

.tower-minute {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 1.2px;
  height: 29px;
  background: rgba(212,165,116,0.3);
  transform-origin: bottom center;
  animation: minuteTick 3s linear infinite;
}

.tower-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);
}

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

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

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

@media (prefers-reduced-motion: reduce) {
  .tower-card { transition: none; }
  .tower-hour, .tower-minute { animation: none; }
}
Tailwind CSS
<div class="group relative w-[220px] min-h-[300px] rounded-2xl overflow-hidden border border-amber-600/20 shadow-lg group-hover:shadow-[0_0_30px_rgba(212,165,116,0.08),0_15px_40px_rgba(0,0,0,0.4)] bg-gradient-to-br from-[#141012] to-[#0e0a0c] cursor-pointer">
  <div class="absolute top-[12%] left-1/2 -translate-x-1/2 w-[90px] h-[90px] rounded-full border border-amber-600/20 bg-amber-600/5 z-2 pointer-events-none">
    <div class="absolute top-[20px] left-1/2 w-[2px] h-[25px] bg-amber-600/40 origin-bottom animate-[hourTick_30s_linear_infinite]"></div>
    <div class="absolute top-[16px] left-1/2 w-[1.2px] h-[29px] bg-amber-600/30 origin-bottom animate-[minuteTick_3s_linear_infinite]"></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">Big Ben</p><p class="text-[9px] text-amber-600/50">GMT</p></div>
      <div class="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest text-amber-600 bg-amber-500/10 border border-amber-500/20">Ticking</div>
    </div>
    <div class="h-px bg-gradient-to-r from-transparent via-amber-600/20 to-transparent"></div>
    <div class="grid grid-cols-2 gap-2">
      <div class="text-center py-1.5 rounded-lg bg-amber-500/10 border border-amber-500/20"><p class="text-[10px] font-semibold text-amber-600">5</p><p class="text-[7px] mt-0.5 text-white/20">Bells</p></div>
      <div class="text-center py-1.5 rounded-lg bg-amber-500/10 border border-amber-500/20"><p class="text-[10px] font-semibold text-amber-600">96m</p><p class="text-[7px] mt-0.5 text-white/20">Height</p></div>
    </div>
    <div class="text-center"><span class="text-[7px] font-mono text-amber-600/30">[▼ click to adjust]</span></div>
  </div>
</div>
React
import React, { useState, useRef } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';

export function ClockTowerCard() {
  const [isHovered, setIsHovered] = useState(false);
  const [timeState, setTimeState] = 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 timeLabels = ['Ticking', 'Sped Up', 'Frozen', 'Striking'];
  return (
    <div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
      <motion.div ref={ref} onMouseMove={handleMouseMove} onClick={() => setTimeState((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, #141012, #0e0a0c)', border: '1.5px solid rgba(212,165,116,0.08)' }}
          animate={{ boxShadow: isHovered ? '0 0 30px rgba(212,165,116,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 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">Big Ben</p><p className="text-[9px]" style={{ color: 'rgba(212,165,116,0.44)' }}>GMT</p></div>
              <motion.div className="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest" style={{ background: 'rgba(212,165,116,0.1)', border: '1px solid rgba(212,165,116,0.12)', color: '#d4a574' }}>{timeLabels[timeState]}</motion.div>
            </div>
            <div className="h-px" style={{ background: 'linear-gradient(90deg, transparent, rgba(212,165,116,0.08), transparent)' }} />
            <div className="grid grid-cols-2 gap-2">
              <div className="text-center py-1.5 rounded-lg" style={{ background: 'rgba(212,165,116,0.02)', border: '1px solid rgba(212,165,116,0.06)' }}><p className="text-[10px] font-semibold" style={{ color: '#d4a574' }}>5</p><p className="text-[7px] mt-0.5 text-white/20">Bells</p></div>
              <div className="text-center py-1.5 rounded-lg" style={{ background: 'rgba(212,165,116,0.02)', border: '1px solid rgba(212,165,116,0.06)' }}><p className="text-[10px] font-semibold" style={{ color: '#d4a574' }}>96m</p><p className="text-[7px] mt-0.5 text-white/20">Height</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(212,165,116,0.2)' }}>{timeState === 2 ? '[▼ click to resume]' : timeState === 3 ? '[▼ click to calm]' : '[▼ click to adjust]'}</span>
            </motion.div>
          </div>
        </motion.div>
      </motion.div>
    </div>
  );
}

Interaction states & animations

  • Hover