8
React VR을 사용하여 VR 애플리케이션을 작성 중이며 진도 표시 줄이있는 시선 버튼 (또는 무언가)을 사용하면 얼마나 오랫동안 해당 버튼을보아야하는지 사용자에게 알릴 수 있습니다. 내가 어떻게 할 수 있니?React VR을 사용하여 어떻게 시선 단추를 만들 수 있습니까?
constructor(props) {
super(props);
this.state = {
watchTime: 3,
progress: 0,
watching: true
};
}
render() {
return (
<VrButton onEnter={() => this.animateProgress() }
onExit={() => this.stopProgress() }
onClick={()=> this.click() }></VrButton>
);
}
animateProgress() {
this.setState({watching: true});
while (this.state.watchTime >== this.state.progress && this.state.watching === true) {
// after a timeout of one second add 1 to `this.state.progress`
}
this.click();
}
stopProgress() {
this.setState({
progress: 0,
watching: false
});
}
click() {
// Handels the click event
}
이 작업을 수행하는 쉬운 방법이 있나요 :
나는 (이 코드 내부의 버그의가있을 수 있습니다)이 의사 을 사용할 생각 해요?