Added removeAction(), removeLayer() and removeCurrentAction() to AnimComposer (#1016)
* Added AnimComposer.removeAction() and AnimComposer.removeLayer() * Added javadoc for AnimComposer.setCurrentAction() * Moved removing of current action to a separate method. * Added javadoc for new methods.
This commit is contained in:
parent
9ded31cf1c
commit
6679873c9b
@ -68,17 +68,40 @@ public class AnimComposer extends AbstractControl {
|
||||
return setCurrentAction(name, DEFAULT_LAYER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run an action on specified layer.
|
||||
*
|
||||
* @param actionName The name of the action to run.
|
||||
* @param layerName The layer on which action should run.
|
||||
* @return The action corresponding to the given name.
|
||||
*/
|
||||
public Action setCurrentAction(String actionName, String layerName) {
|
||||
Layer l = layers.get(layerName);
|
||||
if (l == null) {
|
||||
throw new IllegalArgumentException("Unknown layer " + layerName);
|
||||
}
|
||||
|
||||
Action currentAction = action(actionName);
|
||||
l.time = 0;
|
||||
l.currentAction = currentAction;
|
||||
return currentAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove current action on specified layer.
|
||||
*
|
||||
* @param layerName The name of the layer we want to remove it's action.
|
||||
*/
|
||||
public void removeCurrentAction(String layerName) {
|
||||
Layer l = layers.get(layerName);
|
||||
if (l == null) {
|
||||
throw new IllegalArgumentException("Unknown layer " + layerName);
|
||||
}
|
||||
|
||||
l.time = 0;
|
||||
l.currentAction = null;
|
||||
}
|
||||
|
||||
public Action action(String name) {
|
||||
Action action = actions.get(name);
|
||||
if (action == null) {
|
||||
@ -102,12 +125,30 @@ public class AnimComposer extends AbstractControl {
|
||||
return actions.containsKey(name);
|
||||
}
|
||||
|
||||
public void makeLayer(String name, AnimationMask mask){
|
||||
/**
|
||||
* Remove specified action.
|
||||
*
|
||||
* @param name The name of the action to remove.
|
||||
* @return The removed action.
|
||||
*/
|
||||
public Action removeAction(String name) {
|
||||
return actions.remove(name);
|
||||
}
|
||||
|
||||
public void makeLayer(String name, AnimationMask mask) {
|
||||
Layer l = new Layer();
|
||||
l.mask = mask;
|
||||
layers.put(name, l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove specified layer. This will stop the current action on this layer.
|
||||
*
|
||||
* @param name The name of the layer to remove.
|
||||
*/
|
||||
public void removeLayer(String name) {
|
||||
layers.remove(name);
|
||||
}
|
||||
|
||||
public BaseAction actionSequence(String name, Tween... tweens) {
|
||||
BaseAction action = new BaseAction(Tweens.sequence(tweens));
|
||||
|
Loading…
x
Reference in New Issue
Block a user