zoukankan      html  css  js  c++  java
  • 美观大气的纯JS做出黑客帝国特效 初学前端进来看

    美观大气的纯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>

    【WEB前端互动交流群04】群号617986737,web前端的公益学习交流平台,保你快速入门,海量学习资料免费送,保你快速入门,每周定期有公开直播课,有业内大咖为你授业解惑,海量真实项目案例分享,从零到大神的成功之路,从你相信我开始!!!

  • 相关阅读:
    JavaScript Json对象和Json对象字符串的关系 jsonObj<->JsonString
    VS2012 MVC4 学习笔记-概览
    java中运算符的解析和计算
    Python基本数据类型之tuple
    Python基本数据类型之list
    Python基本数据类型之str
    Python基本数据类型之int
    range和xrange梳理
    python编码
    ubuntu下的ssh
  • 原文地址:https://www.cnblogs.com/xsns/p/6844730.html
Copyright © 2011-2022 走看看