Anxiety Score to Relaxation Technique Timer

Select your current anxiety level (1–10):

Score: 5

Recommended Relaxation Technique

Based on your score: /10

Technique:

Description:

03:00

Summary Report

Anxiety Score: ${score}/10

Recommended Technique: ${technique.name}

Description: ${technique.desc}

This tool provides general suggestions. For severe anxiety, consult a mental health professional.

`; document.getElementById("pdfContent").innerHTML = pdfContent; }; let timerInterval; let totalSeconds = 180; window.startTimer = function() { clearInterval(timerInterval); // Reset if already running totalSeconds = 180; updateTimerDisplay(); timerInterval = setInterval(() => { totalSeconds--; updateTimerDisplay(); if (totalSeconds <= 0) { clearInterval(timerInterval); alert("Time’s up! Take a deep breath and check in with yourself."); } }, 1000); // Breathing animation const circle = document.getElementById("breathingCircle"); circle.style.transition = "transform 2s ease-in-out, width 2s ease-in-out, height 2s ease-in-out"; animateBreathing(circle, 0); }; function animateBreathing(el, count) { if (count > 10) return; // Stop after 10 cycles el.style.width = "150px"; el.style.height = "150px"; setTimeout(() => { el.style.width = "100px"; el.style.height = "100px"; setTimeout(() => animateBreathing(el, count + 1), 2000); }, 2000); } function updateTimerDisplay() { const minutes = Math.floor(totalSeconds / 60).toString().padStart(2, '0'); const seconds = (totalSeconds % 60).toString().padStart(2, '0'); document.getElementById("timerDisplay").textContent = `${minutes}:${seconds}`; } // Load jsPDF dynamically const script = document.createElement('script'); script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js'; document.head.appendChild(script); window.generatePDF = function() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const score = document.getElementById("displayScore").textContent; const technique = document.getElementById("relaxTechnique").textContent; const description = document.getElementById("techniqueDescription").textContent; const lines = [ "Anxiety Relief Recommendation", "", `Anxiety Score: ${score}/10`, `Technique: ${technique}`, `Instructions: ${description}`, "", "This is a general suggestion for self-guided practice.", "For ongoing anxiety, consider consulting a licensed therapist." ]; doc.setFontSize(14); lines.forEach((line, i) => { doc.text(line, 10, 20 + i * 10); }); doc.save("relaxation_technique.pdf"); }; });
Scroll to Top