Concept
I love dad jokes, so I wanted to give them a playful home. My project is a digital aquarium where each joke floats inside a bubble. Click on a bubble and it pops to reveal a new joke. The goal was to combine humor with a visually appealing theme and make the jokes feel alive in their own little environment.
Highlight of Code I am Proud Of
The hardest part was making sure the joke text always fits neatly inside the bubble. I created a custom function called drawWrappedText that splits the joke into lines and centers them vertically. This required measuring text widths, calculating line spacing, and dynamically adjusting positions so the text always looks clean and balanced. I also added gentle floating and rotation to the bubble, giving the jokes a lively, buoyant feel.
// draw wrapped and vertically centered text inside bubble function drawWrappedText(txt, x, y, maxWidth, lineSpacing) { let words = txt.split(" "); // split text into words let lines = []; let line = ""; // build lines that fit within maxWidth for (let i = 0; i < words.length; i++) { let testLine = line + words[i] + " "; if (textWidth(testLine) > maxWidth && line.length > 0) { lines.push(line); line = words[i] + " "; } else { line = testLine; } } lines.push(line); // calculate vertical centering let totalHeight = lines.length * lineSpacing; let startY = y - totalHeight / 2 + lineSpacing / 2; // draw each line for (let i = 0; i < lines.length; i++) { text(lines[i], x, startY + i * lineSpacing); } }
Reflection and Future Improvements
I had a lot of fun combining humor with interactive design. In the future, I would like to add multiple bubbles at once, each with a different joke, and animate the fish reacting to the bubbles for extra playfulness. Another idea is letting users submit their own dad jokes to make the aquarium more personalized and community-driven.