Files
worker/html/vr360-viewer-section.html
2025-10-24 11:31:48 +07:00

425 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nhà mẫu 360° - EuroTile Worker</title>
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* VR360 Container Styles */
.vr360-section {
background: var(--white);
padding: 16px;
margin: 8px 0;
}
.vr360-container {
position: relative;
width: 100%;
border-radius: 16px;
overflow: hidden;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
box-shadow: var(--shadow-medium);
}
/* Option 1: Click to View Style */
.vr360-preview {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 24px;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
color: var(--white);
position: relative;
background: linear-gradient(135deg, rgba(0, 91, 154, 0.9) 0%, rgba(56, 182, 255, 0.9) 100%);
}
.vr360-preview:hover {
transform: scale(1.02);
box-shadow: 0 10px 30px rgba(0, 91, 154, 0.3);
}
.vr360-icon-wrapper {
position: relative;
width: 80px;
height: 80px;
margin-bottom: 16px;
}
.vr360-icon {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
position: relative;
}
.vr360-icon::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
border: 3px solid rgba(255, 255, 255, 0.4);
border-radius: 50%;
animation: pulse360 2s infinite;
}
.vr360-icon::after {
content: '';
position: absolute;
width: 120%;
height: 120%;
border: 2px solid rgba(255, 255, 255, 0.2);
border-radius: 50%;
animation: pulse360 2s infinite 0.5s;
}
.vr360-icon .main-icon {
font-size: 36px;
color: var(--white);
z-index: 1;
position: relative;
}
.vr360-arrow {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 120px;
height: 120px;
pointer-events: none;
}
.vr360-arrow svg {
width: 100%;
height: 100%;
animation: rotate360 4s linear infinite;
}
.vr360-title {
font-size: 24px;
font-weight: 700;
color: var(--white);
margin-bottom: 8px;
text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.vr360-subtitle {
font-size: 14px;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 16px;
}
.vr360-button {
padding: 12px 32px;
background: var(--white);
color: var(--primary-blue);
border-radius: 24px;
font-size: 14px;
font-weight: 600;
display: inline-flex;
align-items: center;
gap: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
transition: all 0.3s ease;
}
.vr360-preview:hover .vr360-button {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
/* Option 2: Embedded iFrame Style */
.vr360-embed {
position: relative;
width: 100%;
padding-bottom: 75%; /* 4:3 Aspect Ratio */
background: var(--background-gray);
border-radius: 16px;
overflow: hidden;
}
.vr360-iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
border-radius: 16px;
}
.vr360-loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: var(--text-light);
}
.vr360-loading .spinner {
width: 40px;
height: 40px;
border: 3px solid var(--border-color);
border-top-color: var(--primary-blue);
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 12px;
}
/* Toggle Switch for View Options */
.view-options {
display: flex;
justify-content: center;
gap: 12px;
margin-bottom: 16px;
}
.view-option-btn {
padding: 8px 16px;
background: var(--white);
border: 1px solid var(--border-color);
border-radius: 20px;
font-size: 13px;
font-weight: 500;
color: var(--text-dark);
cursor: pointer;
transition: all 0.3s ease;
}
.view-option-btn.active {
background: var(--primary-blue);
color: var(--white);
border-color: var(--primary-blue);
}
/* Animations */
@keyframes pulse360 {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.3);
opacity: 0.5;
}
100% {
transform: scale(1.6);
opacity: 0;
}
}
@keyframes rotate360 {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Fullscreen Button */
.vr360-fullscreen-btn {
position: absolute;
top: 16px;
right: 16px;
width: 40px;
height: 40px;
background: rgba(0, 0, 0, 0.7);
color: var(--white);
border: none;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
transition: all 0.3s ease;
}
.vr360-fullscreen-btn:hover {
background: rgba(0, 0, 0, 0.9);
transform: scale(1.1);
}
</style>
</head>
<body>
<div class="page-wrapper">
<!-- Header -->
<div class="header">
<a href="index.html" class="back-button">
<i class="fas fa-arrow-left"></i>
</a>
<h1 class="header-title">Nhà mẫu 360°</h1>
</div>
<div class="container">
<!-- View Options Toggle -->
<div class="view-options">
<button class="view-option-btn active" onclick="showPreview()">
<i class="fas fa-image"></i> Xem trước
</button>
<button class="view-option-btn" onclick="showEmbed()">
<i class="fas fa-play"></i> Xem trực tiếp
</button>
</div>
<!-- VR360 Section -->
<div class="vr360-section">
<!-- Option 1: Preview with Link -->
<div id="previewMode" class="vr360-container">
<a href="https://vr.house3d.com/web/panorama-player/H00179549"
target="_blank"
class="vr360-preview">
<div class="vr360-icon-wrapper">
<div class="vr360-icon">
<span class="main-icon">360°</span>
</div>
<div class="vr360-arrow">
<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
<circle cx="60" cy="60" r="50" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="2" stroke-dasharray="10 5"/>
<path d="M 60 15 L 65 20 M 65 20 L 60 25" stroke="rgba(255,255,255,0.8)" stroke-width="2" fill="none" stroke-linecap="round"/>
</svg>
</div>
</div>
<h2 class="vr360-title">360°</h2>
<p class="vr360-subtitle">Khám phá không gian nhà mẫu toàn cảnh</p>
<div class="vr360-button">
<i class="fas fa-external-link-alt"></i>
<span>Mở chế độ xem 360°</span>
</div>
</a>
</div>
<!-- Option 2: Embedded iFrame (Hidden by default) -->
<div id="embedMode" class="vr360-container" style="display: none;">
<div class="vr360-embed">
<div class="vr360-loading" id="loadingState">
<div class="spinner"></div>
<span>Đang tải mô hình 360°...</span>
</div>
<iframe
id="vr360iframe"
class="vr360-iframe"
src=""
title="Mô hình 360° Nhà mẫu"
allowfullscreen
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
onload="hideLoading()"
style="display: none;">
</iframe>
<button class="vr360-fullscreen-btn" onclick="goFullscreen()">
<i class="fas fa-expand"></i>
</button>
</div>
</div>
</div>
<!-- Additional Info -->
<div class="card">
<h3 class="card-title">Về nhà mẫu này</h3>
<p style="color: var(--text-light); font-size: 14px; line-height: 1.6;">
Trải nghiệm không gian sống hiện đại với công nghệ xem 360°.
Di chuyển chuột hoặc vuốt màn hình để khám phá mọi góc nhìn của căn nhà.
</p>
<ul style="padding-left: 20px; margin-top: 12px;">
<li style="color: var(--text-light); font-size: 14px; margin-bottom: 8px;">
<i class="fas fa-mouse" style="color: var(--primary-blue); margin-right: 8px;"></i>
Kéo chuột để xoay góc nhìn
</li>
<li style="color: var(--text-light); font-size: 14px; margin-bottom: 8px;">
<i class="fas fa-search-plus" style="color: var(--primary-blue); margin-right: 8px;"></i>
Scroll để zoom in/out
</li>
<li style="color: var(--text-light); font-size: 14px;">
<i class="fas fa-hand-point-up" style="color: var(--primary-blue); margin-right: 8px;"></i>
Click vào các điểm nóng để di chuyển
</li>
</ul>
</div>
</div>
</div>
<script>
const VR360_URL = "https://vr.house3d.com/web/panorama-player/H00179549";
// Show preview mode
function showPreview() {
document.getElementById('previewMode').style.display = 'block';
document.getElementById('embedMode').style.display = 'none';
// Update buttons
document.querySelectorAll('.view-option-btn').forEach(btn => {
btn.classList.remove('active');
});
event.target.classList.add('active');
// Clear iframe src to stop loading
document.getElementById('vr360iframe').src = '';
}
// Show embedded mode
function showEmbed() {
document.getElementById('previewMode').style.display = 'none';
document.getElementById('embedMode').style.display = 'block';
// Update buttons
document.querySelectorAll('.view-option-btn').forEach(btn => {
btn.classList.remove('active');
});
event.target.classList.add('active');
// Load iframe
const iframe = document.getElementById('vr360iframe');
if (!iframe.src) {
iframe.src = VR360_URL;
}
}
// Hide loading state when iframe loads
function hideLoading() {
document.getElementById('loadingState').style.display = 'none';
document.getElementById('vr360iframe').style.display = 'block';
}
// Fullscreen function
function goFullscreen() {
const container = document.getElementById('embedMode');
if (container.requestFullscreen) {
container.requestFullscreen();
} else if (container.webkitRequestFullscreen) {
container.webkitRequestFullscreen();
} else if (container.mozRequestFullScreen) {
container.mozRequestFullScreen();
} else if (container.msRequestFullscreen) {
container.msRequestFullscreen();
}
}
// Optional: Auto-load embed after delay
// setTimeout(() => {
// if (window.innerWidth > 768) {
// showEmbed();
// }
// }, 2000);
</script>
</body>
</html>