Typing Flow Docs
  • Introduction
    • Get started
    • Configuration
    • Commands
      • text
      • backspace
      • del
      • cursorLeft
      • cursorRight
      • delay
      • home
      • end
    • Examples
  • Features
    • Renderers
    • Hooks
  • Plugins
    • chain
Powered by GitBook
On this page
  • Installation
  • Usage
  1. Introduction

Get started

Installation

npm install typing-flow

Usage

You should make sure that at the time the animation starts, the element with the specified selector is rendered in the DOM.

flow.ts
import { TypingFlow } from "typing-flow";
import { simpleBrowserRenderer } from "typing-flow/renderers";
import {
  backspace,
  cursorLeft,
  cursorRight,
  delay,
  text,
} from "typing-flow/commands";

// Step 1. Create instance
const flow = new TypingFlow({
  renderer: simpleBrowserRenderer({ selector: ".test" }),
});

// Step 2. Declare animation commands
flow.commands([
  text("Hello, worldd!!!", {
    delay: 130,
    instant: false,
  }),
  delay(300),
  cursorLeft(3, { delay: 120 }),
  backspace({ amount: 1, delay: 280 }),
  delay(310),
  cursorRight(3, { instant: true }),
]);

// Step 3. Start
flow.start();

NextConfiguration

Last updated 3 months ago