Search in sources :

Example 1 with AnimatableSplitDimensionPathValue

use of com.airbnb.lottie.model.animatable.AnimatableSplitDimensionPathValue in project lottie-android by airbnb.

the class AnimatablePathValueParser method parseSplitPath.

/**
 * Returns either an {@link AnimatablePathValue} or an {@link AnimatableSplitDimensionPathValue}.
 */
static AnimatableValue<PointF, PointF> parseSplitPath(JsonReader reader, LottieComposition composition) throws IOException {
    AnimatablePathValue pathAnimation = null;
    AnimatableFloatValue xAnimation = null;
    AnimatableFloatValue yAnimation = null;
    boolean hasExpressions = false;
    reader.beginObject();
    while (reader.peek() != JsonReader.Token.END_OBJECT) {
        switch(reader.selectName(NAMES)) {
            case 0:
                pathAnimation = AnimatablePathValueParser.parse(reader, composition);
                break;
            case 1:
                if (reader.peek() == JsonReader.Token.STRING) {
                    hasExpressions = true;
                    reader.skipValue();
                } else {
                    xAnimation = AnimatableValueParser.parseFloat(reader, composition);
                }
                break;
            case 2:
                if (reader.peek() == JsonReader.Token.STRING) {
                    hasExpressions = true;
                    reader.skipValue();
                } else {
                    yAnimation = AnimatableValueParser.parseFloat(reader, composition);
                }
                break;
            default:
                reader.skipName();
                reader.skipValue();
        }
    }
    reader.endObject();
    if (hasExpressions) {
        composition.addWarning("Lottie doesn't support expressions.");
    }
    if (pathAnimation != null) {
        return pathAnimation;
    }
    return new AnimatableSplitDimensionPathValue(xAnimation, yAnimation);
}
Also used : AnimatableSplitDimensionPathValue(com.airbnb.lottie.model.animatable.AnimatableSplitDimensionPathValue) AnimatableFloatValue(com.airbnb.lottie.model.animatable.AnimatableFloatValue) AnimatablePathValue(com.airbnb.lottie.model.animatable.AnimatablePathValue)

Aggregations

AnimatableFloatValue (com.airbnb.lottie.model.animatable.AnimatableFloatValue)1 AnimatablePathValue (com.airbnb.lottie.model.animatable.AnimatablePathValue)1 AnimatableSplitDimensionPathValue (com.airbnb.lottie.model.animatable.AnimatableSplitDimensionPathValue)1