<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Horloge Duale</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
font-family: 'Segoe UI', sans-serif;
gap: 50px;
}
h1 {
color: #e0e0e0;
font-size: 1.5rem;
letter-spacing: 4px;
text-transform: uppercase;
opacity: 0.7;
}
.clocks-container {
display: flex;
flex-wrap: wrap;
gap: 60px;
align-items: center;
justify-content: center;
}
/* ===== HORLOGE NUMÉRIQUE ===== */
.digital-clock-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
}
.digital-label {
color: #a0a0c0;
font-size: 0.85rem;
letter-spacing: 3px;
text-transform: uppercase;
}
.digital-clock {
background: #0a0a1a;
border: 2px solid #00d4ff33;
border-radius: 16px;
padding: 25px 40px;
box-shadow:
0 0 30px #00d4ff22,
inset 0 0 30px #00000066;
display: flex;
align-items: center;
gap: 5px;
}
.digit-group {
display: flex;
gap: 4px;
}
.digit {
font-size: 5rem;
font-weight: 700;
font-family: 'Courier New', monospace;
color: #00d4ff;
text-shadow:
0 0 10px #00d4ff,
0 0 20px #00d4ff88,
0 0 40px #00d4ff44;
line-height: 1;
min-width: 55px;
text-align: center;
}
.separator {
font-size: 5rem;
font-weight: 700;
font-family: 'Courier New', monospace;
color: #00d4ff;
text-shadow: 0 0 10px #00d4ff;
animation: blink 1s infinite;
line-height: 1;
margin: 0 2px;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.1; }
}
.digital-date {
color: #6080a0;
font-size: 0.9rem;
letter-spacing: 2px;
}
/* ===== HORLOGE ANALOGIQUE ===== */
.analog-clock-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
}
.analog-label {
color: #a0a0c0;
font-size: 0.85rem;
letter-spacing: 3px;
text-transform: uppercase;
}
.clock-face {
position: relative;
width: 260px;
height: 260px;
}
.clock-svg {
width: 100%;
height: 100%;
filter: drop-shadow(0 0 20px #00000088);
}
/* Cadran */
.clock-bg {
fill: #0d1b2a;
stroke: #c8a96e;
stroke-width: 3;
}
.clock-outer-ring {
fill: none;
stroke: #c8a96e88;
stroke-width: 8;
}
/* Chiffres romains */
.roman-number {
fill: #c8a96e;
font-family: 'Times New Roman', serif;
font-size: 13px;
font-weight: bold;
text-anchor: middle;
dominant-baseline: central;
}
/* Graduations */
.tick-major {
stroke: #c8a96e;
stroke-width: 2.5;
}
.tick-minor {
stroke: #c8a96e66;
stroke-width: 1;
}
/* Aiguilles */
.hand {
transform-origin: 130px 130px;
transition: transform 0.3s cubic-bezier(0.4, 2.08, 0.55, 0.44);
}
.hand-hour {
stroke: #e8d5a3;
stroke-width: 6;
stroke-linecap: round;
}
.hand-minute {
stroke: #ffffff;
stroke-width: 4;
stroke-linecap: round;
}
.hand-second {
stroke: #ff4444;
stroke-width: 2;
stroke-linecap: round;
transition: transform 0.1s ease;
}
.center-dot {
fill: #ff4444;
}
.center-dot-inner {
fill: #1a1a2e;
}
</style>
</head>
<body>
<h1>⏱ Horloge Duale</h1>
<div class="clocks-container">
<!-- HORLOGE NUMÉRIQUE -->
<div class="digital-clock-wrapper">
<span class="digital-label">🖥 Numérique</span>
<div class="digital-clock">
<div class="digit-group">
<span class="digit" id="hours">00</span>
</div>
<span class="separator">:</span>
<div class="digit-group">
<span class="digit" id="minutes">00</span>
</div>
<span class="separator">:</span>
<div class="digit-group">
<span class="digit" id="seconds">00</span>
</div>
</div>
<span class="digital-date" id="date">Chargement...</span>
</div>
<!-- HORLOGE ANALOGIQUE -->
<div class="analog-clock-wrapper">
<span class="analog-label">🕰 Analogique</span>
<div class="clock-face">
<svg class="clock-svg" viewBox="0 0 260 260" id="clockSVG">
<!-- Fond et bordures -->
<circle cx="130" cy="130" r="125" class="clock-bg"/>
<circle cx="130" cy="130" r="120" class="clock-outer-ring"/>
<!-- Graduations -->
<g id="ticks"></g>
<!-- Chiffres romains -->
<g id="numbers"></g>
<!-- Aiguilles -->
<line id="hourHand" class="hand hand-hour" x1="130" y1="145" x2="130" y2="68"/>
<line id="minuteHand" class="hand hand-minute" x1="130" y1="150" x2="130" y2="48"/>
<line id="secondHand" class="hand hand-second" x1="130" y1="160" x2="130" y2="38"/>
<!-- Centre -->
<circle cx="130" cy="130" r="8" class="center-dot"/>
<circle cx="130" cy="130" r="3" class="center-dot-inner"/>
</svg>
</div>
</div>
</div>
<script>
// ========== INITIALISATION DU CADRAN ==========
const romanNumerals = ['XII', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI'];
const cx = 130, cy = 130, radius = 130;
// Graduations
const ticksGroup = document.getElementById('ticks');
for (let i = 0; i < 60; i++) {
const angle = (i * 6 - 90) * Math.PI / 180;
const isMajor = i % 5 === 0;
const innerR = isMajor ? 100 : 108;
const outerR = 118;
const x1 = cx + innerR * Math.cos(angle);
const y1 = cy + innerR * Math.sin(angle);
const x2 = cx + outerR * Math.cos(angle);
const y2 = cy + outerR * Math.sin(angle);
const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
line.setAttribute('x1', x1); line.setAttribute('y1', y1);
line.setAttribute('x2', x2); line.setAttribute('y2', y2);
line.setAttribute('class', isMajor ? 'tick-major' : 'tick-minor');
ticksGroup.appendChild(line);
}
// Chiffres romains
const numbersGroup = document.getElementById('numbers');
romanNumerals.forEach((num, i) => {
const angle = (i * 30 - 90) * Math.PI / 180;
const r = 88;
const x = cx + r * Math.cos(angle);
const y = cy + r * Math.sin(angle);
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', x);
text.setAttribute('y', y);
text.setAttribute('class', 'roman-number');
text.textContent = num;
numbersGroup.appendChild(text);
});
// ========== MISE À JOUR DE L'HEURE ==========
const hourHand = document.getElementById('hourHand');
const minuteHand = document.getElementById('minuteHand');
const secondHand = document.getElementById('secondHand');
const hoursEl = document.getElementById('hours');
const minutesEl = document.getElementById('minutes');
const secondsEl = document.getElementById('seconds');
const dateEl = document.getElementById('date');
const days = ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'];
const months = ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'];
function pad(n) {
return String(n).padStart(2, '0');
}
function updateClock() {
const now = new Date();
const h = now.getHours();
const m = now.getMinutes();
const s = now.getSeconds();
const ms = now.getMilliseconds();
// --- Numérique ---
hoursEl.textContent = pad(h);
minutesEl.textContent = pad(m);
secondsEl.textContent = pad(s);
dateEl.textContent = `${days[now.getDay()]} ${now.getDate()} ${months[now.getMonth()]} ${now.getFullYear()}`;
// --- Analogique ---
const secDeg = s * 6 + ms * 0.006;
const minDeg = m * 6 + s * 0.1;
const hourDeg = (h % 12) * 30 + m * 0.5;
hourHand.style.transform = `rotate(${hourDeg}deg)`;
minuteHand.style.transform = `rotate(${minDeg}deg)`;
secondHand.style.transform = `rotate(${secDeg}deg)`;
}
updateClock();
setInterval(updateClock, 50);
</script>
</body>
</html>