javascript - WebVR - 功能
问题描述
我刚刚启动 WebVR,我不知道如何执行此功能,我在环境中有不同符号的框,我希望单击的框等到第二个显示符号,检查它是否匹配和如果是,则以类似的方式隐藏框或任何内容以显示 2 匹配,如果不匹配 - 隐藏符号 agin,类似于 VR 记忆游戏,但我不知道如何制作功能。这是概念,有帮助吗?
AFRAME.registerComponent('show-first-symbol-on-click', {
init: function () {
this.el.addEventListener('click', function (evt) {
this.setAttribute('multisrc', 'srcs:#right,#left,#top,#bottom,#symbol1,#front');
this.setAttribute('color', '#84a37a');
//if box id match = src symbol1{
//first box src symbol
//boxes opacity 0
//}
//else{
//box attribute color ##e2eedd
//multisrc = srcs:#right #left #top #bottom #front #back
//}
});
}
});
<a-box id="box1" color="#84a37a" height="1" width="1" depth="1" position="-2 3 -6" scale="1 1 1" animation="property: object3D.position.y; to: 3.1; dir:alternate; dur: 2000; loop: true" event-set__enter="_event:mouseenter; scale: 1.2 1.2 1.2" event-set__leave="_event:mouseleave; scale: 1 1 1", show-first-symbol-on-click=''></a-box>
解决方案
推荐阅读
- python - 在 Odoo 13 的 one2many 关系中显示非活动记录
- javascript - 如何在模块中以编程方式确定是否通过脚本 src 加载了 javascript 模块(未导入)
- appium - 在 appium 中检查时,模拟器和真实设备的 XCUIElementType 不同
- python - 无法将屈服值传递给另一个函数
- go - 当从 Golang 中的另一个包调用时,全局变量变为 nil
- java - 如何在 Json 对象中解析多个具有相同名称的 Json 数组
- html - 恢复 TikTok 滚动条
- java - 异步方法问题
- regex - Scala string match { case regex(...) => ... } 可以找到多个匹配项吗?
- javascript - 在这段代码中,我如何使用 FOR 循环一次访问两个或多个属性?