mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Add support for disabling animations
This commit is contained in:
parent
b8e5f5f942
commit
053580c412
1 changed files with 20 additions and 0 deletions
|
@ -8,6 +8,8 @@ import java.util.Timer;
|
|||
import java.util.TimerTask;
|
||||
|
||||
public abstract class Animation {
|
||||
private static boolean ENABLED = true;
|
||||
|
||||
private static final long TARGET_MILLIS_PER_FRAME = 30;
|
||||
|
||||
private static Timer timer = new Timer("Animation", true);
|
||||
|
@ -25,6 +27,18 @@ public abstract class Animation {
|
|||
}
|
||||
|
||||
public Animation (final long duration, long delay) {
|
||||
if(!ENABLED) {
|
||||
UI.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run () {
|
||||
start();
|
||||
//update(1.0f);
|
||||
end();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run () {
|
||||
|
@ -171,6 +185,12 @@ public abstract class Animation {
|
|||
|
||||
@Override
|
||||
protected void end () {
|
||||
if (!state) {
|
||||
parent.toggleTransformed();
|
||||
}
|
||||
state = true;
|
||||
panel.transformAngle = 0;
|
||||
|
||||
parent.onEndAnimation();
|
||||
parent.repaint();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue