npm.io
1.1.10 • Published 3 years ago

type-writer-xs

Licence
ISC
Version
1.1.10
Deps
11
Size
642 kB
Vulns
17
Weekly
0
Stars
1

Angular Typewriter made with typescript language.

Installation

npm i type-writer-xs

Example usage

import { TypeWriterXsComponent } from 'type-writer-xs';

@Component({
  selector: 'your-component',
  template: `
    <div class="whitespace"></div>
  `,
  styles: []
})

export default function InsideYourComponent() {

    //TypeWriterXsComponent -> (HTMLElement, loop = false (default), typeSpeed = 50 (default), DeleteSpeed = 50 (default))
    //Note All speeds in milliseconds.
    const writer = new TypeWriterXsComponent(document.querySelector(".whitespace") as HTMLDivElement ,true, 130, 150);

    writer.typeString('hello there').typeString(' its type writer ').typeString(' Made by XeNDeR ').pauseFor(2000).deleteUpto(12).typeString(' visit : www.ixender.com').deleteAll().typeString('Bye').deleteAll().start();
}

Inside Details

NameTypeDescriptionRequiredDefault
userInputstringText to display as string true
loopbooleanSet to true if the typewriter should loop after finishing typing the string(s)truefalse
typeSpeednumberHow long (in ms) does the the typewriter wait after typing one charactertrue50ms
deleteSpeednumberHow long (in ms) does the the typewriter wait after deleting one charactertrue50ms
typeString(userInput: string)function()It will start the typing animation
pauseFor(duration: number)function()It will start pause the typing animation upto "duration"
deleteUpto(chars : number)function()It will delete upto "chars" given by user.
deleteAll()function()It will delete complete text.

Keywords