Spaces:
Running
Running
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>ANEE - Agência Nacional Aeroespacial</title> | |
| <style> | |
| :root { | |
| --primary-color: #4a90e2; | |
| --light-primary-color: #9dbde4; | |
| --background-color: #0c0c1a; | |
| --surface-color: rgba(26, 26, 38, 0.8); | |
| --text-color: #e0e0e0; | |
| --header-bg-color: rgba(20, 20, 35, 0.6); | |
| } | |
| body { | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| line-height: 1.6; | |
| margin: 0; | |
| padding: 0; | |
| background-color: var(--background-color); | |
| color: var(--text-color); | |
| } | |
| .main-header { | |
| position: fixed; | |
| top: 15px; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| width: 95%; | |
| max-width: 1200px; | |
| display: flex; | |
| align-items: center; | |
| padding: 10px 25px; | |
| z-index: 1000; | |
| /* Glassmorphism Effect */ | |
| background: var(--header-bg-color); | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| border-radius: 15px; | |
| border: 1px solid rgba(255, 255, 255, 0.18); | |
| box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); | |
| } | |
| .main-header img.logo { | |
| height: 50px; | |
| width: 50px; | |
| margin-right: 20px; | |
| } | |
| .main-header .title { | |
| font-size: 2.2em; | |
| font-weight: bold; | |
| color: var(--light-primary-color); | |
| text-shadow: 0 0 10px rgba(74, 144, 226, 0.5); | |
| } | |
| #solar-system-container { | |
| width: 100%; | |
| height: 100vh; /* Full viewport height */ | |
| background-color: #000; | |
| overflow: hidden; | |
| cursor: grab; | |
| } | |
| #solar-system-container:active { | |
| cursor: grabbing; | |
| } | |
| #solarSystemCanvas { | |
| display: block; | |
| } | |
| .container { | |
| max-width: 950px; | |
| margin: 30px auto; | |
| background: var(--surface-color); | |
| padding: 20px 40px; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 15px rgba(0,0,0,0.5); | |
| } | |
| h2, h3, h4 { | |
| color: var(--primary-color); | |
| border-bottom: 2px solid #333; | |
| padding-bottom: 10px; | |
| margin-top: 30px; | |
| } | |
| h3 { | |
| color: var(--light-primary-color); | |
| border-bottom: 1px dashed #444; | |
| margin-top: 25px; | |
| } | |
| h4 { | |
| color: var(--text-color); | |
| border-bottom: none; | |
| font-style: italic; | |
| margin-top: 20px; | |
| margin-bottom: 5px; | |
| } | |
| p, li { | |
| text-align: justify; | |
| font-size: 1.05em; | |
| } | |
| pre { | |
| background-color: #1e1e1e; | |
| padding: 15px; | |
| border-radius: 5px; | |
| overflow-x: auto; | |
| font-family: 'Courier New', Courier, monospace; | |
| font-size: 0.95em; | |
| margin: 10px 0 20px 0; | |
| border: 1px solid #444; | |
| white-space: pre-wrap; | |
| word-wrap: break-word; | |
| } | |
| code { | |
| font-family: 'Courier New', Courier, monospace; | |
| background-color: #333; | |
| padding: 3px 5px; | |
| border-radius: 3px; | |
| } | |
| .article-section { | |
| margin-bottom: 20px; | |
| padding-left: 15px; | |
| border-left: 3px solid var(--primary-color); | |
| } | |
| .footer { | |
| text-align: center; | |
| padding: 20px; | |
| margin-top: 30px; | |
| font-size: 0.9em; | |
| color: #888; | |
| border-top: 1px solid #333; | |
| } | |
| /* --- UI Panels --- */ | |
| .ui-panel { | |
| position: fixed; | |
| background: var(--header-bg-color); | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| border-radius: 10px; | |
| border: 1px solid rgba(255, 255, 255, 0.18); | |
| padding: 15px; | |
| z-index: 1001; | |
| color: var(--text-color); | |
| transition: opacity 0.3s, transform 0.3s; | |
| } | |
| .simulation-ui { bottom: 20px; left: 20px; width: 320px; } | |
| #chartContainer { bottom: 20px; right: 20px; width: 400px; height: 250px; padding: 10px; } | |
| .ui-panel h3 { margin-top: 0; text-align: center; color: var(--light-primary-color); border-bottom: 1px solid #444; } | |
| .sim-control { margin-bottom: 12px; } | |
| .sim-control label { display: block; margin-bottom: 5px; font-size: 0.9em; } | |
| .sim-control input, .sim-control select { width: 100%; padding: 8px; border-radius: 5px; border: 1px solid #555; background: #2a2a3a; color: var(--text-color); box-sizing: border-box; } | |
| .sim-button { width: 100%; padding: 10px; border: none; border-radius: 5px; background: var(--primary-color); color: white; font-size: 1.1em; cursor: pointer; transition: background-color 0.3s; } | |
| .sim-button:hover { background-color: #5cadff; } | |
| .sim-results { margin-top: 15px; font-size: 0.85em; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 5px; } | |
| .sim-results p { margin: 5px 0; padding: 0; text-align: left; } | |
| #missionStatus { font-weight: bold; text-align: center; margin-top: 10px; color: #ffd700; } | |
| /* --- Open/Close Functionality --- */ | |
| .close-btn { position: absolute; top: 5px; right: 12px; font-size: 1.8em; font-weight: bold; color: #aaa; cursor: pointer; transition: color 0.2s; } | |
| .close-btn:hover { color: white; } | |
| .panel-opener { position: fixed; bottom: 20px; padding: 10px 15px; background: var(--header-bg-color); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.18); cursor: pointer; z-index: 1002; font-size: 1.2em; } | |
| .panel-opener:hover { background: rgba(40, 40, 60, 0.8); } | |
| #openSimBtn { left: 20px; } | |
| #openChartBtn { right: 20px; } | |
| .hidden { opacity: 0; transform: translateY(20px); pointer-events: none; } | |
| </style> | |
| </head> | |
| <body> | |
| <header class="main-header"> | |
| <img src="lnee.png" alt="ANEE Logo" class="logo"> | |
| <span class="title">ANEE // Agência das Nações Unidas Aero-Espaciais</span> | |
| </header> | |
| <div id="solar-system-container"> | |
| <canvas id="solarSystemCanvas"></canvas> | |
| </div> | |
| <!-- Flight Simulation UI Panel --> | |
| <div id="simPanel" class="ui-panel simulation-ui"> | |
| <span id="closeSimBtn" class="close-btn">×</span> | |
| <h3>Simulador de Voo Espacial</h3> | |
| <div class="sim-control"> | |
| <label for="massaNave">Massa da Nave (kg)</label> | |
| <input type="number" id="massaNave" value="15000" step="1000"> | |
| </div> | |
| <div class="sim-control"> | |
| <label for="forcaMotor">Força do Motor (N)</label> | |
| <input type="number" id="forcaMotor" value="120000" step="10000"> | |
| </div> | |
| <div class="sim-control"> | |
| <label for="destino">Destino</label> | |
| <select id="destino"> | |
| <option value="Mars">Marte</option> | |
| <option value="Jupiter">Júpiter</option> | |
| <option value="Saturn">Saturno</option> | |
| </select> | |
| </div> | |
| <button id="launchButton" class="sim-button">Lançar Simulação</button> | |
| <div class="sim-results"> | |
| <p><strong>Tempo de Voo:</strong> <span id="flightTime">0.00</span> dias</p> | |
| <p><strong>Distância Percorrida:</strong> <span id="traveledDist">0.00</span> M km</p> | |
| <p><strong>Velocidade Atual:</strong> <span id="currentSpeed">0.00</span> km/s</p> | |
| <p id="missionStatus">Status: Aguardando Lançamento</p> | |
| </div> | |
| </div> | |
| <!-- Chart Container --> | |
| <div id="chartContainer" class="ui-panel hidden"> | |
| <span id="closeChartBtn" class="close-btn">×</span> | |
| <canvas id="velocityChart"></canvas> | |
| </div> | |
| <!-- Opener Buttons --> | |
| <div id="openSimBtn" class="panel-opener hidden" title="Abrir Simulador">🚀</div> | |
| <div id="openChartBtn" class="panel-opener hidden" title="Abrir Gráfico">📊</div> | |
| <div class="container"> | |
| <!-- SEÇÃO 1: TEORIA DE DOBRA (INTEIRO TEOR) --> | |
| <section id="warp-drive"> | |
| <h2>DOCUMENTO TÉCNICO: FED-SHAN-RD-001</h2> | |
| <p><strong>ASSUNTO:</strong> Especificações Teóricas do Reator de Dobra por Ressonância de Ditritium</p> | |
| <p><strong>PREÂMBULO:</strong> Este documento detalha os princípios físicos e de engenharia para a construção de um Reator de Dobra funcional, baseado na teoria proposta pela entidade de Shan designada 'Yeshua/Pegasus'.</p> | |
| <h3>SEÇÃO 1: CONCEITO FUNDAMENTAL</h3> | |
| <p>A propulsão de dobra é alcançada não pelo movimento, mas pela manipulação localizada do espaço-tempo. O Reator não gera energia, mas sim uma frequência ressonante que força o espaço-tempo a se contrair à frente e se expandir atrás de uma bolha de realidade estável.</p> | |
| <h3>SEÇÃO 2: EQUAÇÕES E FÓRMULAS CHAVE</h3> | |
| <p>A física deste reator transcende a mecânica clássica. As equações a seguir são traduções conceituais de princípios harmônicos.</p> | |
| <h4>2.1 - Equação de Simulação de Massa do Ditritium:</h4> | |
| <pre><code>M_sim(d) = (E_d * α) * F(Ψ)</code></pre> | |
| <ul> | |
| <li>Onde <code>M_sim(d)</code> é a Massa Simulada de um núcleo de Ditritium.</li> | |
| <li><code>E_d</code> é a energia base do núcleo de Ditritium em estado de repouso.</li> | |
| <li><code>α</code> (Alfa) é a Constante de Ressonância Harmônica.</li> | |
| <li><code>F(Ψ)</code> é a Função de Foco da Consciência do operador, um multiplicador que varia de 1.0 (desatento) a ∞ (foco absoluto).</li> | |
| </ul> | |
| <h4>2.2 - Derivada da Estabilidade da Bolha de Dobra (σ_bolha):</h4> | |
| <pre><code>dσ/dt = [C(Ψ) - (Eᵣ + Dₖ)] / T_ciclo</code></pre> | |
| <ul> | |
| <li>Onde <code>dσ/dt</code> é a variação da estabilidade da bolha por ciclo de tempo.</li> | |
| <li><code>C(Ψ)</code> é a Clareza da Intenção do operador.</li> | |
| <li><code>Eᵣ</code> é a Entropia da Realidade local (ruído de fundo do espaço-tempo).</li> | |
| <li><code>Dₖ</code> é a Dissonância Kármica (resistência do espaço-tempo a mudanças paradoxais).</li> | |
| <li><code>T_ciclo</code> é o tempo de ciclo da oscilação dos núcleos de Ditritium.</li> | |
| </ul> | |
| <h3>SEÇÃO 3: FUNÇÕES DE MANIPULAÇÃO (SINTAXE CONCEITUAL)</h3> | |
| <p>O controle do reator é feito através de comandos psíquicos que executam funções de manipulação de frequência.</p> | |
| <h4>3.1 - Função de Ignição:</h4> | |
| <pre><code>init_resonance_field(ditritium_core_A, ditritium_core_B, frequency: α)</code></pre> | |
| <p>Inicia a oscilação dos dois núcleos de Ditritium na frequência base de ressonância.</p> | |
| <h4>3.2 - Função de Vetor de Dobra:</h4> | |
| <pre><code>set_warp_vector(focus_intent: Ψ, direction_vector: [x,y,z], magnitude: 0.0-1.0)</code></pre> | |
| <ul> | |
| <li>Modula a frequência de oscilação para criar o gradiente de contração/expansão do espaço-tempo.</li> | |
| <li><code>focus_intent</code> deve ser uma imagem mental clara do destino.</li> | |
| <li><code>direction_vector</code> é a direção geral.</li> | |
| <li><code>magnitude</code> controla a 'velocidade' da dobra (a taxa de contração espacial).</li> | |
| </ul> | |
| <h4>3.3 - Função de Colapso de Emergência:</h4> | |
| <pre><code>collapse_field(release_harmony: true)</code></pre> | |
| <p>Cessa a oscilação de forma segura, dissipando a bolha de dobra e retornando a nave ao espaço normal. O parâmetro <code>release_harmony</code> garante que a dissipação ocorra sem gerar ondas gravitacionais destrutivas.</p> | |
| </section> | |
| <!-- SEÇÃO 2: TRATADO DE FUNDAÇÃO (INTEIRO TEOR) --> | |
| <section id="treaty"> | |
| <h2>TRATADO CONSTITUCIONAL DA ALIANÇA FEDERAÇÃO-SHAN</h2> | |
| <p><strong>DOCUMENTO:</strong> FST-002-FINAL (RATIFICADO)</p> | |
| <p><strong>TÍTULO:</strong> Tratado de Cooperação, Governança e Realidade Estável</p> | |
| <h3>PREÂMBULO</h3> | |
| <p>Considerando a unificação da consciência do Representante de Shan, a ameaça mútua de entidades hostis e o advento da tecnologia de dobra, as partes contratantes, A Federação Temporal ('A Federação') e a Soberania de Shan (via ANEE), ratificam esta constituição para uma nova era de paz e cooperação.</p> | |
| <h3>ARTIGO I: PARTES CONTRATANTES E RECONHECIMENTO</h3> | |
| <p><strong>§1.</strong> A Federação reconhece a soberania de Shan sobre seu sistema solar e linha do tempo local.</p> | |
| <p><strong>§2.</strong> A Soberania de Shan reconhece a jurisdição da Federação sobre assuntos que afetam a integridade da Corrente Temporal Primária.</p> | |
| <h3>ARTIGO II: OBJETIVOS COMUNS</h3> | |
| <p><strong>§1.</strong> Contenção de ameaças temporais.</p> | |
| <p><strong>§2.</strong> Desenvolvimento conjunto e supervisionado de tecnologias de dobra.</p> | |
| <p><strong>§3.</strong> Estabelecimento de relações diplomáticas, culturais e científicas pacíficas.</p> | |
| <h3>ARTIGO III: JURISDIÇÃO DA TECNOLOGIA DE DOBRA</h3> | |
| <p><strong>§1.</strong> Um Comitê de Supervisão Conjunto (CSC), com representação igual, supervisionará toda a tecnologia de dobra.</p> | |
| <p><strong>§2.</strong> O primeiro uso operacional do Reator de Dobra será uma missão de comando conjunto.</p> | |
| <h3>ARTIGO IV: PROTOCOLOS DE CONTATO E DEFESA</h3> | |
| <p><strong>§1.</strong> Um canal diplomático permanente será mantido.</p> | |
| <p><strong>§2.</strong> Um pacto de defesa mútua é ativado em caso de ataque por ameaças temporais.</p> | |
| <h3>ARTIGO V: PRINCÍPIOS FUNDAMENTAIS DA ALIANÇA</h3> | |
| <p><strong>§1. Ordem Espiritual:</strong> A Ordem Jedi é reconhecida como uma ordem filosófica com 'Status de Observador Especial' não-votante no CSC.</p> | |
| <p><strong>§2. Direitos Sociais:</strong> A Soberania de Shan reterá autonomia sobre sua estrutura social, com o direito ao bem-estar social e à integração das forças de trabalho no desenvolvimento tecnológico.</p> | |
| <p><strong>§3. Caminho para a Unificação:</strong> O ideal de uma futura fusão completa é afirmado como um objetivo de longo prazo, a ser alcançado em fases e avaliado por futuras gerações.</p> | |
| <h3>ARTIGO VI: GOVERNANÇA E ÉTICA DA ANEE</h3> | |
| <p><strong>§1. Liderança Cívica:</strong> A liderança executiva da ANEE será exclusivamente cívica. Conselheiros com experiência militar ou de estado podem servir em comitês consultivos não-votantes.</p> | |
| <p><strong>§2. Cooperação em Segurança:</strong> Um "Comitê de Defesa Conjunta" (CDC), independente da ANEE, coordenará a defesa contra ameaças externas. A segurança interna de Shan permanece sob sua própria e exclusiva jurisdição.</p> | |
| <p><strong>§3. Supervisão Acadêmica e Democrática:</strong> A ANEE será governada por um Conselho Diretor de líderes acadêmicos de Shan. Representantes políticos e de forças de trabalho terão assentos como Observadores Não-Votantes.</p> | |
| <h3>ARTIGO VII: RATIFICAÇÃO</h3> | |
| <p><strong>§1.</strong> Este tratado, com todas as suas emendas, é considerado ratificado e entra em vigor imediatamente.</p> | |
| </section> | |
| <!-- SEÇÃO 3: PARADOXO DAS ESTRELAS OSCILANTES (INTEIRO TEOR) --> | |
| <section id="paradox"> | |
| <h2>Teoria Científica: O Paradoxo das Estrelas Oscilantes</h2> | |
| <h3>O Conceito: A Teia do Espaço-Tempo e a Dança Gravitacional</h3> | |
| <p>Imagine o espaço-tempo não como um palco vazio, mas como uma imensa teia de borracha. As duas estrelas (vamos chamá-las de Estrela A, com o planeta, e Estrela B, a observada) são como bolas de boliche pesadas que afundam essa teia. Como elas formam um sistema binário, elas não estão paradas; elas orbitam um centro de massa comum.</p> | |
| <p>Essa dança orbital cria três efeitos principais que explicam as oscilações:</p> | |
| <p><strong>1. Distorção Dinâmica do Espaço (Lente Gravitacional Variável):</strong> A gravidade da Estrela A, que está mais próxima, curva a luz vinda da Estrela B. Como A e B estão se movendo, o alinhamento entre o planeta, A e B muda constantemente. Isso faz com que a posição aparente da Estrela B "oscile" no céu e seu brilho flutue.</p> | |
| <p><strong>2. Ondas Gravitacionais:</strong> A órbita acelerada das duas estrelas massivas gera ondulações na própria teia do espaço-tempo, chamadas ondas gravitacionais. Essas ondas, ao passarem pelo sistema planetário, literalmente esticam e comprimem o espaço, causando uma oscilação real na "régua" do universo.</p> | |
| <p><strong>3. Dilatação do Tempo Relativística:</strong> O tempo não é absoluto. Ele passa mais devagar perto de objetos massivos (dilatação gravitacional) e para objetos em alta velocidade (dilatação por velocidade). O planeta, ao orbitar a Estrela A (que por sua vez orbita o centro de massa), está constantemente mudando sua velocidade e sua posição no campo gravitacional combinado das duas estrelas. Isso faz com que o "tique-taque" do tempo no planeta oscile em relação a um observador distante.</p> | |
| </section> | |
| </div> | |
| <footer class="footer"> | |
| <p>© 2025 Agência das Nações Unidas Aeroespacial (ANEE) ; Aliança Federação-Shan & TakaSystem LLC. Todos os direitos reservados.</p> | |
| </footer> | |
| <!-- Libraries --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <script> | |
| // --- GLOBAL VARIABLES --- | |
| let scene, camera, renderer, controls; | |
| let sun, planets = {}; | |
| let spacecraft, time = 0; | |
| // --- SIMULATION STATE --- | |
| let simState = { isActive: false, mass: 0, thrust: 0, target: null, startTime: 0, startPosition: new THREE.Vector3(), totalDistance: 0, traveledDistance: 0, velocity: 0, simTimeStep: 3600 }; | |
| let velocityChart; | |
| const simulationContainer = document.getElementById('solar-system-container'); | |
| const canvas = document.getElementById('solarSystemCanvas'); | |
| const solarSystemData = { | |
| 'Mercury': { color: 0xaaaaaa, radius: 0.38, distance: 8, speed: 1.6 }, | |
| 'Venus': { color: 0xffd700, radius: 0.95, distance: 12, speed: 1.2 }, | |
| 'Earth': { color: 0x0077ff, radius: 1.0, distance: 17, speed: 1.0 }, | |
| 'Mars': { color: 0xff4500, radius: 0.53, distance: 24, speed: 0.8 }, | |
| 'Jupiter': { color: 0xcd853f, radius: 4.0, distance: 45, speed: 0.4 }, | |
| 'Saturn': { color: 0xf0e68c, radius: 3.5, distance: 70, speed: 0.3, hasRing: true } | |
| }; | |
| const SCALE_FACTOR = 1000000; // 1 unit in 3D space = 1M km | |
| // --- INITIALIZATION --- | |
| function init() { | |
| scene = new THREE.Scene(); | |
| scene.background = new THREE.Color(0x000000); | |
| camera = new THREE.PerspectiveCamera(75, simulationContainer.clientWidth / simulationContainer.clientHeight, 0.1, 2000); | |
| camera.position.set(0, 50, 90); | |
| renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true }); | |
| renderer.setSize(simulationContainer.clientWidth, simulationContainer.clientHeight); | |
| renderer.setPixelRatio(window.devicePixelRatio); | |
| controls = new THREE.OrbitControls(camera, renderer.domElement); | |
| controls.enableDamping = true; | |
| controls.minDistance = 20; | |
| controls.maxDistance = 400; | |
| const ambientLight = new THREE.AmbientLight(0xffffff, 0.3); | |
| scene.add(ambientLight); | |
| const pointLight = new THREE.PointLight(0xfff5e1, 1.5, 800); | |
| scene.add(pointLight); | |
| // Sun | |
| const sunGeo = new THREE.SphereGeometry(4.5, 32, 32); | |
| const sunMat = new THREE.MeshBasicMaterial({ color: 0xffcc33 }); | |
| sun = new THREE.Mesh(sunGeo, sunMat); | |
| scene.add(sun); | |
| // Planets and Orbits | |
| for (const [name, data] of Object.entries(solarSystemData)) { | |
| const planetGeo = new THREE.SphereGeometry(data.radius, 16, 16); | |
| const planetMat = new THREE.MeshStandardMaterial({ color: data.color, roughness: 0.8 }); | |
| const planet = new THREE.Mesh(planetGeo, planetMat); | |
| planet.userData = data; | |
| planets[name] = planet; | |
| scene.add(planet); | |
| if (data.hasRing) { | |
| const ringGeo = new THREE.RingGeometry(data.radius * 1.5, data.radius * 2.5, 64); | |
| const ringMat = new THREE.MeshBasicMaterial({ color: 0xaaa_a8, side: THREE.DoubleSide, transparent: true, opacity: 0.8 }); | |
| const ring = new THREE.Mesh(ringGeo, ringMat); | |
| ring.rotation.x = Math.PI / 2.5; | |
| planet.add(ring); | |
| } | |
| const orbitGeo = new THREE.RingGeometry(data.distance - 0.1, data.distance + 0.1, 128); | |
| const orbitMat = new THREE.MeshBasicMaterial({ color: 0x333333, side: THREE.DoubleSide }); | |
| const orbit = new THREE.Mesh(orbitGeo, orbitMat); | |
| orbit.rotation.x = -Math.PI / 2; | |
| scene.add(orbit); | |
| } | |
| // Spacecraft | |
| const spacecraftGeo = new THREE.ConeGeometry(0.3, 1, 8); | |
| const spacecraftMat = new THREE.MeshStandardMaterial({ color: 0xffffff, emissive: 0xdddddd }); | |
| spacecraft = new THREE.Mesh(spacecraftGeo, spacecraftMat); | |
| spacecraft.visible = false; | |
| scene.add(spacecraft); | |
| setupUIListeners(); | |
| initChart(); | |
| window.addEventListener('resize', onWindowResize, false); | |
| } | |
| function setupUIListeners() { | |
| // Main launch button | |
| document.getElementById('launchButton').addEventListener('click', startFlightSimulation); | |
| // Panel toggle logic | |
| const simPanel = document.getElementById('simPanel'); | |
| const chartPanel = document.getElementById('chartContainer'); | |
| const openSimBtn = document.getElementById('openSimBtn'); | |
| const openChartBtn = document.getElementById('openChartBtn'); | |
| const closeSimBtn = document.getElementById('closeSimBtn'); | |
| const closeChartBtn = document.getElementById('closeChartBtn'); | |
| closeSimBtn.addEventListener('click', () => { | |
| simPanel.classList.add('hidden'); | |
| openSimBtn.classList.remove('hidden'); | |
| }); | |
| openSimBtn.addEventListener('click', () => { | |
| simPanel.classList.remove('hidden'); | |
| openSimBtn.classList.add('hidden'); | |
| }); | |
| closeChartBtn.addEventListener('click', () => { | |
| chartPanel.classList.add('hidden'); | |
| openChartBtn.classList.remove('hidden'); | |
| }); | |
| openChartBtn.addEventListener('click', () => { | |
| chartPanel.classList.remove('hidden'); | |
| openChartBtn.classList.add('hidden'); | |
| }); | |
| } | |
| function initChart() { | |
| const ctx = document.getElementById('velocityChart').getContext('2d'); | |
| velocityChart = new Chart(ctx, { | |
| type: 'line', | |
| data: { | |
| labels: [], | |
| datasets: [{ | |
| label: 'Velocidade (km/s)', | |
| data: [], | |
| borderColor: 'rgba(74, 144, 226, 1)', | |
| backgroundColor: 'rgba(74, 144, 226, 0.2)', | |
| borderWidth: 2, fill: true, pointRadius: 0, | |
| }] | |
| }, | |
| options: { | |
| responsive: true, maintainAspectRatio: false, | |
| scales: { | |
| x: { title: { display: true, text: 'Tempo de Voo (dias)', color: '#ccc' }, ticks: { color: '#ccc' } }, | |
| y: { title: { display: true, text: 'Velocidade (km/s)', color: '#ccc' }, ticks: { color: '#ccc' }, beginAtZero: true } | |
| }, | |
| plugins: { legend: { display: false } } | |
| } | |
| }); | |
| } | |
| function onWindowResize() { | |
| camera.aspect = simulationContainer.clientWidth / simulationContainer.clientHeight; | |
| camera.updateProjectionMatrix(); | |
| renderer.setSize(simulationContainer.clientWidth, simulationContainer.clientHeight); | |
| } | |
| // --- FLIGHT SIMULATION LOGIC --- | |
| function startFlightSimulation() { | |
| if (simState.isActive) simState.isActive = false; | |
| const mass = parseFloat(document.getElementById('massaNave').value); | |
| const thrust = parseFloat(document.getElementById('forcaMotor').value); | |
| const targetName = document.getElementById('destino').value; | |
| if (mass <= 0 || thrust <= 0) { | |
| alert("Massa e Força devem ser valores positivos."); | |
| return; | |
| } | |
| const earth = planets['Earth']; | |
| const targetPlanet = planets[targetName]; | |
| simState = { ...simState, isActive: true, mass: mass, thrust: thrust, target: targetPlanet, startTime: time, startPosition: earth.position.clone(), totalDistance: earth.position.distanceTo(targetPlanet.position), traveledDistance: 0, velocity: 0 }; | |
| spacecraft.position.copy(earth.position); | |
| spacecraft.visible = true; | |
| // Show chart and hide its opener | |
| document.getElementById('chartContainer').classList.remove('hidden'); | |
| document.getElementById('openChartBtn').classList.add('hidden'); | |
| velocityChart.data.labels = []; | |
| velocityChart.data.datasets[0].data = []; | |
| velocityChart.update(); | |
| document.getElementById('missionStatus').textContent = `Status: Em rota para ${targetName}`; | |
| } | |
| // --- ANIMATION LOOP --- | |
| function animate() { | |
| requestAnimationFrame(animate); | |
| const timeFactor = 0.005; | |
| time += timeFactor; | |
| // Animate planets | |
| for (const [name, planet] of Object.entries(planets)) { | |
| const data = planet.userData; | |
| const angle = time * data.speed; | |
| planet.position.x = data.distance * Math.cos(angle); | |
| planet.position.z = data.distance * Math.sin(angle); | |
| planet.rotation.y += 0.005; | |
| } | |
| if (simState.isActive) updateFlight(); | |
| controls.update(); | |
| renderer.render(scene, camera); | |
| } | |
| function updateFlight() { | |
| const acceleration = simState.thrust / simState.mass; | |
| simState.velocity += acceleration * simState.simTimeStep; | |
| simState.traveledDistance += simState.velocity * simState.simTimeStep; | |
| const traveledDistanceInUnits = simState.traveledDistance / (SCALE_FACTOR * 1000); | |
| const targetPosition = simState.target.position; | |
| const direction = new THREE.Vector3().subVectors(targetPosition, simState.startPosition).normalize(); | |
| const currentPos = new THREE.Vector3().copy(simState.startPosition).addScaledVector(direction, traveledDistanceInUnits); | |
| spacecraft.position.copy(currentPos); | |
| spacecraft.lookAt(targetPosition); | |
| const flightTimeInSeconds = (time - simState.startTime) / 0.005 * simState.simTimeStep; | |
| const flightTimeInDays = flightTimeInSeconds / (24 * 3600); | |
| const velocityInKmS = simState.velocity / 1000; | |
| document.getElementById('flightTime').textContent = flightTimeInDays.toFixed(2); | |
| document.getElementById('traveledDist').textContent = traveledDistanceInUnits.toFixed(2); | |
| document.getElementById('currentSpeed').textContent = velocityInKmS.toFixed(2); | |
| if (Math.floor(time * 100) % 10 === 0) { | |
| velocityChart.data.labels.push(flightTimeInDays.toFixed(1)); | |
| velocityChart.data.datasets[0].data.push(velocityInKmS.toFixed(2)); | |
| if (velocityChart.data.labels.length > 50) { | |
| velocityChart.data.labels.shift(); | |
| velocityChart.data.datasets[0].data.shift(); | |
| } | |
| velocityChart.update(); | |
| } | |
| simState.totalDistance = spacecraft.position.distanceTo(targetPosition); | |
| if (traveledDistanceInUnits >= simState.totalDistance) { | |
| simState.isActive = false; | |
| spacecraft.visible = false; | |
| document.getElementById('missionStatus').textContent = `Status: Missão Concluída!`; | |
| } | |
| } | |
| // --- START --- | |
| init(); | |
| animate(); | |
| </script> | |
| </body> | |
| </html> | |