Live data from Hacker News

Matrix web-based green code rain, made with love

github.com

11–20 of 69 posts

Re: Matrix web-based green code rain, made with love

#16
For simple matrix-like effects, I use

  
  
  var matrix = document.getElementById("matrix");
  var matrix_ctx = matrix.getContext("2d");
  var mletters = "01"
  var font_size = 10;
  matrix_ctx.font = font_size + "px arial";
  matrix.height = window.innerHeight;
  matrix.width = window.innerWidth;
  var columns = Math.floor(matrix.width/font_size);
  var lines = matrix.height/font_size;
  var drops_reinit_threshold = 0.975; // lower value means more frequent reinit and therefore more drops
  var drops_y = Array(columns).fill(1);
  function draw()
  {
    matrix_ctx.fillStyle = "rgba(10, 10, 10, 0.04)"
    matrix_ctx.fillRect(0, 0, matrix.width, matrix.height);
    matrix_ctx.fillStyle = "#050"; // green text
    for(var i = 0; i drops_reinit_threshold)
        drops_y[i] = 0;
      drops_y[i]++;
    }
  }
  for(var x = 0; x 

Re: Matrix web-based green code rain, made with love

#18
post #16

For simple matrix-like effects, I use var matrix = document.getElementById("matrix"); var matrix_ctx = matrix.getContext("2d"); var mletters = "01" var font_size = 10; matrix_ctx.font = font_size + "px arial"; matrix.height = window.innerHeight; matrix.width = window.innerWidth; var columns = Math.floor(matrix.width/font_size); var lines = matrix.height/font_size; var drops_reinit_threshold = 0.975; // lower value me…

Very nice! Thanks for sharing.

Re: Matrix web-based green code rain, made with love

#20
post #16

For simple matrix-like effects, I use var matrix = document.getElementById("matrix"); var matrix_ctx = matrix.getContext("2d"); var mletters = "01" var font_size = 10; matrix_ctx.font = font_size + "px arial"; matrix.height = window.innerHeight; matrix.width = window.innerWidth; var columns = Math.floor(matrix.width/font_size); var lines = matrix.height/font_size; var drops_reinit_threshold = 0.975; // lower value me…

JSFiddle Preview of the code: https://jsfiddle.net/yLn41po0/
Post reply on HN