Randomly delay revealing of each character in a text (uses CSS3 animation).
- Doesn't remove HTML tags of animated text
- No extra dependencies
Demo (codepen.io)
npm install slimfady --save
import SlimFady from 'slimfady';
const options = {
container: '#foo'
delay: 50
};
const sf = new SlimFady(options);// CSS
<link rel="stylesheet" href="node_modules/slimfady/dist/style.css">
// or import the stylesheet in a CSS pre-processor
@import 'node_modules/slimfady/dist/style.css';<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="test" class="sf-container">hello</div>
</body>
</html>{
container: '#foo'
delay: 50
}
CSS selector of a single DOM node.
Defines time range between starting animation of each character, smaller value => faster animation.
Stops and also pauses animation if it's still in progress. If you would like to remove animation
and reveal the whole text immediately, use clearAnimation().
Removes animation and reveals the whole text. It doesn't remove newly created <span> elements.
After calling clearAnimation(), you can easily start animation from the beginning by using
startAnimation().
MIT
