# Fractal

![Fractal icon](pwa-192x192.png)

Explore the Mandelbrot set on a fullscreen shared display. Touch its matching image on your phone to zoom into intricate coastlines, spirals and islands.

## Join and explore

Launch **Fractal** from the Visuals section in the RCWeb app menu. Existing room controllers move to **Fractal Control** automatically. You can also scan the standard invitation on the display or open [Fractal Control](/fractal-c/) in the same room.

One or more phones can control the shared view. A single authoritative display accepts one zoom at a time; all controllers receive the same view and options. Additional displays mirror its aspect ratio, with letterboxing if needed.

- Touch the preview to zoom in with that point at the centre of the new image. The default step is 2×.
- You can also click the Mandelbrot directly on a display. A **Zoom out** button appears there after a viewer click and hides again at the widest view. Viewer clicks stay synchronized with the phones and other displays.
- **Zoom out** retraces the last ten zoom steps, reusing their cached images without regeneration when colours, detail and display dimensions still match. Beyond that history, it widens the view around the current centre.
- **Reset view** returns to the whole set and can cancel a render.
- **Colour & options** offers six palettes, colour offset, band spacing, reversal, detail, zoom step, animation speed and invitation visibility.
- **Animate palette** cycles smoothly through the selected colours every 20 seconds, including during zooms and the demo. The display and phone share the same cycle; the dark interior stays fixed. Colour cycling reuses calculated pixels rather than recalculating the fractal each frame. Turn it off to restore the chosen static colour offset.
- **Back to apps** returns your phone to the app menu while leaving the display running.
- Settings are saved automatically in the display browser's local storage and restored on reload, then synchronized to controllers. This includes palette animation, colour options, detail, zoom step/speed and invitation visibility. The zoom position and demo session start afresh; **Reset view** keeps your saved settings.
- Use the display's **Full screen** button to request browser fullscreen.

## Destinations and idle demo

Choose a destination on the controller to travel there in steps of at most 2×. Distant destinations are reached by zooming out first. Each step animates the existing image while calculating the next one, easing down when rendering is slow and blending in the new detail during movement. WebGL and Canvas use the same route and timing; previews follow the display's progress.

By default, after one minute without input, the display starts a slow automatic tour. Each destination stays on screen for five seconds after rendering completes, then the tour zooms back out and visits the next location. Touch, mouse or keyboard input on either app stops the tour after the current smooth step; **Reset view** returns immediately. Controllers can select a different destination during a tour.

The controller offers twelve destinations in a visual grid, with locally pre-rendered PNG previews. Six new stops include Spiral whirlpool, Northern satellite, Swirling islands, Delicate lace, Elephant’s trunk and Seahorse’s horn. Seahorse Valley and Elephant Valley are last in both the grid and demo order. Thumbnails use Classic colours and landscape framing; your selected palette and display aspect ratio apply when exploring.

Published centres come from Robert P. Munafo's Mu-Ency ([Seahorse Valley](https://mrob.com/pub/muency/seahorsevalley.html), [Elephant Valley](https://mrob.com/pub/muency/elephantvalley.html)), [Exploring the Mandelbrot Set](https://mandelbrot.dev/) and the [Mandelbrot Gallery](https://mandelbrot.neocities.org/gallery). Framing and descriptive labels are adapted for this app. Rendering uses the app's existing iteration budget, so very fine boundary detail can differ from the reference images. Preview assets can be regenerated with `node src/main/apps/app/fractal/make-previews.cjs`.

## Rendering

During a zoom, the existing image moves smoothly while a sharper destination image is calculated separately. As soon as the destination image is ready, its detail fades in over 180 milliseconds at the same coordinates while movement continues. This applies to click-to-zoom, zoom-out and destination tours; completing the fade does not shorten the zoom. If rendering takes longer, the enlarged image remains visible and the phone shows **Refining…**. Zooming out prepares a wider image first so no empty edges appear.

WebGL accelerates rendering when available. During movement, a pixel worker calculates the destination so the GPU stays free to animate the existing image. Phone previews also use the worker. Canvas 2D provides a fallback; browsers without workers use small calculation batches. Deep zooms use JavaScript double precision even when WebGL presents the image. A numerical zoom limit prevents misleading detail. High detail increases the iteration and pixel budgets and may take longer on older devices. Automatic rendering caps the display at roughly 1080p; Standard uses roughly 720p and High allows up to 4K, subject to device limits.

The phone renders the same mathematical region and colour settings at its own resolution. Minor edge differences can occur between GPU and CPU calculations. Reconnecting phones recover the current session while a display remains open; a full reload of the only display starts a new view.

## Compatibility checks

For diagnostics, `?r=test-0001&canvas=1` forces Canvas rendering. Add `&worker=0` to test calculation without a worker, or `&lean=1` to use the lean display path.

![Fractal display](screenshot.png)

Zoom in defaults to 3 seconds and Zoom out to 1 second, with independent options from 0.7 to 8 seconds. Destination journeys and the demo use the corresponding speed for each direction, slowing when the next image needs more time. **Demo delay** offers Off, 30 seconds, 1 minute, 2 minutes, 5 minutes or 10 minutes. Turning automatic demo off still allows manual destination journeys. Both preferences are saved in the viewer browser; previously saved zoom speeds are preserved as the Zoom in preference.




