当前位置:首页 > 网站应用

字符乱码特效

cjw1232年前 (2024-10-15)网站应用4030
<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
        <title>字符乱码特效</title>
 </head>
 <style>
  * {
   margin: 0;
   padding: 0;
  }

  body {
   overflow: hidden;
  }
 </style>
 <body>
  <canvas id="canvas" width="1280" height="1024"> 您的浏览器不支持canvas标签,请您更换浏览器 </canvas>
 </body>
 <script>
  var canvas = document.getElementById("canvas");
  var can = canvas.getContext("2d");
  var s = window.screen;
  var w = canvas.width = s.width;
  var h = canvas.height = s.height;

  can.fillStyle = color2();

  var words = Array(256).join("1").split("");

  setInterval(draw, 50);

  function draw() {
   can.fillStyle = 'rgba(0,0,0,0.05)';
   can.fillRect(0, 0, w, h);
   can.fillStyle = color2();
   words.map(function(y, n) {
    text = String.fromCharCode(Math.ceil(65 + Math.random() * 57));
    x = n * 10;
    can.fillText(text, x, y)
    words[n] = (y > 758 + Math.random() * 484 ? 0 : y + 10);
   });
  }

  function color1() {
   var colors = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f'];
   var color = "";
   for (var i = 0; i < 6; i++) {
    var n = Math.ceil(Math.random() * 15);
    color += "" + colors[n];
   }
   return '#' + color;
  }

  function color2() {
   var color = Math.ceil(Math.random() * 16777215).toString(16);
   while (color.length < 6) {
    color = '0' + color;
   }
   return '#' + color;
  }

  function color3() {
   return "#" + (function(color) {
    return new Array(7 - color.length).join("0") + color;
   })((Math.random() * 0x1000000 << 0).toString(16))
  }
 </script>
</html>


扫描二维码推送至手机访问。

版权声明:本文由追求完美发布,如需转载请注明出处。

本文链接:https://cjw123.com/blog/?id=127

标签: htmlcss
分享给朋友:

相关文章

html meta标签屏蔽搜索引擎的用法

html页面中的 meta 标签可以用来识别搜索引擎的蜘蛛类型,可以规定meta标签所在的html页面是否被蜘蛛抓取,下面是这个meta标签的用法,大家可以借鉴一下。搜索引擎的 meta 标签的解析下面是meta标签对搜索引擎的解析<meta name='robot…

css3实现不断旋转动画加载,并弹性布局显示

<style> body{ background:#34495e; display:flex; justify-content:center; align-items:center; height:100vh; } .loading{ position:relative…

js实现批量生成18位身份证号码

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title&g…

纯CSS实现菜单炫酷点击展开收起效果

通过纯css3实现展开收缩的弹性动画菜单,可以应用于PC端或移动端页面中,非常实用效果也非常的炫酷,喜欢的码友们可以尝试一下,效果如下:完整代码如下:<!doctype html><html><head><meta charset=&qu…

分享一些可用的网站生成图片接口地址(网站截图api接口)

做导航网站时,处于设计需要及提高用户体验,可能需要给网站截图以调用显示,这就需要把网站生成图片,手动操作可以使用截图工具,或是使用谷歌浏览器开发者工具命令screenshot来生成网站截图,也可使用一些在线网站生成图片的工具,这些都可以把网站生成图片,那么如何自动为网站生成图片?网址截图api接口又…

网站js防扒代码-禁止右键/F12/调试自动关闭窗口

非常暴力。宣称可以禁用所有一切可以进入开发者工具的方法,防止通过开发者工具进行的 "代码搬运"1.效果演示演示站以及原文地址:https://theajack.github.io/disable-devtool/说明:此法较为非常j狠。宣称可以禁用所有一切可以进入开发者工具的方法…

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。