js黑客中毒的效果

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

</head>

<body>

<canvas id="content" width="1250px" height="602px"></canvas>

</body>

</html>

<script>

    var cav = document.getElementById('content');

    var w = window.screen.width;

    var h = window.screen.height;

    var yPositions = Array(300).join(0).split('');

    var ctx = cav.getContext('2d');

    var draw = function(){



        ctx.fillStyle = 'rgba(0,0,0,.05)';

        ctx.fillRect(0,0,w,h);

        ctx.fillStyle = 'green';

        ctx.font = '20px';



        yPositions.map(function(y,index){

            text = String.fromCharCode(1e2+Math.random()*330);

            x = index*10;

            cav.getContext('2d').fillText(text,x,y);

            if(y>Math.random()*1e4){

                yPositions[index]=0;

            }else{

                yPositions[index]=y+10;

            }

        });



    }

    setInterval('draw()',30);

</script>
上一篇:js点击按钮,自动复制到粘贴板


下一篇:Linux 下Shell脚本回滚删除数据