Finished up lobby menu. Set split pane to not change size on resize. Disabled divider on split pane. Added quit button and start button (start only prints to terminal for now). Panes are now wrapped in an anchor pane to fix resizing issues. TODO: Will be working on making a nicer background animation.
parent
c63403d1de
commit
0621e1bdb1
@ -1,53 +0,0 @@
|
||||
package visualiser.model;
|
||||
|
||||
import javafx.animation.Interpolator;
|
||||
import javafx.animation.Transition;
|
||||
import javafx.geometry.Rectangle2D;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.util.Duration;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Created by zwu18 on 29/08/17.
|
||||
*/
|
||||
public class SpriteAnimation extends Transition {
|
||||
|
||||
private final ImageView imageView;
|
||||
private final int count;
|
||||
private final int columns;
|
||||
private final int offsetX;
|
||||
private final int offsetY;
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
private int lastIndex;
|
||||
|
||||
public SpriteAnimation(
|
||||
ImageView imageView,
|
||||
Duration duration,
|
||||
int count, int columns,
|
||||
int offsetX, int offsetY,
|
||||
int width, int height) {
|
||||
this.imageView = imageView;
|
||||
this.count = count;
|
||||
this.columns = columns;
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
setCycleDuration(duration);
|
||||
setInterpolator(Interpolator.LINEAR);
|
||||
}
|
||||
|
||||
protected void interpolate(double k) {
|
||||
final int index = Math.min((int) Math.floor(k * count), count - 1);
|
||||
if (index != lastIndex) {
|
||||
final int x = (index % columns) * width + offsetX;
|
||||
final int y = (index / columns) * height + offsetY;
|
||||
imageView.setViewport(new Rectangle2D(x, y, width, height));
|
||||
lastIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue