open-index/open-npm huggingface dataset:
npm package: @louiscvh/text-engine
Description: A text engine for creating text-based games.
Latest version: 1.0.9

# Text Engine

Text Engine is a TypeScript library for animating text on web pages. It allows you to create animations such as fading in lines of text and sliding them into view. This library is designed to be easily integrated into JavaScript projects with any framework.

## Features

- **fadeInLines**: Fade in each line of text sequentially.
- **slideUpLines**: Slide each line of text into view from below.
- **Customizable**: Configure animation duration, delays, timing functions, and add custom CSS classes.
- **Framework Agnostic**: Works seamlessly with any JavaScript framework.

## Installation

Install Text Engine using npm:

```bash
npm install @louiscvh/text-engine

# or

yarn add @louiscvh/text-engine
```

## Usage

### fadeInLines

```typescript
import { fadeInLines } from '@louiscvh/text-engine';

const element = document.getElementById('textContainer');
fadeInLines(element, { duration: 1000, delay: 200 });
```

### slideUpLines

```typescript
import { slideUpLines } from '@louiscvh/text-engine';
slideUpLines(document.getElementById('textContainer'));
```

## Options

Both `fadeInLines` and `slideUpLines` accept an options object with the following properties:

- **duration**: The duration of the animation in milliseconds. Default is `1000`.
- **delay**: The delay between each line of text in milliseconds. Default is `100`.
- **timingFunction**: The timing function for the animation. Default is `'ease'`.
- **containerClass**: A custom CSS class to apply to the text container.
- **textClass**: A custom CSS class to apply to each line of text.

## Examples

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Text Animation Example</title>
  <style>
    .text-container {
      overflow: hidden;
    }
  </style>
</head>
<body>
  <div id="textContainer" class="text-container">
    Line 1<br>
    Line 2<br>
    Line 3
  </div>

  <script type="module">
    import { fadeInLines, slideUpLines } from '@louiscvh/text-engine';

    const textContainer = document.getElementById('textContainer');

    // Fade in lines
    fadeInLines(textContainer, { duration: 1000, delay: 200 });

    // Slide up lines
    slideUpLines(textContainer, { duration: 1500, delay: 300 });
  </script>
</body>
</html>
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.