Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
78aeed452f |
@ -1,3 +1,6 @@
|
||||
## [0.3.2] - 2020-03-16
|
||||
- Fix a bug with "repeater" content
|
||||
|
||||
## [0.3.1] - 2020-03-05
|
||||
- Support dashed path
|
||||
|
||||
|
1458
example/assets/17297-fireworks.json
Normal file
@ -108,7 +108,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.3.1"
|
||||
version: "0.3.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
23
example/test/fireworks_test.dart
Normal file
@ -0,0 +1,23 @@
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'utils.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Animations with stroke', (tester) async {
|
||||
var size = Size(500, 400);
|
||||
tester.binding.window.physicalSizeTestValue = size;
|
||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
||||
|
||||
var composition = await LottieComposition.fromBytes(
|
||||
File('assets/17297-fireworks.json').readAsBytesSync());
|
||||
|
||||
await tester.pumpWidget(FilmStrip(composition, size: size));
|
||||
|
||||
await expectLater(find.byType(FilmStrip),
|
||||
matchesGoldenFile(p.join('goldens/fireworks.png')));
|
||||
});
|
||||
}
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
BIN
example/test/goldens/fireworks.png
Normal file
After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 21 KiB |
@ -71,10 +71,8 @@ class RepeaterContent
|
||||
var newContents = <Content>[];
|
||||
while (index >= 0) {
|
||||
var content = contents[index];
|
||||
if (content is PathContent) {
|
||||
newContents.add(content);
|
||||
contents.removeAt(index);
|
||||
}
|
||||
newContents.add(content);
|
||||
contents.removeAt(index);
|
||||
--index;
|
||||
}
|
||||
newContents = newContents.reversed.toList();
|
||||
|
@ -158,23 +158,25 @@ class TransformKeyframeAnimation {
|
||||
Matrix4 getMatrixForRepeater(double amount) {
|
||||
final position = _position?.value;
|
||||
final scale = _scale?.value;
|
||||
final rotation = _rotation?.value;
|
||||
|
||||
_matrix.setIdentity();
|
||||
|
||||
if (position != null) {
|
||||
_matrix.translate(position.dx, position.dy);
|
||||
_matrix.translate(position.dx * amount, position.dy * amount);
|
||||
}
|
||||
|
||||
if (scale != null) {
|
||||
_matrix.scale(scale.dx, scale.dy);
|
||||
_matrix.scale(
|
||||
pow(scale.dx, amount).toDouble(), pow(scale.dy, amount).toDouble());
|
||||
}
|
||||
|
||||
if (rotation != null) {
|
||||
final anchorPoint = _anchorPoint?.value ?? Offset.zero;
|
||||
_matrix.translate(anchorPoint.dx, anchorPoint.dy);
|
||||
_matrix.rotateZ(rotation * pi / 180.0);
|
||||
_matrix.translate(-anchorPoint.dx, -anchorPoint.dy);
|
||||
if (_rotation != null) {
|
||||
var rotation = _rotation.value;
|
||||
var anchorPoint = _anchorPoint?.value;
|
||||
_matrix.rotate(
|
||||
Vector3(anchorPoint == null ? 0.0 : anchorPoint.dx,
|
||||
anchorPoint == null ? 0.0 : anchorPoint.dy, 1.0),
|
||||
radians(rotation * amount));
|
||||
}
|
||||
|
||||
return _matrix;
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: lottie
|
||||
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
|
||||
version: 0.3.1
|
||||
version: 0.3.2
|
||||
homepage: https://github.com/xvrh/lottie-flutter
|
||||
|
||||
environment:
|
||||
|