loop () {
    if (!this.shouldLoop) {
      return
    }

    window.requestAnimationFrame(this.loop.bind(this))

    // When not clicking the orientation values can be rounded more, so that
    // less messages are sent.
    const rounding = this.isClicking ? 100 : 25
    const orientation = this.gyroscope.getOrientation(rounding)

    this.gyroplane.updateOrientation(orientation)

    try {
      const coordinates = this.gyroplane.getScreenCoordinates()
      this.lazy.update(coordinates)
    } catch (e) {
      this.gyroplane.init()
    }

    // Get the lazy coordinates.
    const { x, y } = this.lazy.getBrushCoordinates()

    // Set the new values to the array.
    this.intArray.set([
      Math.round(x),
      Math.round(y),
      this.isClicking ? 1 : 0,
      Math.round(this.touch.y)
    ], 0)

    // Only send the data if it actually has changed.
    if (
      this.prevArray[0] !== this.intArray[0] ||
      this.prevArray[1] !== this.intArray[1] ||
      this.prevArray[2] !== this.intArray[2] ||
      this.prevArray[3] !== this.intArray[3]
    ) {
      this._onDataChange(this.buffer)
      this.prevArray.set(this.intArray, 0)
    }
  }
/**
   * The requestAnimationFrame loop for gathering data from the gyroscope and
   * this instance's state.
   */
The requestAnimationFrame loop for gathering data from the gyroscope and
this instance's state.
The requestAnimationFrame loop for gathering data from the gyroscope and this instance ' s state .
loop () {
    if (!this.shouldLoop) {
      return
    }
    window.requestAnimationFrame(this.loop.bind(this))
    const rounding = this.isClicking ? 100 : 25
    const orientation = this.gyroscope.getOrientation(rounding)
    this.gyroplane.updateOrientation(orientation)
    try {
      const coordinates = this.gyroplane.getScreenCoordinates()
      this.lazy.update(coordinates)
    } catch (e) {
      this.gyroplane.init()
    }
    const { x, y } = this.lazy.getBrushCoordinates()
    this.intArray.set([
      Math.round(x),
      Math.round(y),
      this.isClicking ? 1 : 0,
      Math.round(this.touch.y)
    ], 0)
    if (
      this.prevArray[0] !== this.intArray[0] ||
      this.prevArray[1] !== this.intArray[1] ||
      this.prevArray[2] !== this.intArray[2] ||
      this.prevArray[3] !== this.intArray[3]
    ) {
      this._onDataChange(this.buffer)
      this.prevArray.set(this.intArray, 0)
    }
  }
loop ( ) { if ( ! this . shouldLoop ) { return } window . requestAnimationFrame ( this . loop . bind ( this ) ) const rounding = this . isClicking ? 100 : 25 const orientation = this . gyroscope . getOrientation ( rounding ) this . gyroplane . updateOrientation ( orientation ) try { const coordinates = this . gyroplane . getScreenCoordinates ( ) this . lazy . update ( coordinates ) } catch ( e ) { this . gyroplane . init ( ) } const { x , y } = this . lazy . getBrushCoordinates ( ) this . intArray . set ( [ Math . round ( x ) , Math . round ( y ) , this . isClicking ? 1 : 0 , Math . round ( this . touch . y ) ] , 0 ) if ( this . prevArray [ 0 ] !== this . intArray [ 0 ] || this . prevArray [ 1 ] !== this . intArray [ 1 ] || this . prevArray [ 2 ] !== this . intArray [ 2 ] || this . prevArray [ 3 ] !== this . intArray [ 3 ] ) { this . _onDataChange ( this . buffer ) this . prevArray . set ( this . intArray , 0 ) } }
The requestAnimationFrame loop for gathering data from the gyroscope and
 this instance's state.
The requestAnimationFrame loop for gathering data from the gyroscope and this instance ' s state .
// When not clicking the orientation values can be rounded more, so that // less messages are sent. // Get the lazy coordinates. // Set the new values to the array. // Only send the data if it actually has changed.