-
Notifications
You must be signed in to change notification settings - Fork 341
Expand file tree
/
Copy pathAnimationController.java
More file actions
105 lines (92 loc) · 2.5 KB
/
AnimationController.java
File metadata and controls
105 lines (92 loc) · 2.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
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
95
96
97
98
99
100
101
102
103
104
105
/*
* 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 java.util.*;
/**
* The <code>AnimationController</code> class is a convenience class for managing a
* group of <code>Animators</code>.
*
* @author jym
* @version $Id: AnimationController.java 1171 2013-02-11 21:45:02Z dcollins $
*/
public class AnimationController extends
HashMap<Object, Animator>
{
/**
* Starts all of the <code>Animator</code>s in the map
*/
public void startAnimations()
{
Collection<Animator> animators = this.values();
for (Animator a : animators)
{
a.start();
}
}
/**
* Stops all of the <code>Animator</code>s in the map
*/
public void stopAnimations()
{
Collection<Animator> animators = this.values();
for (Animator a : animators)
{
a.stop();
}
}
/**
* Starts the animation associated with <code>animationName</code>
*
* @param animationName the name of the animation to be started.
*/
public void startAnimation(Object animationName)
{
this.get(animationName).start();
}
/**
* Stops the <code>Animator</code> associated with <code>animationName</code>
* @param animationName the name of the animation to be stopped
*/
public void stopAnimation(Object animationName)
{
this.get(animationName).stop();
}
/**
* Stops all <code>Animator</code>s in the map.
* @return true if any <code>Animator</code> was started, false otherwise
*/
public boolean stepAnimators()
{
boolean didStep = false;
Collection<Animator> animators = this.values();
for (Animator a : animators)
{
if (a.hasNext())
{
didStep = true;
a.next();
}
}
return didStep;
}
/**
* Returns <code>true</code> if the controller has any active <code>Animations</code>
*
* @return true if there are any active animations in this <code>CompountAnimation</code>
*/
public boolean hasActiveAnimation()
{
Collection<Animator> animators = this.values();
for (Animator a : animators)
{
if (a.hasNext())
{
return true;
}
}
return false;
}
}