TypewriterConfig<T>

TYPE DEFINITION

Configures the initial state of the `Typewriter`.

Since 1.2.0

Properties

actions Optional

TypewriterAction []

The actions this `Typewriter` is set to enter. Each stroke represents a key press on the Typewriter. A stroke can add or remove characters, or move the cursor.

Defaults to an empty array, meaning no actions will be made.

Since 1.2.0

autoPlay Optional

boolean

Whether or not the animation will immediately start playing.

When `true` the animation will start playing immediately, when `false` the animation will start when `play()` is called.

Note: the animation will only start playing when there are actions defined.

Defaults to `true` meaning that the animation will play instantly.

Since 1.2.0

blinkAfter Optional

number

The time it takes until a cursor starts blinking again after the cursor was used.

A cursor does not blink when it is used until after a certain time. So if you keep typing the cursor does not blink, until you stop typing for some "predefined amount" of time.

The `blinkAfter` is what represents that 'predefined amount' of time, you can also say this is a debounce time.

Note: when you set the `blinkAfter` to a number lower or equal to the `delay` of a `TypewriterAction`, it will negate the debounce. The effect is that all "CHANGED" events will have a "BLINKING" event. This might not "visually" affect your animation, but will make the `Typewriter` send extra events. If this happens it is technically as "misconfiguration" on your part, but the Typewriter will not throw any errors, since visually nothing bad happens.

Defaults to after `250` milliseconds.

Since 1.2.0

cursors Optional

TypewriterCursorConfig<T> []

The cursors the `Typewriter` is going to have.

Defaults to one cursor at the end of the provided `text` with an empty name.

Since 1.2.0

keepHistoryFor Optional

number

For how many items the `history` may contain in the `Typewriter`.

Defaults to `0` meaning that it will not track history.

Since 1.2.0

repeat Optional

boolean | number

Whether or not this animation repeats and how often.

There are three ways to define `repeat`.

1. When `repeat` is `false` or `1` it will never repeat the animation, the animation will run only once.

2. When `repeat` is `true` it will repeat the animation forever.

3. When `repeat` is a number it will repeat the animation for given number of times. If the number is 0 or a negative number is provided a error occurs.

Defaults to `false` meaning that the animation will run once.

Since 1.2.0

repeatDelay Optional

number

The time in milliseconds the animation is paused in between repeats.

Defaults to `0` milliseconds, meaning an almost instant repeat.

Since 1.2.0

text Optional

string

The initial text the `Typewriter` starts with.

Defaults to '' meaning that the Typewriter will not have an initial text.

Since 1.2.0