@apochromat/animation
v0.1.1
Published
Dynamic text animations for interactive command line apps.
Downloads
6
Readme
@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.