My original idea was to create a scene that does something really cool when you close your eyes, but when you open your eyes again, it goes away. It is, however, difficult to make something really cool so I went with something silly instead.
Finding a way to consistently detect closed eyes required a lot of troubleshooting. First I tried using machine learning paired with the second template for face tracking (BRFv4) to detect the difference between someone's eyes open and closed, but the difference wasn't great enough to be legible to the computer. Also that template lagged a ton. Then I found a way that someone had done it online computationally. I tried this first on BRFv4, but that didn't work. The face points were too rigid to react to eye movements. Finally, when I used the computational method on the clmTracker I was able to detect closed eyes consistently enough.
I'm happy with the final product, although there are ways it could be more. The static image could react subtly to the viewer before they close their eyes, the whole conceit could be more immersive.
https://editor.p5js.org/ilovit/sketches/hHoobmOSv