← 一覧へ

Dialog / 29 ウェーブ/波紋|Wave Ripple

デザイン見本

Wave Dialog

開いた瞬間に背景に波紋が広がるようなエフェクトが特徴です。

開くボタンのホバー時や、ダイアログそのものが展開されるタイミングで、水面に広がる波紋(リップル)のようなエフェクトを発生させるアニメーションデザインです。動きが柔らかく、シームレスな体験を作ります。

実装コード

HTML
<button id="dialog-btn-29">Wave Ripple<br>Dialog</button>
<div id="dialog-29" class="dialog">
    <div class="dialog-content-29">
        <div class="wave-header">
            <span>Wave Dialog</span>
        </div>
        <div class="wave-body">
            <p>開いた瞬間に背景に波紋が広がるようなエフェクトが特徴です。</p>
        </div>
        <div class="wave-footer">
            <button class="close-btn-29">Cancel</button>
            <button class="close-btn-29 primary">Confirm</button>
        </div>
    </div>
</div>
CSS
#dialog-btn-29 {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    min-width: 200px;
    min-height: 60px;
    display: block;
    margin: 0 auto;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: background 0.3s;
    z-index: 1;
}
#dialog-btn-29::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease-out, height 0.4s ease-out;
    z-index: -1;
}
#dialog-btn-29:hover::after {
    width: 300px; height: 300px;
}
#dialog-btn-29:active::after {
    background: rgba(255,255,255,0.6);
    transition: 0s;
}

#dialog-29 {
    display: none;
    position: fixed;
    z-index: 2147483647;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 123, 255, 0.4);
    animation: fadeInBg-29 0.4s;
    overflow: hidden;
}

.dialog-content-29 {
    background: #fff;
    border-radius: 24px;
    width: 80%;
    max-width: 450px;
    margin: 10% auto;
    position: relative;
    padding: 35px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    z-index: 10;
    animation: slideUpScale-29 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

#dialog-29::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: rippleBg-29 1s ease-out forwards;
    z-index: 1;
    pointer-events: none;
}

.wave-header {
    margin-bottom: 20px;
}
.wave-header span {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}
.wave-body p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #666;
}

.wave-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.close-btn-29 {
    background: #f1f1f1;
    color: #555;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
}
.close-btn-29.primary {
    background: #007bff;
    color: #fff;
}
.close-btn-29:hover {
    background: #e2e2e2;
}
.close-btn-29.primary:hover {
    background: #0056b3;
    box-shadow: 0 5px 15px rgba(0,123,255,0.4);
}

@keyframes fadeInBg-29 {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUpScale-29 {
    0% { transform: translateY(50px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes rippleBg-29 {
    0% { width: 0; height: 0; opacity: 1; }
    100% { width: 200vw; height: 200vw; opacity: 0; }
}
@media (max-width: 768px) {
    .dialog-content-29 { width: 90%; padding: 25px 20px; }
}
JS
(function () {
    var btn = document.getElementById('dialog-btn-29');
    var dialog = document.getElementById('dialog-29');
    var closeBtns = dialog.querySelectorAll('.close-btn-29');

    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();
        }
    });
})();