# RCWeb NASA APOD

**NASA APOD** turns any RCWeb-capable display into a slow, cinematic slideshow of NASA's *Astronomy Picture of the Day*. The viewer fetches the most recent month of APOD entries directly from `api.nasa.gov`, then cross-fades between them with a Ken Burns zoom/pan animation so each image feels like a deliberate shot rather than a static wallpaper.

![icon](pwa-512x512.png "NASA APOD App Icon")

## What it shows

- Full-bleed image with cross-fade between slides
- Ken Burns animation (subtle zoom + pan, four rotating variants for variety)
- Image title, publication date and copyright
- Slide counter and a small QR code linking to the companion **nasa-apod-c** app

The viewer auto-advances every 16 seconds. Video APODs are skipped (or shown as their thumbnail) so the slideshow stays purely visual.

## How it talks to the controller

This is a classic RCWeb asymmetric viewer. The viewer owns all state — the active slide index, whether the slideshow is playing, and the loaded entry list — and exposes a small public API on `window.nasaApod`:

```text
nasaApod.next()
nasaApod.prev()
nasaApod.goto(index)
nasaApod.play()
nasaApod.pause()
nasaApod.toggle()
nasaApod.requestState(clientId)
```

Whenever the slide changes or play/pause toggles, the viewer pushes a snapshot to every `nasa-apod-c` client in the room with `rc.sendFunctionCall("nasa-apod-c", "nasaApodControl.receiveState", snapshot)`. Newly joining controllers also call `nasaApod.requestState(rc.client)` to ask for a fresh snapshot addressed back to them.

## Browser support

The viewer is written in ES5 with `XMLHttpRequest`, vendor-prefixed CSS animations, and no CSS Grid or custom properties, so it runs comfortably on older signage browsers as well as modern desktop and mobile browsers.

## URL

`/nasa-apod/?r=<room>`
