Changes to arview.scroll.pub

root
root
25 days ago
Initial commit
body.html
Changed around line 1
+
+

AR View

+

Experience Augmented Reality directly in your mobile browser

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

How It Works

+
    +
  1. Allow camera access when prompted
  2. +
  3. Point your camera at a flat surface
  4. +
  5. Watch as virtual objects appear in your space
  6. +
    +
    +
    +
    +
    +

    Bringing augmented reality to your fingertips

    +
    index.scroll
    Changed around line 1
    + buildHtml
    + baseUrl https://arview.scroll.pub
    + metaTags
    + editButton /edit.html
    + title AR View - Augmented Reality for Mobile
    + style.css
    + body.html
    + script.js
    readme.scroll
    Changed around line 1
    + # arview.scroll.pub
    + Website generated by DeepSeek from prompt: I want a website where it able to do augmented reality that compatible with mobile phone where it use the camera as input
    script.js
    Changed around line 1
    + const video = document.getElementById('camera');
    + const canvas = document.getElementById('ar-canvas');
    + const startButton = document.getElementById('start-ar');
    + const stopButton = document.getElementById('stop-ar');
    + const ctx = canvas.getContext('2d');
    +
    + let isARActive = false;
    +
    + async function startAR() {
    + try {
    + const stream = await navigator.mediaDevices.getUserMedia({ video: true });
    + video.srcObject = stream;
    + isARActive = true;
    + startButton.disabled = true;
    + stopButton.disabled = false;
    + requestAnimationFrame(renderAR);
    + } catch (error) {
    + alert('Error accessing camera. Please ensure you have granted permission.');
    + console.error('Camera access error:', error);
    + }
    + }
    +
    + function stopAR() {
    + const stream = video.srcObject;
    + if (stream) {
    + stream.getTracks().forEach(track => track.stop());
    + }
    + video.srcObject = null;
    + isARActive = false;
    + startButton.disabled = false;
    + stopButton.disabled = true;
    + }
    +
    + function renderAR() {
    + if (!isARActive) return;
    +
    + canvas.width = video.videoWidth;
    + canvas.height = video.videoHeight;
    +
    + // Draw camera feed
    + ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
    +
    + // Add AR elements
    + ctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
    + ctx.fillRect(
    + canvas.width / 2 - 50,
    + canvas.height / 2 - 50,
    + 100,
    + 100
    + );
    +
    + requestAnimationFrame(renderAR);
    + }
    +
    + startButton.addEventListener('click', startAR);
    + stopButton.addEventListener('click', stopAR);
    +
    + // Handle window resize
    + window.addEventListener('resize', () => {
    + if (isARActive) {
    + canvas.width = video.videoWidth;
    + canvas.height = video.videoHeight;
    + }
    + });
    style.css
    Changed around line 1
    + :root {
    + --primary-color: #4a90e2;
    + --secondary-color: #333;
    + --bg-color: #f5f5f5;
    + --text-color: #333;
    + --button-bg: var(--primary-color);
    + --button-text: white;
    + }
    +
    + * {
    + margin: 0;
    + padding: 0;
    + box-sizing: border-box;
    + }
    +
    + body {
    + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    + line-height: 1.6;
    + color: var(--text-color);
    + background-color: var(--bg-color);
    + min-height: 100vh;
    + display: flex;
    + flex-direction: column;
    + }
    +
    + header {
    + background: var(--primary-color);
    + color: white;
    + padding: 2rem;
    + text-align: center;
    + }
    +
    + header h1 {
    + font-size: 2.5rem;
    + margin-bottom: 0.5rem;
    + }
    +
    + .ar-container {
    + max-width: 800px;
    + margin: 2rem auto;
    + padding: 1rem;
    + background: white;
    + border-radius: 8px;
    + box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    + }
    +
    + .camera-feed {
    + position: relative;
    + width: 100%;
    + padding-top: 56.25%;
    + background: black;
    + border-radius: 8px;
    + overflow: hidden;
    + }
    +
    + video, canvas {
    + position: absolute;
    + top: 0;
    + left: 0;
    + width: 100%;
    + height: 100%;
    + object-fit: cover;
    + }
    +
    + .controls {
    + display: flex;
    + gap: 1rem;
    + justify-content: center;
    + margin-top: 1rem;
    + }
    +
    + button {
    + padding: 0.75rem 1.5rem;
    + border: none;
    + border-radius: 4px;
    + background: var(--button-bg);
    + color: var(--button-text);
    + font-size: 1rem;
    + cursor: pointer;
    + transition: all 0.3s ease;
    + }
    +
    + button:disabled {
    + opacity: 0.5;
    + cursor: not-allowed;
    + }
    +
    + button:hover:not(:disabled) {
    + transform: translateY(-2px);
    + box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    + }
    +
    + .instructions {
    + max-width: 800px;
    + margin: 2rem auto;
    + padding: 1rem;
    + background: white;
    + border-radius: 8px;
    + box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    + }
    +
    + .instructions h2 {
    + margin-bottom: 1rem;
    + color: var(--primary-color);
    + }
    +
    + .instructions ol {
    + padding-left: 1.5rem;
    + }
    +
    + footer {
    + margin-top: auto;
    + padding: 1rem;
    + text-align: center;
    + background: var(--secondary-color);
    + color: white;
    + }
    +
    + @media (max-width: 600px) {
    + header h1 {
    + font-size: 2rem;
    + }
    +
    + .ar-container {
    + margin: 1rem;
    + }
    + }