Skip to content

Tcode-Motion/ar-photo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Typing SVG

HTML5 A-Frame AR.js WebXR GitHub Pages License

Live Demo Star Forks


╔══════════════════════════════════════════════════════════════════════╗
β•‘                                                                      β•‘
β•‘   Point your phone at a marker.                                      β•‘
β•‘   Watch a photo gallery appear floating in mid-air.                  β•‘
β•‘   No app. No install. Just a browser.  β€” Tcode-Motion ⚑              β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

✦ About

A universal marker-based AR photo gallery built with A-Frame and AR.js β€” works in any modern smartphone browser, no app install required. Point your phone camera at the Hiro marker on any screen and watch a full photo gallery materialize floating in 3D space.

🎯 Single file. Zero build tools. Pure web AR magic.


πŸš€ Live Demo

πŸ”— Link πŸ“– Description
tcode-motion.github.io/ar-photo Live AR Gallery β€” open on your phone
Hiro Marker Open this on your PC/monitor as the AR target

πŸ“± How to Use

Step 1 β†’ Open the Live Demo on your PHONE
         πŸ‘‰ https://tcode-motion.github.io/ar-photo/

Step 2 β†’ Open the Hiro Marker on your PC / monitor
         πŸ‘‰ https://ar-js-org.github.io/AR.js/data/images/HIRO.jpg

Step 3 β†’ Tap "Launch Camera" on your phone
         β†’ Allow camera access when prompted

Step 4 β†’ Point your phone camera at the Hiro Marker on your screen

Step 5 β†’ ✨ AR Gallery appears floating on the marker!
         β†’ Use Prev / Next to browse, or switch to Gallery Mode

πŸ–ΌοΈ Features

✨ Feature πŸ“– Description
πŸ–ΌοΈ Single Mode Browse photos one at a time with Prev / Next navigation
πŸŒ€ Gallery Mode All 5 photos in a beautiful fan/ring arrangement
⚑ Ultra Stable 30-frame smoothing algorithm β€” zero hand-shake jitter
🌍 Universal Works on Android & iOS β€” any phone, any modern browser
πŸ“¦ No App Needed 100% web-based, zero install, zero friction
🎯 Marker-Based AR Standard Hiro marker for rock-solid tracking
πŸ’‘ Single File App Entire gallery in one index.html β€” no build process

πŸ› οΈ Tech Stack

HTML5 A-Frame AR.js JavaScript

Library Version Purpose
A-Frame 1.3 WebXR / 3D scene framework β€” renders the AR world
AR.js Latest Marker-based AR tracking in the browser
HTML5 / JavaScript β€” App logic, gallery navigation, image management
GitHub Pages β€” Zero-cost live hosting

πŸ”₯ No build tools. No backend. No npm. No app store. Open a browser β€” it works.


πŸ“‚ Project Structure

ar-photo/
β”œβ”€β”€ index.html              ← πŸš€ Entire app β€” single file, no build
β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ photo1.jpg          ← Personal photo
β”‚   β”œβ”€β”€ gallery1.png        ← Mountain Lake
β”‚   β”œβ”€β”€ gallery2.png        ← Abstract Art
β”‚   β”œβ”€β”€ gallery3.png        ← Cyberpunk City
β”‚   └── gallery4.png        ← Architecture
β”œβ”€β”€ .nojekyll               ← GitHub Pages config
β”œβ”€β”€ .gitignore
└── README.md

βž• Add Your Own Photos

Customizing the gallery takes 4 simple steps:

Step 1 β€” Drop your image into images/:

images/your-photo.jpg

Step 2 β€” Register it in <a-assets> inside index.html:

<a-assets>
  <!-- existing images... -->
  <img id="img5" src="images/your-photo.jpg" crossorigin="anonymous">
</a-assets>

Step 3 β€” Add it to the gallery ring:

<a-entity id="galleryRing">
  <!-- existing images... -->
  <a-image src="#img5" position="0 0 -1" width="0.8" height="0.6"></a-image>
</a-entity>

Step 4 β€” Update the JavaScript arrays:

const IMAGE_IDS   = ['img1', 'img2', 'img3', 'img4', 'img5'];
const IMAGE_NAMES = ['Personal', 'Mountain Lake', 'Abstract Art', 'Cyberpunk', 'Your Photo'];

Done! βœ… Refresh β€” your photo is now in the AR gallery.


🎯 How AR.js Marker Tracking Works

πŸ“± Phone Camera
      ↓
  Captures live video frame
      ↓
  AR.js scans for HIRO marker pattern
      ↓
  Calculates marker position & orientation in 3D space
      ↓
  A-Frame renders 3D scene anchored to marker coordinates
      ↓
  ✨ Photos appear floating in augmented reality

The Hiro marker is a high-contrast black-and-white pattern AR.js reliably detects even in varying lighting.


🌐 Deploy Your Own Fork

# 1. Fork this repo on GitHub

# 2. Clone your fork
git clone https://github.com/YOUR-USERNAME/ar-photo.git
cd ar-photo

# 3. Add your photos to images/
# 4. Edit index.html with your IMAGE_IDS and IMAGE_NAMES

# 5. Push to GitHub
git add .
git commit -m "Add my photos to AR gallery"
git push

# 6. Enable GitHub Pages:
#    Settings β†’ Pages β†’ Source: master branch β†’ / (root)
#    Live URL: https://YOUR-USERNAME.github.io/ar-photo/

πŸ“œ Requirements

Requirement Details
Device Any smartphone (Android or iOS)
Browser Any modern mobile browser (Chrome, Safari, Firefox)
Camera Rear camera with camera permission granted
AR Target Hiro Marker on any screen or printed
Internet Required to load A-Frame + AR.js from CDN

🀝 Contributing

Contributions welcome! Ideas:

  • 🎡 Audio / video AR support
  • 🎨 Custom marker support (beyond Hiro)
  • πŸ“ More gallery layout modes (grid, stack, spiral)
  • πŸŒ™ Dark UI overlay theme

⭐ Star the repo if you find it useful!


πŸ‘¨β€πŸ’» Author

Tanmoy β€” Tcode-Motion

GitHub YouTube Live Demo

"Predict the future by coding it." ⚑


πŸ“„ License

MIT β€” free to use, fork, and modify.


About

Universal marker-based AR photo gallery. Works on any smartphone browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages