Compare commits

...

3 Commits

Author SHA1 Message Date
8881e357c6 Update changelog 2024-01-11 14:57:07 +01:00
1c665c7756 Small fixes (#331) 2024-01-11 13:41:39 +01:00
cad1806f2e Allow easing to go negative for bounce in/out (#330)
Don't clamp interpolated distance along path to 'progress' value between
0 and 1.

Bounce in / Bounce out easings can transform the `progress` to negative
values or values higher than 1. `getTangentForOffset` unfortunately
clamps the input to be between 0 and 1, so we need to handle the `t < 0`
and `t > 1` cases separately.
2024-01-11 12:14:40 +01:00
33 changed files with 1798 additions and 264 deletions

View File

@ -1,48 +1,22 @@
## 3.0.0-alpha.4 ## 3.0.0
- Add `backgroundLoading` parameter to `Lottie.asset|network|file|memory`. - Add `renderCache` parameter.
If `backgroundLoading` is true, the animation will be loaded in a background isolate.
This is useful for large animations that can take a long time to parse and block the UI work.
- Replace `enableRenderCache` with `renderCache: RenderCache.raster`.
The new enum `RenderCacheMode` allows to specify the cache behaviour:
- `RenderCacheMode.raster`: Cache the frames as rasterized images living in the GPU memory.
- `RenderCacheMode.drawingCommands`: Cache the frames as a list of graphical operations. This will only save CPU
work but will use a lot less memory.
## 3.0.0-alpha.3
- Reduce the max memory used when using `enableRenderCache` (now limited to 50MB)
- Allow to configure the memory with a global settings:
```dart
Lottie.renderCacheMaxMemory = 75000000;
```
## 3.0.0-alpha.2
- Implement auto-orient
- Add support for layer blend mode
- Require Flutter 3.16
## 3.0.0-alpha.1
- Add `enableRenderCache` parameter.
```dart ```dart
Lottie.asset('assets/complex_animation.json', Lottie.asset('assets/complex_animation.json',
enableRenderCache: true, renderCache: RenderCache.raster,
) )
``` ```
It allows to opt into a mode where the frames of the animation are rendered lazily in an offscreen cache. Opt-in to a special render mode where the frames of the animation are lazily rendered and kept in a cache.
Subsequent runs of the animation will be very cheap to render. Subsequent runs of the animation are cheaper to render.
This is useful is the animation is complex and can consume a lot of energy from the battery. There are 2 kinds of caches:
It's a trade-off to lower the CPU usage at the cost of an increased memory usage.
The render cache is managed internally and will release the memory once the animation is disposed. **RenderCache.raster**: keep the frame rasterized in the cache (as [dart:ui.Image]).
The cache is shared between all animations. If 2 `Lottie` widget are rendered at the same size, they will render only Subsequent runs of the animation are very cheap for both the CPU and GPU but it takes
once. a lot of memory.
**RenderCache.drawingCommands**: keep the frame as a list of graphical operations ([dart:ui.Picture]).
Any change in the configuration of the animation (delegates, frame rate etc...) will clear the cache. Subsequent runs of the animation are cheaper for the CPU but not for the GPU.
Any change in the size will invalidate the cache. The cache use the final size visible on the screen (with all
transforms applied).
- Allow to load Telegram Stickers (.tgs) - Allow to load Telegram Stickers (.tgs)
@ -54,7 +28,7 @@ Lottie.asset(
``` ```
- Expose a hook to customize how to decode zip archives. This is useful for dotlottie archives (.lottie) when we want - Expose a hook to customize how to decode zip archives. This is useful for dotlottie archives (.lottie) when we want
to specify a specific .json file inside the archive to specify a specific .json file inside the archive
```dart ```dart
Lottie.asset( Lottie.asset(
@ -69,9 +43,14 @@ Future<LottieComposition?> customDecoder(List<int> bytes) {
} }
``` ```
- Add `backgroundLoading` parameter to `Lottie.asset|network|file|memory`.
If `backgroundLoading` is true, the animation will be loaded in a background isolate.
This is useful for large animations that can take a long time to parse and block the UI work.
- Remove the name property from `LottieComposition` - Remove the name property from `LottieComposition`
- `imageProviderFactory` is not used in .zip file by default anymore. - `imageProviderFactory` is not used in .zip file by default anymore.
To restore the old behaviour, use: To restore the old behaviour, use:
```dart ```dart
Future<LottieComposition?> decoder(List<int> bytes) { Future<LottieComposition?> decoder(List<int> bytes) {
return LottieComposition.decodeZip(bytes, imageProviderFactory: imageProviderFactory); return LottieComposition.decodeZip(bytes, imageProviderFactory: imageProviderFactory);
@ -79,11 +58,31 @@ Future<LottieComposition?> decoder(List<int> bytes) {
Lottie.asset('anim.json', decoder: decoder) Lottie.asset('anim.json', decoder: decoder)
``` ```
- Disable gradient cache optimization when `ValueDelegate.gradientColor` is used - Disable gradient cache optimization when `ValueDelegate.gradientColor` is used
- Use `DefaultAssetBundle.of` in `AssetLottie` before fallback to `rootBundle` - Use `DefaultAssetBundle.of` in `AssetLottie` before fallback to `rootBundle`
- Add `BuildContext` optional parameter in `LottieProvider.load` - Add `BuildContext` optional parameter in `LottieProvider.load`
- Fixed varying opacity stops across keyframes in the same gradient - Fixed varying opacity stops across keyframes in the same gradient
- Fixed rounded corners for non-closed curves - Fixed rounded corners for non-closed curves
- Implement auto-orient
- Add support for layer blend mode
- Require Flutter 3.16
## 3.0.0-alpha.4
*See the latest 3.0.0 release*
## 3.0.0-alpha.3
*See the latest 3.0.0 release*
## 3.0.0-alpha.2
*See the latest 3.0.0 release*
## 3.0.0-alpha.1
*See the latest 3.0.0 release*
## 2.7.0 ## 2.7.0
- Support loading Fonts from a zip file - Support loading Fonts from a zip file

View File

@ -10,6 +10,8 @@ This repository is an unofficial conversion of the [Lottie-android](https://gith
It works on Android, iOS, macOS, linux, windows and web. It works on Android, iOS, macOS, linux, windows and web.
<a href="https://www.buymeacoffee.com/xvrh" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60" width="217"></a>
## Usage ## Usage
### Simple animation ### Simple animation

View File

@ -10,6 +10,8 @@ This repository is an unofficial conversion of the [Lottie-android](https://gith
It works on Android, iOS, macOS, linux, windows and web. It works on Android, iOS, macOS, linux, windows and web.
<a href="https://www.buymeacoffee.com/xvrh" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60" width="217"></a>
## Usage ## Usage
### Simple animation ### Simple animation

View File

@ -0,0 +1,898 @@
{
"v": "5.7.5",
"fr": 100,
"ip": 0,
"op": 400,
"w": 800,
"h": 1000,
"nm": "Comp 1",
"ddd": 0,
"assets": [],
"layers": [
{
"ddd": 0,
"ind": 0,
"ty": 4,
"nm": "Bounce out curve",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
}
},
"ao": 0,
"hd": false,
"shapes": [
{
"ty": "gr",
"hd": false,
"it": [
{
"ty": "rc",
"hd": false,
"d": 1,
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
}
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.21176470588235294,
0.9176470588235294,
1
],
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tm",
"s": {
"a": 0,
"k": 0,
"ix": 2
},
"e": {
"a": 0,
"k": 100,
"ix": 2
},
"o": {
"a": 0,
"k": 0,
"ix": 2
},
"m": 1,
"hd": false
},
{
"ty": "tr",
"hd": false,
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
510,
100
],
"i": {
"x": [
0.2
],
"y": [
1
]
},
"o": {
"x": [
0.5
],
"y": [
-0.5
]
},
"ti": [
-268.19047619047615,
-294.42857142857247
],
"to": [
-268.19047619047615,
238.90476190476068
]
},
{
"t": 400,
"s": [
510,
900
],
"i": {
"x": [
1
],
"y": [
1
]
},
"o": {
"x": [
0
],
"y": [
0
]
}
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"sk": {
"a": 0,
"k": 0,
"ix": 2
},
"sa": {
"a": 0,
"k": 0,
"ix": 2
}
}
]
}
],
"ip": 0,
"op": 401,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 1,
"ty": 4,
"nm": "Bounce in curve",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
}
},
"ao": 0,
"hd": false,
"shapes": [
{
"ty": "gr",
"hd": false,
"it": [
{
"ty": "rc",
"hd": false,
"d": 1,
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
}
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
1,
0.3411764705882353,
0.21176470588235294
],
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tm",
"s": {
"a": 0,
"k": 0,
"ix": 2
},
"e": {
"a": 0,
"k": 100,
"ix": 2
},
"o": {
"a": 0,
"k": 0,
"ix": 2
},
"m": 1,
"hd": false
},
{
"ty": "tr",
"hd": false,
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
360,
100
],
"i": {
"x": [
0.5
],
"y": [
1.5
]
},
"o": {
"x": [
0.8
],
"y": [
0
]
},
"ti": [
-268.19047619047615,
-294.42857142857247
],
"to": [
-268.19047619047615,
238.90476190476068
]
},
{
"t": 400,
"s": [
360,
900
],
"i": {
"x": [
1
],
"y": [
1
]
},
"o": {
"x": [
0
],
"y": [
0
]
}
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"sk": {
"a": 0,
"k": 0,
"ix": 2
},
"sa": {
"a": 0,
"k": 0,
"ix": 2
}
}
]
}
],
"ip": 0,
"op": 401,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 2,
"ty": 4,
"nm": "Bounce in",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
}
},
"ao": 0,
"hd": false,
"shapes": [
{
"ty": "gr",
"hd": false,
"it": [
{
"ty": "rc",
"hd": false,
"d": 1,
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
}
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
1,
0.7254901960784313,
0.5764705882352941
],
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tm",
"s": {
"a": 0,
"k": 0,
"ix": 2
},
"e": {
"a": 0,
"k": 100,
"ix": 2
},
"o": {
"a": 0,
"k": 0,
"ix": 2
},
"m": 1,
"hd": false
},
{
"ty": "tr",
"hd": false,
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
650,
100
],
"i": {
"x": [
0.5
],
"y": [
1.5
]
},
"o": {
"x": [
0.8
],
"y": [
0
]
}
},
{
"t": 400,
"s": [
650,
900
],
"i": {
"x": [
1
],
"y": [
1
]
},
"o": {
"x": [
0
],
"y": [
0
]
}
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"sk": {
"a": 0,
"k": 0,
"ix": 2
},
"sa": {
"a": 0,
"k": 0,
"ix": 2
}
}
]
}
],
"ip": 0,
"op": 401,
"st": 0,
"bm": 0
},
{
"ddd": 0,
"ind": 3,
"ty": 4,
"nm": "Bounce out",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
}
},
"ao": 0,
"hd": false,
"shapes": [
{
"ty": "gr",
"hd": false,
"it": [
{
"ty": "rc",
"hd": false,
"d": 1,
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"p": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
}
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
1,
0.8392156862745098,
0.25098039215686274
],
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"r": 1,
"bm": 0,
"nm": "Fill 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tm",
"s": {
"a": 0,
"k": 0,
"ix": 2
},
"e": {
"a": 0,
"k": 100,
"ix": 2
},
"o": {
"a": 0,
"k": 0,
"ix": 2
},
"m": 1,
"hd": false
},
{
"ty": "tr",
"hd": false,
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
150,
100
],
"i": {
"x": [
0.2
],
"y": [
1
]
},
"o": {
"x": [
0.5
],
"y": [
-0.5
]
}
},
{
"t": 400,
"s": [
150,
900
],
"i": {
"x": [
1
],
"y": [
1
]
},
"o": {
"x": [
0
],
"y": [
0
]
}
}
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 2
},
"s": {
"a": 0,
"k": [
100,
100
],
"ix": 2
},
"r": {
"a": 0,
"k": 0,
"ix": 2
},
"o": {
"a": 0,
"k": 100,
"ix": 2
},
"sk": {
"a": 0,
"k": 0,
"ix": 2
},
"sa": {
"a": 0,
"k": 0,
"ix": 2
}
}
]
}
],
"ip": 0,
"op": 401,
"st": 0,
"bm": 0
}
],
"markers": []
}

View File

@ -0,0 +1,522 @@
{
"v": "4.8.0",
"meta": {
"g": "LottieFiles AE 3.5.2",
"a": "",
"k": "",
"d": "",
"tc": "#000000"
},
"fr": 24,
"ip": 0,
"op": 6912,
"w": 312,
"h": 312,
"nm": "Master_1-4a- GREEN",
"ddd": 0,
"assets": [],
"layers": [
{
"ddd": 0,
"ind": 30,
"ty": 4,
"nm": "Background_Layers",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
158,
154,
0
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
50,
50,
100
],
"ix": 6
}
},
"ao": 0,
"shapes": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
149.841,
0
],
[
0,
-149.841
],
[
-149.841,
0
],
[
0,
149.841
]
],
"o": [
[
-149.841,
0
],
[
0,
149.841
],
[
149.841,
0
],
[
0,
-149.841
]
],
"v": [
[
0,
-271.311
],
[
-271.311,
0
],
[
0,
271.311
],
[
271.311,
0
]
],
"c": true
},
"ix": 2
},
"nm": "Path 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "st",
"c": {
"a": 0,
"k": [
1,
1,
1,
1
],
"ix": 3
},
"o": {
"a": 0,
"k": 100,
"ix": 4
},
"w": {
"a": 0,
"k": 0,
"ix": 5
},
"lc": 1,
"lj": 1,
"ml": 4,
"bm": 0,
"nm": "Stroke 1",
"mn": "ADBE Vector Graphic - Stroke",
"hd": false
},
{
"ty": "gf",
"o": {
"a": 0,
"k": 60,
"ix": 10
},
"r": 1,
"bm": 0,
"g": {
"p": 3,
"k": {
"a": 1,
"k": [
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 898.499,
"s": [
0.799,
0.988,
0.875,
0.435,
0.9,
0.994,
0.937,
0.718,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 1112.312,
"s": [
0.799,
0.988,
0.875,
0.435,
0.9,
0.994,
0.937,
0.718,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 1330.13,
"s": [
0.799,
0.828,
0.855,
0.554,
0.9,
0.914,
0.928,
0.777,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 1420.621,
"s": [
0.799,
0.761,
0.847,
0.604,
0.9,
0.88,
0.924,
0.802,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 4054.455,
"s": [
0.799,
0.761,
0.847,
0.604,
0.9,
0.88,
0.924,
0.802,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 4311.512,
"s": [
0.799,
0.675,
0.859,
0.894,
0.9,
0.837,
0.929,
0.947,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"i": {
"x": 0.833,
"y": 0.833
},
"o": {
"x": 0.167,
"y": 0.167
},
"t": 6439.239,
"s": [
0.799,
0.675,
0.859,
0.894,
0.9,
0.837,
0.929,
0.947,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
},
{
"t": 6672.2724609375,
"s": [
0.799,
0.71,
0.098,
0.392,
0.9,
0.855,
0.549,
0.696,
1,
1,
1,
1,
0.072,
1,
0.536,
0.5,
1,
0
]
}
],
"ix": 9
}
},
"s": {
"a": 0,
"k": [
0.798,
1.032
],
"ix": 5
},
"e": {
"a": 0,
"k": [
244.484,
0
],
"ix": 6
},
"t": 2,
"h": {
"a": 0,
"k": 0,
"ix": 7
},
"a": {
"a": 0,
"k": 0,
"ix": 8
},
"nm": "Gradient Fill 1",
"mn": "ADBE Vector Graphic - G-Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
-4.865,
2.221
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
108.71,
108.71
],
"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": "Transformieren"
}
],
"nm": "Ellipse 1",
"np": 3,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
}
],
"ip": -8.80880880880881,
"op": 7462.66266266266,
"st": -8.80880880880881,
"bm": 0
}
],
"markers": []
}

View File

@ -0,0 +1,222 @@
{
"v": "5.9.1",
"fr": 25,
"ip": 0,
"op": 75,
"w": 1200,
"h": 1200,
"nm": "square",
"ddd": 0,
"assets": [],
"layers": [
{
"ddd": 0,
"ind": 15,
"ty": 4,
"nm": "Fond Silhouettes",
"sr": 1,
"ks": {
"o": {
"a": 0,
"k": 100,
"ix": 11
},
"r": {
"a": 0,
"k": 0,
"ix": 10
},
"p": {
"a": 0,
"k": [
600,
600,
0
],
"ix": 2,
"l": 2
},
"a": {
"a": 0,
"k": [
600,
600,
0
],
"ix": 1,
"l": 2
},
"s": {
"a": 0,
"k": [
100,
100,
100
],
"ix": 6,
"l": 2
}
},
"ao": 0,
"shapes": [
{
"ty": "gr",
"it": [
{
"ind": 0,
"ty": "sh",
"ix": 1,
"ks": {
"a": 0,
"k": {
"i": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"o": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"v": [
[
-600,
600
],
[
600,
600
],
[
600,
-600
],
[
-600,
-600
]
],
"c": true
},
"ix": 2
},
"nm": "Tracé 1",
"mn": "ADBE Vector Shape - Group",
"hd": false
},
{
"ty": "fl",
"c": {
"a": 0,
"k": [
0.561497886508,
0.699996708889,
0.56712066052,
1
],
"ix": 4
},
"o": {
"a": 0,
"k": 100,
"ix": 5
},
"r": 1,
"bm": 0,
"nm": "Fond 1",
"mn": "ADBE Vector Graphic - Fill",
"hd": false
},
{
"ty": "tr",
"p": {
"a": 0,
"k": [
600,
600
],
"ix": 2
},
"a": {
"a": 0,
"k": [
0,
0
],
"ix": 1
},
"s": {
"a": 0,
"k": [
100,
100
],
"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": "Transformer "
}
],
"nm": "Groupe 1",
"np": 2,
"cix": 2,
"bm": 0,
"ix": 1,
"mn": "ADBE Vector Group",
"hd": false
}
],
"ip": 0,
"op": 76,
"st": 0,
"bm": 0
}
],
"markers": []
}

File diff suppressed because one or more lines are too long

View File

@ -5,10 +5,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.4.9" version: "3.4.10"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -161,7 +161,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "3.0.0-alpha.4" version: "3.0.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -198,18 +198,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: path_provider name: path_provider
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.2"
path_provider_foundation: path_provider_foundation:
dependency: transitive dependency: transitive
description: description:
@ -230,10 +230,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
@ -246,18 +246,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.3" version: "3.1.4"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.7" version: "2.1.8"
pointycastle: pointycastle:
dependency: transitive dependency: transitive
description: description:
@ -347,18 +347,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.1" version: "5.2.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.3" version: "1.0.4"
sdks: sdks:
dart: ">=3.2.0 <4.0.0" dart: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0" flutter: ">=3.16.0"

View File

@ -14,7 +14,6 @@ import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/dash_path.dart'; import '../../utils/dash_path.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../utils/utils.dart'; import '../../utils/utils.dart';
import '../../value/drop_shadow.dart'; import '../../value/drop_shadow.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
@ -29,8 +28,8 @@ import 'trim_path_content.dart';
abstract class BaseStrokeContent abstract class BaseStrokeContent
implements KeyPathElementContent, DrawingContent { implements KeyPathElementContent, DrawingContent {
final Path _path = PathFactory.create(); final Path _path = Path();
final Path _trimPathPath = PathFactory.create(); final Path _trimPathPath = Path();
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final BaseLayer layer; final BaseLayer layer;
final List<_PathGroup> _pathGroups = <_PathGroup>[]; final List<_PathGroup> _pathGroups = <_PathGroup>[];

View File

@ -8,7 +8,6 @@ import '../../model/key_path.dart';
import '../../model/key_path_element.dart'; import '../../model/key_path_element.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/path_factory.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/transform_keyframe_animation.dart'; import '../keyframe/transform_keyframe_animation.dart';
import 'content.dart'; import 'content.dart';
@ -42,7 +41,7 @@ class ContentGroup implements DrawingContent, PathContent, KeyPathElement {
} }
final Matrix4 _matrix = Matrix4.identity(); final Matrix4 _matrix = Matrix4.identity();
final Path _path = PathFactory.create(); final Path _path = Path();
@override @override
final String? name; final String? name;

View File

@ -7,7 +7,6 @@ import '../../model/key_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/base_keyframe_animation.dart'; import '../keyframe/base_keyframe_animation.dart';
import 'compound_trim_path_content.dart'; import 'compound_trim_path_content.dart';
@ -19,7 +18,7 @@ import 'trim_path_content.dart';
class EllipseContent implements PathContent, KeyPathElementContent { class EllipseContent implements PathContent, KeyPathElementContent {
static const _ellipseControlPointPercentage = 0.55228; static const _ellipseControlPointPercentage = 0.55228;
final Path _path = PathFactory.create(); final Path _path = Path();
@override @override
final String? name; final String? name;

View File

@ -9,7 +9,6 @@ import '../../model/key_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/drop_shadow.dart'; import '../../value/drop_shadow.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/base_keyframe_animation.dart'; import '../keyframe/base_keyframe_animation.dart';
@ -21,7 +20,7 @@ import 'key_path_element_content.dart';
import 'path_content.dart'; import 'path_content.dart';
class FillContent implements DrawingContent, KeyPathElementContent { class FillContent implements DrawingContent, KeyPathElementContent {
final Path _path = PathFactory.create(); final Path _path = Path();
final BaseLayer layer; final BaseLayer layer;
@override @override
final String? name; final String? name;

View File

@ -11,7 +11,6 @@ import '../../model/key_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/drop_shadow.dart'; import '../../value/drop_shadow.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/base_keyframe_animation.dart'; import '../keyframe/base_keyframe_animation.dart';
@ -29,7 +28,7 @@ class GradientFillContent implements DrawingContent, KeyPathElementContent {
final GradientFill _fill; final GradientFill _fill;
final _linearGradientCache = <int, Gradient>{}; final _linearGradientCache = <int, Gradient>{};
final _radialGradientCache = <int, Gradient>{}; final _radialGradientCache = <int, Gradient>{};
final _path = PathFactory.create(); final _path = Path();
final _paint = Paint(); final _paint = Paint();
final _paths = <PathContent>[]; final _paths = <PathContent>[];
final BaseKeyframeAnimation<GradientColor, GradientColor> _colorAnimation; final BaseKeyframeAnimation<GradientColor, GradientColor> _colorAnimation;

View File

@ -1,16 +1,15 @@
import 'dart:ui'; import 'dart:ui';
import '../../model/content/merge_paths.dart'; import '../../model/content/merge_paths.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/path_factory.dart';
import 'content.dart'; import 'content.dart';
import 'content_group.dart'; import 'content_group.dart';
import 'greedy_content.dart'; import 'greedy_content.dart';
import 'path_content.dart'; import 'path_content.dart';
class MergePathsContent implements PathContent, GreedyContent { class MergePathsContent implements PathContent, GreedyContent {
final Path _firstPath = PathFactory.create(); final Path _firstPath = Path();
final Path _remainderPath = PathFactory.create(); final Path _remainderPath = Path();
final Path _path = PathFactory.create(); final Path _path = Path();
final List<PathContent> _pathContents = <PathContent>[]; final List<PathContent> _pathContents = <PathContent>[];
final MergePaths _mergePaths; final MergePaths _mergePaths;

View File

@ -8,7 +8,6 @@ import '../../model/content/shape_trim_path.dart';
import '../../model/key_path.dart'; import '../../model/key_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/base_keyframe_animation.dart'; import '../keyframe/base_keyframe_animation.dart';
import 'compound_trim_path_content.dart'; import 'compound_trim_path_content.dart';
@ -24,7 +23,7 @@ class PolystarContent implements PathContent, KeyPathElementContent {
/// work otherwise. /// work otherwise.
static const _polystarMagicNumber = .47829; static const _polystarMagicNumber = .47829;
static const _polygonMagicNumber = .25; static const _polygonMagicNumber = .25;
final _path = PathFactory.create(); final _path = Path();
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final PolystarShape _polystarShape; final PolystarShape _polystarShape;

View File

@ -8,7 +8,6 @@ import '../../model/content/shape_trim_path.dart';
import '../../model/key_path.dart'; import '../../model/key_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/base_keyframe_animation.dart'; import '../keyframe/base_keyframe_animation.dart';
import 'compound_trim_path_content.dart'; import 'compound_trim_path_content.dart';
@ -19,7 +18,7 @@ import 'rounded_corners_content.dart';
import 'trim_path_content.dart'; import 'trim_path_content.dart';
class RectangleContent implements KeyPathElementContent, PathContent { class RectangleContent implements KeyPathElementContent, PathContent {
final _path = PathFactory.create(); final _path = Path();
@override @override
final String? name; final String? name;

View File

@ -7,7 +7,6 @@ import '../../model/key_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import '../keyframe/base_keyframe_animation.dart'; import '../keyframe/base_keyframe_animation.dart';
import '../keyframe/transform_keyframe_animation.dart'; import '../keyframe/transform_keyframe_animation.dart';
@ -25,7 +24,7 @@ class RepeaterContent
GreedyContent, GreedyContent,
KeyPathElementContent { KeyPathElementContent {
final Matrix4 _matrix = Matrix4.identity(); final Matrix4 _matrix = Matrix4.identity();
final _path = PathFactory.create(); final _path = Path();
final LottieDrawable lottieDrawable; final LottieDrawable lottieDrawable;
final BaseLayer layer; final BaseLayer layer;

View File

@ -4,7 +4,6 @@ import '../../model/content/shape_path.dart';
import '../../model/content/shape_trim_path.dart'; import '../../model/content/shape_trim_path.dart';
import '../../model/layer/base_layer.dart'; import '../../model/layer/base_layer.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/path_factory.dart';
import '../keyframe/shape_keyframe_animation.dart'; import '../keyframe/shape_keyframe_animation.dart';
import 'compound_trim_path_content.dart'; import 'compound_trim_path_content.dart';
import 'content.dart'; import 'content.dart';
@ -13,7 +12,7 @@ import 'shape_modifier_content.dart';
import 'trim_path_content.dart'; import 'trim_path_content.dart';
class ShapeContent implements PathContent { class ShapeContent implements PathContent {
final _path = PathFactory.create(); final _path = Path();
final ShapePath _shape; final ShapePath _shape;

View File

@ -36,8 +36,22 @@ class PathKeyframeAnimation extends KeyframeAnimation<Offset> {
_pathMeasureKeyframe = pathKeyframe; _pathMeasureKeyframe = pathKeyframe;
} }
return _pathMeasure var length = _pathMeasure.length;
.getTangentForOffset(keyframeProgress * _pathMeasure.length)!
.position; // allow bounce easings to calculate positions outside the path
// by using the tangent at the extremities
if (keyframeProgress < 0) {
var tangent = _pathMeasure.getTangentForOffset(0)!;
return tangent.position + tangent.vector * (keyframeProgress * length);
} else if (keyframeProgress > 1) {
var tangent = _pathMeasure.getTangentForOffset(length)!;
return tangent.position +
tangent.vector * ((keyframeProgress - 1) * length);
} else {
return _pathMeasure
.getTangentForOffset(keyframeProgress * length)!
.position;
}
} }
} }

View File

@ -1,14 +1,13 @@
import 'dart:ui'; import 'dart:ui';
import '../../model/content/shape_data.dart'; import '../../model/content/shape_data.dart';
import '../../utils/misc.dart'; import '../../utils/misc.dart';
import '../../utils/path_factory.dart';
import '../../value/keyframe.dart'; import '../../value/keyframe.dart';
import '../content/shape_modifier_content.dart'; import '../content/shape_modifier_content.dart';
import 'base_keyframe_animation.dart'; import 'base_keyframe_animation.dart';
class ShapeKeyframeAnimation extends BaseKeyframeAnimation<ShapeData, Path> { class ShapeKeyframeAnimation extends BaseKeyframeAnimation<ShapeData, Path> {
final ShapeData _tempShapeData = ShapeData.empty(); final ShapeData _tempShapeData = ShapeData.empty();
final Path _tempPath = PathFactory.create(); final Path _tempPath = Path();
List<ShapeModifierContent>? _shapeModifiers; List<ShapeModifierContent>? _shapeModifiers;
ShapeKeyframeAnimation(super.keyframes); ShapeKeyframeAnimation(super.keyframes);
@ -16,7 +15,7 @@ class ShapeKeyframeAnimation extends BaseKeyframeAnimation<ShapeData, Path> {
@override @override
Path getValue(Keyframe<ShapeData> keyframe, double keyframeProgress) { Path getValue(Keyframe<ShapeData> keyframe, double keyframeProgress) {
var startShapeData = keyframe.startValue!; var startShapeData = keyframe.startValue!;
var endShapeData = keyframe.endValue!; var endShapeData = keyframe.endValue ?? startShapeData;
_tempShapeData.interpolateBetween( _tempShapeData.interpolateBetween(
startShapeData, endShapeData, keyframeProgress); startShapeData, endShapeData, keyframeProgress);

View File

@ -1,16 +1,32 @@
import 'dart:ui'; import 'dart:ui';
import '../../utils.dart';
import '../../utils/collection.dart'; import '../../utils/collection.dart';
import '../../utils/gamma_evaluator.dart'; import '../../utils/gamma_evaluator.dart';
// ignore_for_file: avoid_equals_and_hash_code_on_mutable_classes
class GradientColor { class GradientColor {
final List<double> positions; final List<double> positions;
final List<Color> colors; final List<Color> colors;
GradientColor(this.positions, this.colors); const GradientColor(this.positions, this.colors);
int get size => colors.length; int get size => colors.length;
void lerp(GradientColor gc1, GradientColor gc2, double progress) { void lerp(GradientColor gc1, GradientColor gc2, double progress) {
// Fast return in case start and end is the same
// or if progress is at start/end or out of [0,1] bounds
if (gc1 == gc2) {
_copyFrom(gc1);
return;
} else if (progress <= 0) {
_copyFrom(gc1);
return;
} else if (progress >= 1) {
_copyFrom(gc2);
return;
}
if (gc1.colors.length != gc2.colors.length) { if (gc1.colors.length != gc2.colors.length) {
throw Exception('Cannot interpolate between gradients. ' throw Exception('Cannot interpolate between gradients. '
'Lengths vary (${gc1.colors.length} vs ${gc2.colors.length})'); 'Lengths vary (${gc1.colors.length} vs ${gc2.colors.length})');
@ -59,4 +75,30 @@ class GradientColor {
var fraction = (position - startPosition) / (endPosition - startPosition); var fraction = (position - startPosition) / (endPosition - startPosition);
return GammaEvaluator.evaluate(fraction, startColor, endColor); return GammaEvaluator.evaluate(fraction, startColor, endColor);
} }
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other is! GradientColor) {
return false;
}
return const ListEquality<double>().equals(positions, other.positions) &&
const ListEquality<Color>().equals(colors, other.colors);
}
@override
int get hashCode {
var result = Object.hashAll(positions);
result = 31 * result + Object.hashAll(colors);
return result;
}
void _copyFrom(GradientColor other) {
for (var i = 0; i < other.colors.length; i++) {
positions[i] = other.positions[i];
colors[i] = other.colors[i];
}
}
} }

View File

@ -5,14 +5,13 @@ import '../../animation/keyframe/value_callback_keyframe_animation.dart';
import '../../lottie_drawable.dart'; import '../../lottie_drawable.dart';
import '../../lottie_property.dart'; import '../../lottie_property.dart';
import '../../utils.dart'; import '../../utils.dart';
import '../../utils/path_factory.dart';
import '../../value/lottie_value_callback.dart'; import '../../value/lottie_value_callback.dart';
import 'base_layer.dart'; import 'base_layer.dart';
import 'layer.dart'; import 'layer.dart';
class SolidLayer extends BaseLayer { class SolidLayer extends BaseLayer {
final Paint paint = Paint()..style = PaintingStyle.fill; final Paint paint = Paint()..style = PaintingStyle.fill;
final Path path = PathFactory.create(); final Path path = Path();
BaseKeyframeAnimation<ColorFilter, ColorFilter?>? _colorFilterAnimation; BaseKeyframeAnimation<ColorFilter, ColorFilter?>? _colorFilterAnimation;
BaseKeyframeAnimation<Color, Color?>? _colorAnimation; BaseKeyframeAnimation<Color, Color?>? _colorAnimation;
@ -29,6 +28,8 @@ class SolidLayer extends BaseLayer {
return; return;
} }
paint.color = _colorAnimation?.value ?? layerModel.solidColor;
var opacity = transform.opacity?.value ?? 100; var opacity = transform.opacity?.value ?? 100;
var alpha = (parentAlpha / var alpha = (parentAlpha /
255.0 * 255.0 *
@ -36,9 +37,7 @@ class SolidLayer extends BaseLayer {
255.0) 255.0)
.round(); .round();
paint.setAlpha(alpha); paint.setAlpha(alpha);
if (_colorAnimation?.value case var color?) {
paint.color = color;
}
if (_colorFilterAnimation != null) { if (_colorFilterAnimation != null) {
paint.colorFilter = _colorFilterAnimation!.value; paint.colorFilter = _colorFilterAnimation!.value;
} }

View File

@ -1,6 +1,5 @@
import 'dart:math'; import 'dart:math';
import 'dart:ui'; import 'dart:ui';
import 'path_factory.dart';
Path dashPath( Path dashPath(
Path source, { Path source, {
@ -10,7 +9,7 @@ Path dashPath(
assert(intervals.length >= 2); assert(intervals.length >= 2);
phase ??= 0; phase ??= 0;
var dest = PathFactory.create(); var dest = Path();
for (final metric in source.computeMetrics()) { for (final metric in source.computeMetrics()) {
for (var dash in _dashes(metric.length, intervals, phase)) { for (var dash in _dashes(metric.length, intervals, phase)) {
dest.addPath(metric.extractPath(dash.left, dash.right), Offset.zero); dest.addPath(metric.extractPath(dash.left, dash.right), Offset.zero);

View File

@ -26,9 +26,16 @@ class GammaEvaluator {
} }
static Color evaluate(double fraction, Color startColor, Color endColor) { static Color evaluate(double fraction, Color startColor, Color endColor) {
// Fast return in case start and end is the same
// or if fraction is at start/end or out of [0,1] bounds
if (startColor == endColor) { if (startColor == endColor) {
return startColor; return startColor;
} else if (fraction <= 0) {
return startColor;
} else if (fraction >= 1) {
return endColor;
} }
var startA = startColor.alpha / 255.0; var startA = startColor.alpha / 255.0;
var startR = startColor.red / 255.0; var startR = startColor.red / 255.0;
var startG = startColor.green / 255.0; var startG = startColor.green / 255.0;

View File

@ -1,164 +0,0 @@
import 'dart:typed_data';
import 'dart:ui';
class PathFactory {
static Path create() {
return Path();
}
}
class FakePath implements Path {
@override
PathFillType fillType = PathFillType.nonZero;
@override
void addArc(Rect oval, double startAngle, double sweepAngle) {
// TODO: implement addArc
}
@override
void addOval(Rect oval) {
// TODO: implement addOval
}
@override
void addPath(Path path, Offset offset, {Float64List? matrix4}) {
// TODO: implement addPath
}
@override
void addPolygon(List<Offset> points, bool close) {
// TODO: implement addPolygon
}
@override
void addRRect(RRect rrect) {
// TODO: implement addRRect
}
@override
void addRect(Rect rect) {
// TODO: implement addRect
}
@override
void arcTo(
Rect rect, double startAngle, double sweepAngle, bool forceMoveTo) {
// TODO: implement arcTo
}
@override
void arcToPoint(Offset arcEnd,
{Radius radius = Radius.zero,
double rotation = 0.0,
bool largeArc = false,
bool clockwise = true}) {
// TODO: implement arcToPoint
}
@override
void close() {
// TODO: implement close
}
@override
PathMetrics computeMetrics({bool forceClosed = false}) {
// TODO: implement computeMetrics
throw UnimplementedError();
}
@override
void conicTo(double x1, double y1, double x2, double y2, double w) {
// TODO: implement conicTo
}
@override
bool contains(Offset point) {
// TODO: implement contains
throw UnimplementedError();
}
@override
void cubicTo(
double x1, double y1, double x2, double y2, double x3, double y3) {
// TODO: implement cubicTo
}
@override
void extendWithPath(Path path, Offset offset, {Float64List? matrix4}) {
// TODO: implement extendWithPath
}
@override
Rect getBounds() {
// TODO: implement getBounds
throw UnimplementedError();
}
@override
void lineTo(double x, double y) {
// TODO: implement lineTo
}
@override
void moveTo(double x, double y) {
// TODO: implement moveTo
}
@override
void quadraticBezierTo(double x1, double y1, double x2, double y2) {
// TODO: implement quadraticBezierTo
}
@override
void relativeArcToPoint(Offset arcEndDelta,
{Radius radius = Radius.zero,
double rotation = 0.0,
bool largeArc = false,
bool clockwise = true}) {
// TODO: implement relativeArcToPoint
}
@override
void relativeConicTo(double x1, double y1, double x2, double y2, double w) {
// TODO: implement relativeConicTo
}
@override
void relativeCubicTo(
double x1, double y1, double x2, double y2, double x3, double y3) {
// TODO: implement relativeCubicTo
}
@override
void relativeLineTo(double dx, double dy) {
// TODO: implement relativeLineTo
}
@override
void relativeMoveTo(double dx, double dy) {
// TODO: implement relativeMoveTo
}
@override
void relativeQuadraticBezierTo(double x1, double y1, double x2, double y2) {
// TODO: implement relativeQuadraticBezierTo
}
@override
void reset() {
// TODO: implement reset
}
@override
Path shift(Offset offset) {
// TODO: implement shift
throw UnimplementedError();
}
@override
Path transform(Float64List matrix4) {
// TODO: implement transform
throw UnimplementedError();
}
}

View File

@ -1,5 +1,5 @@
import 'dart:ui';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'path_factory.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class PathInterpolator extends Curve { class PathInterpolator extends Curve {
@ -24,7 +24,7 @@ class PathInterpolator extends Curve {
} }
void _initialize() { void _initialize() {
final path = PathFactory.create(); final path = Path();
path.moveTo(0.0, 0.0); path.moveTo(0.0, 0.0);
path.cubicTo(controlX1, controlY1, controlX2, controlY2, 1.0, 1.0); path.cubicTo(controlX1, controlY1, controlX2, controlY2, 1.0, 1.0);

View File

@ -4,12 +4,11 @@ import '../animation/content/trim_path_content.dart';
import '../l.dart'; import '../l.dart';
import '../utils.dart'; import '../utils.dart';
import 'misc.dart'; import 'misc.dart';
import 'path_factory.dart';
class Utils { class Utils {
static Path createPath( static Path createPath(
Offset startPoint, Offset endPoint, Offset? cp1, Offset? cp2) { Offset startPoint, Offset endPoint, Offset? cp1, Offset? cp2) {
var path = PathFactory.create(); var path = Path();
path.moveTo(startPoint.dx, startPoint.dy); path.moveTo(startPoint.dx, startPoint.dy);
if (cp1 != null && if (cp1 != null &&

View File

@ -21,10 +21,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: archive name: archive
sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.4.9" version: "3.4.10"
args: args:
dependency: transitive dependency: transitive
description: description:

View File

@ -1,8 +1,11 @@
name: lottie name: lottie
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player. description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
version: 3.0.0-alpha.4 version: 3.0.0
repository: https://github.com/xvrh/lottie-flutter repository: https://github.com/xvrh/lottie-flutter
funding:
- https://www.buymeacoffee.com/xvrh
environment: environment:
sdk: '^3.2.0' sdk: '^3.2.0'
flutter: '>=3.16.0' flutter: '>=3.16.0'

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB