code: public GVRAnimation setOnFinish(GVROnFinish callback) {
          mOnFinish = callback;
  
          // Do the instance-of test at set-time, not at use-time
          mOnRepeat = callback instanceof GVROnRepeat ? (GVROnRepeat) callback
                  : null;
          if (mOnRepeat != null) {
              mRepeatCount = -1; // loop until iterate() returns false
          }
          return this;
      }
docs: Set the on-finish callback.
  
  The basic {@link GVROnFinish} callback will notify you when the animation
  runs to completion. This is a good time to do things like removing
  now-invisible objects from the scene graph.
  
  <p>
  The extended {@link GVROnRepeat} callback will be called after every
  iteration of an indefinite (repeat count less than 0) animation, giving
  you a way to stop the animation when it's not longer appropriate.
  
  @param callback
  A {@link GVROnFinish} or {@link GVROnRepeat} implementation.
  <p>
  <em>Note</em>: Supplying a {@link GVROnRepeat} callback will
  {@linkplain #setRepeatCount(int) set the repeat count} to a
  negative number. Calling {@link #setRepeatCount(int)} with a
  non-negative value after setting a {@link GVROnRepeat}
  callback will effectively convert the callback to a
  {@link GVROnFinish}.
  @return {@code this}, so you can chain setProperty() calls.