Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Vinicius authored and Luis Vinicius committed Dec 28, 2017
1 parent 805d0a5 commit f91bcac
Showing 1 changed file with 51 additions and 40 deletions.
91 changes: 51 additions & 40 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# iTyped

[![npm package](https://img.shields.io/badge/npm-v0.0.10-lightgray.svg)](https://www.npmjs.com/package/ityped)
[![npm package](https://img.shields.io/badge/npm-v1.0.0-lightgray.svg)](https://www.npmjs.com/package/ityped)

> Dead simple Animated typing, with no dependencies.
Expand All @@ -10,13 +10,13 @@
<img src="https://cdn.rawgit.com/luisvinicius167/ityped/master/img/itypedjs.gif" width="400"/>
</p>

[iTyped Website ➞](https://ityped.surge.sh/)
[ Website ➞](https://ityped.surge.sh/)

Enter in any string, and watch it type at the speed you've set, backspace what it's typed,
and begin a new sentence for however many strings you've set.

## Why should you use iTyped?
* iTyped has a tiny size: 2.3kB
* iTyped has a tiny size: 2kB
* No jQuery dependency
* Just install and enjoy!

Expand All @@ -26,7 +26,7 @@ At now, if you just need to render Strings, **iTyped** is the best solution for
#### Install

Npm: `npm install ityped` </br>
CDN: `https://unpkg.com/ityped@0.0.10`
CDN: `https://unpkg.com/ityped@1.0.0`


#### The Gist:
Expand All @@ -36,22 +36,25 @@ import { init, destroy } from 'ityped';

init(`#element`, {
// required - for now, only accepting texts
strings: ['Dead simple animated typing.', 'No dependencies'],
strings: ['Put your strings here...', 'and Enjoy!'],
//optional
typeSpeed: 55, //default
typeSpeed: 100, //default
//optional
backSpeed: 30, //default
backSpeed: 50, //default
//optional
startDelay: 500, //default
//optional
backDelay: 500, //default
//optional
loop: false, //default
backDelay: 500, //default
//optional
loop: false, //default
//optional
showCursor: true, //default
//optional
disableBackTyping: false,
// optional
cursorChar: "|", //default
// optional callback called once the last string has been typed
// optional: The callback called (if `loop` is false)
// once the last string was typed
onFinished: function(){}
});
```
Expand Down Expand Up @@ -96,52 +99,58 @@ init(`#element`, {
* @name init
* @description Init the typed animation
* @param {String || Element } element The Element that will receive the strings
* @param {Object} config The typed configuration
* @param {Object} props The ityped configuratio
*/
const element = document.querySelector('#element')
// you can
init(element, config);
// or
init('#element', config);

// es6 import
import { init } from 'ityped'
// Browser
const { init } = window.ityped
// you can pass the element
init(document.querySelector('#element'));

// or pass the string of your element
init('#element'});
```

Set multiples instances of iTyped at the same time, with different properties:

```html

<span id="element"></span>
<span id="one"></span>
<span id="other"></span>

```

Destroy

```javascript
/**
* @name destroy
* @description Destroy the onFinished function
* @param {HTMLElement} element The element on which the ityped animation is applied
*/
// es6 import
import { init } from 'ityped'

init(document.querySelector('#one'), { showCursor: false, strings: ['Nice', 'One' ] });

destroy();
init('#other', { disableBackTyping: true, strings: ['iTyped is', 'Awesome'] });
```

iTyped Configuration
iTyped properties

```javascript
/**
* @name config
* @description The initial typed configuration
* @param {Array} strings An array with the strings that will be animated
* @param {Integer} typeSpeed Typing speed
* @param {Integer} backSpeed Backspacing speed
* @param {String} cursorChar The value of cursor character
* @param {Integer} backDelay Time before backspacing
* @param {Integer} startDelay Time before typing starts
* @param {Boolean} showCursor Show the cursor element
* @param {Boolean} loop The animation loop
* @name properties
* @description The initial ityped properties
* @param {Array} strings An array with the strings that will be animated
* @param {Integer} typeSpeed Typing speed
* @param {Integer} backSpeed Backspacing speed
* @param {String} cursorChar The value of cursor character
* @param {Integer} backDelay Time before backspacing
* @param {Integer} startDelay Time before typing starts
* @param {Boolean} showCursor Show the cursor element
* @param {Boolean} loop The animation loop
* @param {Boolean} disableBackTyping Disable the back typing of the last string
* @param {Function} onFinished The callback that will be called (if `loop` is false) once the last word is decremented
**/

const config = {
strings: ['Dead simple animated typing.', 'No dependencies'],
strings: ['Put your strings here...', 'and Enjoy!']
//optional
typeSpeed: 100, //default
//optional
Expand All @@ -155,9 +164,11 @@ iTyped Configuration
//optional
showCursor: true, //default
//optional
disableBackTyping: false,
// optional
cursorChar: "|", //default
// optional callback called (if `loop` is false) once the
// last string was typed
// optional: The callback called (if `loop` is false)
// once the last string was typed
onFinished: function(){},
}
```

0 comments on commit f91bcac

Please sign in to comment.