js+css实现炫酷带大事件的宇宙时钟圆环代码

代码语言:html

所属分类:其他

代码描述:js+css实现炫酷带大事件的宇宙时钟圆环代码,每一环代表不同的时间维度年月日时分秒

代码标签: js css 炫酷 大事件 宇宙 时钟 圆环 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0a0a0a;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  color: #e5e5e5;
  min-height: 100vh;
}
canvas { display: block; }

#info {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(15, 15, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  max-width: 220px;
  border-radius: 8px;
}

h1 {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 3px;
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.subtitle {
  font-size: 10px;
  color: #555;
  margin-bottom: 14px;
}

#current-time {
  font-size: 28px;
  font-weight: 300;
  color: #fff;
  margin: 12px 0 6px;
  letter-spacing: -1px;
}

#current-date {
  font-size: 11px;
  color: #777;
  margin-bottom: 16px;
}

.ring-legend {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 14px;
}

.legend-section { margin-bottom: 10px; }

.legend-section-title {
  font-size: 8px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin: 4px 0;
  font-size: 9px;
  color: #777;
}

.legend-color {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  margin-right: 7px;
}

#tooltip {
  position: absolute;
  background: rgba(15, 15, 15, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  pointer-events: none;
  display: none;
  font-size: 10px;
  z-index: 1000;
  max-width: 240px;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#tooltip h3 {
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

#tooltip .detail {
  color: #888;
  margin: 2px 0;
  line-height: 1.4;
}

#tooltip .event-tooltip-date {
  color: #aaa;
  font-weight: 500;
}

#event-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(15, 15, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  max-width: 260px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  border-radius: 8px;
}

#event-panel h2 {
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.event-category { margin-bottom: 14px; }

.event-category-title {
  font-size: 8px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.event-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 10px;
}
.event-item:last-child { border-bottom: none; }

.event-date {
  color: #fff;
  font-weight: 500;
  font-size: 10px;
}

.event-name {
  color: #999;
  margin-top: 1px;
  font-size: 9px;
}

.event-days {
  color: #555;
  font-size: 9px;
  margin-top: 1px;
}

.event-icon { margin-right: 5px; font-size: 9px; }

.event-type-political { color: #ef4444; }
.event-type-sports { color: #22c55e; }
.event-type-entertainment { color: #f59e0b; }
.event-type-cultural { color: #ec4899; }
.event-type-astronomical { color: #3b82f6; }
.event-type-tech { color: #8b5cf6; }

#controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(15, 15, 15, 0.95);
  padding: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.control-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #666;
  padding: 6px 12px;
  font-size: 10px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.control-btn.active {
  background: #fff;
  color: #0a0a0a;
  border-color: #fff;
}

#event-panel::-webkit-scrollbar { width: 3px; }
#event-panel::-webkit-scrollbar-track { background: transparent; }
#event-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 2px.........完整代码请登录后点击上方下载按钮下载查看

网友评论0