0.7.3 • Published 5 years ago

microwriter v0.7.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Microwriter npm bundlephobia

A tiny library that simulates the typewriter animation for JavaScript and TypeScript

Installation

  • Use pre-compiled modules in the dist/ directory.
  • Use pika.dev to import the module without bundling:
import microwriter from 'https://cdn.pika.dev/microwriter@^x.y.z';

const writer = microwriter({ ... });
  • Use npm or yarn:
$ npm install microwriter

Example

A working example can be found in the example/ directory. The usage is very straightforward:

// Find a target element to write text into
const target = document.getElementById('microwriter-target');

// Initialize a writer
const writer = microwriter({
  // The target
  target,

  // The lines list
  lines: ['Hello, world', 'This is Microwriter'],

  // Print in infinite loop
  // Default is false
  loop: true,

  // Delete whole line at a time before writing next or preserve the line if there's only one in the list
  // Default is false
  preserve: false,

  // The writing speed in milliseconds
  writeSpeed: 150,

  // The deletion speed in milliseconds
  // If not provided, writeSpeed is used instead
  deleteSpeed: 50,

  // A delay in milliseconds before writing a new line
  writeLineDelay: 400,

  // A delay in milliseconds before deleting a written line
  deleteLineDelay: 1000,
});

// Start writing
writer.start();

// Pause writing
writer.pause();

// Replace lines and restart
writer.replaceLines(['My next list', 'of lines.']);

License

MIT.

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.6.2

5 years ago

0.7.0

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago