0.1.1 • Published 3 years ago

@apochromat/animation v0.1.1

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

@apochromat/animation

Dynamic text animations for interactive command line apps.

Installation

npm install @apochromat/animation --save

Usage

import {AnimationLens} from '@apochromat/animation';
import {print} from '@apochromat/print';
import {Lens} from 'apochromat';

const greeting = new Lens();
const spinner = new AnimationLens();

print(greeting);
greeting.render`Hello, World! ${spinner}`;
spinner.startAnimation(['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'], 80);
setTimeout(() => greeting.render`Hello, World!`, 2000);
Hello, World! ⠋
Hello, World! ⠴
Hello, World!

Types

class AnimationLens extends Lens {
  startAnimation(frames: readonly string[], interval: number): () => void;
}

Copyright 2021 Clemens Akens. All rights reserved. MIT license.