← 一覧へ

Dialog / 20 オーロラ|Aurora

デザイン見本

Aurora Dialog

色がゆっくりと変化・揺らぐ幻想的なダイアログです。

オーロラのように色がゆっくりと変化・揺らぐ背景を持つ幻想的なダイアログデザインです。背景に動的なグラデーションを配置し、さらにアニメーションで回転させることで美しい効果を生み出しています。

実装コード

HTML
<button id="dialog-btn-20">Aurora<br>Dialog</button>
<div id="dialog-20" class="dialog">
    <div class="dialog-content-20">
        <div class="aurora-header">
            <span>Aurora Dialog</span>
        </div>
        <div class="aurora-body">
            <p>色がゆっくりと変化・揺らぐ幻想的なダイアログです。</p>
        </div>
        <div class="aurora-footer">
            <button class="close-btn-20">Close</button>
        </div>
    </div>
</div>
CSS
#dialog-btn-20 {
    background: linear-gradient(45deg, #12c2e9, #c471ed, #f64f59);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.4s ease;
    min-width: 200px;
    min-height: 60px;
    display: block;
    margin: 0 auto;
    text-align: center;
    line-height: 1.4;
    vertical-align: middle;
    animation: auroraBg 5s ease infinite;
}
#dialog-btn-20:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(196, 113, 237, 0.4);
}
@keyframes auroraBg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#dialog-20 {
    display: none;
    position: fixed;
    z-index: 2147483647;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn-20 0.3s;
}

.dialog-content-20 {
    background: #1a1a2e;
    border-radius: 16px;
    width: 80%;
    max-width: 450px;
    margin: 10% auto;
    position: relative;
    padding: 30px;
    text-align: center;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    animation: popIn-20 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dialog-content-20::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(18,194,233,0.3) 0%, rgba(196,113,237,0.3) 30%, rgba(246,79,89,0) 70%);
    z-index: 0;
    pointer-events: none;
    animation: spinAurora 15s linear infinite;
    filter: blur(20px);
}

@keyframes spinAurora {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.aurora-header,
.aurora-body,
.aurora-footer {
    position: relative;
    z-index: 1;
}

.aurora-header {
    margin-bottom: 20px;
}
.aurora-header span {
    font-size: 22px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.aurora-body p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #e0e0e0;
}

.close-btn-20 {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 30px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}
.close-btn-20:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

@keyframes fadeIn-20 {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes popIn-20 {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@media (max-width: 768px) {
    .dialog-content-20 { width: 90%; padding: 20px; }
}
JS
(function () {
    var btn = document.getElementById('dialog-btn-20');
    var dialog = document.getElementById('dialog-20');
    var closeBtns = dialog.querySelectorAll('.close-btn-20');

    if (!btn || !dialog) return;

    function openDialog() {
        dialog.style.display = 'block';
        document.body.style.overflow = 'hidden';
    }

    function closeDialog() {
        dialog.style.display = 'none';
        document.body.style.overflow = 'auto';
    }

    btn.addEventListener('click', openDialog);
    
    closeBtns.forEach(function(b) { b.addEventListener('click', closeDialog); });

    dialog.addEventListener('click', function (e) {
        if (e.target === dialog) {
            closeDialog();
        }
    });

    document.addEventListener('keydown', function (e) {
        if (e.key === 'Escape' && dialog.style.display === 'block') {
            closeDialog();
        }
    });
})();