mirror of
https://github.com/xvrh/lottie-flutter.git
synced 2025-08-06 16:39:36 +08:00

- Added support for rounded corners on shapes and rects - Add support for text in dynamic properties (ValueDelegate) - Improve stroke with offset - Add support for reversed polystar paths - Enforce order of operations to avoid rounding errors
40 lines
1020 B
Dart
40 lines
1020 B
Dart
import '../composition.dart';
|
|
import '../model/animatable/animatable_value.dart';
|
|
import '../model/content/rounded_corners.dart';
|
|
import 'animatable_value_parser.dart';
|
|
import 'moshi/json_reader.dart';
|
|
|
|
class RoundedCornersParser {
|
|
static final _names = JsonReaderOptions.of([
|
|
'nm', // 0
|
|
'r', // 1
|
|
'hd' // 1
|
|
]);
|
|
|
|
static RoundedCorners? parse(
|
|
JsonReader reader, LottieComposition composition) {
|
|
String? name;
|
|
AnimatableValue<double, double>? cornerRadius;
|
|
var hidden = false;
|
|
|
|
while (reader.hasNext()) {
|
|
switch (reader.selectName(_names)) {
|
|
case 0: //nm
|
|
name = reader.nextString();
|
|
break;
|
|
case 1: // r
|
|
cornerRadius =
|
|
AnimatableValueParser.parseFloat(reader, composition, isDp: true);
|
|
break;
|
|
case 2: // hd
|
|
hidden = reader.nextBoolean();
|
|
break;
|
|
default:
|
|
reader.skipValue();
|
|
}
|
|
}
|
|
|
|
return hidden ? null : RoundedCorners(name!, cornerRadius!);
|
|
}
|
|
}
|