write an single HTML file for the best EMDR app you can
- User
write an single HTML file for the best EMDR app you can
Assistant
Here's a single HTML file for a simple, accessible, and functional EMDR (Eye Movement Desensitization and Reprocessing) app. It includes:
- A moving visual target (a dot) for bilateral stimulation
- Start/stop controls
- Timer to track session duration
- Optional sound effects
- Responsive design
⚠️ Note: This is a basic simulation for educational/demo purposes. Always consult a licensed therapist for real EMDR sessions.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>EMDR App</title> <style> body { font-family: Arial, sans-serif; background: #f0f4f8; display: flex; flex-direction: column; align-items: center; padding: 20px; margin: 0; } h1 { color: #333; } #emdr-container { position: relative; width: 80vw; max-width: 600px; height: 100px; border: 2px solid #ccc; border-radius: 10px; overflow: hidden; margin: 20px 0; } #target { position: absolute; width: 20px; height: 20px; background: #007bff; border-radius: 50%; top: 50%; left: 0; transform: translateY(-50%); transition: left 0.1s linear; } .controls { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; } button { padding: 10px 20px; font-size: 16px; cursor: pointer; border: none; border-radius: 5px; background: #007bff; color: white; transition: background 0.3s; } button:hover { background: #0056b3; } #timer { font-size: 20px; margin: 10px 0; color: #333; } .slider-container { margin-top: 10px; } input[type="range"] { width: 100%; } footer { margin-top: 30px; font-size: 14px; color: #666; } </style> </head> <body> <h1>EMDR Therapy Simulator</h1> <div id="emdr-container"> <div id="target"></div> </div> <div class="controls"> <button id="startBtn">Start</button> <button id="stopBtn">Stop</button> <button id="resetBtn">Reset</button> </div> <div id="timer">Time: 0s</div> <div class="slider-container"> <label for="speedSlider">Speed: <span id="speedValue">1</span></label> <input type="range" id="speedSlider" min="1" max="10" value="1"> </div> <div class="slider-container"> <label for="volumeSlider">Volume: <span id="volumeValue">50</span>%</label> <input type="range" id="volumeSlider" min="0" max="100" value="50"> </div> <footer> 📝 This is a simulation. Always consult a licensed therapist for real EMDR sessions. </footer> <script> const target = document.getElementById('target'); const startBtn = document.getElementById('startBtn'); const stopBtn = document.getElementById('stopBtn'); const resetBtn = document.getElementById('resetBtn'); const timerDisplay = document.getElementById('timer'); const speedSlider = document.getElementById('speedSlider'); const volumeSlider = document.getElementById('volumeSlider'); const speedValue = document.getElementById('speedValue'); const volumeValue = document.getElementById('volumeValue'); let animationId = null; let startTime = 0; let elapsedTime = 0; let isRunning = false; let speed = 1; let volume = 0.5; // Update speed display speedSlider.addEventListener('input', () => { speed = parseInt(speedSlider.value); speedValue.textContent = speed; }); // Update volume display volumeSlider.addEventListener('input', () => { volume = parseInt(volumeSlider.value) / 100; volumeValue.textContent = volumeSlider.value; }); // Play a short sound effect function playSound() { if (volume === 0) return; const context = new (window.AudioContext || window.webkitAudioContext)(); const oscillator = context.createOscillator(); const gainNode = context.createGain(); oscillator.type = 'sine'; oscillator.frequency.setValueAtTime(440, context.currentTime); // A note oscillator.connect(gainNode); gainNode.connect(context.destination); gainNode.gain.setValueAtTime(volume, context.currentTime); oscillator.start(); oscillator.stop(context.currentTime + 0.1); } // Animate the target function animate() { const container = document.getElementById('emdr-container'); const containerWidth = container.clientWidth; const targetWidth = target.offsetWidth; let left = parseFloat(target.style.left || 0); const direction = isLeft ? -1 : 1; left += direction * speed; if (left <= 0 || left >= containerWidth - targetWidth) { isLeft = !isLeft; playSound(); } target.style.left = left + 'px'; animationId = requestAnimationFrame(animate); } let isLeft = true; // Start the animation startBtn.addEventListener('click', () => { if (!isRunning) { isRunning = true; startTime = Date.now() - elapsedTime; animate(); updateTimer(); } }); // Stop the animation stopBtn.addEventListener('click', () => { if (isRunning) { isRunning = false; cancelAnimationFrame(animationId); } }); // Reset the session resetBtn.addEventListener('click', () => { stopBtn.click(); elapsedTime = 0; timerDisplay.textContent = 'Time: 0s'; target.style.left = '0px'; isLeft = true; }); // Timer update function updateTimer() { if (!isRunning) return; elapsedTime = Date.now() - startTime; timerDisplay.textContent = `Time: ${Math.floor(elapsedTime / 1000)}s`; setTimeout(updateTimer, 1000); } </script> </body> </html>
🔧 Features:
- Visual Target: A blue dot moves back and forth across the screen.
- Controls: Start, Stop, Reset buttons.
- Timer: Tracks session duration.
- Speed Slider: Adjusts the movement speed.
- Volume Slider: Controls optional sound effects (sine wave tones).
- Responsive Design: Works on desktop and mobile.
🧠 How to Use:
- Open the file in a browser.
- Adjust speed and volume as needed.
- Click Start to begin the EMDR simulation.
- Click Stop or Reset to end or restart.
This is a basic prototype. For a professional tool, you'd need to integrate with a therapist's guidance, add more customization, and ensure compliance with medical standards.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.