public static double lerp(double a, double b, @FloatRange(from = 0f, to = 1f) double percentage) { return a + percentage * (b - a); }
void write(@Nullable FloatRange floatRange) { checkAnnotationNotNull(floatRange); // Args: validationContext, value, from, to BaseAnnotationWriter baseWriter = new BaseAnnotationWriter(getter, CHECK_FLOAT_RANGE_METHOD_NAME, true); if (Double.isInfinite(floatRange.from())) { baseWriter.addArg("Double.NEGATIVE_INFINITY", null, true); } else { baseWriter.addArg(LITERAL_DOUBLE, floatRange.from(), true); } if (Double.isInfinite(floatRange.to())) { baseWriter.addArg("Double.POSITIVE_INFINITY", null, true); } else { baseWriter.addArg(LITERAL_DOUBLE, floatRange.to(), true); } buildStatements(baseWriter.getFormattedString(), baseWriter.getArgs()); }
public static int lerp(int a, int b, @FloatRange(from = 0f, to = 1f) float percentage) { return (int) (a + percentage * (b - a)); }
public static float lerp(float a, float b, @FloatRange(from = 0f, to = 1f) float percentage) { return a + percentage * (b - a); }
/** * @return The corner radius applied when drawing this drawable. 0 when drawable is not rounded. */ @FloatRange(from = 0) public float getCornerRadius() { return mCornerRadius; }
/** * Sets dragging item alpha. * * @param alpha Alpha (e.g. 1.0: fully opaque, 0.0: fully transparent) */ public void setDraggingItemAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha) { mDraggingItemEffectsInfo.alpha = alpha; }
/** * @return The minimal available scale. */ @FloatRange(from = 0) public float getMaximumScale() { return mMaximumScale; }
/** * @return The minimal available scale. */ @FloatRange(from = 0) public float getMinimumScale() { return mMinimumScale; }
/** * @see #setMinProgress(float) * @see #setMaxProgress(float) */ public void setMinAndMaxProgress( @FloatRange(from = 0f, to = 1f) float minProgress, @FloatRange(from = 0f, to = 1f) float maxProgress) { lottieDrawable.setMinAndMaxProgress(minProgress, maxProgress); }
private void setCornerRadiusSafely(@FloatRange(from = 0) float cornerRadius) { cornerRadius = Math.max(0, cornerRadius); if (cornerRadius != mCornerRadius) { mCornerRadius = cornerRadius; mShader = null; } }
/** * @param minimumScale The scale which will be used as minimal available value. */ @NonNull public BlinkScaleProcessor minimumScale(@FloatRange(from = 0) float minimumScale) { mMinimumScale = minimumScale; return this; }
/** * @return completed percent of animation */ @FloatRange(from = 0, to = 100) protected float getAnimatedPercent() { return (float) mAnimator.getAnimatedValue(); }
/** * @param maximumScale The scale which will be used as maximal available value. */ @NonNull public BlinkScaleProcessor maximumScale(@FloatRange(from = 0) float maximumScale) { mMaximumScale = maximumScale; return this; }
/** * Sets the maximum progress that the animation will end at when playing or looping. */ public void setMaxProgress(@FloatRange(from = 0f, to = 1f) float endProgress) { lottieDrawable.setMaxProgress(endProgress); }
@FloatRange(from = 0f, to = 1f) private float getStartDelayProgress() { if (cachedStartDelayProgress == -1f) { cachedStartDelayProgress = keyframes.isEmpty() ? 0f : keyframes.get(0).getStartProgress(); } return cachedStartDelayProgress; }
@FloatRange(from = 0f, to = 1f) float getEndProgress() { if (cachedEndProgress == -1f) { cachedEndProgress = keyframes.isEmpty() ? 1f : keyframes.get(keyframes.size() - 1).getEndProgress(); } return cachedEndProgress; }
@FloatRange(from = 0f, to = 1f) public float getProgress() { return animator.getAnimatedValueAbsolute(); }
public void setProgress(@FloatRange(from = 0f, to = 1f) float progress) { lottieDrawable.setProgress(progress); }
@FloatRange(from = 0.0f, to = 1.0f) public float getProgress() { return lottieDrawable.getProgress(); }
public void setAlpha(@FloatRange(from = 0f, to = 1f) float alpha) { color = ColorUtils.modifyAlpha(color, alpha); }