src/components/motion-capture-replayer.js
function (delta) {
    var currentPose;
    var currentEvent
    var playingPoses = this.playingPoses;
    var playingEvents = this.playingEvents;
    currentPose = playingPoses && playingPoses[this.currentPoseIndex]
    currentEvent = playingEvents && playingEvents[this.currentEventIndex];
    this.currentPoseTime += delta;
    this.currentEventTime += delta;
    // Determine next pose.
    // Comparing currentPoseTime to currentEvent.timestamp is not a typo.
    while ((currentPose && this.currentPoseTime >= currentPose.timestamp) ||
           (currentEvent && this.currentPoseTime >= currentEvent.timestamp)) {
      // Pose.
      if (currentPose && this.currentPoseTime >= currentPose.timestamp) {
        if (this.currentPoseIndex === playingPoses.length - 1) {
          if (this.data.loop) {
            this.currentPoseIndex = 0;
            this.currentPoseTime = playingPoses[0].timestamp;
          } else {
            this.stopReplaying();
          }
        }
        applyPose(this.el, currentPose);
        this.currentPoseIndex += 1;
        currentPose = playingPoses[this.currentPoseIndex];
      }
      // Event.
      if (currentEvent && this.currentPoseTime >= currentEvent.timestamp) {
        if (this.currentEventIndex === playingEvents.length && this.data.loop) {
          this.currentEventIndex = 0;
          this.currentEventTime = playingEvents[0].timestamp;
        }
        this.el.emit(currentEvent.name, currentEvent.detail);
        this.currentEventIndex += 1;
        currentEvent = this.playingEvents[this.currentEventIndex];
      }
    }
  }
function (delta) {
    var currentPose;
    var currentEvent
    var playingPoses = this.playingPoses;
    var playingEvents = this.playingEvents;
    currentPose = playingPoses && playingPoses[this.currentPoseIndex]
    currentEvent = playingEvents && playingEvents[this.currentEventIndex];
    this.currentPoseTime += delta;
    this.currentEventTime += delta;
    // Determine next pose.
    // Comparing currentPoseTime to currentEvent.timestamp is not a typo.
    while ((currentPose && this.currentPoseTime >= currentPose.timestamp) ||
           (currentEvent && this.currentPoseTime >= currentEvent.timestamp)) {
      // Pose.
      if (currentPose && this.currentPoseTime >= currentPose.timestamp) {
        if (this.currentPoseIndex === playingPoses.length - 1) {
          if (this.data.loop) {
            this.currentPoseIndex = 0;
            this.currentPoseTime = playingPoses[0].timestamp;
          } else {
            this.stopReplaying();
          }
        }
        applyPose(this.el, currentPose);
        this.currentPoseIndex += 1;
        currentPose = playingPoses[this.currentPoseIndex];
      }
      // Event.
      if (currentEvent && this.currentPoseTime >= currentEvent.timestamp) {
        if (this.currentEventIndex === playingEvents.length && this.data.loop) {
          this.currentEventIndex = 0;
          this.currentEventTime = playingEvents[0].timestamp;
        }
        this.el.emit(currentEvent.name, currentEvent.detail);
        this.currentEventIndex += 1;
        currentEvent = this.playingEvents[this.currentEventIndex];
      }
    }
  }
function ( delta ) { var currentPose ; var currentEvent var playingPoses = this . playingPoses ; var playingEvents = this . playingEvents ; currentPose = playingPoses && playingPoses [ this . currentPoseIndex ] currentEvent = playingEvents && playingEvents [ this . currentEventIndex ] ; this . currentPoseTime += delta ; this . currentEventTime += delta ; // Determine next pose. // Comparing currentPoseTime to currentEvent.timestamp is not a typo. while ( ( currentPose && this . currentPoseTime >= currentPose . timestamp ) || ( currentEvent && this . currentPoseTime >= currentEvent . timestamp ) ) { // Pose. if ( currentPose && this . currentPoseTime >= currentPose . timestamp ) { if ( this . currentPoseIndex === playingPoses . length - 1 ) { if ( this . data . loop ) { this . currentPoseIndex = 0 ; this . currentPoseTime = playingPoses [ 0 ] . timestamp ; } else { this . stopReplaying ( ) ; } } applyPose ( this . el , currentPose ) ; this . currentPoseIndex += 1 ; currentPose = playingPoses [ this . currentPoseIndex ] ; } // Event. if ( currentEvent && this . currentPoseTime >= currentEvent . timestamp ) { if ( this . currentEventIndex === playingEvents . length && this . data . loop ) { this . currentEventIndex = 0 ; this . currentEventTime = playingEvents [ 0 ] . timestamp ; } this . el . emit ( currentEvent . name , currentEvent . detail ) ; this . currentEventIndex += 1 ; currentEvent = this . playingEvents [ this . currentEventIndex ] ; } } }
Called on tick.
Called on tick .