public void update() { if (isInMotion()) { Set<Motion> toRemove = new HashSet<Motion>(); for (Motion m : tweens) { if (!m.isPlaying()) { if (m.getPosition() == 0) { m.play(); } else { toRemove.add(m); } } else { m.update(); } } for (Motion m : toRemove) { tweens.remove(m); } } }
public boolean isInMotion() { return !tweens.isEmpty(); }