css3实现登录框动画特效效果

今日实现个登录框的动画效果,记录一下和大家分享😊~

希望对大家也有所帮助,共同成长进步💪~

如果大家喜欢,可以点赞或留言💕~~~~,谢谢大家⭐️⭐️⭐️~~~

展示效果图

Html部分

html 复制代码
    <div id="login_box">
      <div class="login-container">
        <span class="login-right-warp-one"></span>
        <span class="login-right-warp-two"></span>
        <span class="login-right-warp-main">框动画效果</span>
      </div>
    </div>

Css部分

css 复制代码
    * {
        margin: 0;
        padding: 0;
        /* font-size: 16px; */
        font-size: 10px;
        /* background-color: rgb(189, 188, 188); */
      }
      html,
      body {
        width: 100%;
        height: 100%;
        /* background-color: pink; */
        margin: 0 auto;
      }
      :root {
        --el-color-primary: #4da197;
        --el-color-primary-light: #4da197;
        --el-color-white: #ffffff;
      }
      @keyframes loginLeft {
        0% {
          left: -100%;
        }
        50%,
        100% {
          left: 100%;
        }
      }
      @keyframes loginTop {
        0% {
          top: -100%;
        }
        50%,
        100% {
          top: 100%;
        }
      }
      @keyframes loginRight {
        0% {
          right: -100%;
        }
        50%,
        100% {
          right: 100%;
        }
      }
      @keyframes loginBottom {
        0% {
          bottom: -100%;
        }
        50%,
        100% {
          bottom: 100%;
        }
      }
      .login-container {
        width: 500px;
        height: 500px;
        border-radius: 3px;
        border: 1px solid var(--el-color-primary-light);
        position: relative;
        overflow: hidden;
        background-color: var(--el-color-white);
        margin: 0 auto;
      }
      .login-right-warp-one,
      .login-right-warp-two {
        position: absolute;
        display: block;
        width: inherit;
        height: inherit;
        &::before,
        &::after {
          content: "";
          position: absolute;
          z-index: 1;
        }
      }
      .login-right-warp-one {
        &::before {
          filter: hue-rotate(0deg);
          top: 0;
          left: 0;
          width: 100%;
          height: 3px;
          background: linear-gradient(
            90deg,
            transparent,
            var(--el-color-primary)
          );
          animation: loginLeft 3s linear infinite;
        }
        &::after {
          filter: hue-rotate(60deg);
          top: -100%;
          right: 0px;
          width: 3px;
          height: 100%;
          background: linear-gradient(
            180deg,
            transparent,
            var(--el-color-primary)
          );
          animation: loginTop 3s linear infinite;
          animation-delay: 0.7s;
        }
      }
      .login-right-warp-two {
        &::before {
          filter: hue-rotate(120deg);
          bottom: 0px;
          right: -100%;
          width: 100%;
          height: 3px;
          background: linear-gradient(
            270deg,
            transparent,
            var(--el-color-primary)
          );
          animation: loginRight 3s linear infinite;
          animation-delay: 1.4s;
        }
        &::after {
          filter: hue-rotate(300deg);
          bottom: -100%;
          left: 0px;
          width: 3px;
          height: 100%;
          background: linear-gradient(
            360deg,
            transparent,
            var(--el-color-primary)
          );
          animation: loginBottom 3s linear infinite;
          animation-delay: 2.1s;
        }
      }
      .login-right-warp-main {
        display: flex;
        flex-direction: column;
        height: 100%;
        justify-content: center;
        align-items: center;
      }

最后感谢大家阅读⭐️⭐️⭐️,如果文章对你有帮助,喜欢可以点赞或留言哟💕💕💕

相关推荐
冬奇Lab6 分钟前
每日一个开源项目(第137篇):Penpot - 真正开源的设计协作工具,SVG 原生格式消灭设计-开发鸿沟
前端·开源·设计
nuIl23 分钟前
实现一个 Coding Agent(7):Skills
前端·agent·cursor
nuIl28 分钟前
实现一个 Coding Agent(8):会话持久化与多会话
前端·agent·cursor
jt君424262 小时前
React Native JSI 深入剖析 — 第 5 部分中文技术整理:用 HostObject 把 C++ 类暴露给 JavaScript
前端·react native
胡萝卜术2 小时前
滑动窗口最大值:从暴力到单调队列,层层优化全解析
前端·javascript·面试
fluffyox2 小时前
Notion 的公式栏里,藏着一台虚拟机——逆向 + 用 600 行 JS 复刻它的编译器与栈式 VM
前端
kyriewen3 小时前
2026 年了,这 6 个 npm 包可以卸载了——浏览器原生 API 已经能替代
前端·javascript·npm
Csvn5 小时前
Monorepo 迁移血泪史:从 Multi-Repo 到 Turborepo,这 3 个坑我帮你踩完了
前端
星栈6 小时前
Dioxus 多页面怎么做:`dioxus-router`、嵌套路由、`Outlet` 和页面组织,一篇给你讲顺
前端·rust·前端框架
用户987409238876 小时前
用 Remotion + edge-tts 打造中文教学视频全自动流水线
前端