-
Notifications
You must be signed in to change notification settings - Fork 339
Expand file tree
/
Copy pathDoubleAnimator.java
More file actions
94 lines (79 loc) · 2.19 KB
/
DoubleAnimator.java
File metadata and controls
94 lines (79 loc) · 2.19 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* 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;
import gov.nasa.worldwind.util.*;
/**
* An {@link Animator} implentation for animating values of type Double.
*
* @author jym
* @version $Id: DoubleAnimator.java 1171 2013-02-11 21:45:02Z dcollins $
*/
public class DoubleAnimator extends BasicAnimator
{
protected double begin;
protected double end;
protected final PropertyAccessor.DoubleAccessor propertyAccessor;
public DoubleAnimator(Interpolator interpolator,
double begin, double end,
PropertyAccessor.DoubleAccessor propertyAccessor)
{
super(interpolator);
if (interpolator == null)
{
this.interpolator = new ScheduledInterpolator(10000);
}
if (propertyAccessor == null)
{
String message = Logging.getMessage("nullValue.ViewPropertyAccessorIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.begin = begin;
this.end = end;
this.propertyAccessor = propertyAccessor;
}
public void setBegin(Double begin)
{
this.begin = begin;
}
public void setEnd(Double end)
{
this.end = end;
}
public final Double getBegin()
{
return this.begin;
}
public final Double getEnd()
{
return this.end;
}
public final PropertyAccessor.DoubleAccessor getPropertyAccessor()
{
return this.propertyAccessor;
}
protected void setImpl(double interpolant)
{
Double newValue = this.nextDouble(interpolant);
if (newValue == null)
return;
boolean success = this.propertyAccessor.setDouble(newValue);
if (!success)
{
this.flagLastStateInvalid();
}
if (interpolant >= 1.0)
this.stop();
}
@SuppressWarnings({"UnusedDeclaration"})
public Double nextDouble(double interpolant)
{
return AnimationSupport.mixDouble(
interpolant,
this.begin,
this.end);
}
}