Table of Contents

Class Interpolation

Namespace
PlumJsonAnimator.Services
Assembly
PlumJsonAnimator.dll

Provides interpolation methods for animations and method for finding interpolation parameter t.

public class Interpolation
Inheritance
Interpolation
Inherited Members

Methods

angleInterpolation(double, double, double)

Angle interpolation with shortest path (handles 360° wrap-around)

public double angleInterpolation(double start, double end, double t)

Parameters

start double

Start angle in degrees

end double

End angle in degrees

t double

Interpolation parameter (0 to 1)

Returns

double

Examples

new Interpolation().angleInterpolation(350, 10, 0.5);

findInterpolateParam(double, double)

Calculates interpolation parameter t from elapsed time

public double findInterpolateParam(double segmentDuration, double timeElapsed)

Parameters

segmentDuration double

Total duration in ms

timeElapsed double

Time passed in ms

Returns

double

t value clamped between 0 and 1

Examples

new Interpolation().findInterpolateParam(10, 6); //Returns 0.6

linearInterpolation(double, double, double)

Linear interpolation between two values

public double linearInterpolation(double start, double end, double t)

Parameters

start double

Start value at t=0

end double

End value at t=1

t double

Interpolation parameter (0 to 1)

Returns

double

Examples

new Interpolation().linearInterpolation(20, 40, 0.5);