Logo

dev-resources.site

for different kinds of informations.

Matrix (and perlish) background effect in Javascript :)

Published at
3/3/2021
Categories
perl
javascript
effect
Author
thibaultduponchelle
Categories
3 categories in total
perl
open
javascript
open
effect
open
Author
19 person written this
thibaultduponchelle
open
Matrix (and perlish) background effect in Javascript :)

Today I have something useless-but-cool to show.

My Matrix-perlish background! 😎 😎 😎

Perl Matrix

Check out my github page to see a live preview πŸ˜€

It's only a couple of lines of javascript derivated from the work that you can find here or here so I deserve absolutely zero credit but I simply modified it to make it appear more perlish! πŸ‘

(or p@r]i$% if you prefer πŸ˜€)

Below the full code:

<html>
  <head>
  </head>
  <body>
    <!-- background animations -->
    <div class="div_bg">
      <canvas id="c"></canvas>
    </div>
    <script>
      var c = document.getElementById("c");
      var ctx = c.getContext("2d");
      c.height = window.innerHeight;
      c.width = window.innerWidth;
      var txts = "~!@#$%^&*)(_-=+;:{}[]|\/<>,.";
      txts = txts.split("");
      var font_size = 12;
      var columns = c.width / font_size;
      var drops = [];
      for (var x = 0; x < columns; x++) drops[x] = 1;

      function draw() {
        ctx.fillStyle = "rgba(255, 255, 255, 0.05)";
        ctx.fillRect(0, 0, c.width, c.height);
        ctx.fillStyle = "#000";
        ctx.font = font_size + "px arial";
        for (var i = 0; i < drops.length; i++) {
          var text = txts[Math.floor(Math.random() * txts.length)];
          ctx.fillText(text, i * font_size, drops[i] * font_size);
          if (drops[i] * font_size > c.height || Math.random() > 0.98) drops[i] = 0;
          drops[i]++;
        }
      }
      setInterval(draw, 20);
    </script>
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode
effect Article's
30 articles in total
Favicon
Wrapping up 2024
Favicon
This Week in Effect - 2024-12-27
Favicon
Effect 3.12 (Release)
Favicon
Effect 3.11 (Release)
Favicon
Cause & Effect Podcast #1
Favicon
Mapping Operations in Effect-TS Optionals
Favicon
Using do Notation in Effect-TS Optionals
Favicon
Exploring Option Getters in Effect-TS
Favicon
Exploring Option Conversions in Effect-TS
Favicon
Using match with Option in Effect
Favicon
Using match with Option in Effect
Favicon
Effect in React
Favicon
Understanding Type Guards in Effect-TS: Ensuring Safe Option Handling
Favicon
Exploring Option Constructors in Effect-TS
Favicon
Introduction to Options in Effect
Favicon
Effects in Ember
Favicon
How we migrated our codebase from fp-ts toΒ Effect
Favicon
Synthetic Turf Benefits: Cost-Effective Solutions for Public Spaces
Favicon
The Effect Tax
Favicon
Effect 3.0
Favicon
Effect Days conference on Feb 23, 2024 in Vienna
Favicon
Link: OCAML 5 is Out + Effects Tutorial
Favicon
How To Fade In And Out In Premiere Pro
Favicon
React - Don't update parent state in the rendering phase of the child
Favicon
Encoding HKTs in TypeScript (Once Again)
Favicon
Developing A Wrapper Around Node.Js FS
Favicon
Contentlayer & Effectβ€Šβ€”β€ŠArchitectural Patterns And Decisions.
Favicon
JavaScript photo efffect fun project
Favicon
Matrix (and perlish) background effect in Javascript :)
Favicon
Social Media Buttons with HTML and CSS ( blur effect ).

Featured ones: