From e15f1076b59e997108914f6a5b9b28652d323268 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sat, 20 Dec 2025 21:36:45 +0800 Subject: Change website structure to a log. --- _site/poc/matrix-digital-rain/index.html | 148 ---------------------------- _site/poc/matrix-digital-rain/katakana.png | Bin 133709 -> 0 bytes _site/poc/matrix-digital-rain/matrix.mp4 | Bin 930430 -> 0 bytes _site/poc/matrix-digital-rain/poster.png | Bin 70901 -> 0 bytes _site/poc/matrix-digital-rain/source.tar.gz | Bin 2075 -> 0 bytes _site/poc/matrix-digital-rain/thumb_sm.png | Bin 22764 -> 0 bytes 6 files changed, 148 deletions(-) delete mode 100644 _site/poc/matrix-digital-rain/index.html delete mode 100644 _site/poc/matrix-digital-rain/katakana.png delete mode 100644 _site/poc/matrix-digital-rain/matrix.mp4 delete mode 100644 _site/poc/matrix-digital-rain/poster.png delete mode 100644 _site/poc/matrix-digital-rain/source.tar.gz delete mode 100644 _site/poc/matrix-digital-rain/thumb_sm.png (limited to '_site/poc/matrix-digital-rain') diff --git a/_site/poc/matrix-digital-rain/index.html b/_site/poc/matrix-digital-rain/index.html deleted file mode 100644 index dfcc274..0000000 --- a/_site/poc/matrix-digital-rain/index.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - The Matrix digital rain - - - - - The Matrix digital rain - - - - - - - - - - - - - -
-
-
-

THE MATRIX DIGITAL RAIN

-
12 JANUARY 2024
-
-

“All I see is blonde, brunette, red head.” The iconic digital rain from The -Matrix in C, with zero dependencies—not even ncurses.

- - - -

Overview

- -

This is my fork of Domsson’s beautiful 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 implementation supports:

- -
    -
  • 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 -conversation.
  • -
- -

With no dependencies, compilation is trivial:

- -
$ cc -O3 main.c -o matrix
-$ ./matrix
-
- -

How does it work?

- -

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)
-{
-    size_t idx;
-    idx = mat_idx(mat, row, col);
-    wprintf(L"\x1b[%d;%dH\x1b[38;2;%d;%d;%dm%lc",
-        row, col,
-        mat->rgb[idx].color[R],
-        mat->rgb[idx].color[G],
-        mat->rgb[idx].color[B],
-        mat->code[idx]);
-}
-
- -

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) 
-{
-    unsigned char *color;
-    color = mat->rgb[mat_idx(mat, row, col)].color;
-    color[R] = color[R] - (color[R] - COLOR_BG_RED) / 2;
-    color[G] = color[G] - (color[G] - COLOR_BG_GRN) / 2;
-    color[B] = color[B] - (color[B] - COLOR_BG_BLU) / 2;
-}
-
- -

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 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 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:

- -

- -

Files: source.tar.gz

-
- -
-
-
- - - - - - diff --git a/_site/poc/matrix-digital-rain/katakana.png b/_site/poc/matrix-digital-rain/katakana.png deleted file mode 100644 index b9df873..0000000 Binary files a/_site/poc/matrix-digital-rain/katakana.png and /dev/null differ diff --git a/_site/poc/matrix-digital-rain/matrix.mp4 b/_site/poc/matrix-digital-rain/matrix.mp4 deleted file mode 100644 index 84a9839..0000000 Binary files a/_site/poc/matrix-digital-rain/matrix.mp4 and /dev/null differ diff --git a/_site/poc/matrix-digital-rain/poster.png b/_site/poc/matrix-digital-rain/poster.png deleted file mode 100644 index 0321ad3..0000000 Binary files a/_site/poc/matrix-digital-rain/poster.png and /dev/null differ diff --git a/_site/poc/matrix-digital-rain/source.tar.gz b/_site/poc/matrix-digital-rain/source.tar.gz deleted file mode 100644 index fead280..0000000 Binary files a/_site/poc/matrix-digital-rain/source.tar.gz and /dev/null differ diff --git a/_site/poc/matrix-digital-rain/thumb_sm.png b/_site/poc/matrix-digital-rain/thumb_sm.png deleted file mode 100644 index d3f06c9..0000000 Binary files a/_site/poc/matrix-digital-rain/thumb_sm.png and /dev/null differ -- cgit v1.2.3