Dialog / 26 ゲーミングデバイス|Gaming Device
デザイン見本
Gaming Device Dialog
RGBグラデーションが外縁を回転して光るダイアログです。
ゲーミングPCやゲーミングキーボードをイメージし、レインボーカラーのRGBグラデーションが要素の縁をくるくると回転して光るサイバーなデザインです。`conic-gradient`を使っています。
実装コード
HTML
<button id="dialog-btn-26"><span>Gaming Device<br>Dialog</span></button>
<div id="dialog-26" class="dialog">
<div class="dialog-content-26">
<div class="gaming-inner">
<div class="gaming-header">
<span>Gaming Device Dialog</span>
</div>
<div class="gaming-body">
<p>RGBグラデーションが外縁を回転して光るダイアログです。</p>
</div>
<div class="gaming-footer">
<button class="close-btn-26">Close</button>
</div>
</div>
</div>
</div>
CSS
#dialog-btn-26 {
background-color: #1a1a2e;
color: #fff;
border: none;
padding: 4px;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
font-weight: 700;
position: relative;
z-index: 1;
overflow: hidden;
min-width: 200px;
min-height: 60px;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
}
#dialog-btn-26::before {
content: '';
position: absolute;
top: -50%; left: -50%; width: 200%; height: 200%;
background: conic-gradient(from 0deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
z-index: -2;
animation: rotateGradient-26 4s linear infinite;
}
#dialog-btn-26::after {
content: '';
position: absolute;
top: 3px; left: 3px; right: 3px; bottom: 3px;
background-color: #151525;
z-index: -1;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.3s;
}
#dialog-btn-26:hover::after {
background-color: #1f1f3a;
}
#dialog-btn-26:hover {
color: #00ffd5;
}
@keyframes rotateGradient-26 {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#dialog-26 {
display: none;
position: fixed;
z-index: 2147483647;
left: 0; top: 0; width: 100%; height: 100%;
background-color: rgba(5, 5, 10, 0.85);
animation: fadeIn-26 0.3s;
}
.dialog-content-26 {
width: 80%;
max-width: 500px;
margin: 10% auto;
position: relative;
padding: 4px;
border-radius: 12px;
overflow: hidden;
z-index: 1;
box-shadow: 0 10px 40px rgba(0,255,213,0.2);
animation: popIn-26 0.4s ease-out;
}
.dialog-content-26::before {
content: '';
position: absolute;
top: -50%; left: -50%; width: 200%; height: 200%;
background: conic-gradient(from 0deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
z-index: -2;
animation: rotateGradient-26 4s linear infinite;
}
.gaming-inner {
background: #0f0f1a;
border-radius: 8px;
z-index: -1;
padding: 25px;
text-align: center;
color: #fff;
}
.gaming-header {
margin-bottom: 20px;
}
.gaming-header span {
font-size: 22px;
font-weight: 800;
text-shadow: 0 0 10px rgba(0, 255, 213, 0.6);
letter-spacing: 1px;
}
.gaming-body p {
font-size: 15px;
line-height: 1.6;
margin-bottom: 30px;
color: #a0a0b0;
}
.gaming-footer {
display: flex;
justify-content: center;
}
.close-btn-26 {
background: transparent;
color: #00ffd5;
border: 1px solid #00ffd5;
padding: 8px 30px;
border-radius: 4px;
cursor: pointer;
font-size: 15px;
font-weight: bold;
text-transform: uppercase;
transition: all 0.3s;
box-shadow: 0 0 5px rgba(0,255,213,0.3);
}
.close-btn-26:hover {
background: #00ffd5;
color: #000;
box-shadow: 0 0 15px rgba(0,255,213,0.8);
}
@keyframes fadeIn-26 {
from { opacity: 0; } to { opacity: 1; }
}
@keyframes popIn-26 {
from { transform: scale(0.8); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
@media (max-width: 768px) {
.dialog-content-26 { width: 90%; }
}
JS
(function () {
var btn = document.getElementById('dialog-btn-26');
var dialog = document.getElementById('dialog-26');
var closeBtns = dialog.querySelectorAll('.close-btn-26');
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();
}
});
})();