Origami Popup
A geometric popup inspired by origami paper folding.
HTML
<div class="container">
<div id="popup-container">
<button id="popup-btn">Origami</button>
</div>
<div id="popup" class="popup">
<div class="popup-content">
<p>Origami Popup</p>
<p>A geometric popup inspired by origami paper folding.</p>
</div>
</div>
</div>
CSS
#popup-btn {
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:hover {
opacity: 0.5;
}
.popup {
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.active {
opacity: 1;
visibility: visible;
bottom: 20px;
transform: translateX(-50%);
animation: popupShowHide 3.4s ease forwards;
}
@keyframes popupShowHide {
0% {
opacity: 0;
transform: translateX(-50%) translateY(100%) scale(0.5) rotate(45deg);
}
20% {
opacity: 1;
transform: translateX(-50%) translateY(0) scale(1.1) rotate(0deg);
}
30% {
transform: translateX(-50%) translateY(0) scale(1) rotate(0deg);
}
80% {
opacity: 1;
transform: translateX(-50%) translateY(0) scale(1) rotate(0deg);
}
100% {
opacity: 0;
transform: translateX(-50%) translateY(100%) scale(0.5) rotate(-45deg);
}
}
.popup-content {
background: linear-gradient(135deg, #ff9ff3 0%, #f368e0 50%, #ff6b6b 100%);
padding: 50px;
border-radius: 0;
text-align: center;
position: relative;
min-width: 320px;
clip-path: polygon(0 0, 90% 0, 100% 10%, 100% 100%, 10% 100%, 0 90%);
box-shadow:
0 10px 30px rgba(0,0,0,0.3),
0 0 0 1px rgba(255,255,255,0.2);
animation: origamiFold 0.7s ease-out;
transform-origin: center;
}
@keyframes origamiFold {
0% {
opacity: 0;
transform: scale(0.5) rotate(45deg);
clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%);
}
50% {
clip-path: polygon(25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 25%, 25% 25%);
}
100% {
opacity: 1;
transform: scale(1) rotate(0deg);
clip-path: polygon(0 0, 90% 0, 100% 10%, 100% 100%, 10% 100%, 0 90%);
}
}
.popup-content::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
animation: origamiShine 3s ease-in-out infinite;
}
@keyframes origamiShine {
0%, 100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
.popup-content p:first-child {
font-size: 30px;
font-weight: bold;
margin-bottom: 25px;
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
font-family: 'Arial', sans-serif;
text-align: center;
transform: skew(-2deg);
}
.popup-content p:last-of-type {
font-size: 16px;
color: white;
margin-bottom: 0;
line-height: 1.7;
font-weight: 500;
text-align: center;
text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
@media (max-width: 768px) {
.popup-content {
padding: 30px;
min-width: 300px;
}
.popup-content p:first-child {
font-size: 24px;
}
.popup-content p:last-of-type {
font-size: 14px;
}
#popup-btn {
padding: 10px 20px;
font-size: 14px;
}
}
@media (max-width: 480px) {
.popup-content {
padding: 25px;
min-width: 280px;
}
.popup-content p:first-child {
font-size: 22px;
}
.popup-content p:last-of-type {
font-size: 13px;
}
#popup-btn {
padding: 8px 16px;
font-size: 13px;
}
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
const button = document.getElementById('popup-btn');
const popup = document.getElementById('popup');
if (button && popup) {
button.addEventListener('click', function() {
popup.classList.add('active');
});
// アニメーション終了後にポップアップを閉じる
popup.addEventListener('animationend', function() {
popup.classList.remove('active');
});
}
});