# News Ticker — `news-ticker@1.0.0`

The scrolling headline bar of a news broadcast: a label block, headlines sliding right to left between separators, and a clock. Loops perfectly.

The scrolling headline bar along the bottom of a news broadcast: a coloured label block at the left (BREAKING), a dark bar with headlines that scroll right to left with small separators between them, and a clock at the right. The scroll is a whole number of repeats of the headline strip per loop, so it repeats seamlessly. Type up to three headlines, the label and the clock, choose the theme (breaking, business, sport or mono) and how many strips scroll past per loop.

- Kind: text; status: published; digest sha256:7f50d8fdd86eb7297e0ac514ff0a3a110456cec908e9c5482ea5b4177ce66bbc
- Role: Text overlay (Canvas 2D): the headline crawl for news, markets and sports content.
- Implementation: canvas2d; entry `src/news-ticker.js`
- Files: https://aipixelwizard.com/registry/news-ticker/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/news-ticker.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/news-ticker/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/news-ticker/1.0.0/index.html (open over http; it imports sibling packages by relative path)
- Dependencies (exact): `apw-runtime@1.0.0` (demo) — Demo harness. The reusable source has no dependencies.

## Exports
- `createNewsTicker({ headlines?, label?, theme?, repeats?, clock?, y?, fontFamily? }) => { draw(ctx, info, width, height) }` — Canvas 2D bar layer; info.progress (0 to 1 over the loop) sets the scroll; draws on top of the canvas.
- `THEMES: { breaking, business, sport, mono }` — Colour themes.

## Parameters
- `headline1` (text, default "Markets close higher as tech leads the rally") — Headline 1
- `headline2` (text, default "Storm system moves east, warnings issued for the coast") — Headline 2
- `headline3` (text, default "City opens new metro line after six years") — Headline 3
- `label` (text, default "BREAKING") — Label
- `clock` (text, default "21:45") — Clock text: Leave empty for no clock block.
- `theme` (select one of breaking | business | sport | mono, default "breaking") — Theme
- `repeats` (integer 1–4, default 1) — Strips per loop
- `background` (color, default "#141a26") — Backdrop

## Composition
- Inputs: Canvas 2D context, info.progress (0 to 1 over the loop), width, height.
- Outputs: Draws the bar on top of the canvas; does not clear it.
- Coordinates: The bar is centred at 88% of the height and 108 units tall on a 1080 canvas; the label is at the left, the clock at the right, headlines scroll between them.
- Lighting: A soft shadow above the bar lifts it off the picture.
- Timing: Pure function of info.progress; the strip is measured once.
- Works with: kinetic-title, gradient-background
- Text is treated as private: it is not stored in shared packs unless you choose to include it.
- Headlines repeat as needed to fill the bar, so a short strip still scrolls without gaps.

## Output and loop
- 1080×1080, 30 fps, 10 s, procedural
- Seamless loop: yes — The headline strip scrolls a whole number of its own lengths per loop, so the last frame meets the first.
- Verified 2026-10-08 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (Canvas 2D); deterministic: yes; loop check: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.

## Use it
New project: Create the ticker once, then each frame draw your picture and call ticker.draw(ctx, { progress }, width, height).

Existing project: Copy src/news-ticker.js. Call draw on your existing 2D canvas after the rest of the frame.

Reuse ideas:
- Breaking news: Breaking red.
- Markets: Business blue.
- Match day: Sport green, fast.

## Limitations
- System fonts differ between computers; pass fontFamily and load the font first for identical renders.
- The scroll speed follows the strip's length: more headlines scroll faster for the same loop length.

## License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.

Provenance: Original code written for AI Pixel Wizard in October 2026, to the catalog quality bar (docs/QUALITY.md).

