diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-12-13 11:18:22 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-12-13 11:18:22 +0800 |
| commit | 8e3f47e3b76154da225ef5acda690d5e20454bf0 (patch) | |
| tree | 2a2d33acb1823671561159c630874c12d1023277 /_site/projects/matrix-digital-rain | |
| parent | 5cab2b6a89097e0647295588e46901aaf049be65 (diff) | |
| download | www-8e3f47e3b76154da225ef5acda690d5e20454bf0.tar.gz | |
wip: matrix.
Diffstat (limited to '_site/projects/matrix-digital-rain')
| -rw-r--r-- | _site/projects/matrix-digital-rain/index.html | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/_site/projects/matrix-digital-rain/index.html b/_site/projects/matrix-digital-rain/index.html index b69ac2d..5c33db1 100644 --- a/_site/projects/matrix-digital-rain/index.html +++ b/_site/projects/matrix-digital-rain/index.html @@ -45,34 +45,42 @@ <h6 class="center">12 JANUARY 2024</h5> <br> <div class="twocol justify"><p>“All I see is blonde, brunette, red head.” The iconic digital rain from The -Matrix, implemented in C, without dependencies (not even ncurses).</p> +Matrix implemented in C without dependencies (not even ncurses).</p> <video style="max-width:100%;" controls="" poster="thumb.png"> <source src="matrix.mp4" type="video/mp4" /> </video> -<p>This project is a fork of Domsson’s beautiful <a href="https://github.com/domsson/fakesteak" class="external" target="_blank" rel="noopener noreferrer">Fakesteak</a>. Use the following commands to compile -and run the program:</p> +<h2 id="overview">Overview</h2> + +<p>This is my fork of Domsson’s beautiful <a href="https://github.com/domsson/fakesteak" class="external" target="_blank" rel="noopener noreferrer">Fakesteak</a>. As I was going through the fakesteak +code, I thought about what it might take to recreate the original rain from the +first Matrix movie without losing the program’s minimalism and elegance.</p> + +<p>My version of the matrix has the following features:</p> + +<ul> + <li>Unicode characters.</li> + <li>Fully customizable 24-bit RGB (truecolor) colors.</li> + <li>Glitches in the matrix.</li> + <li>Ghosting effect of old monochrome displays.</li> + <li>Closely resembles the one seen in the background while Neo and Cypher were +talking in the first Matrix movie.</li> +</ul> + +<p>As there are no dependencies, you can compile and run it however you want:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ cc -O3 main.c -o matrix $ ./matrix </code></pre></div></div> -<p>While I loved Domsson’s take on the -digital rain, what blew my mind was the minimalistic elegance of his code. As I -carefully examined it, I thought about what it might take to recreate the -original digital rain from the first Matrix movie with it. The challenge is -adding these features without destroying fakesteak’s elegance.</p> - <h2 id="how-does-it-work">How does it work?</h2> -<p>The <code class="language-plaintext highlighter-rouge">matrix</code> struct makes use of three 2D arrays to encode the Matrix: the -<code class="language-plaintext highlighter-rouge">code</code> array for 32-bit Unicode characters, the <code class="language-plaintext highlighter-rouge">rgb</code> array for 24-bit RGB -values of the character (foreground color), and the <code class="language-plaintext highlighter-rouge">shade</code> array for the -degree of transparency of the character to simulate the ghosting effect of old -monochrome displays. The dimensions of these arrays depend on the size of the -terminal screen. Each slot in the array corresponds to a cursor position on the -screen.</p> +<p>The <code class="language-plaintext highlighter-rouge">matrix</code> struct makes use of two 2D arrays to encode the Matrix: the <code class="language-plaintext highlighter-rouge">code</code> +array for 32-bit Unicode characters and the <code class="language-plaintext highlighter-rouge">rgb</code> array for RGB values of the +characters (foreground color). The dimensions of these arrays depend on the +size of the terminal window. Each slot in the array corresponds to a cursor +position on the screen.</p> <p>The ghosting effect, which is arguably the crowning feature of my version, is implemented by carefully scaling and mixing the RGB channels:</p> |
