Gender reveal Christmas tree written in Javascript and uses a Bézier Curve and the Philips HUE API.
Go to file
2024-04-03 18:10:58 -07:00
bezier.js Provide Better Attribution To Library Code 2024-04-03 18:10:58 -07:00
lib.js First Commit 2024-04-03 18:04:39 -07:00
main.js First Commit 2024-04-03 18:04:39 -07:00
README.md Fix Typo 2024-04-03 18:10:25 -07:00

HUE LightShow

Motivation

For the gender reveal of my second kid, I wanted to do something unique and fun. It was the perfect excuse to justify the purchase of a Philips Hue Lightstrip to the Mrs.

I wrapped the light strip around our Christmas tree and wrote some Javascipt to alternate between blue and pink. There were a couple iterations.

Technical Details

lib.js contains some helper functions (and authentication to the Hue Bridge) that leverage the Philips Hue REST API. These functions are used in main.js to control the light strip.

The first iteration of the light show was a simple alternating sequence that loaded all the color transitions into the event loop at the start with the setTimeout progressively having a longer delay to create the sequence.

The linear nature was a bit boring, so I pulled in a bezier.js library (Thank you Pomax) to create a more dynamic pacing of the sequence.

Following the same setTimeout strategy, I created a list of values from the bezier curve to use as the root of the setTimeout delay making the sequence speed up and then slow down to a stop. Once the sequence was complete, the final color would start to glow in and out.

Video

Here is the final product. Please be aware, the video contains rapid flashes near the beginning. If you are sensitive to flashing lights and still want to watch it, consider skipping to the middle of the video where the sequence slows down considerably.

HUE Light Show