Skip to content
Dkarena
Dkarena

  • Home
  • Privacy Policy
  • Contact us
  • About Us
  • Disclaimer
Dkarena

Matrix animation code
December 15, 2022December 16, 2022

Matrix code

Html code|

<!DOCTYPE html>
<html lang=”en”>
<head>
    <meta charset=”UTF-8″>
    <meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
    <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
    <link rel=”stylesheet” href=”style.css”>
    <title>Matrix</title>
</head>
<body>
    <canvas id=”canvas1″></canvas>
    <script src=”index.js”></script>
</body>
</html>

JAVASCRIPT|

const canvas = document.getElementById(‘canvas1’)
const ctx = canvas.getContext(‘2d’)

canvas.width=window.innerWidth
canvas.height=window.innerHeight

let mouse ={
    x:null,
    y:null
}

let set=[“A”,”B”,”C”,”D”,”E”,”F”,”G”,”H”,”I”,”J”,”K”,”L”,”M”,”N”,”O”,”P”,”Q”,”R”,”S”,”T”,”U”,”V”,”W”,”X”,”Y”,”Z”,0, 1, 2, 3, 4, 5, 6, 7, 8, 9,’$’,’#’]
let dhaval=()=>{
    ctx.clearRect(0,0,canvas.width,canvas.height)
   
    ctx.fillStyle=’white’
    ctx.font=’10px arial’
    for(let i=0;i<canvas.width;i+=10)
    {
        for(let j=0;j<canvas.height;j+=10)
        {
            let r=Math.floor(Math.random()*255)
            let g=Math.floor(Math.random()*255)
            let b=Math.floor(Math.random()*255)
           
            ctx.fillStyle=`rgb(${r},${g},${b})`
            let rnd=Math.floor(Math.random()*38)
           
            ctx.fillText(set[rnd],i,j)
        }
    }
}
setInterval(dhaval,150)

css|

*{
    margin: 0;
}
#canvas1{
    background-color: black;
}
Coding Nursery animationMatrix

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How Sustainable Technology is Shaping a Greener Future for All
  • AI in healthcare: Faster diagnosis, better medicines and customized treatments
  • Nokia history | dkarena.in
  • history of Oneplus
  • Matrix code

Recent Comments

No comments to show.

Archives

  • October 2024
  • December 2022
  • November 2022

Categories

  • Coding Nursery
  • General Knowledge
  • History
  • Technology
©2025 Dkarena By Dhaval Kedaria our Other Site PCZone.in || shivam