← 一覧へ

Popup / 08 3D|3D

デザイン見本

CSSの transform 3D プロパティを駆使し、立体的な動き表現したポップアップです。出現時の回転アニメーションと、常に浮遊し続ける演出が目を引きます。

実装コード

HTML
<div id="popup-container-8">
  <button id="popup-btn-8">3D</button>
</div>
<div id="popup-8" class="popup-8">
  <div class="popup-content-8">
    <p>3D Popup</p>
    <p>3Dエフェクトと遠近法を使った立体的なポップアップです。</p>
  </div>
</div>
CSS
/* Button Style */
#popup-btn-8 {
  cursor: pointer;
  border: none;
  padding: 12px 24px;
  border-radius: 16px;
  color: #333;
  background-color: #eee;
  font-weight: 600;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  display: block;
  margin: 0 auto;
  width: 180px;
}

#popup-btn-8:hover {
  opacity: 0.5;
}

/* Popup Style */
.popup-8 {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  max-width: 90%;
  max-height: 90%;
}

.popup-8.active {
  opacity: 1;
  visibility: visible;
  bottom: 20px;
  transform: translateX(-50%);
  animation: popupShowHide8 3.4s ease forwards;
}

@keyframes popupShowHide8 {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(100%) rotateX(-15deg) rotateY(-5deg);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotateX(0deg) rotateY(0deg);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) rotateX(0deg) rotateY(0deg);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(100%) rotateX(15deg) rotateY(5deg);
  }
}

.popup-content-8 {
  background: linear-gradient(145deg, #f8f9fa, #ffffff);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  position: relative;
  min-width: 300px;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.3),
    0 15px 30px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform-style: preserve-3d;
  perspective: 1000px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  animation: float3D 3s ease-in-out infinite;
}

@keyframes float3D {
  0%, 100% {
    transform: translateY(0px) rotateX(0deg) rotateY(0deg);
  }
  50% {
    transform: translateY(-8px) rotateX(2deg) rotateY(1deg);
  }
}

.popup-content-8::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

.popup-content-8 p:first-child {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #2196f3;
  text-shadow: 0 2px 4px rgba(33, 150, 243, 0.2);
  transform: translateZ(10px);
}

.popup-content-8 p:last-of-type {
  font-size: 16px;
  color: #555;
  margin-bottom: 25px;
  line-height: 1.7;
  font-weight: 500;
  transform: translateZ(5px);
}
JS
var btn = document.getElementById('popup-btn-8');
var popup = document.getElementById('popup-8');

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

  popup.addEventListener('animationend', function () {
    popup.classList.remove('active');
  });
}