一、html代码雨
效果图:
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code</title>
<style>
body{
margin: 0;
overflow: hidden;
}
</style>
</head>
<body>
<canvas id="myCanvas"></canvas>
<script>
const width = document.getElementById("myCanvas").width = screen.availWidth;
const height = document.getElementById("myCanvas").height = screen.availHeight;
const ctx = document.getElementById("myCanvas").getContext("2d");
const arr = Array(Math.ceil(width / 10)).fill(0);
const str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");
function rain() {
ctx.fillStyle = "rgba(0,0,0,0.05)";
ctx.fillRect(0, 0, width, height);
ctx.fillStyle = "#0f0";
arr.forEach(function (value, index) {
ctx.fillText(str[Math.floor(Math.random() * str.length)], index * 10, value + 10);
arr[index] = value >= height || value > 8888 * Math.random() ? 0 : value + 10;
});
}
setInterval(rain, 30);
</script>
</body>
</html>
二、vb代码雨
效果图:
代码
@echo off&mode con cols=42 lines=20&color 02
setlocal enabledelayedexpansion
set code=123456789abcdef
set m=1&set v=1
title 神秘小峯代码雨
:begin
set /a a=%random%%%2,b=%random%%%3
if %b% neq 0 (set b=%a%) else (set "b= ")
set str=%str%%b%
set /a n+=1
if %n% lss 40 goto begin nanjingachopard.patek-swissa.com
set /a m+=1,x+=1
if %m% geq 20 set /a v+=1
set str%m%=%str%
cls&for /l %%i in (%m%,-1,%v%) do echo.!str%%i!
if %x% equ 20 call :lp
set str=&set n=0
goto begin
:lp
set /a a=%random%%%15,x=0
set a=!code:~%a%,1!
color 0%a%
三、bat代码雨
效果图:
代码
@echo off&mode con cols=42 lines=20&color 02
set m=1&set v=1
set code==^^^&%%%^:!$#^>^<:=~*()@"'`;\|-_+?,.ghijklmnopqrstuvwxyz0123456789abcdef
setlocal enabledelayedexpansion
:begin
set /a num=%random%%%40+1,num1=num,num=200/num
title 乱雨纷飞,当前雨量:%num1%
:lp
set /a a=%random%%%63,b=%random%%%%num%
set a=!code:~%a%,1!
if %b% equ 0 (set "b=!a!") else (set "b= ")
set str%m%=!str%m%!!b!
set /a n+=1AA
if %n% lss 40 goto lp
set /a x+=1,w+=1
if %x% equ 40 call :lop
cls&for /l %%i in (%m%,-1,%v%) do echo.!str%%i!
set /a m+=1
if %m% geq 20 set /a v+=1
if %w% equ 100 (set w=0&goto begin) else (set n=0&goto lp)
:lop
set /a a=%random%%%15+1
set a=!code:~-%a%,1!
if %w% equ 100 (set w=0&goto begin) else (set n=0&goto lp)
:lop
set /a a=%random%%%15+1
set a=!code:~-%a%,1!
color 0!a!&set x=0
感谢你读到这里!