/*
* @title matrix
* @javascript_url
* @description my bookmarklet
* @include http://*
* @license MIT License
* @require
*/
// original: https://github.com/MinhasKamal/CreepyCodeCollection/blob/master/matrix_effect.html
(function() {
let q = document.createElement('canvas');
document.body.appendChild(q);
let s=window.screen;
let w=q.width=s.width;
let h=q.height=document.body.scrollHeight;
let p=Array(256).join(1).split('');
let c=q.getContext("2d");
let m=Math;
// q.style.height = `${document.body.scrollHeight}px`;
q.style.position = 'absolute';
q.style.top = q.style.left = '0';
q.style.zIndex = '99999';
let opacity = 0;
let inc = true;
setInterval(() => {
c.fillStyle="rgba(0,0,0,0.05)";
c.fillRect(0,0,w,h);
c.fillStyle="rgba(0,255,0,1)";
if (inc) {
opacity += 10;
q.style.opacity = `${opacity/100}`;
if (opacity >= 100) {
inc = false;
}
} else {
opacity -= 10;
q.style.opacity = `${opacity/100}`;
if (opacity <= 0) {
inc = true;
}
}
p=p.map((v,i) => {
let r=m.random();
c.fillText(String.fromCharCode(m.floor(2720+r*33)),i*10,v);
v+=10;
return v>768+r*1e4?0:v
})
},33);
}())