首页 > web前端 > js教程 > 正文

使用 css 和 html5 对按钮动画幻觉的霓虹灯效果

DDD
发布: 2024-12-06 18:42:11
转载
564人浏览过

使用 css 和 html5 对按钮动画幻觉的霓虹灯效果

AppMall应用商店
AppMall应用商店

AI应用商店,提供即时交付、按需付费的人工智能应用服务

AppMall应用商店 56
查看详情 AppMall应用商店
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>illusionistic 3d neon button</title>
  <link rel="stylesheet" href="2.css">
</head>
<body>
  <div class="button-container">
    <button class="neon-button">click me</button>
  </div>
</body>
</html>

登录后复制
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: black;
  overflow: hidden;
  font-family: "Courier New", monospace;
  position: relative;
  color: white;
}

/* Binary code background */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.5));
  z-index: 0;
  pointer-events: none;
  mask: repeating-linear-gradient(
    0deg,
    transparent 0%,
    transparent 20%,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.1) 40%
  );
  animation: binaryMove 5s linear infinite;
}

@keyframes binaryMove {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 100%;
  }
}

.button-container {
  position: relative;
  z-index: 1;
}

.neon-button {
  padding: 20px 60px;
  font-size: 1.5rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 0 30px rgba(255, 0, 255, 0.5);
  overflow: hidden;
  transition: all 0.3s ease;
}

.neon-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ff00ff, #00ffff);
  filter: blur(15px);
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.neon-button:hover {
  transform: translateY(-5px) rotate(2deg);
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.7), 0 0 60px rgba(255, 0, 255, 0.7);
}

.neon-button:hover::before {
  opacity: 1;
  filter: blur(25px);
}

.neon-button:active {
  transform: translateY(3px);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.9), 0 0 20px rgba(255, 0, 255, 0.9);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: ripple-animation 1s linear infinite;
}

@keyframes ripple-animation {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(10);
    opacity: 0;
  }
}

.neon-button:active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff00ff, #00ffff);
  opacity: 0.4;
  filter: blur(10px);
  animation: ripple-animation 0.8s linear;
}

登录后复制

以上就是使用 css 和 html5 对按钮动画幻觉的霓虹灯效果的详细内容,更多请关注php中文网其它相关文章!

相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:dev.to网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号