-
Notifications
You must be signed in to change notification settings - Fork 339
Expand file tree
/
Copy pathSmoothInterpolator.java
More file actions
46 lines (39 loc) · 1.5 KB
/
SmoothInterpolator.java
File metadata and controls
46 lines (39 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Copyright (C) 2012 United States Government as represented by the Administrator of the
* National Aeronautics and Space Administration.
* All Rights Reserved.
*/
package gov.nasa.worldwind.animation;
/**
* @author jym
* @version $Id: SmoothInterpolator.java 1171 2013-02-11 21:45:02Z dcollins $
*/
public class SmoothInterpolator extends ScheduledInterpolator
{
private boolean useMidZoom = true;
private final int MAX_SMOOTHING = 3;
private final double START = this.useMidZoom ? 0.0 : 0.6;
private final double STOP = 1.0;
public SmoothInterpolator(long lengthMillis)
{
super(lengthMillis);
}
public double nextInterpolant()
{
double interpolant = super.nextInterpolant();
return basicInterpolant(interpolant,
this.START, this.STOP, this.MAX_SMOOTHING);
}
protected static double basicInterpolant(double interpolant, double startInterpolant,
double stopInterpolant,
int maxSmoothing)
{
double normalizedInterpolant = AnimationSupport.interpolantNormalized(interpolant, startInterpolant,
stopInterpolant);
return AnimationSupport.interpolantSmoothed(normalizedInterpolant, maxSmoothing);
}
// ============== Helper Functions ======================= //
// ============== Helper Functions ======================= //
// ============== Helper Functions ======================= //
// Map amount range [startAmount, stopAmount] to [0, 1] when amount is inside range.
}