Clip interpolators so they can't loop back on themselves (#1471)
Fixes #1457
diff --git a/LottieSample/src/main/assets/Tests/InterpolatorLoopBack.json b/LottieSample/src/main/assets/Tests/InterpolatorLoopBack.json
new file mode 100644
index 0000000..b9e70fc
--- /dev/null
+++ b/LottieSample/src/main/assets/Tests/InterpolatorLoopBack.json
@@ -0,0 +1,1533 @@
+{
+ "v": "5.1.16",
+ "fr": 60,
+ "ip": 218,
+ "op": 343,
+ "w": 1080,
+ "h": 1080,
+ "nm": "EVA - 01_Highlighting_02",
+ "ddd": 0,
+ "assets": [],
+ "layers": [
+ {
+ "ddd": 0,
+ "ind": 1,
+ "ty": 4,
+ "nm": "Antennae - 3",
+ "parent": 137,
+ "sr": 1,
+ "ks": {
+ "o": {
+ "a": 1,
+ "k": [
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 1
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_1_0"
+ ],
+ "t": 168.43,
+ "s": [
+ 0
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.163
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p163_0"
+ ],
+ "t": 169.293,
+ "s": [
+ 100
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 1
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_1_0"
+ ],
+ "t": 199.428,
+ "s": [
+ 100
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p167_0"
+ ],
+ "t": 200.289,
+ "s": [
+ 0
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.378
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p378_0"
+ ],
+ "t": 231.289,
+ "s": [
+ 0
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ -0.122
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 1
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "-0p122_1_1_0"
+ ],
+ "t": 231.43,
+ "s": [
+ 0
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.163
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_0p163_0"
+ ],
+ "t": 232.146,
+ "s": [
+ 100
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.163
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p163_0"
+ ],
+ "t": 232.293,
+ "s": [
+ 100
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 1
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_1_0"
+ ],
+ "t": 262.428,
+ "s": [
+ 100
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p167_0"
+ ],
+ "t": 263.289,
+ "s": [
+ 0
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.326
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p326_0"
+ ],
+ "t": 294.289,
+ "s": [
+ 0
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 1
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_1_0"
+ ],
+ "t": 294.43,
+ "s": [
+ 0
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.163
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_0p163_0"
+ ],
+ "t": 295.146,
+ "s": [
+ 100
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.163
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p163_0"
+ ],
+ "t": 295.293,
+ "s": [
+ 100
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 1
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0_1_1_0"
+ ],
+ "t": 325.428,
+ "s": [
+ 100
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p167_0"
+ ],
+ "t": 326.289,
+ "s": [
+ 0
+ ],
+ "e": [
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 1
+ ]
+ },
+ "o": {
+ "x": [
+ 0.326
+ ],
+ "y": [
+ 0
+ ]
+ },
+ "n": [
+ "0p833_1_0p326_0"
+ ],
+ "t": 357.289,
+ "s": [
+ 0
+ ],
+ "e": [
+ 100
+ ]
+ },
+ {
+ "t": 358.146484375
+ }
+ ],
+ "ix": 11
+ },
+ "r": {
+ "a": 0,
+ "k": 0,
+ "ix": 10
+ },
+ "p": {
+ "a": 1,
+ "k": [
+ {
+ "i": {
+ "x": 0.32,
+ "y": 1
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0
+ },
+ "n": "0p32_1_0p68_0",
+ "t": 168,
+ "s": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "e": [
+ 204.013,
+ -184.873,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.32,
+ "y": 1
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0
+ },
+ "n": "0p32_1_0p68_0",
+ "t": 199.428,
+ "s": [
+ 204.013,
+ -184.873,
+ 0
+ ],
+ "e": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.833,
+ "y": 0.833
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0.68
+ },
+ "n": "0p833_0p833_0p68_0p68",
+ "t": 230.857,
+ "s": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "e": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.32,
+ "y": 1
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0
+ },
+ "n": "0p32_1_0p68_0",
+ "t": 231,
+ "s": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "e": [
+ 204.013,
+ -184.873,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.32,
+ "y": 1
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0
+ },
+ "n": "0p32_1_0p68_0",
+ "t": 262.428,
+ "s": [
+ 204.013,
+ -184.873,
+ 0
+ ],
+ "e": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.833,
+ "y": 0.833
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0.68
+ },
+ "n": "0p833_0p833_0p68_0p68",
+ "t": 293.857,
+ "s": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "e": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.32,
+ "y": 1
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0
+ },
+ "n": "0p32_1_0p68_0",
+ "t": 294,
+ "s": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "e": [
+ 204.013,
+ -184.873,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "i": {
+ "x": 0.32,
+ "y": 1
+ },
+ "o": {
+ "x": 0.68,
+ "y": 0
+ },
+ "n": "0p32_1_0p68_0",
+ "t": 325.428,
+ "s": [
+ 204.013,
+ -184.873,
+ 0
+ ],
+ "e": [
+ -130.609,
+ 326.483,
+ 0
+ ],
+ "to": [
+ 0,
+ 0,
+ 0
+ ],
+ "ti": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "t": 356.857421875
+ }
+ ],
+ "ix": 2
+ },
+ "a": {
+ "a": 0,
+ "k": [
+ 154.113,
+ -226.331,
+ 0
+ ],
+ "ix": 1
+ },
+ "s": {
+ "a": 0,
+ "k": [
+ 183,
+ 183,
+ 100
+ ],
+ "ix": 6
+ }
+ },
+ "ao": 0,
+ "ef": [
+ {
+ "ty": 5,
+ "nm": "Warp Time",
+ "np": 7,
+ "mn": "ADBE Echo",
+ "ix": 1,
+ "en": 1,
+ "ef": [
+ {
+ "ty": 0,
+ "nm": "Echo Time (seconds)",
+ "mn": "ADBE Echo-0001",
+ "ix": 1,
+ "v": {
+ "a": 0,
+ "k": -0.001,
+ "ix": 1
+ }
+ },
+ {
+ "ty": 0,
+ "nm": "Number Of Echoes",
+ "mn": "ADBE Echo-0002",
+ "ix": 2,
+ "v": {
+ "a": 0,
+ "k": 25,
+ "ix": 2
+ }
+ },
+ {
+ "ty": 0,
+ "nm": "Starting Intensity",
+ "mn": "ADBE Echo-0003",
+ "ix": 3,
+ "v": {
+ "a": 0,
+ "k": 1,
+ "ix": 3
+ }
+ },
+ {
+ "ty": 0,
+ "nm": "Decay",
+ "mn": "ADBE Echo-0004",
+ "ix": 4,
+ "v": {
+ "a": 0,
+ "k": 1,
+ "ix": 4
+ }
+ },
+ {
+ "ty": 7,
+ "nm": "Echo Operator",
+ "mn": "ADBE Echo-0005",
+ "ix": 5,
+ "v": {
+ "a": 0,
+ "k": 2,
+ "ix": 5
+ }
+ }
+ ]
+ }
+ ],
+ "shapes": [
+ {
+ "ty": "gr",
+ "it": [
+ {
+ "ind": 0,
+ "ty": "sh",
+ "ix": 1,
+ "ks": {
+ "a": 0,
+ "k": {
+ "i": [
+ [
+ 5.822,
+ -8.033
+ ],
+ [
+ 8.033,
+ 5.822
+ ],
+ [
+ -5.822,
+ 8.033
+ ],
+ [
+ -8.033,
+ -5.822
+ ]
+ ],
+ "o": [
+ [
+ -5.822,
+ 8.033
+ ],
+ [
+ -8.033,
+ -5.822
+ ],
+ [
+ 5.822,
+ -8.033
+ ],
+ [
+ 8.033,
+ 5.822
+ ]
+ ],
+ "v": [
+ [
+ 168.658,
+ -215.789
+ ],
+ [
+ 143.571,
+ -211.786
+ ],
+ [
+ 139.568,
+ -236.874
+ ],
+ [
+ 164.656,
+ -240.876
+ ]
+ ],
+ "c": true
+ },
+ "ix": 2
+ },
+ "nm": "Path 1",
+ "mn": "ADBE Vector Shape - Group",
+ "hd": false
+ },
+ {
+ "ty": "fl",
+ "c": {
+ "a": 0,
+ "k": [
+ 0.176470592618,
+ 0.168627455831,
+ 0.321568638086,
+ 1
+ ],
+ "ix": 4
+ },
+ "o": {
+ "a": 0,
+ "k": 100,
+ "ix": 5
+ },
+ "r": 1,
+ "nm": "Fill 1",
+ "mn": "ADBE Vector Graphic - Fill",
+ "hd": false
+ },
+ {
+ "ty": "tr",
+ "p": {
+ "a": 0,
+ "k": [
+ 154.047,
+ -226.399
+ ],
+ "ix": 2
+ },
+ "a": {
+ "a": 0,
+ "k": [
+ 154.047,
+ -226.399
+ ],
+ "ix": 1
+ },
+ "s": {
+ "a": 1,
+ "k": [
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 168,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 250,
+ 250
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 183.713,
+ "s": [
+ 250,
+ 250
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 199.428,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 35,
+ 35
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 215.143,
+ "s": [
+ 35,
+ 35
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 230.857,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 231,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 250,
+ 250
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 246.713,
+ "s": [
+ 250,
+ 250
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 262.428,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 35,
+ 35
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 278.143,
+ "s": [
+ 35,
+ 35
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 293.857,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 294,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 250,
+ 250
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 309.713,
+ "s": [
+ 250,
+ 250
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 325.428,
+ "s": [
+ 100,
+ 100
+ ],
+ "e": [
+ 35,
+ 35
+ ]
+ },
+ {
+ "i": {
+ "x": [
+ 0.833,
+ 0.833
+ ],
+ "y": [
+ 0.833,
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167,
+ 0.167
+ ],
+ "y": [
+ 0.167,
+ 0.167
+ ]
+ },
+ "n": [
+ "0p833_0p833_0p167_0p167",
+ "0p833_0p833_0p167_0p167"
+ ],
+ "t": 341.143,
+ "s": [
+ 35,
+ 35
+ ],
+ "e": [
+ 100,
+ 100
+ ]
+ },
+ {
+ "t": 356.857421875
+ }
+ ],
+ "ix": 3
+ },
+ "r": {
+ "a": 0,
+ "k": 0,
+ "ix": 6
+ },
+ "o": {
+ "a": 0,
+ "k": 100,
+ "ix": 7
+ },
+ "sk": {
+ "a": 0,
+ "k": 0,
+ "ix": 4
+ },
+ "sa": {
+ "a": 0,
+ "k": 0,
+ "ix": 5
+ },
+ "nm": "Transform"
+ }
+ ],
+ "nm": "Group 1",
+ "np": 2,
+ "cix": 2,
+ "ix": 1,
+ "mn": "ADBE Vector Group",
+ "hd": false
+ }
+ ],
+ "ip": -50,
+ "op": 685,
+ "st": -50,
+ "bm": 0
+ }
+ ],
+ "markers": [
+ {
+ "tm": 218,
+ "cm": "1",
+ "dr": 0
+ },
+ {
+ "tm": 290,
+ "cm": "",
+ "dr": 0
+ },
+ {
+ "tm": 341,
+ "cm": "2",
+ "dr": 0
+ },
+ {
+ "tm": 404,
+ "cm": "",
+ "dr": 0
+ }
+ ]
+}
\ No newline at end of file
diff --git a/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java b/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java
index 8cd45ba..dada31b 100644
--- a/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java
+++ b/lottie/src/main/java/com/airbnb/lottie/parser/KeyframeParser.java
@@ -137,8 +137,23 @@
interpolator = interpolatorRef.get();
}
if (interpolatorRef == null || interpolator == null) {
- interpolator = PathInterpolatorCompat.create(
- cp1.x / scale, cp1.y / scale, cp2.x / scale, cp2.y / scale);
+ cp1.x /= scale;
+ cp1.y /= scale;
+ cp2.x /= scale;
+ cp2.y /= scale;
+ try {
+ interpolator = PathInterpolatorCompat.create(cp1.x, cp1.y, cp2.x, cp2.y);
+ } catch (IllegalArgumentException e) {
+ if (e.getMessage().equals("The Path cannot loop back on itself.")) {
+ // If a control point extends beyond the previous/next point then it will cause the value of the interpolator to no
+ // longer monotonously increase. This clips the control point bounds to prevent that from happening.
+ // NOTE: this will make the rendered animation behave slightly differently than the original.
+ interpolator = PathInterpolatorCompat.create(Math.min(cp1.x, 1f), cp1.y, Math.max(cp2.x, 0f), cp2.y);
+ } else {
+ // We failed to create the interpolator. Fall back to linear.
+ interpolator = new LinearInterpolator();
+ }
+ }
try {
putInterpolator(hash, new WeakReference<>(interpolator));
} catch (ArrayIndexOutOfBoundsException e) {