public class Circle implements Drawing {
private File[] files;
private Image[] frames;
private int counter = 0;
private int speed = 5;
@Override
public void init(View view) {
files = new File[27];
frames = new Image[27];
for (int i = 0; i < 27; i++) {
String path = "/home/codemyst/Downloads/rickroll/frame_" + (i+1) + ".png";
files[i] = new File(path);
frames[i] = new Image(files[i].toURI().toString());
}
}
@Override
public void draw(View view) {
DrawingUtils.clear(view, new Color(0.1, 0.1, 0.1, 1f));
view.drawImageCentered(Vector.ZERO, frames[counter / speed]);
counter++;
if (counter > (frames.length - 1) * speed) counter = 0;
}
public static void main(String[] args) {
DrawingApplication.launch(640, 640);
}
}