From 4edf733b7bf460d1c27c9e6529b8d39cf5bb5e56 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Thu, 18 Dec 2025 22:22:54 +0800 Subject: Bumblebee post. --- _projects/matrix-digital-rain.md | 47 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to '_projects/matrix-digital-rain.md') diff --git a/_projects/matrix-digital-rain.md b/_projects/matrix-digital-rain.md index bca5c38..6d15008 100644 --- a/_projects/matrix-digital-rain.md +++ b/_projects/matrix-digital-rain.md @@ -16,14 +16,14 @@ Matrix in C, with zero dependencies—not even ncurses. This is my fork of Domsson's beautiful Fakesteak. While studying the code, I wondered -what it would take to faithfully recreate the original Matrix from the first -movie without sacrificing the program's minimalism and elegance. +rel="noopener noreferrer">Fakesteak. While going through his code, I +wondered what it would take to faithfully recreate the original Matrix from the +first movie without sacrificing its minimalism. -My version adds: +My implementation supports: - - Unicode character support. - - Fully customizable 24-bit RGB (truecolor) colors. + - Unicode characters. + - 24-bit RGB colors (truecolor). - Glitches in the matrix. - Ghosting effect of old monochrome CRT displays. - Closely resembles the Matrix seen in the background during Neo and Cypher's @@ -38,10 +38,10 @@ $ ./matrix ## How does it work? -The program tracks the state of the terminal - characters, background and -foreground colors, shading levels, cursor position - using multiple internal -data buffers. On each frame, it updates these buffers and repaints the screen -using ANSI escape codes: +The program tracks the state of the terminal, such as code points, background +and foreground colors, and cursor position, using multiple internal data +buffers. On each frame, it updates these buffers and repaints the screen using +ANSI escape codes: ``` static void term_print(const matrix *mat, size_t row, size_t col) @@ -57,8 +57,8 @@ static void term_print(const matrix *mat, size_t row, size_t col) } ``` -The ghosting effect, the signature feature of this implementation, works by -scaling and mixing the RGB channels: +The ghosting effect is achieved by carefully scaling the RGB +channels before mixing them: ``` static void mat_shade(matrix *mat, size_t row, size_t col) @@ -71,25 +71,24 @@ static void mat_shade(matrix *mat, size_t row, size_t col) } ``` -The ghosting function emulates the screen decay by gradually transitioning each -raindrop's color towards the background color. This approach provides two key -benefits: straightforward color configuration that integrates naturally with -Unix ricing (desktop customization) and high-fidelity recreation of the Matrix -aesthetic. +The ghosting function emulates the dim after glow by gradually transitioning +each raindrop's color towards the background color. This approach provides two +key benefits: straightforward color configuration that integrates naturally +with (Unix) ricing and high-fidelity recreation of the Matrix aesthetic. ## Customization -While you can adjust almost every aspect, including its speed, glitch -frequency, and rain density, the most useful settings for customization are the -color scheme and character set. +While you can alter almost every aspect, including speed, glitch frequency, and +rain density, the most common customizations are the color scheme and character +set. There are three color settings: head, tail, and background. You can configure -them by setting the `COLOR_*_RED`, `COLOR_*_GRN`, and `COLOR_*_BLU` definitions -in main.c. +them using `COLOR_*_RED`, `COLOR_*_GRN`, and `COLOR_*_BLU` definitions found in +main.c. The `UNICODE_MIN` and `UNICODE_MAX` values control the Unicode block used. For -example, setting them to `0x30A1` and `0x30F6` rains Katakana (if a font that -supports Katakana is present on the system): +example, setting them to `0x30A1` and `0x30F6` rains Katakana, if a font that +supports Katakana is present on the system: -- cgit v1.2.3