0
Matrix rain code
My question is in matrix rain code the letters are falling down how can these letters can keep in sequence form
3 odpowiedzi
+ 1
Can you please show us your attempt so we can assist you ?
0
It is easy, you will create like an array on the screen and the text is not show to people. Then you can show the text at array[i++] in every frame
0
I done in html,this is my code <html>
<head>
<title>Matrix Rain</title>
<style>
* {margin: 0; padding: 0;}
body {background: black;}
canvas {display: block;}
</style>
</head>
<body>
<canvas id="c"></canvas>
</body>
<script>
var c = document.getElementById("c");
var ctx = c.getContext("2d");
//making the canvas full screen
c.height = window.innerHeight;
c.width = window.innerWidth;
//english characters
var english = "10010101011101ysgj1010101010010101000gyjjfd101011101111010101010110101010101010101110000101";
//converting the string into an array of single characters
english = english.split("");
var font_size = 15;
var columns = c.width/font_size; //number of columns for the rain
//an array of drops - one per column
var drops = [];
//x below is the x coordinate
//1 = y co-ordinate of the drop(same for every drop initially)
for(var x = 0; x < columns; x++)
drops[x] = 1;
//drawing the characters
function draw()
{
//Black BG fo