/** * Simplest variation; determine keyTimes based on even division of 0-1 * range based on number of keyValues. This constructor assumes LINEAR * interpolation. * * @param keyValues * values that will be assumed at each time in keyTimes */ public KeyFrames(KeyValues<T> keyValues) { init(keyValues, null, (TimelineEase) null); }
/** * Returns a value for the given fraction elapsed of the animation cycle. * Given the fraction, this method will determine what interval the fraction * lies within, how much of that interval has elapsed, what the boundary * values are (from KeyValues), what the interpolated fraction is (from the * Interpolator for the interval), and what the final interpolated * intermediate value is (using the appropriate Evaluator). This method will * call into the Interpolator for the time interval to get the interpolated * method. To ensure that future operations succeed, the value received from * the interpolation will be clamped to the interval [0,1]. */ public Object getValue(float fraction) { // First, figure out the real fraction to use, given the // interpolation type and keyTimes int interval = getInterval(fraction); float t0 = keyTimes.getTime(interval); float t1 = keyTimes.getTime(interval + 1); float t = (fraction - t0) / (t1 - t0); float interpolatedT = interpolators.interpolate(interval, t); // clamp to avoid problems with buggy Interpolators if (interpolatedT < 0f) { interpolatedT = 0f; } else if (interpolatedT > 1f) { interpolatedT = 1f; } return keyValues.getValue(interval, (interval + 1), interpolatedT); }
/** * Returns a value for the given fraction elapsed of the animation cycle. * Given the fraction, this method will determine what interval the fraction * lies within, how much of that interval has elapsed, what the boundary * values are (from KeyValues), what the interpolated fraction is (from the * Interpolator for the interval), and what the final interpolated * intermediate value is (using the appropriate Evaluator). This method will * call into the Interpolator for the time interval to get the interpolated * method. To ensure that future operations succeed, the value received from * the interpolation will be clamped to the interval [0,1]. */ public Object getValue(float fraction) { // First, figure out the real fraction to use, given the // interpolation type and keyTimes int interval = getInterval(fraction); float t0 = keyTimes.getTime(interval); float t1 = keyTimes.getTime(interval + 1); float t = (fraction - t0) / (t1 - t0); float interpolatedT = interpolators.interpolate(interval, t); // clamp to avoid problems with buggy Interpolators if (interpolatedT < 0f) { interpolatedT = 0f; } else if (interpolatedT > 1f) { interpolatedT = 1f; } return keyValues.getValue(interval, (interval + 1), interpolatedT); }
/** * Simplest variation; determine keyTimes based on even division of 0-1 * range based on number of keyValues. This constructor assumes LINEAR * interpolation. * * @param keyValues * values that will be assumed at each time in keyTimes */ public KeyFrames(KeyValues<T> keyValues) { init(keyValues, null, (TimelineEase) null); }
/** * Returns a value for the given fraction elapsed of the animation cycle. * Given the fraction, this method will determine what interval the fraction * lies within, how much of that interval has elapsed, what the boundary * values are (from KeyValues), what the interpolated fraction is (from the * Interpolator for the interval), and what the final interpolated * intermediate value is (using the appropriate Evaluator). This method will * call into the Interpolator for the time interval to get the interpolated * method. To ensure that future operations succeed, the value received from * the interpolation will be clamped to the interval [0,1]. */ public Object getValue(float fraction) { // First, figure out the real fraction to use, given the // interpolation type and keyTimes int interval = getInterval(fraction); float t0 = keyTimes.getTime(interval); float t1 = keyTimes.getTime(interval + 1); float t = (fraction - t0) / (t1 - t0); float interpolatedT = interpolators.interpolate(interval, t); // clamp to avoid problems with buggy Interpolators if (interpolatedT < 0f) { interpolatedT = 0f; } else if (interpolatedT > 1f) { interpolatedT = 1f; } return keyValues.getValue(interval, (interval + 1), interpolatedT); }
/** * Simplest variation; determine keyTimes based on even division of 0-1 * range based on number of keyValues. This constructor assumes LINEAR * interpolation. * * @param keyValues * values that will be assumed at each time in keyTimes */ public KeyFrames(KeyValues<T> keyValues) { init(keyValues, null, (TimelineEase) null); }
/** * Utility constructor that assumes even division of times according to size * of keyValues and interpolation according to interpolators parameter. * * @param keyValues * values that the animation will assume at each of the * corresponding times in keyTimes * @param interpolators * collection of Interpolators that control the calculation of * values in each of the intervals defined by keyFrames. If this * value is null, a {@link org.pushingpixels.trident.ease.Linear} Interpolator will be used for * all intervals. If there is only one interpolator, that * interpolator will be used for all intervals. Otherwise, there * must be a number of interpolators equal to the number of * intervals (which is one less than the number of keyTimes). * @throws IllegalArgumentException * The number of interpolators must either be zero * (interpolators == null), one, or one less than the size of * keyTimes. */ public KeyFrames(KeyValues<T> keyValues, TimelineEase... interpolators) { init(keyValues, null, interpolators); }
/** * This variant takes both keyValues (values at each point in time) and * keyTimes (times at which values are sampled). * * @param keyValues * values that the animation will assume at each of the * corresponding times in keyTimes * @param keyTimes * times at which the animation will assume the corresponding * values in keyValues * @throws IllegalArgumentException * keyTimes and keySizes must have the same number of elements * since these structures are meant to have corresponding * entries; an exception is thrown otherwise. */ public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes) { init(keyValues, keyTimes, (TimelineEase) null); }
/** * This variant takes both keyValues (values at each point in time) and * keyTimes (times at which values are sampled). * * @param keyValues * values that the animation will assume at each of the * corresponding times in keyTimes * @param keyTimes * times at which the animation will assume the corresponding * values in keyValues * @throws IllegalArgumentException * keyTimes and keySizes must have the same number of elements * since these structures are meant to have corresponding * entries; an exception is thrown otherwise. */ public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes) { init(keyValues, keyTimes, (TimelineEase) null); }
/** * This variant takes both keyValues (values at each point in time) and * keyTimes (times at which values are sampled). * * @param keyValues * values that the animation will assume at each of the * corresponding times in keyTimes * @param keyTimes * times at which the animation will assume the corresponding * values in keyValues * @throws IllegalArgumentException * keyTimes and keySizes must have the same number of elements * since these structures are meant to have corresponding * entries; an exception is thrown otherwise. */ public KeyFrames(KeyValues<T> keyValues, KeyTimes keyTimes) { init(keyValues, keyTimes, (TimelineEase) null); }
/** * Utility constructor that assumes even division of times according to size * of keyValues and interpolation according to interpolators parameter. * * @param keyValues * values that the animation will assume at each of the * corresponding times in keyTimes * @param interpolators * collection of Interpolators that control the calculation of * values in each of the intervals defined by keyFrames. If this * value is null, a {@link LinearInterpolator} will be used for * all intervals. If there is only one interpolator, that * interpolator will be used for all intervals. Otherwise, there * must be a number of interpolators equal to the number of * intervals (which is one less than the number of keyTimes). * @throws IllegalArgumentException * The number of interpolators must either be zero * (interpolators == null), one, or one less than the size of * keyTimes. */ public KeyFrames(KeyValues<T> keyValues, TimelineEase... interpolators) { init(keyValues, null, interpolators); }
/** * Utility constructor that assumes even division of times according to size * of keyValues and interpolation according to interpolators parameter. * * @param keyValues * values that the animation will assume at each of the * corresponding times in keyTimes * @param interpolators * collection of Interpolators that control the calculation of * values in each of the intervals defined by keyFrames. If this * value is null, a {@link LinearInterpolator} will be used for * all intervals. If there is only one interpolator, that * interpolator will be used for all intervals. Otherwise, there * must be a number of interpolators equal to the number of * intervals (which is one less than the number of keyTimes). * @throws IllegalArgumentException * The number of interpolators must either be zero * (interpolators == null), one, or one less than the size of * keyTimes. */ public KeyFrames(KeyValues<T> keyValues, TimelineEase... interpolators) { init(keyValues, null, interpolators); }
init(keyValues, keyTimes, interpolators);
init(keyValues, keyTimes, interpolators);
init(keyValues, keyTimes, interpolators);