(self, time)
return f0, f1, blend
Calculate the indices of the two frames and the interpolation value that

    should be used when computing the frame at a given point in time.

    Args:
      time: Time at which the frame is to be computed.
    Return:
      f0: Start framed used for blending.
      f1: End frame used for blending.
      blend: Interpolation value used to blend between the two frames.
Calculate the indices of the two frames and the interpolation value that
Calculate the indices of the two frames and the interpolation value that
def calc_blend_idx(self, time):
    """Calculate the indices of the two frames and the interpolation value that

    should be used when computing the frame at a given point in time.

    Args:
      time: Time at which the frame is to be computed.
    Return:
      f0: Start framed used for blending.
      f1: End frame used for blending.
      blend: Interpolation value used to blend between the two frames.
    """
    dur = self.get_duration()
    num_frames = self.get_num_frames()

    if not self.enable_loop() and time <= 0:
      f0 = 0
      f1 = 0
      blend = 0
    elif not self.enable_loop() and time >= dur:
      f0 = num_frames - 1
      f1 = num_frames - 1
      blend = 0
    else:
      phase = self.calc_phase(time)

      f0 = int(phase * (num_frames - 1))
      f1 = min(f0 + 1, num_frames - 1)

      norm_time = phase * dur
      time0 = self.get_frame_time(f0)
      time1 = self.get_frame_time(f1)
      assert (norm_time >= time0 - 1e-5) and (norm_time <= time1 + 1e-5)

      blend = (norm_time - time0) / (time1 - time0)

    return f0, f1, blend
def calc_blend_idx ( self , time ) : dur = self . get_duration ( ) num_frames = self . get_num_frames ( ) if not self . enable_loop ( ) and time <= 0 : f0 = 0 f1 = 0 blend = 0 elif not self . enable_loop ( ) and time >= dur : f0 = num_frames - 1 f1 = num_frames - 1 blend = 0 else : phase = self . calc_phase ( time ) f0 = int ( phase * ( num_frames - 1 ) ) f1 = min ( f0 + 1 , num_frames - 1 ) norm_time = phase * dur time0 = self . get_frame_time ( f0 ) time1 = self . get_frame_time ( f1 ) assert ( norm_time >= time0 - 1e-5 ) and ( norm_time <= time1 + 1e-5 ) blend = ( norm_time - time0 ) / ( time1 - time0 ) return f0 , f1 , blend