Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gigabyte5671/autotype

A simple auto-typing/typewriter effect written in vanilla JS.
https://github.com/gigabyte5671/autotype

autotype-effect javascript javascript-library typewriter-effect

Last synced: about 1 month ago
JSON representation

A simple auto-typing/typewriter effect written in vanilla JS.

Awesome Lists containing this project

README

        

# AutoType JS
A simple auto-typing/typewriter effect written in vanilla JS.
Just 470 bytes :sparkles:

[Demo](https://autotype.zakweb.dev/)

### Usage:

Include:

```html

```
Or download the files you want from the releases page.

To add the effect to an element, call the `AutoType()` function with the following arguments:
- A reference to the element, or its ID.
- The string you want typed.
- And optionally, the delay (in ms) between typed characters.

```javascript
AutoType("element_ID", "Your Text Here", character_delay);
```

`AutoBackspace()` can also be called with the same arguments (except the string to be typed) to get a backspacing effect:
```javascript
AutoBackspace("element_ID", character_delay);
```

Both of these functions can be `await`ed so you can run your own code after the effects have finished.
```javascript
await AutoBackspace("element_ID");

// Or

AutoBackspace("element_ID").then(() => {
// Do something awesome
});
```

### CSS:
You can also use autotype.css to add a blinking cursor to the end of your autotyped text. Just add the `autotype_horizontal_cursor` or `autotype_vertical_cursor` class to the text element:

```html


Horizontal cursor!_


Vertical cursor!|


```

> [!NOTE]
> Using either of these classes will set the text element's position to relative.