Type Character
The Type Writer splits every line into letters and wraps each one in a <type-character>. That’s what lets it reveal the line letter by letter, and what the text effects style: a letter inside {angry}…{/angry} is a type character with a data-effect-angry attribute. You never write one yourself, but you style them.

| Tag | <type-character> |
| Where it lives | Created by the Type Writer, one per letter (spaces stay plain text) |
| Built on | Component |
| Source | src/components/type-character/ |
Markup
<type-character letter="r" charindex="7" class="animated" data-component="type-character" data-effect-shake="" style="--char-index: 7;">r</type-character>| Hook | What it is |
|---|---|
type-character |
Every letter. They’re inline, so they flow like ordinary text. |
[data-effect-name] |
A letter inside the {name}…{/name} effect. A letter in nested effects has one attribute per effect. |
--char-index |
The letter’s position in its run of text, from 0. The wave and mood effects use it to delay each letter’s animation a little more than the previous one. |
.cursor |
The letter the typing cursor follows, when the cursor is on. |
style="opacity: 0" |
A letter that isn’t typed yet. |
A <br>, <hr> or <img> in a line also becomes a type character, which draws that tag with its attributes (like src and class) when its turn comes.
Properties and attributes
| Name | Type | What it is |
|---|---|---|
letter |
string |
The letter it shows. |
charIndex |
number |
Its position, copied to --char-index. |
br, hr, img |
boolean |
Set when it stands for one of those tags instead of a letter. |
special (state) |
object |
The effects it’s in. The component turns them into data-effect-… attributes. |
Events
None.
Style it
The effects read these variables, set on type-character itself:
| Variable | Default | What it styles |
|---|---|---|
--effect-wave-amplitude |
0.3em |
How far the wave effects and happy lift each letter. A negative value makes them dip instead. |
--effect-wave-speed |
0.8s |
How long one wave of wave takes (not wave-slow or wave-fast). |
--effect-glitch-color-1, --effect-glitch-color-2 |
#ff0040, #00ffff |
The colored fringes of the glitch effects and static. |
--effect-reveal-duration |
0.4s |
How long the effects that play as a letter appears take (fade, blur, impact, redacted and the others), as a scale: each keeps its own proportion of it, so fade takes three quarters of it and fade-slow twice as long. |
--cursor-blinker, --cursor-speed, --cursor-easing, --cursor-color |
see Type Writer | The typing cursor. |
Change an effect, or every letter, in your game’s style/main.css:
type-character[data-component] {
--effect-wave-amplitude: 0.4em;
--effect-glitch-color-1: #ffd23f;
}
type-character[data-effect-angry] {
color: #ff9f1c;
}The effect variables are set on type-character[data-component], so override them with that same selector (or a more specific one): a rule on plain type-character loses to the engine’s.
Replace or extend it
Style it rather than replace it. The type writer creates the letters with document.createElement('type-character') and sets their properties directly, so a subclass registered with the same tag would receive them, but there’s little a letter can do differently. To give a part of a line a new look, add an effect instead (Type Writer).
Related pages
- Type Writer: the effects and markers.
- Text Box: where most lines are typed.