A pixel word that tears into sliding slices in short bursts.
A word set in a blocky pixel face holds clean, then breaks up in short digital bursts: slices slide sideways and lose registration, cells corrupt. Three bursts in every seven seconds, then it comes round again. Your word, for an error page, a "no signal" or a heading with some edge.
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): it starts
afresh with the new text, the bursts keeping their time, being a function
of play time.
text- the word or words, in capitals whatever their case. The face hasAtoZ,0to9, the space and. , : ! ? - ' " / & + · * # ( ) @ % = _, and draws?for any other character. A pixel is two columns wide when the text fits, about five letters, and one column when it does not; past about twelve letters it is cut at the frame's edge. Default"noise".
The frame is always 64 by 13, the word centred in it.
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:
letter- the word's pixels, wherever a slice slides them, a smear drags them or a block copies them; andletter.<n>, each letter by its place in the text from 1, counting every character, spaces too (sosisletter.4in "no signal").ghost- the copy a slid slice leaves behind where it was, cyan.noise- corrupted cells and a block's static, red.tear- the line torn through the word, grey.
Each frame is labelled as it was drawn, from its time.
Keys and clicks
It takes none: it is a word to read, 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): which letter, say.
Screen readers
Ascii.describe/1 reads the text, its spaces closed up: "glitch:
error 404". A text of only spaces gives the piece's name and note.
Example
word = Ascii.new!("glitch", options: %{text: "error 404"}, parts: true)
{frame, _word} = Ascii.frame(word, 3.0)
frame.palette
#=> [nil, "#39c5cf", "#8b949e", "#f85149"]
Ascii.describe(word)
#=> "glitch: error 404"
heading = Ascii.new!("glitch", options: %{text: "ok"}, parts: %{"letter.1" => "#3fb950", "letter.2" => "#58a6ff"})
{frame, _heading} = Ascii.frame(heading, 0.0)
frame.palette
#=> [nil, "#3fb950", "#58a6ff"]<Ascii.Phoenix.live_player id="oops" piece="glitch" options={%{text: "error 500"}} parts />Ported from src/pieces/glitch.ts in bas3line/ascii (MIT).