• 炫酷HTML蜘蛛侠登录页面


    全篇使用HTML、CSS、JavaScript,建议有过基础的进行阅读。 

    一、预览图

    二、HTML代码

    1. 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. <title>蜘蛛侠登录界面title>
    7. <link rel="stylesheet" href="styles.css">
    8. head>
    9. <body>
    10. <div class="center-container">
    11. <div class="login-container">
    12. <div class="spiderman-logo">
    13. <img src="logo.png" alt="Spider-Man Logo">
    14. div>
    15. <h2>欢迎回家h2>
    16. <form class="login-form">
    17. <div class="input-group">
    18. <label for="username">用户名label>
    19. <input type="text" id="username" placeholder="输入你的用户名">
    20. div>
    21. <div class="input-group">
    22. <label for="password">密码label>
    23. <input type="password" id="password" placeholder="输入你的密码">
    24. div>
    25. <button type="submit">登录button>
    26. form>
    27. div>
    28. div>
    29. <canvas id="spider-web">canvas>
    30. <script src="script.js">script>
    31. body>
    32. html>

    三、CSS代码

    1. * {
    2. margin: 0;
    3. padding: 0;
    4. box-sizing: border-box;
    5. }
    6. body {
    7. font-family: Arial, sans-serif;
    8. background-color: #0A0A2A;
    9. display: flex;
    10. justify-content: center;
    11. align-items: center;
    12. height: 100vh;
    13. overflow: hidden;
    14. position: relative;
    15. color: white;
    16. }
    17. .center-container {
    18. display: flex;
    19. justify-content: center;
    20. align-items: center;
    21. z-index: 2;
    22. position: relative;
    23. }
    24. .login-container {
    25. background: linear-gradient(145deg, #c8102e, #0a0a2a);
    26. padding: 40px;
    27. border-radius: 15px;
    28. box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    29. text-align: center;
    30. width: 300px;
    31. z-index: 2;
    32. }
    33. .spiderman-logo img {
    34. width: 50px;
    35. height: 60px;
    36. margin-bottom: 5px;
    37. }
    38. /* Form styles */
    39. .login-form {
    40. display: flex;
    41. flex-direction: column;
    42. }
    43. .input-group {
    44. margin-bottom: 20px;
    45. }
    46. .input-group label {
    47. margin-bottom: 8px;
    48. font-size: 14px;
    49. float: left;
    50. }
    51. .input-group input {
    52. width: 100%;
    53. padding: 10px;
    54. border: none;
    55. border-radius: 5px;
    56. background-color: #ffffff;
    57. color: black;
    58. font-size: 16px;
    59. }
    60. button {
    61. padding: 10px 20px;
    62. border: none;
    63. background-color: #ff4c4c;
    64. color: white;
    65. font-size: 18px;
    66. border-radius: 5px;
    67. cursor: pointer;
    68. transition: background-color 0.3s ease;
    69. }
    70. button:hover {
    71. background-color: #ff1c1c;
    72. }
    73. #spider-web {
    74. position: absolute;
    75. top: 50%;
    76. left: 50%;
    77. transform: translate(-50%, -50%);
    78. z-index: 1;
    79. width: 100vw;
    80. height: 100vh;
    81. }

    四、JavaScript代码

    1. const canvas = document.getElementById('spider-web');
    2. const ctx = canvas.getContext('2d');
    3. canvas.width = window.innerWidth;
    4. canvas.height = window.innerHeight;
    5. function drawWeb() {
    6. const centerX = canvas.width / 2;
    7. const centerY = canvas.height / 2;
    8. const radiusStep = 30;
    9. const radialStep = 10;
    10. const rings = 10;
    11. const lines = 12;
    12. for (let i = 1; i <= rings; i++) {
    13. ctx.beginPath();
    14. ctx.arc(centerX, centerY, radiusStep * i, 0, Math.PI * 2);
    15. ctx.strokeStyle = 'white';
    16. ctx.lineWidth = 1;
    17. ctx.stroke();
    18. }
    19. for (let i = 0; i < lines; i++) {
    20. const angle = (i / lines) * Math.PI * 2;
    21. const x = centerX + Math.cos(angle) * radiusStep * rings;
    22. const y = centerY + Math.sin(angle) * radiusStep * rings;
    23. ctx.beginPath();
    24. ctx.moveTo(centerX, centerY);
    25. ctx.lineTo(x, y);
    26. ctx.strokeStyle = 'white';
    27. ctx.lineWidth = 1;
    28. ctx.stroke();
    29. }
    30. for (let i = 1; i < rings; i++) {
    31. for (let j = 0; j < lines; j++) {
    32. const angle1 = (j / lines) * Math.PI * 2;
    33. const angle2 = ((j + 1) / lines) * Math.PI * 2;
    34. const x1 = centerX + Math.cos(angle1) * radiusStep * i;
    35. const y1 = centerY + Math.sin(angle1) * radiusStep * i;
    36. const x2 = centerX + Math.cos(angle2) * radiusStep * i;
    37. const y2 = centerY + Math.sin(angle2) * radiusStep * i;
    38. ctx.beginPath();
    39. ctx.moveTo(x1, y1);
    40. ctx.lineTo(x2, y2);
    41. ctx.strokeStyle = 'white';
    42. ctx.lineWidth = 1;
    43. ctx.stroke();
    44. }
    45. }
    46. }
    47. drawWeb();

  • 相关阅读:
    CrownCAD 2023发布的背后,国产软件如何破局突围?
    TypeScript接口与泛型的使用
    电脑如何查看是否支持虚拟化及如何开启虚拟化
    欧拉角(Euler Angle)
    PP洗气瓶:耐用、安全、高效 —— 您的气体采样理想伙伴
    flutter 应用 抓包
    【c++】信号处理--signal、raise、sigaction的介绍
    尚硅谷Vue
    tomcat出现中文乱码原因和解决办法(简单快捷易懂)
    java 工程管理系统源码+项目说明+功能描述+前后端分离 + 二次开发
  • 原文地址:https://blog.csdn.net/bjjgff/article/details/142255345