# `Ascii.Pieces.Scramble`
[🔗](https://github.com/houllette/ascii_art/blob/main/lib/ascii/pieces/scramble.ex#L1)

Phrases decoding left to right out of flickering glyphs.

A decode effect. Each phrase breaks into flickering glyphs from the left,
and the next one settles out of them a letter at a time. Give it your own
phrases: a login's "access granted", a rotating tagline.

## 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 on the new phrases.

  * `phrases` - the phrases, in turn, each centred on the middle row,
    held settled for about two seconds, and cut to 40 characters; after
    the last comes the first again. An empty list is a blank line.
    Default `["hello, world", "decoding the signal", "nothing is lost",
    "see you on the other side"]`.

The line is always 44 by 3.

## Colours

It has no parts to colour one by one: in one ink, or a gradient, with
`:ink` and `:gradient` (see `Ascii.Ink`). A horizontal gradient runs
through the phrase and the glyphs alike.

## Keys and clicks

It takes none: it decodes its phrases, and `Ascii.handle_event/2`
ignores every event. A Phoenix player given `interactive` and `notify`
still tells your LiveView where it was clicked.

## Screen readers

`Ascii.describe/1` reads the phrases, four at most, their closing
stops dropped: "scramble: access granted; welcome back". With none, it
gives the piece's name and note.

## Example

```elixir
decode = Ascii.new!("scramble", options: %{phrases: ["access granted.", "welcome back"]}, ink: "#3fb950")
{frame, decode} = Ascii.frame(decode, 0.0)
frame.text =~ "access granted."
#=> true

Ascii.describe(decode)
#=> "scramble: access granted; welcome back"
```

```heex
<Ascii.Phoenix.live_player id="decode" piece="scramble" options={%{phrases: @phrases}} ink="#3fb950" />
```

Ported from `src/pieces/scramble.ts` in bas3line/ascii (MIT).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
