This module follows the Elm Architecture. If you are new, it's definitely a good idea to start by reading the Official Guide.
The settings for the typewriter. You can create one of these using
withWords, and then customize it using functions like
iterations. You can then initialize your typewriter by
passing your Config to init.
Typewriter.withWords [ "Supercalifragilisticexpialidocious" ]
|> Typewriter.iterations (Typewriter.times 3)
|> Typewriter.withTypeDelay 600
|> Typewriter.withBackspaceDelay 10
|> Typewriter.withJitter (Random.float 0.5 1.5)
|> Typewriter.initSee Customizing.
Create a new typewriter model from some settings.
Typewriter.withWords [ "Let's get typing!" ]
|> Typwriter.initSee Config for more ways to customize it's behavior.
The view function. We just give you the String, so you can render it in whatever way makes sense for your application.
The type of messages that typewriters emit.
Make sure to call this update in your own update to make
the typewriter type!
Controls how many times the typwriter will run through it's script
of words. By default it will type infinitely, but you can also constrain
it. See times.
Typewriter.withWords [ "Type", "Forever" ]
|> Typwriter.iterations Typewriter.infinite
|> Typwriter.initChange the amount of time between each key typed. This should specified in milliseconds.
Note that this only affects how fast characters are deleted, and not how fast they
are deleted. For that, see withBackspaceDelay.
Change the amount of time between each character deleted. This should specified in milliseconds.
Provide a generator that produces floats, that will be used to calculate the delay in the next step of the typing process. The float is used as a coefficient with the delay configured for that step.
If generator produces 0.5, then the next step will be twice as fast. Conversely, if it
were to produce 2.0, then that next step will take twice as long.
Typewriter.withWords [ "I'm", "All", "Over", "The", "Place" ]
|> Typwriter.withJitter (Random.float 0.1 20)
|> Typwriter.initControls how many times the typewriter will play.
The typewriter will continuously type it's list of words, starting from the beginning after it finishes it's last word.
The typewriter will go through it's list of words a specified
amount of times, and then stop. There is a minimum of at least one
iteration, so for any value n where n < 1, it will be treated as 1.
Toggles the playing state of the typewriter. If it is currently playing, then this will pause it. If it is already paused, then it will resume playing.
You can check if it is currently paused or playing using isPaused.
Returns true if the typewriter is paused.
Typewriter.withWords [ "Type", "Forever" ]
|> Typwriter.init
|> Typewriter.isPaused
|> Expect.equal FalseRetuorns true if this typewriter has no more things to type! This
will never return false if the iterations was set to
infinite.
Opaque type representing the current state of the typewriter.