tnblog
首页
视频
资源
登录

代码雨

5397人阅读 2019/4/10 16:26 总访问:3467500 评论:2 收藏:1 手机
分类: 前端

喜欢的拿起去试一下嘛!

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. *{
  10. padding0;
  11. margin0;
  12. }
  13. /*#canvas{
  14.             display: block;
  15.             border: 1px solid black;
  16.             margin: 50px auto;
  17.              宽高在标签上设置 
  18.         }*/
  19. </style>
  20. </head>
  21. <body>
  22. <canvas id="canvas"></canvas>
  23. <script>
  24. document.body.parentNode.style.overflow = "hidden";
  25. var oCanvas = document.querySelector("#canvas"),
  26. // 获取一下canvas里面所有api(方法)
  27. oCtx = oCanvas.getContext("2d");
  28. //1获取可视区域的宽高 附值给画布
  29. var oWidth = window.innerWidth,
  30. oHeight = window.innerHeight;
  31. oCanvas.width = oWidth,
  32. oCanvas.height = oHeight;
  33. //2准备下落的字母
  34. var thischar = 'QWERTYUIOPASDFGHJKKLZXCVBNM';
  35. //3设置文字大小 
  36. var fontSize = 24;
  37. //4一行多少个
  38. var num = Math.floor(oWidth/fontSize);
  39. //用一个数组去存放字母的y坐标
  40. var drops =[];
  41. for (let index = 0; index < num; index++) {
  42. drops.push(0);
  43. }
  44. function draw({
  45. oCtx.fillStyle = "rgba(0,0,0,0.1)";
  46. //设置背景颜色
  47. oCtx.fillRect(0,0,oWidth,oHeight);
  48. oCtx.fillStyle="green";
  49. oCtx.font = fontSize+"px";
  50. //造字母
  51. for(var i = 0;i <num;i++){
  52. var oX = i*fontSize,
  53. oY = drops[i]*fontSize;
  54. //绘制坐标
  55. oCtx.fillText(thischar[Math.floor(Math.random()*thischar.length)],oX,oY);
  56. if (oY>oHeight&&Math.random()>0.95) {
  57. drops[i]=0;
  58. }
  59. drops[i]++;
  60. }
  61. }
  62. setInterval(() => {
  63. draw();
  64. }, 50); //每隔50毫秒 去执行一次 draw这个函数
  65. </script>
  66. </body>
  67. </html>
  68. <!-- 
  69.     基础
  70.        //线条开始的坐标(x,y)
  71.             // oCtx.moveTo(20,20);
  72.             // //线条终止的地方
  73.             // oCtx.lineTo(200,200);
  74.             // //
  75.             // oCtx.lineTo(400,20);
  76.             // oCtx.lineTo(20,20);
  77.             // //填充颜色
  78.             // oCtx.fillStyle="lightblue";
  79.             // oCtx.fill();
  80.             // //画到画布上去
  81.             // oCtx.stroke();
  82.  -->

下面是做的一个简单的登录页面,做得不是很好呀

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
  9. <style>
  10. *{
  11. padding0;
  12. margin0;
  13. font-family"montserrat",sans-serif;
  14. }
  15. /*#canvas{
  16.             display: block;
  17.             border: 1px solid black;
  18.             margin: 50px auto;
  19.              宽高在标签上设置 
  20.         }*/
  21. #mytoby {
  22. position: absolute;
  23. width350px;
  24. height400px;
  25. top50%;
  26. left50%;
  27. transformtranslate(-50%,-50%);
  28. background-colorrgb(73, 73, 66);
  29. opacity: .7;
  30. border-radius5px;
  31. }
  32. .mytoby-form{
  33. position: absolute;
  34. top50%;
  35. left50%;
  36. transformtranslate(-50%,-50%);
  37. text-align: center;
  38. }
  39. .mytoby-form h1{
  40. font-weight400;
  41. margin-top0;
  42. color: white;
  43. }
  44. .txtb{
  45. display: block;
  46. box-sizing: border-box;
  47. border1px solid white;
  48. width240px;
  49. padding10px;
  50. border-radius5px;
  51. text-align: center;
  52. margin10px auto;
  53. outline: none;
  54. }
  55. .txtsub{
  56. width240px;
  57. background-color#2c3e50;
  58. border0;
  59. color: white;
  60. padding10px;
  61. border-radius6px;
  62. cursor: pointer;
  63. transition1s;
  64. }
  65. .txtsub:hover{
  66. background-color: white;
  67. color#2c3e50;
  68. font-weight: bold;
  69. }
  70. .now-hr{
  71. border-bottom1px solid white;
  72. margin15px auto;
  73. }
  74. .then-other{
  75. display: block;
  76. box-sizing: border-box;
  77. position: relative;
  78. list-style-type: none;
  79. }
  80. .then-other li{
  81. display: inline-block;
  82. padding10px;
  83. }
  84. .then-other li a{
  85. color: white;
  86. text-decoration: none;
  87. transition1s;
  88. }
  89. .then-other li:hover{
  90. background-color: white;
  91. cursor: pointer;
  92. }
  93. .then-other li:hover a{
  94. color#2c3e50;
  95. }
  96. </style>
  97. </head>
  98. <body>
  99. <div id="mytoby">
  100. <form class="mytoby-form" action="index.html" method="post">
  101. <h1>WelCome</h1>
  102. <input class="txtb" type="password" placeholder="Username">
  103. <input class="txtb" type="password" placeholder="Password">
  104. <input class="txtsub" type="submit" value="Login">
  105. <p class="now-hr"></p>
  106. <ul class="then-other">
  107. <li><a href="index.html">无法验证?</a></li>
  108. <li><a href="index.html">忘记密码?</a></li>
  109. </ul>
  110. </form>
  111. </div>
  112. <canvas id="canvas"></canvas>
  113. <script>
  114. document.body.parentNode.style.overflow = "hidden";
  115. var oCanvas = document.querySelector("#canvas"),
  116. // 获取一下canvas里面所有api(方法)
  117. oCtx = oCanvas.getContext("2d");
  118. //1获取可视区域的宽高 附值给画布
  119. var oWidth = window.innerWidth,
  120. oHeight = window.innerHeight;
  121. oCanvas.width = oWidth,
  122. oCanvas.height = oHeight;
  123. //2准备下落的字母
  124. var thischar = 'QWERTYUIOPASDFGHJKKLZXCVBNM';
  125. //3设置文字大小 
  126. var fontSize = 24;
  127. //4一行多少个
  128. var num = Math.floor(oWidth/fontSize);
  129. //用一个数组去存放字母的y坐标
  130. var drops =[];
  131. for (let index = 0; index < num; index++) {
  132. drops.push(0);
  133. }
  134. function draw({
  135. oCtx.fillStyle = "rgba(0,0,0,0.1)";
  136. //设置背景颜色
  137. oCtx.fillRect(0,0,oWidth,oHeight);
  138. oCtx.fillStyle="green";
  139. oCtx.font = fontSize+"px";
  140. //造字母
  141. for(var i = 0;i <num;i++){
  142. var oX = i*fontSize,
  143. oY = drops[i]*fontSize;
  144. //绘制坐标
  145. oCtx.fillText(thischar[Math.floor(Math.random()*thischar.length)],oX,oY);
  146. if (oY>oHeight&&Math.random()>0.95) {
  147. drops[i]=0;
  148. }
  149. drops[i]++;
  150. }
  151. }
  152. setInterval(() => {
  153. draw();
  154. }, 50); //每隔50毫秒 去执行一次 draw这个函数
  155. </script>
  156. </body>
  157. </html>
  158. <!-- 
  159.     基础
  160.        //线条开始的坐标(x,y)
  161.             // oCtx.moveTo(20,20);
  162.             // //线条终止的地方
  163.             // oCtx.lineTo(200,200);
  164.             // //
  165.             // oCtx.lineTo(400,20);
  166.             // oCtx.lineTo(20,20);
  167.             // //填充颜色
  168.             // oCtx.fillStyle="lightblue";
  169.             // oCtx.fill();
  170.             // //画到画布上去
  171.             // oCtx.stroke();
  172.  -->



欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739

评价

是伍尚金哇_v

2020/7/8 16:28:43

秀儿

剑轩:@是伍尚金哇_v这个拿来整个啥音乐播放还可以

2020/7/8 19:39:59 回复

瑾语

2020/7/10 11:06:41

好看哎

这一世以无限游戏为使命!
排名
2
文章
634
粉丝
44
评论
93
docker中Sware集群与service
尘叶心繁 : 想学呀!我教你呀
一个bug让程序员走上法庭 索赔金额达400亿日元
叼着奶瓶逛酒吧 : 所以说做程序员也要懂点法律知识
.net core 塑形资源
剑轩 : 收藏收藏
映射AutoMapper
剑轩 : 好是好,这个对效率影响大不大哇,效率高不高
ASP.NET Core 服务注册生命周期
剑轩 : http://www.tnblog.net/aojiancc2/article/details/167
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术