|
1 | | -## ⌨️ TinyTyper - a tiny library for creating a typing effect on specified text element. |
2 | | -[](https://badge.fury.io/js/tinytyper) |
3 | | -[](http://standardjs.com/) |
4 | | -[](https://travis-ci.org/lourenc/tinytyper) |
5 | | -[](https://gemnasium.com/github.com/lourenc/tinytyper) |
| 1 | +## VueTinyTyper - a vue component for creating a typing effect element. |
| 2 | + |
| 3 | +#### Credits |
| 4 | +This project is forked from https://github.com/lourenc/tinytyper |
| 5 | +Some parts of the readme are also originally from above repository. |
| 6 | + |
| 7 | +#### Why |
| 8 | +This project was created because I was missing events in non-vue version. |
6 | 9 |
|
7 | 10 | #### Demo |
8 | 11 | <img align="center" src="https://s28.postimg.org/4qva5c1f1/tinytyper2.gif"> |
9 | 12 |
|
10 | | -#### Size (It's really tiny) |
11 | | - - *Minimized: 2.9KB* |
12 | | - - *Gziped: 1.1KB* |
13 | | - |
14 | 13 | #### Installation |
15 | | -Library can be easily installed via either NPM or Bower: |
16 | | - |
17 | | -`npm i tinytyper --save` |
| 14 | +Library can be easily installed via either Yarn or NPM: |
18 | 15 |
|
| 16 | +`npm i vue-tinytyper --save` |
19 | 17 | OR |
20 | | - |
21 | | -`bower i tinytyper --save` |
| 18 | +`yarn add vue-tinytyper` |
22 | 19 |
|
23 | 20 | #### Usage |
24 | 21 |
|
25 | 22 | Basic setup looks like this: |
26 | 23 |
|
27 | 24 | ```js |
28 | | -import TinyTyper from 'tinytyper'; |
29 | | - |
30 | | -const el = document.querySelector('.text-el') |
31 | | -const options = { /* . . . */ } |
32 | | -const instance = new TinyTyper(el, options) |
| 25 | +import VueTinytyper from 'vue-tinytyper'; |
33 | 26 | ``` |
34 | | - |
35 | | -In case you need to run animation again: |
| 27 | +THEN |
36 | 28 | ```js |
37 | | -instance.animate() |
| 29 | +<vue-tinytyper text="Hello, please type this out."></vue-tinytyper> |
38 | 30 | ``` |
| 31 | +OR |
| 32 | +```js |
| 33 | +<vue-tinytyper>Hello, please type this out.</vue-tinytyper> |
| 34 | +``` |
| 35 | + |
| 36 | +Available `props`: |
| 37 | + |
| 38 | +Prop | Default | Type | Description |
| 39 | +---------------- | ------------- | ----------- | -------------- |
| 40 | +`text` | `` | String | The text to animate |
| 41 | +`textSpeed` | `95` | Number | Defines text speed animation |
| 42 | +`cursor` | `▌` | String | Defines current cursor symbol |
| 43 | +`blinkSpeed` | `0.05` | Number | Defines blink speed of a cursor |
| 44 | +`containerClass` | 'tiny-typer-container' | String | A CSS class for the container element |
| 45 | +`cursorClass` | `tiny-typer-cursor` | String | A CSS class for cursor element |
| 46 | +`textClass` | `tiny-typer-text` | String | A CSS class for text element |
| 47 | +`staticCursor` | `false` | Boolean | Makes cursor static (disables blinking) |
| 48 | +`staticText` | `false` | Boolean | Makes text static (disables animation) |
| 49 | +`customEvents` | `{}` | Object | Pass custom "on-character" events. Example: `{ '!': 'my-event' }`, where the event 'my-event' will be triggered every time the current animation character matches the object key, eg. "!". |
| 50 | + |
39 | 51 |
|
40 | | -Available `options`: |
| 52 | +Available `events` |
41 | 53 |
|
42 | | -Option | Default | Description |
43 | | -------------- | -------------|-------------- |
44 | | -`text` | `innerText` of specifed `el`ement | Sets a text to be displayed |
45 | | -`textSpeed` | `95` | Defines text speed animation |
46 | | -`cursor` | ` ▌` | Defines current cursor symbol |
47 | | -`blinkSpeed` | `0.05` | Defines blink speed of a cursor |
48 | | -`cursorClass` | `tiny-typer-cursor` | A CSS class for cursor element |
49 | | -`textClass` | `tiny-typer-text` | A CSS class for text element |
50 | | -`staticCursor`| `false` | Makes cursor static (disables blinking) |
51 | | -`staticText` | `false` | Makes text static (disables animation) |
| 54 | +Eventname | Trigger | Payload |
| 55 | +------------- | ---------- | ---------- |
| 56 | +`animation-finished` | When animation doesn't have any more characters to animate | None |
52 | 57 |
|
53 | 58 | #### Contributions |
54 | 59 |
|
55 | | -Contributions are welcome. Feel free to create [issues](https://github.com/lourenc/tinytyper/issues) and [PRs](https://github.com/lourenc/tinytyper/pulls) |
| 60 | +Contributions are welcome. Feel free to create [issues](https://github.com/ViktorPontinen/vue-tinytyper/issues) and [PRs](https://github.com/ViktorPontinen/vue-tinytyper/pulls) |
56 | 61 |
|
57 | 62 | #### License |
58 | 63 |
|
|
0 commit comments