mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-26 09:48:01 +08:00
Merge pull request #13 from rive-app/workAreaAnimations
Work area animations
This commit is contained in:
@ -5,7 +5,12 @@ 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 =
|
||||||
|
(animation.enableWorkArea ? animation.workStart : 0).toDouble() /
|
||||||
|
animation.fps;
|
||||||
|
|
||||||
double get time => _time;
|
double get time => _time;
|
||||||
set time(double value) {
|
set time(double value) {
|
||||||
if (_time == value) {
|
if (_time == value) {
|
||||||
|
@ -92,6 +92,7 @@ abstract class RiveRenderBox extends RenderBox {
|
|||||||
void _frameCallback(Duration duration) {
|
void _frameCallback(Duration duration) {
|
||||||
_elapsedSeconds = _stopwatch.elapsedTicks / _stopwatch.frequency;
|
_elapsedSeconds = _stopwatch.elapsedTicks / _stopwatch.frequency;
|
||||||
_stopwatch.reset();
|
_stopwatch.reset();
|
||||||
|
_stopwatch.start();
|
||||||
markNeedsPaint();
|
markNeedsPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +110,8 @@ abstract class RiveRenderBox extends RenderBox {
|
|||||||
_frameCallbackId = null;
|
_frameCallbackId = null;
|
||||||
if (advance(_elapsedSeconds)) {
|
if (advance(_elapsedSeconds)) {
|
||||||
scheduleRepaint();
|
scheduleRepaint();
|
||||||
|
} else {
|
||||||
|
_stopwatch.stop();
|
||||||
}
|
}
|
||||||
_elapsedSeconds = 0;
|
_elapsedSeconds = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user