An open API service indexing awesome lists of open source software.

https://github.com/avdaredevil/matrix

Matrix Animation in your Terminal (cross-platform in PowerShell)
https://github.com/avdaredevil/matrix

Last synced: 3 months ago
JSON representation

Matrix Animation in your Terminal (cross-platform in PowerShell)

Awesome Lists containing this project

README

          

# Pwsh Matrix Animation

Matrix Animation in your Terminal (cross-platform in PowerShell). With lots of rendering options below!

## Demo


Matrix in Unix Renderer (WinTerm)
Matrix in Windows Renderer (WinTerm)



Matrix in Unix Renderer (WinTerm)
Matrix in Windows Renderer (WinTerm)


Retro Effect in WinTerm




Retro Effect in WinTerm

_**Note:** Iterm2 is perfectly supported! This entire file is cross-platform!_

## Features

Written to be quite flexible, featuring:
- Cross-platform rendering systems (Switchable with `-Renderer [Windows, Unix]`)
- Windows mode: Uses PowerShell's native console manipulation capabilities through `System.Management.Automation.Host` namespace. It utilizes `Place-BufferedContent` for precise character placement and supports Windows console color schemes.
- Unix mode: Employs ANSI escape sequences for text positioning and coloring, providing compatibility with a wide range of Unix-based terminals. This mode offers more fine-grained color control, enabling smoother color transitions and a more vibrant "glow" effect for the leading characters.
- Adjustable sparsity of the matrix effect with `-Sparsity`
- Customizable animation speed with `-SleepTime`
- Option to use special characters for a **more authentic Matrix look** with `-SpecialChars` (works best with Unicode-compatible terminals)
- Debug mode for troubleshooting with `-Debug`
- Dynamic resizing to fit the terminal window

## Requirements

- PowerShell 5.1 or later (PowerShell Core 6.0+ recommended for cross-platform use)

## Usage

Run the script using PowerShell:

```powershell
Matrix.ps1 [[-Sparsity] ] [[-SleepTime] ] [[-Renderer] ] [-SpecialChars] [-Debug]
```

### Parameters
- `-Sparsity`: Density of the matrix effect (range: 0.0001 to 1, default: 0.1)
- `-SleepTime`: Animation speed in milliseconds (default: 50)
- `-Renderer`: Choose between "Windows" or "Unix" rendering (default: "Unix")
- `-SpecialChars`: Use special characters for a more authentic Matrix look
- `-Debug`: Enable debug mode for troubleshooting

### Examples

1. Run with default settings:
```powershell
.\Matrix.ps1
```

2. Full feature demo:
```powershell
.\Matrix.ps1 -SpecialChars -Sparsity 1 -Renderer Unix
```

3. Use Windows on old terminals (like `conhost`, `cmd`)
```powershell
.\Matrix.ps1 -SleepTime 20 -Renderer Windows
```

### In case you've never setup powershell
- Run this: `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned` (Allows you to run powershell scripts)
- Cd to the path where you cloned this project
- Run `./Matrix.ps1`

## How It Works
The script creates a matrix-like animation by:
1. Generating random characters (including optional special characters)
2. Creating vertical lines of these characters
3. Animating the lines to fall down the screen
4. Adjusting colors to create a glowing effect

The animation adapts to the terminal window size and can handle window resizing.

## Known Issues
- Performance may vary depending on terminal and system specifications
- Some terminals may not support all color features

## License
[MIT License](LICENSE)

## Acknowledgements
Inspired by the iconic digital rain effect from "The Matrix" film series.