zoukankan      html  css  js  c++  java
  • Javsscript实现的黑客动画

    <!DOCTYPE html>
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>黑客动画</title>
    <style> 
        *{margin: 0; padding: 0;} body {background: black;} canvas {display: block;} 
    </style>
    </head>
    <body>
        <canvas id="ad"></canvas>
        <script> 
            var ad = document.getElementById("ad");
            var ctx = ad.getContext("2d");
            ad.height = window.innerHeight;
            ad.width = window.innerWidth;
            var chinese = "我是黑客";
            chinese = chinese.split("");
            var font_size = 10;
            var columns = ad.width / font_size;
            var drops = [];
            for (var x = 0; x < columns; x++) drops[x] = 1; function draw() {
                ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
                ctx.fillRect(0, 0, ad.width, ad.height);
                ctx.fillStyle = "#0F0";
                ctx.font = font_size + "px arial";
                for (var i = 0; i < drops.length; i++) {
                    var text = chinese[Math.floor(Math.random() * chinese.length)];
                    ctx.fillText(text, i * font_size, drops[i] * font_size);
                    if (drops[i] * font_size > ad.height && Math.random() > 0.975) 
                        drops[i] = 0; drops[i]++;
                }
            }
            setInterval(draw, 50); 
        </script>
    </body>
    </html>

  • 相关阅读:
    HTTP响应状态码
    跨域
    第一章-极限与函数
    离群点检测
    关联规则(初识)
    python分类预测模型的特点
    分类预测算法评价(初识)
    人工神经网络(初识)
    决策树(初识)
    挖掘建模
  • 原文地址:https://www.cnblogs.com/seeyoumiter/p/12483072.html
Copyright © 2011-2022 走看看