style body width 300pt height 300pt border 1px solid blue style script src https cdnjs cloudflare com ajax libs p5 js 1 0 0 p5 min js script script var streams var fadeInterval 1 6 var symbolSize 14 function setup createCanvas window innerWidth window innerHeight background 0 let x 0 for let i 0 i width symbolSize i var stream new Stream stream generateSymbols x random 2000 0 streams push stream x symbolSize textFont Consolas textSize symbolSize end setup function draw background 0 150 streams forEach function stream stream render end draw function ESymbol x y speed first opacity this x x this y y this value this speed speed 0 2 this first first this opacity opacity this switchInterval round random 2 25 this setToRandomSymbol function var charType round random 0 5 if frameCount this switchInterval 0 if charType 1 set it to Katakana this value String fromCharCode 0x30A0 floor random 0 97 else set it to numeric this value floor random 0 10 end this setToRandomSymbol this rain function this y this y height 0 this y this speed end this rain end ESymbol function Stream this symbols this totalSymbols round random 5 35 this speed random 5 22 this generateSymbols function x y var opacity 255 var first round random 0 4 1 for var i 0 i this totalSymbols i symbol new ESymbol x y this speed first opacity symbol setToRandomSymbol this symbols push symbol opacity 255 this totalSymbols fadeInterval y symbolSize first false end this generateSymbols this render function this symbols forEach function symbol if symbol first fill 140 255 170 symbol opacity else fill 0 255 70 symbol opacity text symbol value symbol x symbol y symbol rain symbol setToRandomSymbol end this render end Stream script
else set it to numeric this value floor random 0 10 end this setToRandomSymbol this rain function this y this y height 0 this y this speed end this rain end ESymbol function Stream this symbols this totalSymbols round random 5 35 this speed random 5 22 this generateSymbols function x y var opacity 255 var first round random 0 4 1 for var i 0 i this totalSymbols i symbol new ESymbol x y this speed first opacity symbol setToRandomSymbol this symbols push symbol opacity 255 this totalSymbols fadeInterval y symbolSize first false end this generateSymbols this render function this symbols forEach function symbol if symbol first fill 140 255 170 symbol opacity else fill 0 255 70 symbol opacity text symbol value symbol x symbol y symbol rain symbol setToRandomSymbol end this render end Stream script