You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <title>MARTINS.js WebAR demo using A-Frame</title>
  7. <link href="../assets/demo.css" rel="stylesheet">
  8. <script src="../../dist/martins.js"></script>
  9. <script src="https://cdn.jsdelivr.net/npm/aframe@1.3.0/dist/aframe-v1.3.0.min.js"></script>
  10. <script src="../assets/aframe-particle-system-component.min.js"></script>
  11. <script src="demo.js"></script>
  12. <script src="../assets/aframe-with-martins.js"></script>
  13. </head>
  14. <body>
  15. <div id="ar-viewport">
  16. <div id="ar-hud" hidden>
  17. <img id="scan" src="../assets/scan.png">
  18. <button id="toggle-webcam"></button>
  19. </div>
  20. </div>
  21. <img id="my-reference-image" src="../assets/my-reference-image.webp" hidden>
  22. <video id="my-video" src="../assets/my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
  23. <!-- This is a scene -->
  24. <a-scene ar-scene>
  25. <a-camera ar-camera></a-camera>
  26. <!-- Whatever you add to <ar-root> will appear in AR -->
  27. <ar-root>
  28. <!-- Ground plane -->
  29. <a-plane position="0 -0.5 -0.5" rotation="-90 0 0" width="2" height="1" color="indigo">
  30. <!-- 3D model -->
  31. <a-entity gltf-model="#my-3d-model"></a-entity>
  32. <!-- Particles -->
  33. <a-entity rotation="90 0 0">
  34. <a-entity position="0.75 0 0" particle-system="texture: ../assets/particle.png; color: #03f; opacity: 0.33; size: 20; maxAge: 0.64; velocityValue: 0 6.5 0; velocitySpread: 0 0 0; accelerationSpread: 2 0 2; particleCount: 2000"></a-entity>
  35. <a-entity position="-0.75 0 0" particle-system="texture: ../assets/particle.png; color: #f70; opacity: 0.33; size: 20; maxAge: 0.64; velocityValue: 0 6.5 0; velocitySpread: 0 0 0; accelerationSpread: 2 0 2; particleCount: 2000"></a-entity>
  36. </a-entity>
  37. <!-- Rotating text -->
  38. <a-entity animation="property: rotation.z; from: 0; to: 360; dur: 2000; loop: true; easing: linear">
  39. <a-text value="It works!" font="mozillavr" color="#fe3" scale="-1 -1 1" rotation="-90 0 0" position="0 0.40 1" align="center"></a-text>
  40. <a-text value="Cool!" font="mozillavr" color="#8ef" scale="1 1 1" rotation="90 0 0" position="0 -0.40 1" align="center"></a-text>
  41. </a-entity>
  42. </a-plane>
  43. </ar-root>
  44. <!-- Declare external media files here -->
  45. <a-assets>
  46. <a-asset-item id="my-3d-model" src="../assets/my-3d-model.glb"></a-asset-item>
  47. </a-assets>
  48. </a-scene>
  49. </body>
  50. </html>