DEV Community

Valentin Ste
Valentin Ste

Posted on AI-assisted

How I built a Pomodoro timer with a flying Tesla Roadster for the desktop

When Tesla showed the new Roadster doing stunts on rocket thrusters, everyone was impressed by this piece of engineering art. And I had an idea: I wanted this car to fly right across my screen, over all my windows, while I work. A realistic Roadster taking off on jets of steam, flipping in the air above open windows and landing softly in clouds of vapour. But a flying toy with no practical use would get old fast, so from the start I decided to make it a Pomodoro timer: the car animation plays when a work session or a break ends.

For the first couple of days, Claude and I eagerly wrote a prototype in three.js. To test the physics, I temporarily took the standard Ferrari model from the engine's examples, and made the steam from the nozzles with ordinary shader particles on the GPU. The result was dismal: the steam looked less like compressed gas from a nozzle and more like grey smoke from a broken muffler.

Early three.js prototype: a red Ferrari with grey particle smoke flying over a Notes window and a code editor

The Architectural Pivot: Prerendered Video

It became clear that real-time generation was a dead end. So we rebuilt the architecture:

  • No WebGL on the desktop: instead of drawing polygons on the fly, we decided to render a perfect clip in Blender Cycles with physically correct lighting and export it as a transparent video (HEVC with an alpha channel). The native Mac app just plays the finished clip at the right moment.
  • Ready-made simulations instead of homemade ones: instead of fruitless attempts to get AI to write a gas simulation from scratch, we found high-quality OpenVDB simulations of a high-pressure gas leak on Blendkit (Pipe Leak Animated and looped ground smoke by BleachedBroccoli Medvešek).
  • For the car's 3D model I settled on "Tesla Roadster 2020" by metarex.4d on Sketchfab (the 2017 prototype design), licensed under CC BY 4.0: I scaled it to the real car's length and set up the wheel rotation and the materials.

To make the gas jets look authentic, we went through the videos from Tesla's official channel frame by frame and even wrote a script that measures the jet's profile along its length, the bright clumps of steam at the nozzle, and the speed at which the jet's pattern travels.

Layered Rendering: From 150 Hours to Overnight

Once the scene came together in Blender, a new obstacle appeared: on my MacBook, a full render of even the 3.5-second landing clip at 60 frames per second with physically based volumetric smoke would have taken 70 to 150 hours. Rendering in layers saved the day:

  • The car itself, with its metallic reflections and highlights, was rendered at full resolution.
  • The volumetric smoke and steam jets were rendered as a separate layer at half resolution (smoke has soft edges, and in motion the pixel difference is invisible to the eye).
  • The shadow on the desktop went into a third, transparent layer.

With the layers composited, the landing's render time dropped to about 6 hours, and it rendered overnight without trouble. The whole 13-second show at a MacBook's screen resolution (3024×1964) took about 15 hours the same way.

The final Blender render: a silver Roadster hovering on two jets of steam above its own cloud, over desktop

macOS Native Implementation

This time I was happy with the result. I built the utility itself in Swift as a macOS menu bar app. The transparent video plays over the entire system, but thanks to .ignoresMouseEvents = true, mouse clicks pass right through the flying car, and the window is a nonactivatingPanel that can't take focus (canBecomeKey = false), so your typing isn't interrupted either.

Porting to Windows with Tauri 2 & Rust

I made the Windows version later with Tauri 2: a Rust shell, with the panel and the show itself as web pages in the system's built-in WebView2. The video there is the same one the website serves to Chrome (WebM/VP9 with alpha), since WebView2 is the same Chromium. The show window gets the styles WS_EX_LAYERED | WS_EX_TRANSPARENT so clicks pass through it, WS_EX_NOACTIVATE so it doesn't take focus, and WS_EX_TOOLWINDOW so it doesn't appear on the taskbar or in Alt+Tab. I ported the scheduling logic from Swift to plain Rust along with all 107 tests from the Mac version. Everything builds right on the Mac with cargo-xwin into a 6 MB NSIS installer, and when the panel is closed WebView2 is unloaded, so the idle app takes about 6 MB of memory.

Download & Open Source

I built the app's landing page with Astro and hosted it on Cloudflare Pages. The page's main trick is the "Watch it fly" button: press it, and the same transparent video flies right over the site's content (HEVC with alpha for Safari, WebM/VP9 for Chrome and Firefox).

The app is free and open source. Because it isn't signed with an Apple Developer certificate, macOS will stop it on first launch: open System Settings → Privacy & Security and click "Open Anyway". On Windows, SmartScreen will ask you to click "More info" → "Run anyway".

The full list of authors and licences for all assets is in the CREDITS file in the repository.

Disclaimer: This is an independent open-source fan project and is not affiliated with, sponsored, or endorsed by Tesla, Inc. Tesla and Roadster are trademarks of Tesla, Inc.

Top comments (0)