|
|

楼主 |
发表于 2022-9-2 13:19
|
显示全部楼层
代码:
- <style>
- #mama { margin: 50px auto 0; width: 400px; height: 400px; border: 1px solid #ccc; overflow: hidden; position: relative; }
- .borderLine { position: absolute; animation: flow 4s var(--delay) linear infinite; }
- .bl1 { --xx: 200%; --yy: 0%; --delay: 0s; width: 100%; height: 4px; left: -100%; top: 0; background: linear-gradient(to right, red, tan, gold,olive, tomato); }
- .bl2 { --xx: 0%; --yy: 200%; --delay: 2s; width: 4px; height: 100%; right: 0; top: -100%; background: linear-gradient(to top, red, tan, gold,olive, tomato); }
- .bl3 { --xx: -200%; --yy: 0%; --delay: 4s; width: 100%; height: 4px; right: -100%; bottom: 0; background: linear-gradient(to left, red, tan, gold,olive, tomato); }
- .bl4 { --xx: 0%; --yy: -200%; --delay: 6s; width: 4px; height: 100%; left: 0; bottom: -100%; background: linear-gradient(to bottom, red, tan, gold,olive, tomato); }
- @keyframes flow { to { transform: translate(var(--xx), var(--yy)); } }
- </style>
- <div id="mama">
- <span class="borderLine bl1"></span>
- <span class="borderLine bl2"></span>
- <span class="borderLine bl3"></span>
- <span class="borderLine bl4"></span>
- </div>
复制代码
|
|