Class AnimationUtils
java.lang.Object
com.arbergashi.charts.util.AnimationUtils
High-performance animation and interpolation utilities for ArberCharts.
Design goals:
- EDT-friendly: pure functions, no global mutable state.
- Stable timing: use
System.nanoTime()for progress computation. - Small API surface: only what is required by the framework.
- Since:
- 2025-06-01
- Version:
- 1.0.0
- Author:
- Arber Gashi
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleeaseInOut(double fraction) Cubic ease-in-out.static doubleeaseInOutExpo(double fraction) Exponential ease-in-out.static doubleeaseInOutQuad(double fraction) Quadratic ease-in-out.static doubleeaseInOutSine(double fraction) Sine ease-in-out.static doublegetEasedProgressNanos(long startNanos, long durationMillis) Convenience: cubic eased progress.static doublegetEasedProgressNanos(long startNanos, long durationMillis, AnimationUtils.EasingType easingType) Convenience: eased progress with selectable easing.static doublegetProgressNanos(long startNanos, long durationMillis) Progress based onSystem.nanoTime().static booleanisFinishedNanos(long startNanos, long durationMillis) Returns true once progress reaches 1.0.static doublelerp(double start, double end, double fraction) Linear interpolation (lerp).static floatlerp(float start, float end, float fraction) Float lerp.static intlerp(int start, int end, double fraction) Int lerp (rounded).static longnowNanos()Monotonic timestamp suitable for animations.
-
Method Details
-
lerp
public static double lerp(double start, double end, double fraction) Linear interpolation (lerp).- Parameters:
start- start valueend- end valuefraction- interpolation factor in [0..1]
-
lerp
public static float lerp(float start, float end, float fraction) Float lerp. -
lerp
public static int lerp(int start, int end, double fraction) Int lerp (rounded). -
easeInOut
public static double easeInOut(double fraction) Cubic ease-in-out. -
easeInOutQuad
public static double easeInOutQuad(double fraction) Quadratic ease-in-out. -
easeInOutExpo
public static double easeInOutExpo(double fraction) Exponential ease-in-out. -
easeInOutSine
public static double easeInOutSine(double fraction) Sine ease-in-out. -
nowNanos
public static long nowNanos()Monotonic timestamp suitable for animations. -
getProgressNanos
public static double getProgressNanos(long startNanos, long durationMillis) Progress based onSystem.nanoTime(). -
isFinishedNanos
public static boolean isFinishedNanos(long startNanos, long durationMillis) Returns true once progress reaches 1.0. -
getEasedProgressNanos
public static double getEasedProgressNanos(long startNanos, long durationMillis) Convenience: cubic eased progress. -
getEasedProgressNanos
public static double getEasedProgressNanos(long startNanos, long durationMillis, AnimationUtils.EasingType easingType) Convenience: eased progress with selectable easing.
-