Spaces:
Running

ar-2 / index.html
Mkdm1's picture
<!DOCTYPE html> <html lang="ar"> <head> <meta charset="UTF-8"> <title>AR Studio Maker Pro</title> <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> <script src="https://cdn.rawgit.com/jeromeetienne/ar.js/2.1.8/aframe/build/aframe-ar.min.js"></script> <style> body { font-family: sans-serif; max-width: 800px; margin: auto; padding: 20px; } input, button, select { display: block; margin: 10px 0; padding: 8px; width: 100%; box-sizing: border-box; } button { cursor: pointer; background: #007BFF; color: white; border: none; } iframe { border: 1px solid #ccc; margin-top: 20px; width: 100%; height: 500px; } </style> </head> <body> <h1>🎬 AR Studio Maker Pro</h1> <p>صمّم تجربة AR مخصصة (فيديو، صورة) وشوفها فورًا، أو نزّلها.</p> <label>اختر نوع الماركر:</label> <select id="markerType"> <option value="hiro">Hiro (ماركر افتراضي)</option> <option value="custom">ماركر مخصص (رفع صورة)</option> </select> <input type="file" id="markerFile" accept="image/*" style="display: none;"/> <label>اختر فيديو أو صورة:</label> <input type="file" id="mediaFile" accept="video/mp4,image/*"/> <button id="generateBtn">✔️ أنشئ تجربة AR</button> <button id="downloadBtn" style="display:none;">⬇️ حمل كملف HTML</button> <iframe id="preview"></iframe> <script> const markerType = document.getElementById('markerType'); const markerFile = document.getElementById('markerFile'); const mediaFile = document.getElementById('mediaFile'); const generateBtn = document.getElementById('generateBtn'); const downloadBtn = document.getElementById('downloadBtn'); const preview = document.getElementById('preview'); markerType.addEventListener('change', () => { markerFile.style.display = markerType.value === 'custom' ? 'block' : 'none'; }); generateBtn.addEventListener('click', () => { const media = mediaFile.files[0]; if (!media) return alert('يرجى رفع فيديو أو صورة أولًا'); let markerHTML = markerType.value === 'hiro' ? `<a-marker preset="hiro">` : `<a-marker type="pattern" url="${URL.createObjectURL(markerFile.files[0])}">`; const isVideo = media.type.startsWith('video'); const mediaTag = isVideo ? `<a-video src="${URL.createObjectURL(media)}" width="1.5" height="1" autoplay loop muted></a-video>` : `<a-image src="${URL.createObjectURL(media)}" width="1" height="1"></a-image>`; const arCode = ` <!DOCTYPE html> <html lang="ar"><head><meta charset="utf-8"> <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> <script src="https://cdn.rawgit.com/jeromeetienne/ar.js/2.1.8/aframe/build/aframe-ar.min.js"></script> </head><body style="margin:0;overflow:hidden"> <a-scene embedded arjs> ${markerHTML} ${mediaTag} </a-marker> <a-entity camera></a-entity> </a-scene> </body></html>`; const blob = new Blob([arCode], { type: 'text/html' }); const url = URL.createObjectURL(blob); preview.src = url; downloadBtn.href = url; downloadBtn.download = 'ar-experience.html'; downloadBtn.style.display = 'block'; }); </script> </body> </html> - Initial Deployment
e95ee17 verified
Raw History Blame Contribute Delete
12.3 kB
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AR Studio Maker Pro | استوديو الواقع المعزز</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/ar.js/2.1.8/aframe/build/aframe-ar.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');
body {
font-family: 'Tajawal', sans-serif;
}
.file-input {
opacity: 0;
width: 0.1px;
height: 0.1px;
position: absolute;
}
.file-input-label {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 24px;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
}
.file-input-label:hover {
transform: translateY(-2px);
}
.preview-container {
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
border-radius: 16px;
overflow: hidden;
transition: all 0.3s ease;
}
.preview-container:hover {
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.gradient-bg {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.btn-gradient {
background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
}
.btn-gradient:hover {
background: linear-gradient(to right, #00f2fe 0%, #4facfe 100%);
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="gradient-bg text-white py-8 shadow-lg">
<div class="container mx-auto px-4">
<div class="flex flex-col items-center text-center">
<div class="flex items-center mb-4">
<i class="fas fa-vr-cardboard text-4xl mr-3"></i>
<h1 class="text-3xl md:text-4xl font-bold">AR Studio Maker Pro</h1>
</div>
<p class="text-lg md:text-xl max-w-2xl opacity-90">
صمّم تجربة الواقع المعزز الخاصة بك في دقائق معدودة. اختر الماركر ووسائطك وشاهد النتيجة فورًا!
</p>
</div>
</div>
</div>
<div class="container mx-auto px-4 py-12">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<!-- Form Section -->
<div class="bg-white rounded-xl shadow-md p-6 lg:p-8">
<h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-3 flex items-center">
<i class="fas fa-cogs mr-3 text-blue-500"></i>
إعدادات التجربة
</h2>
<div class="space-y-6">
<!-- Marker Type Selection -->
<div>
<label class="block text-gray-700 font-medium mb-2">
<i class="fas fa-qrcode mr-2 text-blue-500"></i>
نوع الماركر
</label>
<select id="markerType" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition">
<option value="hiro">Hiro (ماركر افتراضي)</option>
<option value="custom">ماركر مخصص</option>
</select>
</div>
<!-- Custom Marker Upload (hidden by default) -->
<div id="customMarkerContainer" class="hidden">
<label class="block text-gray-700 font-medium mb-2">
<i class="fas fa-image mr-2 text-blue-500"></i>
رفع صورة الماركر المخصص
</label>
<input type="file" id="markerFile" accept="image/*" class="file-input">
<label for="markerFile" class="file-input-label bg-gray-100 text-gray-700 border border-gray-300 hover:bg-gray-200">
<i class="fas fa-upload"></i>
اختر ملف الماركر
</label>
<p id="markerFileName" class="text-sm text-gray-500 mt-2"></p>
</div>
<!-- Media Upload -->
<div>
<label class="block text-gray-700 font-medium mb-2">
<i class="fas fa-photo-video mr-2 text-blue-500"></i>
الوسائط (فيديو أو صورة)
</label>
<input type="file" id="mediaFile" accept="video/mp4,image/*" class="file-input">
<label for="mediaFile" class="file-input-label bg-gray-100 text-gray-700 border border-gray-300 hover:bg-gray-200">
<i class="fas fa-cloud-upload-alt"></i>
اختر ملف الوسائط
</label>
<p id="mediaFileName" class="text-sm text-gray-500 mt-2"></p>
</div>
<!-- Buttons -->
<div class="flex flex-col sm:flex-row gap-4 pt-4">
<button id="generateBtn" class="btn-gradient text-white font-bold py-3 px-6 rounded-lg shadow-md hover:shadow-lg transition flex-1 flex items-center justify-center">
<i class="fas fa-magic mr-2"></i>
أنشئ تجربة AR
</button>
<button id="downloadBtn" class="hidden bg-green-500 hover:bg-green-600 text-white font-bold py-3 px-6 rounded-lg shadow-md hover:shadow-lg transition flex-1 flex items-center justify-center">
<i class="fas fa-download mr-2"></i>
حمل التجربة
</button>
</div>
</div>
</div>
<!-- Preview Section -->
<div class="bg-white rounded-xl shadow-md p-6 lg:p-8">
<h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-3 flex items-center">
<i class="fas fa-eye mr-3 text-blue-500"></i>
معاينة مباشرة
</h2>
<div class="preview-container bg-gray-100">
<div id="previewPlaceholder" class="flex flex-col items-center justify-center p-8 text-center text-gray-500 h-96">
<i class="fas fa-cube text-5xl mb-4 text-gray-300"></i>
<h3 class="text-xl font-medium mb-2">لا توجد معاينة متاحة</h3>
<p class="max-w-xs">بعد اختيار الماركر والوسائط، اضغط على "أنشئ تجربة AR" لرؤية النتيجة هنا</p>
</div>
<iframe id="preview" class="w-full h-96 hidden"></iframe>
</div>
<div id="instructions" class="mt-6 bg-blue-50 border border-blue-200 rounded-lg p-4 hidden">
<h3 class="font-bold text-blue-800 mb-2 flex items-center">
<i class="fas fa-info-circle mr-2"></i>
تعليمات الاستخدام
</h3>
<ol class="list-decimal list-inside space-y-2 text-blue-700">
<li>اطبع الماركر على ورقة بيضاء</li>
<li>افتح التجربة على هاتفك الذكي</li>
<li>وجه الكاميرا نحو الماركر</li>
<li>استمتع بتجربة الواقع المعزز!</li>
</ol>
</div>
</div>
</div>
</div>
<footer class="bg-gray-800 text-white py-6">
<div class="container mx-auto px-4 text-center">
<p>AR Studio Maker Pro &copy; 2023 | صنع بكل ❤️ لمحبي التقنية</p>
<div class="flex justify-center space-x-4 mt-4">
<a href="#" class="hover:text-blue-300"><i class="fab fa-twitter"></i></a>
<a href="#" class="hover:text-blue-300"><i class="fab fa-github"></i></a>
<a href="#" class="hover:text-blue-300"><i class="fab fa-linkedin"></i></a>
</div>
</div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const markerType = document.getElementById('markerType');
const customMarkerContainer = document.getElementById('customMarkerContainer');
const markerFile = document.getElementById('markerFile');
const markerFileName = document.getElementById('markerFileName');
const mediaFile = document.getElementById('mediaFile');
const mediaFileName = document.getElementById('mediaFileName');
const generateBtn = document.getElementById('generateBtn');
const downloadBtn = document.getElementById('downloadBtn');
const preview = document.getElementById('preview');
const previewPlaceholder = document.getElementById('previewPlaceholder');
const instructions = document.getElementById('instructions');
// Toggle custom marker upload field
markerType.addEventListener('change', () => {
if (markerType.value === 'custom') {
customMarkerContainer.classList.remove('hidden');
} else {
customMarkerContainer.classList.add('hidden');
}
});
// Display selected marker file name
markerFile.addEventListener('change', function() {
if (this.files.length > 0) {
markerFileName.textContent = `تم اختيار: ${this.files[0].name}`;
} else {
markerFileName.textContent = '';
}
});
// Display selected media file name
mediaFile.addEventListener('change', function() {
if (this.files.length > 0) {
mediaFileName.textContent = `تم اختيار: ${this.files[0].name}`;
} else {
mediaFileName.textContent = '';
}
});
// Generate AR experience
generateBtn.addEventListener('click', () => {
const media = mediaFile.files[0];
if (!media) {
showAlert('يرجى رفع فيديو أو صورة أولًا', 'error');
return;
}
if (markerType.value === 'custom' && !markerFile.files[0]) {
showAlert('يرجى رفع صورة الماركر المخصص أولًا', 'error');
return;
}
generateBtn.disabled = true;
generateBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> جاري الإنشاء...';
setTimeout(() => {
createARExperience();
generateBtn.disabled = false;
generateBtn.innerHTML = '<i class="fas fa-magic mr-2"></i> أنشئ تجربة AR';
}, 500);
});
function createARExperience() {
const media = mediaFile.files[0];
const isVideo = media.type.startsWith('video');
let markerHTML = '';
if (markerType.value === 'hiro') {
markerHTML = `<a-marker preset="hiro">`;
} else {
markerHTML = `<a-marker type="pattern" url="${URL.createObjectURL(markerFile.files[0])}">`;
}
const mediaTag = isVideo
? `<a-video src="${URL.createObjectURL(media)}" width="1.5" height="1" autoplay loop muted></a-video>`
: `<a-image src="${URL.createObjectURL(media)}" width="1" height="1"></a-image>`;
const arCode = `<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="utf-8">
<title>تجربة الواقع المعزز</title>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/ar.js/2.1.8/aframe/build/aframe-ar.min.js"></script>
<style>
body { margin: 0; overflow: hidden; }
a-scene { width: 100vw; height: 100vh; }
</style>
</head>
<body>
<a-scene embedded arjs='sourceType: webcam;'>
${markerHTML}
${mediaTag}
</a-marker>
<a-entity camera></a-entity>
</a-scene>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Mkdm1/ar-2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>