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