/** * The Dance of Life's Seasons * * A representation of how I view life's transitions as a series of seasons, * each with its own beauty and purpose. The UI animations mirror the natural * flow between periods of growth, abundance, reflection, and rest. */classLifeSeason{constructor(name,color,mood,activities,lessons){this.name=name;this.color=color;this.mood=mood;this.activities=activities;this.lessons=lessons;this.transitionDuration=1200;// ms}// Each season has its own animation stylegetTransitionStyle(){conststyles={'Spring':'cubic-bezier(0.2, 0.8, 0.2, 1)',// Bouncy, energetic'Summer':'cubic-bezier(0, 0, 0.58, 1)',// Quick start, slow finish'Autumn':'cubic-bezier(0.25, 0.1, 0.25, 1)',// Steady, contemplative'Winter':'cubic-bezier(0.42, 0, 0.58, 1)'// Symmetric, balanced};returnstyles[this.name]||'ease';}// How we visually represent this seasonrenderVisual(container){container.style.backgroundColor=this.color;container.style.transition=`all ${this.transitionDuration}ms ${this.getTransitionStyle()}`;// Clear previous contentcontainer.innerHTML='';// Create season title with mood emojiconsttitle=document.createElement('h2');title.textContent=`${this.name}${this.mood}`;title.classList.add('season-title');container.appendChild(title);// Add floating elements that represent activitiesthis.activities.forEach(activity=>{constelement=document.createElement('div');element.textContent=activity;element.classList.add('activity-bubble');element.style.animationDuration=`${5+Math.random()*7}s`;container.appendChild(element);});// Add the lesson as a footerconstlesson=document.createElement('p');lesson.textContent=this.lessons[Math.floor(Math.random()*this.lessons.length)];lesson.classList.add('season-lesson');container.appendChild(lesson);}}classLifeJourney{constructor(){this.seasons=[newLifeSeason('Spring','#a6e3b7','π±',['Learning','Starting','Growing','Dreaming'],['Beginnings require courage','Growth is uncomfortable but necessary','Plant intentions with care']),newLifeSeason('Summer','#ffd166','βοΈ',['Creating','Sharing','Building','Connecting'],['Celebrate your achievements','Abundance comes from consistent effort','Share your light with others']),newLifeSeason('Autumn','#e07a5f','π',['Reflecting','Evaluating','Releasing','Transforming'],['Let go of what no longer serves you','Beauty exists in transition','Harvest what you've learned'] ), new LifeSeason( 'Winter', '#8ecae6', 'βοΈ', ['Resting', 'Planning', 'Healing', 'Contemplating'], ['Stillness brings clarity', 'Rest is productive', 'In silence,wisdom grows'] ) ]; this.currentSeasonIndex = 0; this.container = null; this.isTransitioning = false; } initialize(containerId) { this.container = document.getElementById(containerId); if (!this.container) { console.error('Containerelementnotfound'); return; } // Add navigation controls const controls = document.createElement('div'); controls.classList.add('season-controls'); const prevBtn = document.createElement('button'); prevBtn.textContent = 'βPreviousSeason'; prevBtn.addEventListener('click', () => this.previousSeason()); const nextBtn = document.createElement('button'); nextBtn.textContent = 'NextSeasonβ'; nextBtn.addEventListener('click', () => this.nextSeason()); controls.appendChild(prevBtn); controls.appendChild(nextBtn); document.body.appendChild(controls); // Display initial season this.displayCurrentSeason(); } displayCurrentSeason() { if (this.isTransitioning) return; const season = this.seasons[this.currentSeasonIndex]; season.renderVisual(this.container); } nextSeason() { if (this.isTransitioning) return; this.isTransitioning = true; this.currentSeasonIndex = (this.currentSeasonIndex + 1) % this.seasons.length; // Add transition-out class this.container.classList.add('transition-out'); setTimeout(() => { this.displayCurrentSeason(); this.container.classList.remove('transition-out'); this.isTransitioning = false; }, 600); } previousSeason() { if (this.isTransitioning) return; this.isTransitioning = true; this.currentSeasonIndex = (this.currentSeasonIndex - 1 + this.seasons.length) % this.seasons.length; // Add transition-out class but in reverse this.container.classList.add('transition-out-reverse'); setTimeout(() => { this.displayCurrentSeason(); this.container.classList.remove('transition-out-reverse'); this.isTransitioning = false; }, 600); }}// Initialize the journey when the DOM is readydocument.addEventListener('DOMContentLoaded', () => { const journey = new LifeJourney(); journey.initialize('life-container'); // Add a reflection prompt that changes periodically const reflectionPrompts = [ "What season of life are you in right now?", "Which season challenges you the most?", "What are you growing in this season?", "What needs to be released before your next season?" ]; const reflectionElement = document.createElement('div'); reflectionElement.classList.add('reflection-prompt');document.body.appendChild(reflectionElement);letpromptIndex=0;constupdatePrompt=()=>{reflectionElement.textContent=reflectionPrompts[promptIndex];promptIndex=(promptIndex+1)%reflectionPrompts.length;};updatePrompt();setInterval(updatePrompt,10000);});