Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/connoratherton/typewriter
Simulate typing on a page.
https://github.com/connoratherton/typewriter
Last synced: 19 days ago
JSON representation
Simulate typing on a page.
- Host: GitHub
- URL: https://github.com/connoratherton/typewriter
- Owner: ConnorAtherton
- License: mit
- Created: 2014-04-03T23:39:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-29T10:44:58.000Z (about 9 years ago)
- Last Synced: 2024-04-24T04:10:28.922Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 223 KB
- Stars: 48
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Typewriter
==========Typewriter provides an easy way to print out text on the web. It comes with a
few different configuration options that are all documented below.See some examples [here](http://connoratherton.com/typewriter).
### Letter by letter, fixed interval.
``` js
var tw = new Typewriter('.example-1-output', {
text: 'I love printing text! Pity my intervals are the same each time.',
interval: 100
});tw.type();
```### Letter by letter, random natural human interval.
``` js
var tw = new Typewriter('.example-2-output', {
text: 'My intervals are randomised to look like a human is typing.',
interval: 'human'
});tw.type();
```### Word by work, fixed interval
``` js
var tw = new Typewriter('.example-3-output', {
text: 'I LOVE PRINTING THE MOST!',
interval: 500,
words: true
});tw.type();
```### Letter by letter, random natural human interval with bounds specified and a callback on completion.
``` js
var tw = new Typewriter('.example-4-output', {
text: 'Woah! So glad this is the last example I have to sit through.',
interval: 'human',
lowerBound: 30,
upperBound: 130
});tw.type(function() {
console.log('Finished typing now');
});
```### All options
``` js
var tw = new Typewriter('selector', {
text: 'The text to write into the selector',
words: false, // Optional. Defaults to false.
interval: 'human' || 300, // Optional. Defaults to human.
lowerBound: 30 || null, // Optional. Defaults to 30ms
upperBound: 200 || null // Optional. Defaults to 200ms
});tw.type(callback)
```