o1 solar system model

HTML

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Solar System Animation</title>
  <!-- Enabled pinch and zoom -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  <style>
    body {
      margin: 0;
      background-color: black;
      overflow: hidden; /* Prevent scrolling */
    }
    #canvas {
      display: block;
      margin: 0 auto;
      background-color: black;
    }
    #controls {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 10;
    }
    #controls button {
      padding: 15px; /* Increased padding */
      margin-right: 5px;
      font-size: 18px; /* Increased font size */
    }
    #summaryBox {
      position: absolute;
      top: 70px; /* Moved down below the buttons */
      left: 10px;
      right: 10px;
      bottom: 10px;
      background-color: rgba(0, 0, 0, 0.7);
      color: white;
      padding: 20px;
      box-sizing: border-box;
      display: none; /* Hidden by default */
      overflow-y: auto;
    }
    #summaryBox h2 {
      margin-top: 0;
    }
  </style>
</head>
<body>
  <div id="controls">
    <button id="pausePlayBtn">Pause</button>
    <button id="slowDownBtn">Slow Down</button>
    <button id="speedUpBtn">Speed Up</button>
    <!-- Zoom In/Out button will be added dynamically -->
  </div>
  <div id="summaryBox">
    <!-- Planet or Moon summary will be displayed here -->
  </div>
  <canvas id="canvas"></canvas>
  <script>
    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');

    // Variables for pan and zoom
    let scale = 1;
    let translatePos = { x: 0, y: 0 };
    let lastTouchDistance = null;
    let lastTouchPosition = null;

    // Variables for pause/play and speed control
    let isPaused = false;
    let speedMultiplier = 1;

    // Variables for time and center position
    let lastTime = Date.now();
    let time = 0;

    // Variables for selection and zooming
    let selectedBody =...