/** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. * * @return The control to interpolate to, will not be <code>null</code>. * @see #getControlFrom() */ protected C getControlTo() { C to = null; switch (getRepeatType()) { case CLAMP: if (getIndex() >= getMaximumIndex()) { to = getControls().get(getMaximumIndex()); } else { to = getControls().get(getIndex() + 1); } break; case CYCLE: if (isCycleForward()) { to = getControls().get(getIndex() + 1); } else { to = getControls().get(getIndex() - 1); } break; case WRAP: to = getControls().get(getIndex() + 1); break; } return to; }
/** * This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly. * * @return The control to interpolate to, will not be <code>null</code>. * @see #getControlFrom() */ protected C getControlTo() { C to = null; switch (getRepeatType()) { case CLAMP: if (getIndex() >= getMaximumIndex()) { to = getControls().get(getMaximumIndex()); } else { to = getControls().get(getIndex() + 1); } break; case CYCLE: if (isCycleForward()) { to = getControls().get(getIndex() + 1); } else { to = getControls().get(getIndex() - 1); } break; case WRAP: to = getControls().get(getIndex() + 1); break; } return to; }
/** * Updates the {@link #getDelta() delta} and {@link #getIndex() index}. * * @param time * The raw time since this was last called. */ protected void updateDeltaAndIndex(final double time) { incrementDelta(getSpeed() * time); /* If >= DELTA_MAX then we need to start interpolating between next set of points */ while (getDelta() >= DELTA_MAX) { /* Adjust delta for new set of points */ decrementDelta(DELTA_MAX); /* Increment/decrement current index based on whether we are cycling forward or backwards */ if (isCycleForward()) { incrementIndex(); } else { decrementIndex(); } } }
/** * Updates the {@link #getDelta() delta} and {@link #getIndex() index}. * * @param time * The raw time since this was last called. */ protected void updateDeltaAndIndex(final double time) { incrementDelta(getSpeed() * time); /* If >= DELTA_MAX then we need to start interpolating between next set of points */ while (getDelta() >= DELTA_MAX) { /* Adjust delta for new set of points */ decrementDelta(DELTA_MAX); /* Increment/decrement current index based on whether we are cycling forward or backwards */ if (isCycleForward()) { incrementIndex(); } else { decrementIndex(); } } }
if (isCycleForward()) { if (getIndex() >= getMaximumIndex()) { setIndex(getMaximumIndex());
if (isCycleForward()) { if (getIndex() >= getMaximumIndex()) { setIndex(getMaximumIndex());