diff --git a/CHANGELOG.md b/CHANGELOG.md index 2683bf4..cc16998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.6.2] - 2020-10-02 15:45:10 + +- Exposed major and minor runtime version (issue #15) via riveVersion. +- Exposed major and minor version of loaded files via RiveFile().version. +- SimpleAnimation exposes the underlying LinearAnimationInstance. +- Export Loop enum such that it is available to users of the package. +- Fixed start point of LinearAnimationInstance when using a work area (custom start/end). + ## [0.6.1] - 2020-09-30 12:21:32 - Bumping all runtimes to 0.6.1 to match (no functional changes in the Flutter one). diff --git a/README.md b/README.md index e1acbe1..666a8de 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ```yaml dependencies: - rive: ^0.6.1 + rive: ^0.6.2 ``` ## Example diff --git a/example/lib/main.dart b/example/lib/main.dart index 945493b..c391f4a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -47,6 +47,7 @@ class _MyHomePageState extends State { rootBundle.load('assets/off_road_car.riv').then( (data) async { var file = RiveFile(); + // Load the RiveFile from the binary data. var success = file.import(data); if (success) { diff --git a/example/pubspec.lock b/example/pubspec.lock index 316790e..db8d062 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -94,7 +94,7 @@ packages: path: ".." relative: true source: path - version: "0.6.1" + version: "0.6.2" sky_engine: dependency: transitive description: flutter diff --git a/lib/rive.dart b/lib/rive.dart index fbbae64..4660713 100644 --- a/lib/rive.dart +++ b/lib/rive.dart @@ -15,3 +15,5 @@ export 'package:rive/src/rive_core/shapes/paint/stroke.dart'; export 'package:rive/src/rive_core/shapes/paint/solid_color.dart'; export 'package:rive/src/rive_core/shapes/paint/linear_gradient.dart'; export 'package:rive/src/rive_core/shapes/paint/radial_gradient.dart'; +export 'package:rive/src/rive_core/runtime/runtime_header.dart' + show riveVersion; diff --git a/lib/src/rive_core/animation/linear_animation_instance.dart b/lib/src/rive_core/animation/linear_animation_instance.dart index 64328f7..1e17a2d 100644 --- a/lib/src/rive_core/animation/linear_animation_instance.dart +++ b/lib/src/rive_core/animation/linear_animation_instance.dart @@ -5,12 +5,10 @@ class LinearAnimationInstance { final LinearAnimation animation; double _time = 0; int direction = 1; - LinearAnimationInstance(this.animation) : _time = (animation.enableWorkArea ? animation.workStart : 0).toDouble() / animation.fps; - double get time => _time; set time(double value) { if (_time == value) { diff --git a/lib/src/rive_core/runtime/runtime_header.dart b/lib/src/rive_core/runtime/runtime_header.dart index 5831b10..a4c3b6b 100644 --- a/lib/src/rive_core/runtime/runtime_header.dart +++ b/lib/src/rive_core/runtime/runtime_header.dart @@ -4,16 +4,24 @@ import 'package:rive/src/rive_core/runtime/exceptions/rive_unsupported_version_e import 'package:rive/src/utilities/binary_buffer/binary_reader.dart'; import 'exceptions/rive_format_error_exception.dart'; +class RuntimeVersion { + final int major; + final int minor; + const RuntimeVersion(this.major, this.minor); +} + +const riveVersion = RuntimeVersion(6, 2); + class RuntimeHeader { - static const int majorVersion = 6; - static const int minorVersion = 0; static const String fingerprint = 'RIVE'; + final RuntimeVersion version; final int ownerId; final int fileId; final HashMap propertyToFieldIndex; RuntimeHeader( {@required this.ownerId, @required this.fileId, + @required this.version, this.propertyToFieldIndex}); factory RuntimeHeader.read(BinaryReader reader) { var fingerprint = RuntimeHeader.fingerprint.codeUnits; @@ -24,9 +32,9 @@ class RuntimeHeader { } int readMajorVersion = reader.readVarUint(); int readMinorVersion = reader.readVarUint(); - if (readMajorVersion > majorVersion) { - throw RiveUnsupportedVersionException( - majorVersion, minorVersion, readMajorVersion, readMinorVersion); + if (readMajorVersion > riveVersion.major) { + throw RiveUnsupportedVersionException(riveVersion.major, + riveVersion.minor, readMajorVersion, readMinorVersion); } int ownerId = reader.readVarUint(); int fileId = reader.readVarUint(); @@ -49,6 +57,9 @@ class RuntimeHeader { currentBit += 2; } return RuntimeHeader( - ownerId: ownerId, fileId: fileId, propertyToFieldIndex: propertyFields); + ownerId: ownerId, + fileId: fileId, + version: RuntimeVersion(readMajorVersion, readMinorVersion), + propertyToFieldIndex: propertyFields); } } diff --git a/lib/src/rive_core/shapes/points_path.dart b/lib/src/rive_core/shapes/points_path.dart index 8506a66..0a2c8f0 100644 --- a/lib/src/rive_core/shapes/points_path.dart +++ b/lib/src/rive_core/shapes/points_path.dart @@ -16,7 +16,8 @@ class PointsPath extends PointsPathBase with Skinnable { @override Mat2D get pathTransform => skin != null ? Mat2D() : worldTransform; @override - Mat2D get inversePathTransform => inverseWorldTransform; + Mat2D get inversePathTransform => + skin != null ? Mat2D() : inverseWorldTransform; @override List get vertices => _vertices; @override diff --git a/pubspec.yaml b/pubspec.yaml index a5cc43f..19cedc6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: rive -description: Rive 2 Flutter Runtime -version: 0.6.1 +description: Rive 2 Flutter Runtime. This package provides runtime functionality for playing back and interacting with animations built with the Rive editor available at https://rive.app. +version: 0.6.2 repository: https://github.com/rive-app/rive-flutter homepage: https://rive.app