A scrolling led sign framed by chasing bulbs.
A theatre sign. Its text scrolls across an LED panel a pixel at a time and loops without a seam, while the bulbs round the edge chase. Give it your own text: an announcement, a status line, a headline.
Options
Give them to Ascii.new/2 as options:, and new ones while it plays
with Ascii.put_options/2 (or a Phoenix player's options): the sign
starts afresh with them, its text from the start.
text- what scrolls, in a 5×7 pixel face, upper case: letters, digits and common punctuation, any other character drawn as?. Space at either end is trimmed, and a gap of 12 pixel columns closes the loop, so end the text with a separator (·) to part one pass from the next. Default"now showing · doors open at 7:30 ·".speed- pixel columns a second the text moves. Default 12.
The sign is always 61 by 10.
Colours
In one ink, or a gradient, with :ink and :gradient (see
Ascii.Ink); part by part with :parts (see Ascii.Parts),
parts: true taking the colours suggested here:
bulb.on,bulb.off- the bulbs round the edge, lit (o, yellow) and dark (·, grey).frame- the sign's double-line border, grey.text- the lit pixels of the scrolling text.
Keys and clicks
It takes none: it is a sign, and Ascii.handle_event/2 ignores every
event. A Phoenix player given interactive and notify still tells your
LiveView where it was clicked, and on which part (Ascii.part_at/4):
the text, say, or a bulb.
Screen readers
Ascii.describe/1 reads the text, the · that part its messages as
commas: "marquee: doors at 8, bar open". Without text, it gives the
piece's name and note.
Example
sign = Ascii.new!("marquee", options: %{text: "doors at 8 · bar open ·", speed: 20}, ink: "#ffb000")
{frame, sign} = Ascii.frame(sign, 1.0)
frame.palette
#=> ["#ffb000"]
Ascii.describe(sign)
#=> "marquee: doors at 8, bar open"<Ascii.Phoenix.live_player id="sign" piece="marquee" options={%{text: @headline <> " ·"}} parts />Ported from src/pieces/marquee.ts in bas3line/ascii (MIT).