+ 8

How to make a Js Matrix?

I am not a Js animation master, so I want to see examples of some Js matrixes!

11th Oct 2018, 1:34 AM
Potato Hacker
Potato Hacker - avatar
3 odpowiedzi
+ 6
I can’t really understand your answer, but I’ll try to answer it. A matrix is really a 2-dimensional array: it has got a width, and a height. To create one in JS, just do this: var width = 10; // You can change the width var height = 10; // Same here var matrix = new Array(height); // Creates a normal array for(i = 0; i < height; i++) { // For loop which goes from 0 to height matrix[i] = new Array(width); // In that spot in the array, make a new array there } // End for loop Now to access the data, do matrix[column][row] to get the data. Hope that helps!
11th Oct 2018, 4:58 AM
Rowsej
Rowsej - avatar
+ 4
This code has: 1) Create matrix function. 2) Show matrix function. 3) Basic matrix operations such as: addition, subtraction and multiplication. 4) Links for linear algebra & matrix multiplication. https://code.sololearn.com/WWGaqlmrb42n/?ref=app
11th Oct 2018, 11:16 AM
Haris
Haris - avatar
+ 1
To create Matrix Effect using HTML5 and JavaScript,I used HTML5 canvas functions ... I am using JavaScript Math.random() to do the same. var matrix = []; for(var i=0; i<9; i++) { matrix[i] = []; for(var j=0; j<9; j++) { matrix[i][j] = undefined; } } https://crbtech.in/java-training/top-java-developer-training-and-placement-in-pune/
12th Oct 2018, 4:37 AM
meenal deshpande