untyper
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

^^_^^ untyper

Looking forward to your feedback

NPM version

untyper

A simple typewriter for browser,Typing effects can be achieved using chained methods

🛹  TODO

  • [x] support custom typing effect
  • [x] support custom cursor
  • [x] support move cursor
  • [x] support add any document node
  • ...

🚀  Feature

  1. use Web Animations API Api to achieve typing effect
  2. Support custom typing speed
  3. Support chained methods

📦  Install

  npm install untyper

Usage

import { UnTyper } from 'untyper'
const text = document.querySelector('#text')
const unTyper = new UnTyper(text, { speed: 100, startDelay: 1000 })
unTyper.type('hi', { delay: 200 }).go()

Api

type

Warning: only support string input

  • text string
  • opts: object { delay?: number, startDelay: number, animationspancontent: string, animate: { cancel: boolean, },}

output

  • this

pause

input

  • ms number

output

  • this

delete

input

  • charAt: number > 0
  • opts: object -> delay?: number

output

  • this

move

input

  • movementArg: number | null
  • opts?: object-> {to?: string, delay?: number}

output

  • this

add

input

  • text string | HTMLElement
  • opts: object -> delay?: number

output

  • this

go

output

  • Promise

License

MIT License © 2022 Song wuk

Package Sidebar

Install

npm i untyper

Weekly Downloads

1

Version

0.0.9

License

MIT

Unpacked Size

33.7 kB

Total Files

6

Last publish

Collaborators

  • songwuk