airbnb / lottie-ios

An iOS library to natively render After Effects vector animations
http://airbnb.io/lottie/
Apache License 2.0
25.65k stars 3.74k forks source link

Valid animation throws `invalidInput` #2222

Closed freak4pc closed 9 months ago

freak4pc commented 10 months ago

We noticed a specific animation file which worked under Lottie 4.2.0 doesn't work anymore in 4.3.3.

It throws an invalidInput error here, when trying to get the vertices of a bezier path, it seems. I tried to track down the exact cause but was a bit unsuccessful:

image

Being called from here:

image

I'm happy to share the animation JSON in a DM / private link to a maintainer of that's possible :)

This is the specific section it was trying to decode:

[
    {
        "i": {
            "x": 0.66700000000000004,
            "y": 1
        },
        "s": [
            {
                "i": [
                    [
                        -14.699999999999999,
                        24.600000000000001
                    ],
                    [
                        -6.0999999999999996,
                        8.5
                    ],
                    [
                        5.2999999999999998,
                        6
                    ],
                    [
                        -29.399999999999999,
                        10.4
                    ],
                    [
                        -2.8999999999999999,
                        18
                    ],
                    [
                        -38.200000000000003,
                        0.80000000000000004
                    ],
                    [
                        -14.199999999999999,
                        -7.9000000000000004
                    ],
                    [
                        24,
                        -16.899999999999999
                    ],
                    [
                        0.5,
                        -23.100000000000001
                    ],
                    [
                        -2.5,
                        -11.4
                    ],
                    [
                        17.800000000000001,
                        -38
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        6.0999999999999996,
                        -8.5
                    ],
                    [
                        -5.2999999999999998,
                        -6
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        2.8999999999999999,
                        -18
                    ],
                    [
                        38.200000000000003,
                        -0.80000000000000004
                    ],
                    [
                        14.199999999999999,
                        8
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -0.40000000000000002,
                        23.100000000000001
                    ],
                    [
                        2.5,
                        11.4
                    ],
                    [
                        -14.300000000000001,
                        30.5
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.10000000000000001,
                        0.10000000000000001
                    ]
                ],
                "v": [
                    [
                        -77.227999999999994,
                        55.143999999999998
                    ],
                    [
                        -79.927999999999997,
                        28.844000000000001
                    ],
                    [
                        -71.628,
                        13.744
                    ],
                    [
                        -59.828000000000003,
                        -31.556000000000001
                    ],
                    [
                        -80.028000000000006,
                        -64.055999999999997
                    ],
                    [
                        -20.827999999999999,
                        -83.055999999999997
                    ],
                    [
                        73.072000000000003,
                        -70.256
                    ],
                    [
                        67.072000000000003,
                        -29.756
                    ],
                    [
                        84.772000000000006,
                        -11.356
                    ],
                    [
                        67.872,
                        13.544
                    ],
                    [
                        73.072000000000003,
                        63.043999999999997
                    ],
                    [
                        -69.427999999999997,
                        80.244
                    ],
                    [
                        -80.727999999999994,
                        78.244
                    ]
                ]
            }
        ],
        "o": {
            "x": 0.87,
            "y": 0
        },
        "t": -7
    },
    {
        "i": {
            "x": 0,
            "y": 1
        },
        "s": [
            {
                "i": [
                    [
                        -14.699999999999999,
                        24.600000000000001
                    ],
                    [
                        -6.0999999999999996,
                        8.5
                    ],
                    [
                        5.2999999999999998,
                        6
                    ],
                    [
                        -15.818,
                        17.988
                    ],
                    [
                        -5.5499999999999998,
                        17.367000000000001
                    ],
                    [
                        -38.200000000000003,
                        0.80000000000000004
                    ],
                    [
                        -10.699999999999999,
                        -9.1989999999999998
                    ],
                    [
                        17.321999999999999,
                        -7.7320000000000002
                    ],
                    [
                        0.5,
                        -23.100000000000001
                    ],
                    [
                        -2.5,
                        -11.4
                    ],
                    [
                        17.800000000000001,
                        -38
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        6.0999999999999996,
                        -8.5
                    ],
                    [
                        -5.2999999999999998,
                        -6
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        5.4000000000000004,
                        -16.899000000000001
                    ],
                    [
                        38.200000000000003,
                        -0.80000000000000004
                    ],
                    [
                        14.199999999999999,
                        8
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -0.40000000000000002,
                        23.100000000000001
                    ],
                    [
                        2.5,
                        11.4
                    ],
                    [
                        -14.300000000000001,
                        30.5
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.10000000000000001,
                        0.10000000000000001
                    ]
                ],
                "v": [
                    [
                        -77.227999999999994,
                        55.143999999999998
                    ],
                    [
                        -79.927999999999997,
                        28.844000000000001
                    ],
                    [
                        -75.358000000000004,
                        11.278
                    ],
                    [
                        -72.613,
                        -34.112000000000002
                    ],
                    [
                        -80.028000000000006,
                        -64.055999999999997
                    ],
                    [
                        -15.327999999999999,
                        -90.555999999999997
                    ],
                    [
                        73.072000000000003,
                        -70.256
                    ],
                    [
                        74.503,
                        -32.884999999999998
                    ],
                    [
                        84.772000000000006,
                        -11.356
                    ],
                    [
                        69.888000000000005,
                        21.847000000000001
                    ],
                    [
                        73.072000000000003,
                        63.043999999999997
                    ],
                    [
                        -69.427999999999997,
                        80.244
                    ],
                    [
                        -80.727999999999994,
                        78.244
                    ]
                ]
            }
        ],
        "o": {
            "x": 0.33300000000000002,
            "y": 0
        },
        "t": 8
    },
    {
        "i": {
            "x": 0.61699999999999999,
            "y": 1
        },
        "s": [
            {
                "i": [
                    [
                        -15.223000000000001,
                        34.817
                    ],
                    [
                        -6.3170000000000002,
                        12.029999999999999
                    ],
                    [
                        5.4880000000000004,
                        8.4920000000000009
                    ],
                    [
                        -16.381,
                        25.460000000000001
                    ],
                    [
                        -3.0030000000000001,
                        25.475999999999999
                    ],
                    [
                        -39.564999999999998,
                        0.55100000000000005
                    ],
                    [
                        -14.705,
                        -11.180999999999999
                    ],
                    [
                        14.112,
                        -16.885999999999999
                    ],
                    [
                        0.51800000000000002,
                        -32.694000000000003
                    ],
                    [
                        -2.589,
                        -16.135000000000002
                    ],
                    [
                        18.446999999999999,
                        -53.774000000000001
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        6.3170000000000002,
                        -12.029999999999999
                    ],
                    [
                        -5.4880000000000004,
                        -8.4920000000000009
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        3.0030000000000001,
                        -25.475999999999999
                    ],
                    [
                        45.198,
                        -0.629
                    ],
                    [
                        15.808999999999999,
                        19.733000000000001
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -0.41399999999999998,
                        32.695
                    ],
                    [
                        2.589,
                        16.135000000000002
                    ],
                    [
                        -14.808,
                        43.167999999999999
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.104,
                        0.14199999999999999
                    ]
                ],
                "v": [
                    [
                        -74.198999999999998,
                        117.645
                    ],
                    [
                        -77.551000000000002,
                        83.238
                    ],
                    [
                        -69.712000000000003,
                        58.451999999999998
                    ],
                    [
                        -62.201000000000001,
                        -6.383
                    ],
                    [
                        -73.525999999999996,
                        -52.417000000000002
                    ],
                    [
                        -11.561,
                        -92.692999999999998
                    ],
                    [
                        73.805000000000007,
                        -73.477000000000004
                    ],
                    [
                        67.394999999999996,
                        -7.3300000000000001
                    ],
                    [
                        83.103999999999999,
                        31.052
                    ],
                    [
                        72.980000000000004,
                        69.682000000000002
                    ],
                    [
                        76.277000000000001,
                        127.991
                    ],
                    [
                        -71.290000000000006,
                        152.334
                    ],
                    [
                        -82.992000000000004,
                        149.50399999999999
                    ]
                ]
            }
        ],
        "o": {
            "x": 0.78500000000000003,
            "y": 0
        },
        "t": 23
    },
    {
        "i": {
            "x": 0.42899999999999999,
            "y": 1
        },
        "s": [
            {
                "i": [
                    [
                        -15.223000000000001,
                        24.600000000000001
                    ],
                    [
                        -6.3170000000000002,
                        8.5
                    ],
                    [
                        5.4880000000000004,
                        6
                    ],
                    [
                        -16.381,
                        17.988
                    ],
                    [
                        -3.0030000000000001,
                        18
                    ],
                    [
                        -39.564999999999998,
                        0.38900000000000001
                    ],
                    [
                        -14.705,
                        -7.9000000000000004
                    ],
                    [
                        14.112,
                        -11.930999999999999
                    ],
                    [
                        0.51800000000000002,
                        -23.100000000000001
                    ],
                    [
                        -2.589,
                        -11.4
                    ],
                    [
                        18.446999999999999,
                        -37.993000000000002
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        6.3170000000000002,
                        -8.5
                    ],
                    [
                        -5.4880000000000004,
                        -6
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        3.0030000000000001,
                        -18
                    ],
                    [
                        45.198,
                        -0.44500000000000001
                    ],
                    [
                        15.808999999999999,
                        13.942
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -0.41399999999999998,
                        23.100000000000001
                    ],
                    [
                        2.589,
                        11.4
                    ],
                    [
                        -14.808,
                        30.5
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.104,
                        0.10000000000000001
                    ]
                ],
                "v": [
                    [
                        -74.198999999999998,
                        55.734000000000002
                    ],
                    [
                        -77.551000000000002,
                        31.425000000000001
                    ],
                    [
                        -69.712000000000003,
                        13.913
                    ],
                    [
                        -62.201000000000001,
                        -31.896000000000001
                    ],
                    [
                        -73.525999999999996,
                        -64.421000000000006
                    ],
                    [
                        -11.561,
                        -92.878
                    ],
                    [
                        73.805000000000007,
                        -79.301000000000002
                    ],
                    [
                        67.394999999999996,
                        -32.564999999999998
                    ],
                    [
                        83.103999999999999,
                        -5.4470000000000001
                    ],
                    [
                        72.980000000000004,
                        21.847000000000001
                    ],
                    [
                        76.277000000000001,
                        63.043999999999997
                    ],
                    [
                        -71.290000000000006,
                        80.244
                    ],
                    [
                        -82.992000000000004,
                        78.244
                    ]
                ]
            }
        ],
        "o": {
            "x": 0.33300000000000002,
            "y": 0
        },
        "t": 31
    },
    {
        "i": {
            "x": 0.69299999999999995,
            "y": 0.67400000000000004
        },
        "s": [
            {
                "i": [
                    [
                        -14.356999999999999,
                        25.344999999999999
                    ],
                    [
                        -5.9569999999999999,
                        8.7579999999999991
                    ],
                    [
                        5.1760000000000002,
                        6.1820000000000004
                    ],
                    [
                        -15.449,
                        18.533000000000001
                    ],
                    [
                        -5.4199999999999999,
                        17.893000000000001
                    ],
                    [
                        -37.308,
                        0.82399999999999995
                    ],
                    [
                        -10.449999999999999,
                        -9.4779999999999998
                    ],
                    [
                        16.917000000000002,
                        -7.9660000000000002
                    ],
                    [
                        0.48799999999999999,
                        -23.800000000000001
                    ],
                    [
                        -2.4420000000000002,
                        -11.744999999999999
                    ],
                    [
                        17.396999999999998,
                        -39.145000000000003
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        5.9569999999999999,
                        -8.7579999999999991
                    ],
                    [
                        -5.1760000000000002,
                        -6.1820000000000004
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        5.274,
                        -17.411000000000001
                    ],
                    [
                        37.308,
                        -0.82399999999999995
                    ],
                    [
                        13.868,
                        8.2420000000000009
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -4.1989999999999998,
                        27.260999999999999
                    ],
                    [
                        2.4420000000000002,
                        11.744999999999999
                    ],
                    [
                        -13.965999999999999,
                        31.423999999999999
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.098000000000000004,
                        0.10299999999999999
                    ]
                ],
                "v": [
                    [
                        -75.570999999999998,
                        53.981000000000002
                    ],
                    [
                        -78.207999999999998,
                        26.884
                    ],
                    [
                        -73.745000000000005,
                        8.7850000000000001
                    ],
                    [
                        -71.063999999999993,
                        -37.979999999999997
                    ],
                    [
                        -78.305999999999997,
                        -68.831000000000003
                    ],
                    [
                        -15.117000000000001,
                        -96.134
                    ],
                    [
                        71.216999999999999,
                        -75.218999999999994
                    ],
                    [
                        72.614000000000004,
                        -36.715000000000003
                    ],
                    [
                        83.582999999999998,
                        -7.5259999999999998
                    ],
                    [
                        68.108000000000004,
                        19.675000000000001
                    ],
                    [
                        78.207999999999998,
                        63.180999999999997
                    ],
                    [
                        -67.953000000000003,
                        79.840999999999994
                    ],
                    [
                        -78.989000000000004,
                        77.781000000000006
                    ]
                ]
            }
        ],
        "o": {
            "x": 0.28399999999999997,
            "y": 0
        },
        "t": 43.192999999999998
    },
    {
        "i": {
            "x": 0.83299999999999996,
            "y": 1
        },
        "s": [
            {
                "i": [
                    [
                        -15.824,
                        24.600000000000001
                    ],
                    [
                        -6.5670000000000002,
                        8.5
                    ],
                    [
                        5.7050000000000001,
                        6
                    ],
                    [
                        -17.027999999999999,
                        17.988
                    ],
                    [
                        -3.1219999999999999,
                        18
                    ],
                    [
                        -41.128999999999998,
                        0.38900000000000001
                    ],
                    [
                        -15.286,
                        -7.9000000000000004
                    ],
                    [
                        14.67,
                        -11.930999999999999
                    ],
                    [
                        0.53800000000000003,
                        -23.100000000000001
                    ],
                    [
                        -2.6909999999999998,
                        -11.4
                    ],
                    [
                        19.175999999999998,
                        -37.993000000000002
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        6.5670000000000002,
                        -8.5
                    ],
                    [
                        -5.7050000000000001,
                        -6
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        3.1219999999999999,
                        -18
                    ],
                    [
                        46.984000000000002,
                        -0.44500000000000001
                    ],
                    [
                        16.433,
                        13.942
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -0.43099999999999999,
                        23.100000000000001
                    ],
                    [
                        2.6909999999999998,
                        11.4
                    ],
                    [
                        -15.394,
                        30.5
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.108,
                        0.10000000000000001
                    ]
                ],
                "v": [
                    [
                        -76.597999999999999,
                        55.734000000000002
                    ],
                    [
                        -80.081000000000003,
                        31.425000000000001
                    ],
                    [
                        -71.933000000000007,
                        13.913
                    ],
                    [
                        -64.125,
                        -31.896000000000001
                    ],
                    [
                        -75.897000000000006,
                        -64.421000000000006
                    ],
                    [
                        -11.484,
                        -92.878
                    ],
                    [
                        72.024000000000001,
                        -77.388000000000005
                    ],
                    [
                        70.593999999999994,
                        -32.564999999999998
                    ],
                    [
                        86.924000000000007,
                        -5.4470000000000001
                    ],
                    [
                        76.400000000000006,
                        21.847000000000001
                    ],
                    [
                        79.826999999999998,
                        63.043999999999997
                    ],
                    [
                        -73.572999999999993,
                        80.244
                    ],
                    [
                        -85.736999999999995,
                        78.244
                    ]
                ]
            }
        ],
        "o": {
            "x": 0.33300000000000002,
            "y": 0.51700000000000002
        },
        "t": 62
    },
    {
        "t": 69.5166015625,
        "s": [
            {
                "i": [
                    [
                        -15.824,
                        24.600000000000001
                    ],
                    [
                        -6.5670000000000002,
                        8.5
                    ],
                    [
                        5.7050000000000001,
                        6
                    ],
                    [
                        -17.027999999999999,
                        17.988
                    ],
                    [
                        -3.1219999999999999,
                        18
                    ],
                    [
                        -41.128999999999998,
                        0.38900000000000001
                    ],
                    [
                        -15.286,
                        -7.9000000000000004
                    ],
                    [
                        14.67,
                        -11.930999999999999
                    ],
                    [
                        0.53800000000000003,
                        -23.100000000000001
                    ],
                    [
                        -2.6909999999999998,
                        -11.4
                    ],
                    [
                        19.175999999999998,
                        -37.993000000000002
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0,
                        0
                    ]
                ],
                "c": true,
                "o": [
                    [
                        0,
                        0
                    ],
                    [
                        6.5670000000000002,
                        -8.5
                    ],
                    [
                        -5.7050000000000001,
                        -6
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        3.1219999999999999,
                        -18
                    ],
                    [
                        46.984000000000002,
                        -0.44500000000000001
                    ],
                    [
                        16.433,
                        13.942
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        -0.43099999999999999,
                        23.100000000000001
                    ],
                    [
                        2.6909999999999998,
                        11.4
                    ],
                    [
                        -15.394,
                        30.5
                    ],
                    [
                        0,
                        0
                    ],
                    [
                        0.108,
                        0.10000000000000001
                    ]
                ],
                "v": [
                    [
                        -76.597999999999999,
                        55.734000000000002
                    ],
                    [
                        -80.081000000000003,
                        31.425000000000001
                    ],
                    [
                        -71.933000000000007,
                        13.913
                    ],
                    [
                        -64.125,
                        -31.896000000000001
                    ],
                    [
                        -75.897000000000006,
                        -64.421000000000006
                    ],
                    [
                        -11.484,
                        -92.878
                    ],
                    [
                        72.024000000000001,
                        -77.388000000000005
                    ],
                    [
                        70.593999999999994,
                        -32.564999999999998
                    ],
                    [
                        86.924000000000007,
                        -5.4470000000000001
                    ],
                    [
                        76.400000000000006,
                        21.847000000000001
                    ],
                    [
                        79.826999999999998,
                        63.043999999999997
                    ],
                    [
                        -73.572999999999993,
                        80.244
                    ],
                    [
                        -85.736999999999995,
                        78.244
                    ]
                ]
            }
        ]
    }
]

Which Version of Lottie are you using?

Lottie 4.3.3

Expected Behavior

Animation plays without issues

Actual Behavior

Getting Error when decoding animation "email-verification": invalidInput

Animation JSON

I'm happy sending it to you in a DM if that's applicable but can't share it in a GH Issue

freak4pc commented 10 months ago

Maybe this is the cause? https://github.com/airbnb/lottie-ios/pull/2208

calda commented 10 months ago

Can you please send a full animation json file to me at cal@calstephens.tech? Thanks

freak4pc commented 10 months ago

@calda Done

freak4pc commented 10 months ago

Maybe this is the cause? #2208

Seems unrelated to this unfortunately

trifon0v commented 10 months ago

The same in our project. If we are trying to pass data animation to the Lottie, it throws an error. LottieAnimation.from(data: lottieAnimationData) Lottie.InitializableError.invalidInput

OmarJalil commented 10 months ago

Same thing here, same version

github-actions[bot] commented 10 months ago

This issue is stale because it is marked "can't reproduce" and has had no activity in the past week. Please comment with additional information, or this issue will be closed due to inactivity in one week.

freak4pc commented 10 months ago

Seems this is reproducible, @calda mind removing that label?

calda commented 10 months ago

Forgot to remove the label when you sent me the animation json, thanks

calda commented 9 months ago

@freak4pc, I tested this locally and this issue was indeed fixed by https://github.com/airbnb/lottie-ios/pull/2208. This animation loads and plays correctly on master, but fails to load if I revert https://github.com/airbnb/lottie-ios/pull/2208.

freak4pc commented 9 months ago

That's great, thank you ! 😊 😄

voghDev commented 4 months ago

Hello! We're having the same issue when updating from 3.2.1 to 4.4.2. The code we're running is the following

    private let splashAnimationView: LottieAnimationView = LottieAnimationView()
    ...

    splashAnimationView.animation = LottieAnimation.named("Splash", bundle: componentsBundle)

This was working correctly and after the update came with:

Error when decoding animation "Splash": invalidInput(file: "/Users/user/path/to/the/project/Tuist/Dependencies/SwiftPackageManager/.build/checkouts/lottie-ios/Sources/Private/Model/Objects/Marker.swift", line: 16

Is this expected to fail with this error? Is there any other code we can try? Thank you so much 🫂

✅ [Update] Our problem was located in the Splash file. A "dr" field had a String value instead of Float. We had to manually change the file and it is now working.