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 ## [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). - Bumping all runtimes to 0.6.1 to match (no functional changes in the Flutter one).

View File

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

View File

@ -47,6 +47,7 @@ class _MyHomePageState extends State<MyHomePage> {
rootBundle.load('assets/off_road_car.riv').then( rootBundle.load('assets/off_road_car.riv').then(
(data) async { (data) async {
var file = RiveFile(); var file = RiveFile();
// Load the RiveFile from the binary data. // Load the RiveFile from the binary data.
var success = file.import(data); var success = file.import(data);
if (success) { if (success) {

View File

@ -94,7 +94,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "0.6.1" version: "0.6.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter 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/solid_color.dart';
export 'package:rive/src/rive_core/shapes/paint/linear_gradient.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/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; final LinearAnimation animation;
double _time = 0; double _time = 0;
int direction = 1; int direction = 1;
LinearAnimationInstance(this.animation) LinearAnimationInstance(this.animation)
: _time = : _time =
(animation.enableWorkArea ? animation.workStart : 0).toDouble() / (animation.enableWorkArea ? animation.workStart : 0).toDouble() /
animation.fps; animation.fps;
double get time => _time; double get time => _time;
set time(double value) { set time(double value) {
if (_time == 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 'package:rive/src/utilities/binary_buffer/binary_reader.dart';
import 'exceptions/rive_format_error_exception.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 { class RuntimeHeader {
static const int majorVersion = 6;
static const int minorVersion = 0;
static const String fingerprint = 'RIVE'; static const String fingerprint = 'RIVE';
final RuntimeVersion version;
final int ownerId; final int ownerId;
final int fileId; final int fileId;
final HashMap<int, int> propertyToFieldIndex; final HashMap<int, int> propertyToFieldIndex;
RuntimeHeader( RuntimeHeader(
{@required this.ownerId, {@required this.ownerId,
@required this.fileId, @required this.fileId,
@required this.version,
this.propertyToFieldIndex}); this.propertyToFieldIndex});
factory RuntimeHeader.read(BinaryReader reader) { factory RuntimeHeader.read(BinaryReader reader) {
var fingerprint = RuntimeHeader.fingerprint.codeUnits; var fingerprint = RuntimeHeader.fingerprint.codeUnits;
@ -24,9 +32,9 @@ class RuntimeHeader {
} }
int readMajorVersion = reader.readVarUint(); int readMajorVersion = reader.readVarUint();
int readMinorVersion = reader.readVarUint(); int readMinorVersion = reader.readVarUint();
if (readMajorVersion > majorVersion) { if (readMajorVersion > riveVersion.major) {
throw RiveUnsupportedVersionException( throw RiveUnsupportedVersionException(riveVersion.major,
majorVersion, minorVersion, readMajorVersion, readMinorVersion); riveVersion.minor, readMajorVersion, readMinorVersion);
} }
int ownerId = reader.readVarUint(); int ownerId = reader.readVarUint();
int fileId = reader.readVarUint(); int fileId = reader.readVarUint();
@ -49,6 +57,9 @@ class RuntimeHeader {
currentBit += 2; currentBit += 2;
} }
return RuntimeHeader( 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 @override
Mat2D get pathTransform => skin != null ? Mat2D() : worldTransform; Mat2D get pathTransform => skin != null ? Mat2D() : worldTransform;
@override @override
Mat2D get inversePathTransform => inverseWorldTransform; Mat2D get inversePathTransform =>
skin != null ? Mat2D() : inverseWorldTransform;
@override @override
List<PathVertex> get vertices => _vertices; List<PathVertex> get vertices => _vertices;
@override @override

View File

@ -1,6 +1,6 @@
name: rive name: rive
description: Rive 2 Flutter Runtime 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.1 version: 0.6.2
repository: https://github.com/rive-app/rive-flutter repository: https://github.com/rive-app/rive-flutter
homepage: https://rive.app homepage: https://rive.app