mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09: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;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public abstract class Animation {
|
public abstract class Animation {
|
||||||
|
private static boolean ENABLED = true;
|
||||||
|
|
||||||
private static final long TARGET_MILLIS_PER_FRAME = 30;
|
private static final long TARGET_MILLIS_PER_FRAME = 30;
|
||||||
|
|
||||||
private static Timer timer = new Timer("Animation", true);
|
private static Timer timer = new Timer("Animation", true);
|
||||||
|
@ -25,6 +27,18 @@ public abstract class Animation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animation (final long duration, long delay) {
|
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() {
|
timerTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run () {
|
public void run () {
|
||||||
|
@ -171,6 +185,12 @@ public abstract class Animation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void end () {
|
protected void end () {
|
||||||
|
if (!state) {
|
||||||
|
parent.toggleTransformed();
|
||||||
|
}
|
||||||
|
state = true;
|
||||||
|
panel.transformAngle = 0;
|
||||||
|
|
||||||
parent.onEndAnimation();
|
parent.onEndAnimation();
|
||||||
parent.repaint();
|
parent.repaint();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue