← 一覧へ

Popup / 28 ゲーミングデバイス|Gaming Device

デザイン見本

ゲーミングPCやデバイス特有のRGBライティングをCSSだけで表現。conic-gradientを擬似要素にして回転させることで、光が枠を流れるようなサイバーな演出を作り出しています。

実装コード

HTML
<div id="popup-container-28">
    <button id="popup-btn-28">Gaming Device</button>
</div>
<div id="popup-28" class="popup-28">
    <div class="popup-content-28">
        <div class="inner-content">
            <p>Gaming Device Popup</p>
            <p>RGBに光る枠線を持つゲーミングPC風のポップアップです。</p>
        </div>
    </div>
</div>
CSS
#popup-btn-28 {
    cursor: pointer;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    display: block;
    margin: 0 auto;
    width: 180px;
    color: #fff; 
    background-color: #1a1a2e;
    position: relative;
    z-index: 1;
    overflow: hidden;
}
#popup-btn-28::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    z-index: -2;
    background-size: 400%;
    animation: glowingBorder 20s linear infinite;
    border-radius: 10px;
}
#popup-btn-28::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    background-color: #1a1a2e;
    z-index: -1;
    border-radius: 6px;
}
@keyframes glowingBorder {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}
#popup-btn-28:hover {
    color: #00ffd5;
}
.popup-28 {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90%;
}
.popup-28.active {
    opacity: 1;
    visibility: visible;
    bottom: 30px;
    transform: translateX(-50%);
    animation: popupShowHide28 3.4s ease forwards;
}
@keyframes popupShowHide28 {
    0% { opacity: 0; transform: translateX(-50%) translateY(100%); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(100%); }
}
.popup-content-28 {
    background: #0f0f1a;
    padding: 3px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    min-width: 320px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    z-index: 1;
    overflow: hidden;
}
.popup-content-28::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: conic-gradient(from 0deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    animation: rotateGradient 4s linear infinite;
    z-index: -2;
}
.popup-content-28::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px; bottom: 3px;
    background: #151525;
    z-index: -1;
    border-radius: 9px;
}
@keyframes rotateGradient {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.popup-content-28 .inner-content {
    background: transparent;
    padding: 30px 40px;
    position: relative;
    z-index: 2;
}
.popup-content-28 p:first-child {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 255, 213, 0.8), 0 0 20px rgba(0, 255, 213, 0.4);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.popup-content-28 p:last-of-type {
    font-size: 15px;
    color: #a0a0b0;
    margin-bottom: 0;
    line-height: 1.6;
}
JS
var btn = document.getElementById('popup-btn-28');
var popup = document.getElementById('popup-28');

if (btn && popup) {
  btn.addEventListener('click', function () {
    popup.classList.add('active');
  });

  popup.addEventListener('animationend', function (e) {
    if (e.animationName.startsWith('popupShowHide')) {
      popup.classList.remove('active');
    }
  });
}