-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated README.md, updated example, changed how to install
- Loading branch information
Showing
5 changed files
with
125 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,125 @@ | ||
![GitHub release](https://img.shields.io/github/release/MattMoony/10fingersJS.svg) ![GitHub last commit](https://img.shields.io/github/last-commit/MattMoony/10fingersJS.svg) ![GitHub All Releases](https://img.shields.io/github/downloads/MattMoony/10fingersJS/total.svg) ![GitHub repo size in bytes](https://img.shields.io/github/repo-size/MattMoony/10fingersJS.svg) ![GitHub](https://img.shields.io/github/license/MattMoony/10fingersJS.svg) | ||
|
||
# 10fingersJS | ||
_A pure JavaScript-Typewriter._ | ||
|
||
--- | ||
|
||
This project is still under development, however I hope you'll be able to enjoy the final product / the current framework. | ||
Provide strings and see them magically being typed out on the page. The typer will automatically detect which part of the string should be removed, in order for the new one to correctly appear, so only the necessary parts will be deleted. | ||
|
||
## Installation | ||
|
||
#### Script tag | ||
|
||
```html | ||
<script src='https://cdn.jsdelivr.net/gh/MattMoony/10fingersJS@v1.0/src/tenfingers.js'></script> | ||
``` | ||
|
||
## Setup | ||
|
||
```javascript | ||
let target = document.getElementById('target'); | ||
let typer = new TenFingers(target); | ||
``` | ||
|
||
## Usage | ||
|
||
#### Basic Example | ||
|
||
In this example we will use TenFingers to type a couple of strings into the [previously](#Setup) specified element. | ||
|
||
```javascript | ||
// ... | ||
|
||
typer.typeAll([ | ||
'!© MattMoony', | ||
'Hello World!', | ||
'Hello Whales!', | ||
'Hello Wales!', | ||
'Hello Water!', | ||
'Hello Mum!', | ||
'#great', | ||
'This is a statement', | ||
'This is a statement.', | ||
]); | ||
|
||
// ... | ||
``` | ||
|
||
![Result of code above](./media/01.gif) | ||
|
||
#### Or | ||
|
||
You can achieve the same, by using a more complex, but easily customizable syntax. | ||
|
||
```javascript | ||
// ... | ||
|
||
typer.clear() | ||
.type('!© MattMoony') | ||
.pause(1250) | ||
.clear() | ||
.type('Hello World!') | ||
.pause(1250) | ||
.delete('orld!'.length) | ||
.type('hales!') | ||
.pause(1250) | ||
.delete('hales!'.length) | ||
.type('ales!') | ||
.pause(1250) | ||
// and so on ... | ||
|
||
// ... | ||
``` | ||
|
||
#### With options | ||
|
||
Now, we will create a customized typer using the _args_ parameter. | ||
|
||
```javascript | ||
// ... | ||
|
||
let args = { | ||
typingSpeed: 250, | ||
deletingSpeed: 125, | ||
cursorSpeed: .25, | ||
pauseTimeout: 1000, | ||
// pauseTimeoutS: 1, | ||
endTimeout: 3000, | ||
endStringTimeout: 1000, | ||
loop: true, | ||
}; | ||
let typer = new TenFingers(target, args); | ||
|
||
typer.typeAll([ | ||
'Hello World!', | ||
'How are you doing?', | ||
'How are the people around you doing?', | ||
'Great, it was nice talking to you!', | ||
]); | ||
|
||
// ... | ||
``` | ||
|
||
#### HTML strings | ||
|
||
You can also pass IDs to the typer, it will then use the content of those elements. | ||
|
||
```javascript | ||
// ... | ||
|
||
typer.typeAll([ | ||
'#some_id', | ||
'#some_other_id', | ||
]); | ||
|
||
// ... | ||
``` | ||
|
||
## Conclusion | ||
|
||
That is about it. If you have any further questions or suggestions, feel free to contact me on [twitter](https://twitter.com/Matthia23184857). | ||
|
||
--- | ||
|
||
... Matthias M. | ||
_... Matthias M. (March, 2019)_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters