canvas透镜黑洞周围的交互式本地时天文台代码

代码语言:html

所属分类:其他

代码描述:canvas透镜黑洞周围的交互式本地时天文台代码,事件视界轨道:透镜黑洞周围的交互式本地时天文台。 金色(时)、粉色(分)和青色(秒)光波,以及轨道信标和碎片,呈现于Canvas 2D中。

代码标签: canvas 透镜 黑洞 周围 交互式 本地 天文台 代码

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

<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">


<style>
  :root {
    color-scheme: dark;
    --ink: #010108;
    --text: #f7f1ff;
    --amber: #ffb35c;
    --ice: #79e7ff;
    --pink: #ff4fc8;
    --violet: #8d6bff;
    --lime: #b7ff72;
    --coral: #ff6b6b;
  }
  * { box-sizing: border-box; }
  html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--ink); }
  body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }
  canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    display: block; touch-action: none; cursor: grab; outline: none;
  }
  canvas:active { cursor: grabbing; }
  canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--ice); }
  .readout {
    position: fixed; z-index: 2;
    left: max(18px, env(safe-area-inset-left));
    top: max(18px, env(safe-area-inset-top));
    padding: 10px 12px 10px 10px;
    border-left: 2px solid rgba(121, 231, 255, 0.55);
    pointer-events: none;
    text-shadow: 0 2px 12px #000;
    background: linear-gradient(90deg, rgba(8, 8, 24, 0.75), transparent);
  }
  .time {
    display: block;
    color: rgba(247, 241, 255, 0.88);
    font-size: clamp(15px, 1.9vw, 22px);
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
  }
  .legend {
    display: flex; gap: 0.85rem; margin-top: 7px;
    font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    color: rgba(247, 241, 255, 0.42);
  }
  .legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
  .legend i {
    width: 7px; height: 7px; border-radius: 50%;
    box-shadow: 0 0 8px currentColor; background: currentColor;
  }
  .legend .h { color: var(--amber); }
  .legend .m { color: var(--pink); }
  .legend .s { color: var(--ice); }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  @media (max-width: 560px) {
    .time { font-size: 14px; }
    .legend { font-size: 9px; gap: 0.55rem; }
  }
  @media (max-height: 480px) { .legend { display: none; } }
  @media (prefers-reduced-motion: reduce) { canvas { cursor: default; } }
  @media (forced-colors: active) {
    canvas:focus-visible { outline: 3px solid Highlight; }
  }
</style>
</head>
<body>
<main>
  <canvas id="orbit" tabindex="0" role="img" aria-label="Event Horizon Orbit is loading local time."></canvas>
  <div class="readout" aria-hidden="true">
    <time id="display" class="time">--:--:--</time>
    <p class="legend">
      <span class="h"><i></i>hour</span>
     .........完整代码请登录后点击上方下载按钮下载查看

网友评论0