Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ideyuta/ghost-writer
:ghost: Ghost Writer outputs the sentence like typewriter
https://github.com/ideyuta/ghost-writer
Last synced: 8 days ago
JSON representation
:ghost: Ghost Writer outputs the sentence like typewriter
- Host: GitHub
- URL: https://github.com/ideyuta/ghost-writer
- Owner: ideyuta
- License: mit
- Created: 2016-02-17T23:13:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-20T04:35:24.000Z (over 8 years ago)
- Last Synced: 2024-10-14T11:49:07.523Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://ideyuta.com/ghost-writer/
- Size: 290 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ghost Writer
Ghost Writer outputs the sentence like typewriter.
|
Installation |
Usage |
Advanced Use |
Types |
License |
Demo → |
## Installation
```
npm install ghost-writer
```## Usage
#### Japanese Typewriting
![Demo - Ghostruct](./demo-ghostruct.gif)
```js
import ghostWriter from 'ghost-writer';const struct = [{
i: 'anoiーhatoーvono',
o: 'あのイーハトーヴォの'
}, {
i: 'sukitoottakaze',
o: 'すきとおった風、'
}, {
i: 'natsudemo',
o: '夏でも'
}, {
i: 'sokoni',
o: '底に'
}, {
i: 'tsumetasawomotsu',
o: '冷たさをもつ'
}, {
i: 'aoisora',
o: '青いそら'
}];
const writer = ghostWriter(struct);let text = '';
writer(t => text = t);
```#### Simple Typewriting
![Demo - Simple Text](./demo-simple-text.gif)
```js
import ghostWriter from 'ghost-writer';const writer = ghostWriter('あのイーハトーヴォのすきとおった風');
let text = '';
writer(t => text = t);
```![Demo - English](./demo-en.gif)
```js
import ghostWriter from 'ghost-writer';const struct = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
const writer = ghostWriter(struct);let text = '';
writer(t => text = t, 50);
```## Advanced Use
```js
import {ghost} from 'ghost-writer';ghost([{i: 'anoiーhatoーvono', o: 'あのイーハトーヴォの'}]);
/* return
[
'あ',
'あn',
'あの',
'あのい',
'あのいー',
'あのいーh',
'あのいーは',
'あのいーはt',
'あのいーはと',
'あのいーはとー',
'あのいーはとーv',
'あのいーはとーゔぉ',
'あのいーはとーゔぉn',
'あのいーはとーゔぉの',
'あのイーハトーヴォの'
]
*/
```## Types
```js
ghostWriter: (struct: RawGhostruct|string) => writer
``````js
writer: (
callbackFunction: (string) => void,
msec: number
) => string
``````js
ghost: (struct: RawGhostruct|string) => string[]
``````js
RawGhostruct: [{
i: RawGhostruct | string,
o: string
}]
```## License
[MIT](https://github.com/ideyuta/ghost-writer/blob/master/LICENSE)