ghost-writer
v0.2.1
Published
Ghost Writer outputs the sentence like typewriter.
Downloads
14
Readme
Installation
npm install ghost-writer
Usage
Japanese Typewriting
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
import ghostWriter from 'ghost-writer';
const writer = ghostWriter('あのイーハトーヴォのすきとおった風');
let text = '';
writer(t => text = t);
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
import {ghost} from 'ghost-writer';
ghost([{i: 'anoiーhatoーvono', o: 'あのイーハトーヴォの'}]);
/* return
[
'あ',
'あn',
'あの',
'あのい',
'あのいー',
'あのいーh',
'あのいーは',
'あのいーはt',
'あのいーはと',
'あのいーはとー',
'あのいーはとーv',
'あのいーはとーゔぉ',
'あのいーはとーゔぉn',
'あのいーはとーゔぉの',
'あのイーハトーヴォの'
]
*/
Types
ghostWriter: (struct: RawGhostruct|string) => writer
writer: (
callbackFunction: (string) => void,
msec: number
) => string
ghost: (struct: RawGhostruct|string) => string[]
RawGhostruct: [{
i: RawGhostruct | string,
o: string
}]