# EbookReader Animated Demonstrations

This directory contains animated GIF demonstrations of the pyWebLayout EbookReader functionality.

## Generated GIFs

### 1. Page Navigation (`ereader_page_navigation.gif`)
Demonstrates forward and backward page navigation through an EPUB book. Shows smooth transitions between pages using `next_page()` and `previous_page()` methods.

**Features shown:**
- Sequential page advancement
- Page-by-page content rendering
- Natural reading flow

### 2. Font Size Adjustment (`ereader_font_size.gif`)
Shows dynamic font size scaling from 0.8x to 1.4x and back. The reader maintains the current reading position even as the layout changes with different font sizes.

**Features shown:**
- `increase_font_size()` / `decrease_font_size()`
- `set_font_size(scale)` with specific values
- Position preservation across layout changes
- Text reflow with different sizes

### 3. Chapter Navigation (`ereader_chapter_navigation.gif`)
Demonstrates jumping between chapters in a book. Each chapter's first page is displayed, showing the ability to navigate non-linearly through the content.

**Features shown:**
- `jump_to_chapter(index)` for index-based navigation
- `jump_to_chapter(title)` for title-based navigation
- `get_chapters()` to list available chapters
- Quick access to any part of the book

### 4. Bookmarks & Positions (`ereader_bookmarks.gif`)
Illustrates the bookmark system: navigating to a position, saving it, navigating away, and then returning to the saved position.

**Features shown:**
- `save_position(name)` to bookmark current location
- `load_position(name)` to return to saved bookmark
- Position stability across navigation
- Multiple bookmark support

## Generating Your Own GIFs

To generate these animations with your own EPUB file:

```bash
cd examples
python generate_ereader_gifs.py path/to/your/book.epub ../docs/images/
```

This will create all four GIF animations in the specified output directory.

### Script Options

```python
python generate_ereader_gifs.py <epub_path> [output_dir]
```

- `epub_path`: Path to your EPUB file (required)
- `output_dir`: Directory to save GIFs (default: current directory)

### Customization

You can modify `generate_ereader_gifs.py` to adjust:
- Frame duration (`duration` parameter in `create_gif()`)
- Page dimensions (change `page_size` in `EbookReader`)
- Number of frames for each animation
- Font scale ranges
- Animation sequences

## Technical Details

- **Format**: Animated GIF
- **Page Size**: 600x800 pixels
- **Frame Rate**: Variable (500-1000ms per frame)
- **Loop**: Infinite
- **Book Used**: Alice's Adventures in Wonderland (test.epub)

## File Sizes

| GIF | Size | Frames | Duration per Frame |
|-----|------|--------|-------------------|
| `ereader_page_navigation.gif` | ~500 KB | 10 | 600ms |
| `ereader_font_size.gif` | ~680 KB | 13 | 500ms |
| `ereader_chapter_navigation.gif` | ~290 KB | 11 | 1000ms |
| `ereader_bookmarks.gif` | ~500 KB | 17 | 600ms |

## Usage in Documentation

These GIFs are embedded in the main [README.md](../../README.md) to showcase the EbookReader's capabilities to potential users.

To embed in Markdown:
```markdown
![Page Navigation](docs/images/ereader_page_navigation.gif)
```

To embed in HTML with size control:
```html
<img src="docs/images/ereader_page_navigation.gif" width="300" alt="Page Navigation">
```
