blob: 4a5095bf379a13b423c19574e66bfeb5c18d58a1 [file] [log] [blame]
package com.airbnb.lottie.parser;
import com.airbnb.lottie.parser.moshi.JsonReader;
import com.airbnb.lottie.value.ScaleXY;
import java.io.IOException;
public class ScaleXYParser implements ValueParser<ScaleXY> {
public static final ScaleXYParser INSTANCE = new ScaleXYParser();
private ScaleXYParser() {
}
@Override public ScaleXY parse(JsonReader reader, float scale) throws IOException {
boolean isArray = reader.peek() == JsonReader.Token.BEGIN_ARRAY;
if (isArray) {
reader.beginArray();
}
float sx = reader.nextFloat();
float sy = reader.nextFloat();
while (reader.hasNext()) {
reader.skipValue();
}
if (isArray) {
reader.endArray();
}
return new ScaleXY(sx / 100f * scale, sy / 100f * scale);
}
}