Search in sources :

Example 1 with LottieFrameInfo

use of com.airbnb.lottie.value.LottieFrameInfo in project lottie-android by airbnb.

the class TextKeyframeAnimation method setStringValueCallback.

public void setStringValueCallback(LottieValueCallback<String> valueCallback) {
    final LottieFrameInfo<String> stringFrameInfo = new LottieFrameInfo<>();
    final DocumentData documentData = new DocumentData();
    super.setValueCallback(new LottieValueCallback<DocumentData>() {

        @Override
        public DocumentData getValue(LottieFrameInfo<DocumentData> frameInfo) {
            stringFrameInfo.set(frameInfo.getStartFrame(), frameInfo.getEndFrame(), frameInfo.getStartValue().text, frameInfo.getEndValue().text, frameInfo.getLinearKeyframeProgress(), frameInfo.getInterpolatedKeyframeProgress(), frameInfo.getOverallProgress());
            String text = valueCallback.getValue(stringFrameInfo);
            DocumentData baseDocumentData = frameInfo.getInterpolatedKeyframeProgress() == 1f ? frameInfo.getEndValue() : frameInfo.getStartValue();
            documentData.set(text, baseDocumentData.fontName, baseDocumentData.size, baseDocumentData.justification, baseDocumentData.tracking, baseDocumentData.lineHeight, baseDocumentData.baselineShift, baseDocumentData.color, baseDocumentData.strokeColor, baseDocumentData.strokeWidth, baseDocumentData.strokeOverFill);
            return documentData;
        }
    });
}
Also used : LottieFrameInfo(com.airbnb.lottie.value.LottieFrameInfo) DocumentData(com.airbnb.lottie.model.DocumentData)

Aggregations

DocumentData (com.airbnb.lottie.model.DocumentData)1 LottieFrameInfo (com.airbnb.lottie.value.LottieFrameInfo)1