Download index.html from CSNET/digital-body-health-simulator: direct link, hf CLI and curl.
- Browser
- Download file 28 kB
-
https://huggingface.co/spaces/CSNET/digital-body-health-simulator/resolve/main/index.html
- Command line
-
hf download hf://spaces/CSNET/digital-body-health-simulator/index.html
-
curl -L -o index.html https://huggingface.co/spaces/CSNET/digital-body-health-simulator/resolve/main/index.html
28 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Digital Body Health Simulator - WP WELLNET</title> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| :root { | |
| --primary-emerald: #10b981; | |
| --primary-emerald-dark: #059669; | |
| --primary-emerald-light: #d1fae5; | |
| --secondary-yellow: #eab308; | |
| --secondary-yellow-light: #fef3c7; | |
| --bg-light: #ffffff; | |
| --bg-gray: #f9fafb; | |
| --text-primary: #111827; | |
| --text-secondary: #6b7280; | |
| --border-color: #e5e7eb; | |
| --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); | |
| --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1); | |
| --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1); | |
| --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1); | |
| --radius: 12px; | |
| --radius-lg: 16px; | |
| } | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; | |
| background: linear-gradient(135deg, #f0fdf4 0%, #f9fafb 100%); | |
| color: var(--text-primary); | |
| min-height: 100vh; | |
| line-height: 1.6; | |
| } | |
| .container { | |
| max-width: 1400px; | |
| margin: 0 auto; | |
| padding: 0 20px; | |
| } | |
| /* Header */ | |
| .header { | |
| text-align: center; | |
| padding: 40px 0 30px; | |
| background: linear-gradient(135deg, var(--primary-emerald-light) 0%, transparent 100%); | |
| } | |
| .header h1 { | |
| font-size: 2.5rem; | |
| font-weight: 700; | |
| background: linear-gradient(135deg, var(--primary-emerald), var(--primary-emerald-dark)); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| margin-bottom: 8px; | |
| } | |
| .header p { | |
| color: var(--text-secondary); | |
| font-size: 1.1rem; | |
| } | |
| /* Main Layout */ | |
| .main-content { | |
| display: grid; | |
| grid-template-columns: 380px 1fr; | |
| gap: 30px; | |
| margin-bottom: 40px; | |
| } | |
| @media (max-width: 968px) { | |
| .main-content { | |
| grid-template-columns: 1fr; | |
| } | |
| } | |
| /* Cards */ | |
| .card { | |
| background: var(--bg-light); | |
| border-radius: var(--radius-lg); | |
| padding: 24px; | |
| box-shadow: var(--shadow-md); | |
| transition: all 0.3s ease; | |
| } | |
| .card-title { | |
| font-size: 1.25rem; | |
| font-weight: 600; | |
| margin-bottom: 20px; | |
| color: var(--text-primary); | |
| } | |
| /* Input Panel */ | |
| .input-group { | |
| margin-bottom: 24px; | |
| } | |
| .input-label { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| margin-bottom: 8px; | |
| font-size: 0.95rem; | |
| font-weight: 500; | |
| color: var(--text-primary); | |
| } | |
| .input-value { | |
| background: var(--primary-emerald-light); | |
| color: var(--primary-emerald-dark); | |
| padding: 4px 12px; | |
| border-radius: 20px; | |
| font-weight: 600; | |
| font-size: 0.9rem; | |
| } | |
| input[type="range"] { | |
| width: 100%; | |
| height: 6px; | |
| border-radius: 3px; | |
| background: var(--border-color); | |
| outline: none; | |
| -webkit-appearance: none; | |
| cursor: pointer; | |
| } | |
| input[type="range"]::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| appearance: none; | |
| width: 20px; | |
| height: 20px; | |
| border-radius: 50%; | |
| background: var(--primary-emerald); | |
| cursor: pointer; | |
| box-shadow: var(--shadow-md); | |
| transition: all 0.2s; | |
| } | |
| input[type="range"]::-webkit-slider-thumb:hover { | |
| transform: scale(1.2); | |
| background: var(--primary-emerald-dark); | |
| } | |
| input[type="range"]::-moz-range-thumb { | |
| width: 20px; | |
| height: 20px; | |
| border-radius: 50%; | |
| background: var(--primary-emerald); | |
| cursor: pointer; | |
| box-shadow: var(--shadow-md); | |
| border: none; | |
| } | |
| /* Body Simulator */ | |
| .simulator-container { | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| min-height: 500px; | |
| background: linear-gradient(135deg, var(--primary-emerald-light) 0%, var(--secondary-yellow-light) 100%); | |
| border-radius: var(--radius-lg); | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .simulator-svg { | |
| transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| /* Tabs */ | |
| .tabs-container { | |
| margin-bottom: 30px; | |
| } | |
| .tabs-header { | |
| display: flex; | |
| gap: 8px; | |
| margin-bottom: 20px; | |
| overflow-x: auto; | |
| padding-bottom: 8px; | |
| } | |
| .tab-button { | |
| padding: 10px 20px; | |
| background: var(--bg-gray); | |
| border: none; | |
| border-radius: var(--radius); | |
| font-size: 0.95rem; | |
| font-weight: 500; | |
| color: var(--text-secondary); | |
| cursor: pointer; | |
| transition: all 0.3s ease; | |
| white-space: nowrap; | |
| } | |
| .tab-button:hover { | |
| background: var(--primary-emerald-light); | |
| color: var(--primary-emerald-dark); | |
| } | |
| .tab-button.active { | |
| background: var(--primary-emerald); | |
| color: white; | |
| box-shadow: var(--shadow-md); | |
| } | |
| .tab-content { | |
| display: none; | |
| animation: fadeIn 0.3s ease; | |
| } | |
| .tab-content.active { | |
| display: block; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(10px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| /* AI Insight Card */ | |
| .insight-card { | |
| background: linear-gradient(135deg, var(--primary-emerald) 0%, var(--primary-emerald-dark) 100%); | |
| color: white; | |
| padding: 24px; | |
| border-radius: var(--radius-lg); | |
| box-shadow: var(--shadow-xl); | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .insight-card::before { | |
| content: ''; | |
| position: absolute; | |
| top: -50%; | |
| right: -50%; | |
| width: 200%; | |
| height: 200%; | |
| background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%); | |
| animation: pulse 4s ease-in-out infinite; | |
| } | |
| @keyframes pulse { | |
| 0%, 100% { transform: scale(1); opacity: 0.5; } | |
| 50% { transform: scale(1.1); opacity: 0.3; } | |
| } | |
| .insight-icon { | |
| width: 48px; | |
| height: 48px; | |
| background: rgba(255,255,255,0.2); | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| margin-bottom: 16px; | |
| font-size: 24px; | |
| } | |
| /* Footer */ | |
| .footer { | |
| text-align: center; | |
| padding: 30px 0; | |
| color: var(--text-secondary); | |
| border-top: 1px solid var(--border-color); | |
| margin-top: 40px; | |
| } | |
| .footer span { | |
| color: var(--primary-emerald); | |
| font-weight: 600; | |
| } | |
| /* Comparison View */ | |
| .comparison-container { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 20px; | |
| margin-top: 20px; | |
| } | |
| .comparison-item { | |
| text-align: center; | |
| padding: 20px; | |
| background: var(--bg-gray); | |
| border-radius: var(--radius); | |
| } | |
| .comparison-label { | |
| font-weight: 600; | |
| margin-bottom: 10px; | |
| color: var(--text-primary); | |
| } | |
| /* Responsive */ | |
| @media (max-width: 640px) { | |
| .header h1 { | |
| font-size: 1.8rem; | |
| } | |
| .comparison-container { | |
| grid-template-columns: 1fr; | |
| } | |
| .tabs-header { | |
| justify-content: flex-start; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header class="header"> | |
| <div class="container"> | |
| <h1>Digital Body Health Simulator</h1> | |
| <p>Semi-Realistic Minimal Body Engine using Health Metrics</p> | |
| </div> | |
| </header> | |
| <div class="container"> | |
| <div class="main-content"> | |
| <!-- Input Panel --> | |
| <div class="card"> | |
| <h2 class="card-title">π Body Metrics</h2> | |
| <div class="input-group"> | |
| <label class="input-label"> | |
| Body Fat | |
| <span class="input-value" id="bodyFatValue">20%</span> | |
| </label> | |
| <input type="range" id="bodyFat" min="5" max="40" value="20" step="0.5"> | |
| </div> | |
| <div class="input-group"> | |
| <label class="input-label"> | |
| Visceral Fat | |
| <span class="input-value" id="visceralFatValue">10</span> | |
| </label> | |
| <input type="range" id="visceralFat" min="1" max="20" value="10" step="1"> | |
| </div> | |
| <div class="input-group"> | |
| <label class="input-label"> | |
| Muscle Mass | |
| <span class="input-value" id="muscleMassValue">40%</span> | |
| </label> | |
| <input type="range" id="muscleMass" min="20" max="60" value="40" step="0.5"> | |
| </div> | |
| <div class="input-group"> | |
| <label class="input-label"> | |
| Weight | |
| <span class="input-value" id="weightValue">70 kg</span> | |
| </label> | |
| <input type="range" id="weight" min="40" max="150" value="70" step="0.5"> | |
| </div> | |
| <div class="input-group"> | |
| <label class="input-label"> | |
| Height | |
| <span class="input-value" id="heightValue">170 cm</span> | |
| </label> | |
| <input type="range" id="height" min="140" max="220" value="170" step="1"> | |
| </div> | |
| </div> | |
| <!-- Body Simulator --> | |
| <div class="card"> | |
| <h2 class="card-title">π€ Body Simulation</h2> | |
| <div class="simulator-container"> | |
| <svg class="simulator-svg" id="bodySvg" width="300" height="450" viewBox="0 0 300 450"> | |
| <!-- Head --> | |
| <ellipse id="head" cx="150" cy="50" rx="35" ry="40" fill="#fdbcb4" stroke="#e8a298" stroke-width="2"/> | |
| <!-- Neck --> | |
| <rect id="neck" x="135" y="85" width="30" height="25" fill="#fdbcb4" stroke="#e8a298" stroke-width="1"/> | |
| <!-- Torso --> | |
| <path id="torso" d="M 100 110 Q 80 180 90 250 L 110 280 L 190 280 L 210 250 Q 220 180 200 110 Z" | |
| fill="#4a90e2" stroke="#357abd" stroke-width="2" opacity="0.8"/> | |
| <!-- Arms --> | |
| <path id="leftArm" d="M 100 120 Q 70 140 60 180 L 65 250 L 80 260 L 95 230 L 90 150 Z" | |
| fill="#fdbcb4" stroke="#e8a298" stroke-width="1.5"/> | |
| <path id="rightArm" d="M 200 120 Q 230 140 240 180 L 235 250 L 220 260 L 205 230 L 210 150 Z" | |
| fill="#fdbcb4" stroke="#e8a298" stroke-width="1.5"/> | |
| <!-- Belly/Fat Layer --> | |
| <ellipse id="belly" cx="150" cy="220" rx="0" ry="0" fill="#ffd4a3" opacity="0.6"/> | |
| <!-- Legs --> | |
| <path id="leftLeg" d="M 110 280 L 105 350 L 95 420 L 125 420 L 130 350 L 125 290 Z" | |
| fill="#2c5282" stroke="#1e3a5f" stroke-width="2"/> | |
| <path id="rightLeg" d="M 190 280 L 195 350 L 205 420 L 175 420 L 170 350 L 175 290 Z" | |
| fill="#2c5282" stroke="#1e3a5f" stroke-width="2"/> | |
| </svg> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Tabs Section --> | |
| <div class="card tabs-container"> | |
| <div class="tabs-header"> | |
| <button class="tab-button active" data-tab="fat">Fat Layer</button> | |
| <button class="tab-button" data-tab="visceral">Visceral Layer</button> | |
| <button class="tab-button" data-tab="muscle">Muscle Layer</button> | |
| <button class="tab-button" data-tab="posture">Posture</button> | |
| <button class="tab-button" data-tab="projection">30-Day Projection</button> | |
| </div> | |
| <div id="fat" class="tab-content active"> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; margin-bottom: 12px; color: var(--primary-emerald);">Subcutaneous Fat Analysis</h3> | |
| <p style="color: var(--text-secondary); margin-bottom: 16px;">Current body fat percentage is in the healthy range. The visual simulation shows balanced fat distribution across major muscle groups.</p> | |
| <div style="background: var(--bg-gray); padding: 16px; border-radius: var(--radius);"> | |
| <div style="display: flex; justify-content: space-between; align-items: center;"> | |
| <span style="font-weight: 500;">Fat Distribution Score</span> | |
| <span style="background: var(--primary-emerald-light); color: var(--primary-emerald-dark); padding: 4px 12px; border-radius: 20px; font-weight: 600;">85/100</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="visceral" class="tab-content"> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; margin-bottom: 12px; color: var(--primary-emerald);">Visceral Fat Assessment</h3> | |
| <p style="color: var(--text-secondary); margin-bottom: 16px;">Visceral fat levels are moderate. This type of fat surrounds internal organs and is crucial for metabolic health monitoring.</p> | |
| <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px;"> | |
| <div style="text-align: center; padding: 12px; background: var(--bg-gray); border-radius: var(--radius);"> | |
| <div style="font-size: 1.5rem; font-weight: 700; color: var(--secondary-yellow);">β οΈ</div> | |
| <div style="font-size: 0.9rem; color: var(--text-secondary); mt-2;">Monitor</div> | |
| </div> | |
| <div style="text-align: center; padding: 12px; background: var(--bg-gray); border-radius: var(--radius);"> | |
| <div style="font-size: 1.5rem; font-weight: 700; color: var(--primary-emerald);">10</div> | |
| <div style="font-size: 0.9rem; color: var(--text-secondary);">Current Level</div> | |
| </div> | |
| <div style="text-align: center; padding: 12px; background: var(--bg-gray); border-radius: var(--radius);"> | |
| <div style="font-size: 1.5rem; font-weight: 700; color: var(--text-secondary);">8</div> | |
| <div style="font-size: 0.9rem; color: var(--text-secondary);">Optimal</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="muscle" class="tab-content"> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; margin-bottom: 12px; color: var(--primary-emerald);">Muscle Composition</h3> | |
| <p style="color: var(--text-secondary); margin-bottom: 16px;">Muscle mass is above average for your height and weight category. Regular resistance training is maintaining lean tissue effectively.</p> | |
| <div style="background: linear-gradient(90deg, var(--primary-emerald-light) 0%, var(--secondary-yellow-light) 100%); padding: 20px; border-radius: var(--radius); margin-top: 16px;"> | |
| <div style="font-weight: 600; margin-bottom: 8px;">Muscle Mass Distribution</div> | |
| <div style="display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-secondary);"> | |
| <span>Upper Body: 45%</span> | |
| <span>Lower Body: 55%</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="posture" class="tab-content"> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; margin-bottom: 12px; color: var(--primary-emerald);">Posture Analysis</h3> | |
| <p style="color: var(--text-secondary); margin-bottom: 16px;">Based on your body composition, we recommend focusing on core strengthening and flexibility exercises.</p> | |
| <div style="background: var(--bg-gray); padding: 16px; border-radius: var(--radius); margin-top: 16px;"> | |
| <h4 style="font-weight: 600; margin-bottom: 12px;">Recommendations:</h4> | |
| <ul style="list-style: none; padding: 0;"> | |
| <li style="padding: 8px 0; color: var(--text-secondary);">β Daily stretching routine (10 minutes)</li> | |
| <li style="padding: 8px 0; color: var(--text-secondary);">β Core exercises 3x per week</li> | |
| <li style="padding: 8px 0; color: var(--text-secondary);">β Ergonomic workspace setup</li> | |
| </ul> | |
| </div> | |
| </div> | |
| <div id="projection" class="tab-content"> | |
| <h3 style="font-size: 1.2rem; font-weight: 600; margin-bottom: 12px; color: var(--primary-emerald);">30-Day Projection</h3> | |
| <p style="color: var(--text-secondary); margin-bottom: 16px;">Based on current metrics and optimal intervention strategy:</p> | |
| <div class="comparison-container"> | |
| <div class="comparison-item"> | |
| <div class="comparison-label">π Current State</div> | |
| <div style="font-size: 1.8rem; font-weight: 700; color: var(--text-secondary);">20%</div> | |
| <div style="font-size: 0.9rem; color: var(--text-secondary);">Body Fat</div> | |
| </div> | |
| <div class="comparison-item"> | |
| <div class="comparison-label">π― Projected State</div> | |
| <div style="font-size: 1.8rem; font-weight: 700; color: var(--primary-emerald);">17.5%</div> | |
| <div style="font-size: 0.9rem; color: var(--text-secondary);">Body Fat</div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- AI Insight Card --> | |
| <div class="insight-card" style="margin-bottom: 30px;"> | |
| <div class="insight-icon">π§ </div> | |
| <h3 style="font-size: 1.3rem; font-weight: 600; margin-bottom: 12px;">AI Health Insight</h3> | |
| <p style="line-height: 1.6; position: relative; z-index: 1;"> | |
| Your visceral fat indicates central abdominal pressure. Recommended: reduce late-night meals, increase Zone 2 exercise, and prioritize 7-8 hours of quality sleep. Current metabolic efficiency is at 78% - with proper interventions, this can improve to 85% within 4 weeks. | |
| </p> | |
| </div> | |
| </div> | |
| <footer class="footer"> | |
| <p>Β© 2024 <span>WP WELLNET</span> β Health Simulation Engine Demo</p> | |
| </footer> | |
| <script> | |
| // Get all input elements | |
| const bodyFatSlider = document.getElementById('bodyFat'); | |
| const visceralFatSlider = document.getElementById('visceralFat'); | |
| const muscleMassSlider = document.getElementById('muscleMass'); | |
| const weightSlider = document.getElementById('weight'); | |
| const heightSlider = document.getElementById('height'); | |
| // Get value display elements | |
| const bodyFatValue = document.getElementById('bodyFatValue'); | |
| const visceralFatValue = document.getElementById('visceralFatValue'); | |
| const muscleMassValue = document.getElementById('muscleMassValue'); | |
| const weightValue = document.getElementById('weightValue'); | |
| const heightValue = document.getElementById('heightValue'); | |
| // Get SVG elements | |
| const bodySvg = document.getElementById('bodySvg'); | |
| const head = document.getElementById('head'); | |
| const neck = document.getElementById('neck'); | |
| const torso = document.getElementById('torso'); | |
| const belly = document.getElementById('belly'); | |
| const leftArm = document.getElementById('leftArm'); | |
| const rightArm = document.getElementById('rightArm'); | |
| const leftLeg = document.getElementById('leftLeg'); | |
| const rightLeg = document.getElementById('rightLeg'); | |
| // Update value displays | |
| function updateValues() { | |
| bodyFatValue.textContent = `${bodyFatSlider.value}%`; | |
| visceralFatValue.textContent = visceralFatSlider.value; | |
| muscleMassValue.textContent = `${muscleMassSlider.value}%`; | |
| weightValue.textContent = `${weightSlider.value} kg`; | |
| heightValue.textContent = `${heightSlider.value} cm`; | |
| updateBodySimulation(); | |
| } | |
| // Update body simulation based on metrics | |
| function updateBodySimulation() { | |
| const bodyFat = parseFloat(bodyFatSlider.value); | |
| const visceralFat = parseInt(visceralFatSlider.value); | |
| const muscleMass = parseFloat(muscleMassSlider.value); | |
| const weight = parseFloat(weightSlider.value); | |
| const height = parseFloat(heightSlider.value); | |
| // Calculate scale based on height and weight (simplified BMI scaling) | |
| const bmi = weight / Math.pow(height / 100, 2); | |
| const scale = 0.8 + (bmi / 40) * 0.4; // Scale between 0.8 and 1.2 | |
| // Apply transformations | |
| bodySvg.style.transform = `scale(${scale})`; | |
| // Update belly size based on visceral fat | |
| const bellyRadiusX = 20 + (visceralFat * 4); | |
| const bellyRadiusY = 15 + (visceralFat * 3); | |
| belly.setAttribute('rx', bellyRadiusX); | |
| belly.setAttribute('ry', bellyRadiusY); | |
| // Update belly opacity based on body fat | |
| belly.setAttribute('opacity', 0.3 + (bodyFat / 40) * 0.5); | |
| // Update torso width based on body fat and muscle mass | |
| const torsoWidth = 80 + (bodyFat * 2) + (muscleMass * 1.5); | |
| const newTorsoPath = `M ${150 - torsoWidth/2} 110 Q ${150 - torsoWidth/2 - 20} 180 ${150 - torsoWidth/2 + 10} 250 L ${150 - 40} 280 L ${150 + 40} 280 L ${150 + torsoWidth/2 - 10} 250 Q ${150 + torsoWidth/2 + 20} 180 ${150 + torsoWidth/2} 110 Z`; | |
| torso.setAttribute('d', newTorsoPath); | |
| // Update arm thickness based on muscle mass | |
| const armThickness = 15 + (muscleMass / 4); | |
| const newLeftArmPath = `M ${150 - torsoWidth/2} 120 Q ${150 - torsoWidth/2 - 30} 140 ${150 - torsoWidth/2 - 40} 180 L ${150 - torsoWidth/2 - 35} 250 L ${150 - torsoWidth/2 - 20} 260 L ${150 - torsoWidth/2 - 5} 230 L ${150 - torsoWidth/2} 150 Z`; | |
| leftArm.setAttribute('d', newLeftArmPath); | |
| const newRightArmPath = `M ${150 + torsoWidth/2} 120 Q ${150 + torsoWidth/2 + 30} 140 ${150 + torsoWidth/2 + 40} 180 L ${150 + torsoWidth/2 + 35} 250 L ${150 + torsoWidth/2 + 20} 260 L ${150 + torsoWidth/2 + 5} 230 L ${150 + torsoWidth/2} 150 Z`; | |
| rightArm.setAttribute('d', newRightArmPath); | |
| // Update shoulder width based on muscle mass | |
| const shoulderWidth = 30 + (muscleMass / 3); | |
| head.setAttribute('rx', shoulderWidth); | |
| // Update colors based on health metrics | |
| if (bodyFat > 25) { | |
| torso.setAttribute('fill', '#e74c3c'); | |
| torso.setAttribute('stroke', '#c0392b'); | |
| } else if (bodyFat > 18) { | |
| torso.setAttribute('fill', '#f39c12'); | |
| torso.setAttribute('stroke', '#d68910'); | |
| } else { | |
| torso.setAttribute('fill', '#4a90e2'); | |
| torso.setAttribute('stroke', '#357abd'); | |
| } | |
| if (muscleMass > 45) { | |
| leftLeg.setAttribute('fill', '#27ae60'); | |
| leftLeg.setAttribute('stroke', '#1e8449'); | |
| rightLeg.setAttribute('fill', '#27ae60'); | |
| rightLeg.setAttribute('stroke', '#1e8449'); | |
| } else if (muscleMass > 35) { | |
| leftLeg.setAttribute('fill', '#2c5282'); | |
| leftLeg.setAttribute('stroke', '#1e3a5f'); | |
| rightLeg.setAttribute('fill', '#2c5282'); | |
| rightLeg.setAttribute('stroke', '#1e3a5f'); | |
| } else { | |
| leftLeg.setAttribute('fill', '#7f8c8d'); | |
| leftLeg.setAttribute('stroke', '#566573'); | |
| rightLeg.setAttribute('fill', '#7f8c8d'); | |
| rightLeg.setAttribute('stroke', '#566573'); | |
| } | |
| } | |
| // Tab functionality | |
| const tabButtons = document.querySelectorAll('.tab-button'); | |
| const tabContents = document.querySelectorAll('.tab-content'); | |
| tabButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| const targetTab = button.getAttribute('data-tab'); | |
| // Remove active class from all buttons and contents | |
| tabButtons.forEach(btn => btn.classList.remove('active')); | |
| tabContents.forEach(content => content.classList.remove('active')); | |
| // Add active class to clicked button and corresponding content | |
| button.classList.add('active'); | |
| document.getElementById(targetTab).classList.add('active'); | |
| }); | |
| }); | |
| // Event listeners for sliders | |
| bodyFatSlider.addEventListener('input', updateValues); | |
| visceralFatSlider.addEventListener('input', updateValues); | |
| muscleMassSlider.addEventListener('input', updateValues); | |
| weightSlider.addEventListener('input', updateValues); | |
| heightSlider.addEventListener('input', updateValues); | |
| // Initialize | |
| updateValues(); | |
| // Add smooth transitions for all SVG elements | |
| const svgElements = document.querySelectorAll('#bodySvg path, #bodySvg ellipse, #bodySvg rect'); | |
| svgElements.forEach(element => { | |
| element.style.transition = 'all 0.8s cubic-bezier(0.4, 0, 0.2, 1)'; | |
| }); | |
| // Simulate real-time data updates | |
| setInterval(() => { | |
| const randomVariation = (Math.random() - 0.5) * 0.2; | |
| const currentBelly = parseFloat(belly.getAttribute('rx')); | |
| const newBelly = Math.max(20, Math.min(100, currentBelly + randomVariation)); | |
| belly.setAttribute('rx', newBelly); | |
| }, 3000); | |
| </script> | |
| <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script> | |
| </body> | |
| </html> |