Fixes #15 and preps for publish.

This commit is contained in:
Luigi Rosso
2020-10-02 15:56:43 -07:00
parent 6f1b2eeddc
commit 2e4a8ace85
9 changed files with 34 additions and 13 deletions

View File

@ -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).

View File

@ -10,7 +10,7 @@
```yaml
dependencies:
rive: ^0.6.1
rive: ^0.6.2
```
## Example

View File

@ -47,6 +47,7 @@ class _MyHomePageState extends State<MyHomePage> {
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) {

View File

@ -94,7 +94,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.6.1"
version: "0.6.2"
sky_engine:
dependency: transitive
description: flutter

View File

@ -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;

View File

@ -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) {

View File

@ -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<int, int> 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);
}
}

View File

@ -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<PathVertex> get vertices => _vertices;
@override

View File

@ -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