How to create react-vr "enter vr button/cardboard"? -
i'm playing around react-vr framework , can't seem find in docs entering vr mode on chrome/cardboard ? or pointers appreciated.
here part of code while creating webvr tour
<view> <pano source={asset(this.state.current_scene['scene_image'])} oninput={this.onpanoinput.bind(this)} onload={this.sceneonload} onloadend={this.sceneonloadend} style={{ transform: [{translate: [0, 0, 0]}] }}/> {this.state.current_scene['navigations'].map(function(item,i){ return <mesh key={i} style={{ layoutorigin: [0.5, 0.5], transform: [{translate: item['translate']}, {rotatex: item['rotation'][0]}, {rotatey: item['rotation'][1]}, {rotatez: item['rotation'][2]}] }} oninput={ e => that.onnavigationclick(item,e)}> <vrbutton style={{ width: 0.15, height:0.15, borderradius: 50, justifycontent: 'center', alignitems: 'center', borderstyle: 'solid', bordercolor: '#ffffff80', borderwidth: 0.01 }}> <vrbutton style={{ width: that.state.animationwidth, height:that.state.animationwidth, borderradius: that.state.animationradius, backgroundcolor: '#ffffffd9' }}> </vrbutton> </vrbutton> </mesh> })} </view> onnavigationclick(item,e){ if(e.nativeevent.inputevent.eventtype === "mousedown" && e.nativeevent.inputevent.button === 0){ var new_scene = this.state.scenes.find(i => i['step'] === item.step); this.setstate({current_scene: new_scene}); postmessage({ type: "scenechanged"}) } } sceneonload(){ postmessage({ type: "sceneloadstart"}) } sceneonloadend(){ postmessage({ type: "sceneloadend"}) } this.sceneonload = this.sceneonload.bind(this); this.sceneonloadend = this.sceneonloadend.bind(this); this.onnavigationclick = this.onnavigationclick.bind(this); maybe find helpful here
Comments
Post a Comment