Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constructor(props) {
- super(props);
- this.state = {
- watchTime = 3,
- progress = 0,
- };
- }
- 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});
- this.setState({watching: false});
- }
- click() {
- // Handels the click event
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement