public class BlendCameraAnimation {
private final int startFrame;
private final int endFrame;
private final int totalFrames;
private final List frames;
public BlendCameraAnimation(int startFrame, int endFrame, int totalFrames, List frames) {
this.startFrame = startFrame;
this.endFrame = endFrame;
this.totalFrames = totalFrames;
Vector clone = ((Frame)frames.get(0)).getLocation().clone();
this.frames = (List)frames.stream().map((f) -> {
f.getLocation().subtract(clone);
return f;
}).collect(Collectors.toList());
}
public int getStartFrame() {
return this.startFrame;
}
public int getEndFrame() {
return this.endFrame;
}
public int getTotalFrames() {
return this.totalFrames;
}
public List getFrames() {
return this.frames;
}
public BlendCameraAnimation clone() {
try {
return (BlendCameraAnimation)super.clone();
} catch (CloneNotSupportedException var2) {
return null;
}
}
public String toString() {
return "BlendCameraAnimation{startFrame=" + this.startFrame + ", endFrame=" + this.endFrame + ", totalFrames=" + this.totalFrames + ", frames=" + this.frames + '}';
}
public static BlendCameraAnimation parse(File file) throws IOException {
return parse((InputStream)(new FileInputStream(file)));
}
public static BlendCameraAnimation parse(InputStream file) throws IOException {
List strings = new ArrayList();
BufferedReader reader = new BufferedReader(new InputStreamReader(file, StandardCharsets.UTF_8));
Throwable var3 = null;
try {
while(true) {
String line = reader.readLine();
if (line == null) {
break;
}
strings.add(line);
}
} catch (Throwable var18) {
var3 = var18;
throw var18;
} finally {
if (reader != null) {
if (var3 != null) {
try {
reader.close();
} catch (Throwable var17) {
var3.addSuppressed(var17);
}
} else {
reader.close();
}
}
}
int seek = 0;
if (!((String)strings.get(seek++)).equals("AlixAnimations")) {
throw new UnsupportedDataTypeException("This is not an .animation file.");
} else {
int startFrame = Integer.parseInt((String)strings.get(seek++));
int endFrame = Integer.parseInt((String)strings.get(seek++));
int totalFrames = Integer.parseInt((String)strings.get(seek++));
List frames = new ArrayList();
List locations = new ArrayList();
List rotations = new ArrayList();
int totalMarkers;
for(totalMarkers = 0; totalMarkers < totalFrames; ++totalMarkers) {
locations.add(new float[]{Float.parseFloat((String)strings.get(seek++)), Float.parseFloat((String)strings.get(seek++)), Float.parseFloat((String)strings.get(seek++))});
rotations.add(new float[]{Float.parseFloat((String)strings.get(seek++)), Float.parseFloat((String)strings.get(seek++)), Float.parseFloat((String)strings.get(seek++))});
}
totalMarkers = Integer.parseInt((String)strings.get(seek++));
List markers = new ArrayList();
int i;
for(i = 0; i < totalMarkers; ++i) {
markers.add(new Marker((String)strings.get(seek++), Integer.parseInt((String)strings.get(seek++))));
}
for(i = 0; i < totalFrames; ++i) {
frames.add(new Frame((float[])locations.get(i), (float[])rotations.get(i), (List)markers.stream().filter((m) -> {
return m.getFrame() == i;
}).collect(Collectors.toList())));
}
return new BlendCameraAnimation(startFrame, endFrame, totalFrames, frames);
}
}
}