如何解决Web Ar、Aframe、Ar.js
谢谢,我想在按下快门按钮之前隐藏标签。我的快门按钮的目的是随机化显示的图像。 目前,当我还没有按下快门按钮时,我的 img 帧显示为黑框(我想隐藏此帧)。 以及如何在扫描条码后立即加载 Dance mp4 视频?我的代码如下:
<html>
<body style='margin: 0; overflow: hidden;'>
<a-scene embedded arjs='sourceType: webcam; debugUIEnabled: false;'>
<a-assets>
<video src="Dance.mp4"></video>
<img id="my-image">
</a-assets>
<a-image src="#my-image"
position="0 2 -5"
width="2.5"
height="1.5"
scale="1 1 1">
</a-image>
</a-scene>
<div class="ui">
<a id="take-phot" title="Take Phot"><i class="material-icons">photo_camera</i></a>
</div>
</body>
<script>
var myPix = new Array("ass/1.png","ass/2.jpg","ass/3.png");
function choosePic() {
var randomNum = Math.floor(Math.random() * myPix.length);
document.getElementById("my-image").src = myPix[randomNum];
}
var take_photo_btn = document.querySelector('#take-phot');
take_photo_btn.addEventListener("click",function (e) {
choosePic();
});
</script>
</html>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。