← 一覧へ

Popup / 27 クレイモーフィズム|Claymorphism

デザイン見本

内側に向かうインナーシャドウを利用して、マシュマロや粘土のような柔らかな膨らみを持たせたデザイン。親しみやすさや可愛さを重要視するUIにおすすめです。

実装コード

HTML
<div id="popup-container-27">
    <button id="popup-btn-27">Claymorphism</button>
</div>
<div id="popup-27" class="popup-27">
    <div class="popup-content-27">
        <p>Claymorphism Popup</p>
        <p>粘土のようにふっくらとした3D感とパステルカラーのポップアップです。</p>
    </div>
</div>
CSS
#popup-btn-27 {
    cursor: pointer;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    display: block;
    margin: 0 auto;
    width: 180px;
    color: #4a5568; 
    background-color: #fcebd5;
    box-shadow: 
        8px 8px 16px rgba(220, 200, 170, 0.6), 
        -8px -8px 16px rgba(255, 255, 255, 1), 
        inset 4px 4px 10px rgba(255, 255, 255, 0.8), 
        inset -4px -4px 10px rgba(220, 200, 170, 0.3);
    transition: all 0.2s ease;
}
#popup-btn-27:hover {
    transform: scale(1.02);
}
#popup-btn-27:active {
    transform: scale(0.98);
}
.popup-27 {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90%;
}
.popup-27.active {
    opacity: 1;
    visibility: visible;
    bottom: 30px;
    transform: translateX(-50%);
    animation: popupShowHide27 3.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes popupShowHide27 {
    0% { opacity: 0; transform: translateX(-50%) translateY(50px) scale(0.8); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.05); }
    25% { transform: translateX(-50%) translateY(0) scale(1); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(50px) scale(0.8); }
}
.popup-content-27 {
    background: #fcebd5;
    padding: 35px 40px;
    border-radius: 40px;
    text-align: center;
    min-width: 320px;
    box-shadow: 
        15px 15px 30px rgba(220, 200, 170, 0.6), 
        -15px -15px 30px rgba(255, 255, 255, 1), 
        inset 8px 8px 20px rgba(255, 255, 255, 0.9), 
        inset -8px -8px 20px rgba(220, 200, 170, 0.4);
}
.popup-content-27 p:first-child {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 15px;
    color: #ff9a9e;
    text-shadow: 2px 2px 4px rgba(255, 154, 158, 0.2);
}
.popup-content-27 p:last-of-type {
    font-size: 16px;
    color: #8c7b6f;
    margin-bottom: 0;
    line-height: 1.6;
    font-weight: 500;
}
JS
var btn = document.getElementById('popup-btn-27');
var popup = document.getElementById('popup-27');

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