{
  "id": 23278950,
  "title": "I Built a Bilingual Hanukkah Menorah in 2D and 3D — and One Candle Refused to Sync",
  "url": "https://urgent.news/2026/12/03/i-built-a-bilingual-hanukkah-menorah-in-2d-and-3d-and-one-candle",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-03T13:09:50.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mar_gus/i-built-a-bilingual-hanukkah-menorah-in-2d-and-3d-and-one-candle-refused-to-sync-55c3"
  },
  "original_language": null,
  "account": "In the late autumn months, I contemplated crafting a unique gift for Hanukkah. This year, I finally completed it: a web application that showcases the menorah, displays the precise candle-lighting time for any location, enables users to light the candles in the correct order, and even simulates the candles burning down in real-time. I constructed the entire project using only HTML, CSS, and JavaScript, and completed it on a tablet - the most educational endeavor I've undertaken thus far due to the myriad of bugs that emerged.\n\nThe application features two views of the same menorah: a 2D SVG candelabrum with nine candles, including the Shamash, the central helper candle. Users can tap a candle to light it, following the authentic halakhic order - starting with the Shamash, then the newest candle moving left to right. Incorrect selections are highlighted with a glowing gold candle and a message directing users to light the correct candle first. Each lit candle flickers, emits sparks, drips wax, and gradually shrinks over a period of four hours, reflecting the typical burning time of a Hanukkah candle. A demo mode compresses this time into three minutes for practice without lengthy waits.\n\nParallel to the 2D view, there exists a 3D Three.js menorah with identical nine candles, PBR textures for the wax, HDR environment reflections on the gold, and orbit controls for finger-spinning. Both perspectives are bilingual, supporting both Spanish and English, and share a unified state, allowing candles lit in one view to be lit in the other. Accurate lighting times for specific cities are the most challenging aspect. Hanukkah candles are lit at nightfall, which varies by location and day of the week. To address this, I implemented the NOAA sunset algorithm in JavaScript, incorporating the latitude, longitude, and timezone of the chosen city, along with weekday offsets. Consequently, users in Caracas and Jerusalem will experience different, yet correct times for the same night. The app also includes a date table covering Hanukkah from 2024 to 2124, ensuring uninterrupted countdowns as one festival concludes and the next begins.\n\nSeveral bugs provided valuable lessons during development. Firstly, the 3D scene loaded but the camera controls crashed with a \"Cannot access 'controls' before initialization\" error. The issue stemmed from calling a function that read a const variable before its initialization. The solution involved declaring the variable with let, initializing it to null, and guarding every use with if (controls). The lesson learned: with const, variable order is more crucial than commonly assumed.\n\nSecondly, issues with the OrbitControls and RGBELoader files arose, resulting in the error \"Cannot use import statement outside a module.\" Initially, I had downloaded the ES-module versions but loaded them using standard script tags. The remedy was to use the correct build of the library. The lesson learned: understanding the specific build of a library being utilized is essential.\n\nMost challenging and time-consuming was the synchronization between the 2D and 3D candelabra. The 'storage' event only triggers across different tabs, not when navigating between index.html and 3d.html within the same tab. To resolve this, I added a 'focus' listener that re-reads localStorage each time the page regains attention. The lesson learned: browser events have hidden scopes that must be accounted for.\n\nThirdly, the central Shamash candle presented a complication. The 2D view began with everything off, but the 3D view automatically lit it upon loading, and the demo mode did not light it either. The issue was a hardcoded line of code adding the Shamash to litCandles.add(4) in three different locations. Once removed, both views started clean, respecting the user's saved state. The lesson learned: a default state is still a deliberate choice and must be consistent across all files.\n\nLastly, the cache issue on my tablet prevented JavaScript refresh via Ctrl+F5. The solution was cache busting: appending ?v=3 to every script and stylesheet link. The lesson learned: in production, versioning assets is crucial to prevent debugging unanticipated changes.\n\nThe entire project is available on GitHub Pages, free of charge, with no backend or tracking. It serves as a small tool for a meaningful holiday, also representing my commitment to coding with purpose. For those who celebrate Hanukkah, I hope the accurate lighting times and ceremonial order enhance your evenings. For those who don't celebrate, I hope the bug stories offer a reason to smile, as each one was a moment where I desired to abandon the tablet but did not.",
  "summary": "Every December I think about making something for Hanukkah. This year I finally did it: a web app that shows the menorah, tells you the exact candle-lighting time for your city, lets you light the candles in the correct ceremonial order, and even simulates them burning down in real time. I built it in pure HTML, CSS and JavaScript, and I did the whole thing on a tablet. It was the most…",
  "summary_source": "publisher",
  "key_points": [
    "Created bilingual Hanukkah menorah web app using HTML, CSS, JavaScript",
    "Implemented 2D SVG and 3D Three.js menorah with PBR textures",
    "Synchronized candle lighting between 2D and 3D views despite browser event scope"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}