首页 > 解决方案 > 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>

标签: javascriptwebvr

解决方案


推荐阅读