Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. constructor(props) {
  2. super(props);
  3. this.state = {
  4. watchTime = 3,
  5. progress = 0,
  6. };
  7. }
  8.  
  9. render() {
  10. return (
  11. <VrButton onEnter={ () => this.animateProgress() }
  12. onExit={ () => this.stopProgress() }
  13. onClick={ ()=> this.click() }></VrButton>
  14. );
  15. }
  16.  
  17. animateProgress() {
  18.  
  19. this.setState({watching: true});
  20. while (this.state.watchTime >== this.state.progress && this.state.watching === true) {
  21. // after a timeout of one second add 1 to `this.state.progress`
  22. }
  23.  
  24. this.click();
  25. }
  26.  
  27. stopProgress() {
  28. this.setState({progress: 0});
  29. this.setState({watching: false});
  30. }
  31.  
  32. click() {
  33. // Handels the click event
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement