You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
873 B
41 lines
873 B
package visualiser.layout;
|
|
|
|
import javafx.animation.AnimationTimer;
|
|
import javafx.scene.shape.Mesh;
|
|
import javafx.scene.shape.MeshView;
|
|
|
|
/**
|
|
* Created by Gondr on 21/09/2017.
|
|
*/
|
|
public class Sails3D extends MeshView {
|
|
private int index = 0;
|
|
private boolean isLuffing = false;
|
|
|
|
public Sails3D() {
|
|
setMesh(Assets3D.sails[0].getMesh());
|
|
}
|
|
|
|
private AnimationTimer luff = new AnimationTimer() {
|
|
@Override
|
|
public void handle(long now) {
|
|
setMesh(Assets3D.sails[index].getMesh());
|
|
index = (index + 1) % 40;
|
|
}
|
|
};
|
|
|
|
public void startLuffing(){
|
|
luff.start();
|
|
isLuffing = true;
|
|
}
|
|
|
|
public void stopLuffing(){
|
|
luff.stop();
|
|
isLuffing = false;
|
|
setMesh(Assets3D.sails[0].getMesh());
|
|
}
|
|
|
|
public boolean isLuffing() {
|
|
return isLuffing;
|
|
}
|
|
}
|