VirtuPet
VirtuPet: Your Virtual Companion for Emotional Well-being and Mindfulness
Created on 21st February 2025
•
VirtuPet
VirtuPet: Your Virtual Companion for Emotional Well-being and Mindfulness
The problem VirtuPet solves
VirtuPet addresses the growing need for emotional support and mindfulness in daily life. Many people face stress, anxiety, or loneliness, and may not have immediate outlets to express or manage their emotions.
How VirtuPet Helps:
Emotional Support: Acts as a virtual companion that users can care for, providing a sense of responsibility and connection.
Mindfulness Promotion: Offers daily affirmations and challenges that encourage users to focus on self-care and mental well-being.
Mood Tracking: Allows users to reflect on their emotions and observe mood trends over time through journaling and mood selection.
Personalized Experience: Mood-based environments and music create a calming and supportive space tailored to how users feel.
VirtuPet makes it easier for users to manage their emotions, reflect on their mental health, and practice mindfulness—all in a fun, interactive, and supportive environment.
Challenges I ran into
1. Integrating 3D Environment with UI Elements
Challenge: Combining a dynamic 3D environment (using Three.js) with the user interface elements (pet stats, buttons, journal, etc.) was difficult. Some UI elements would overlap or become hidden behind the 3D scene.
Solution: I adjusted the z-index and CSS positioning of the UI elements to ensure they floated above the 3D environment. Careful use of CSS flex and grid layouts helped maintain responsiveness and proper placement.
2. Managing Animations for Pet Actions
Challenge: Animating the pet’s actions (feed, play, rest) while ensuring stats updated smoothly without bugs.
Solution: I separated animation logic from stat updates and used JavaScript promises to synchronize the two, ensuring seamless user interactions.
3. Audio Playback Restrictions
Challenge: Browsers often block autoplaying background music unless the user interacts with the page first. This prevented mood-based music from playing automatically.
Solution: I added an event listener for the first user action (e.g., clicking a button), which then triggered the background music based on the selected mood.
Technologies used