Updates docs

This commit is contained in:
matt Sullivan
2021-06-14 15:49:01 -07:00
parent dddb78b62f
commit 941a2aa922
3 changed files with 61 additions and 2 deletions

View File

@ -1,6 +1,8 @@
## [0.7.18] - 2021-06-14 12:00:00
- Adds ability to pass controllers into RiveAnimation widgets
- Adds autoplay option to SimpleAnimation controller
- Adds one-shot animation contoller
- Updates examples
## [0.7.17] - 2021-06-11 18:00:00
- Exposes antialiasing option in Rive and RiveAnimation widgets.

View File

@ -98,6 +98,63 @@ class _PlayPauseAnimationState extends State<PlayPauseAnimation> {
}
```
Play a one-shot animation repeatedly on demand
```dart
/// Demonstrates playing a one-shot animation on demand
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
class PlayOneShotAnimation extends StatefulWidget {
const PlayOneShotAnimation({Key? key}) : super(key: key);
@override
_PlayOneShotAnimationState createState() => _PlayOneShotAnimationState();
}
class _PlayOneShotAnimationState extends State<PlayOneShotAnimation> {
/// Controller for playback
late RiveAnimationController _controller;
/// Is the animation currently playing?
bool _isPlaying = false;
@override
void initState() {
super.initState();
_controller = OnShotAnimation(
'bounce',
autoplay: false,
onStop: () => setState(() => _isPlaying = false),
onStart: () => setState(() => _isPlaying = true),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('One-Shot Example'),
),
body: Center(
child: RiveAnimation.network(
'https://cdn.rive.app/animations/vehicles.riv',
animations: const ['idle', 'curves'],
controllers: [_controller],
),
),
floatingActionButton: FloatingActionButton(
// disable the button while playing the animation
onPressed: () => _isPlaying ? null : _controller.isActive = true,
tooltip: 'Play',
child: const Icon(Icons.arrow_upward),
),
);
}
}
```
## Antialiasing
If you want to disable antialiasing (usually for performance reasons), you can set `antialiasing` to `false` on the `Rive` and `RiveAnimation` widgets.

View File

@ -1,4 +1,4 @@
/// Demonstrates play a one-shot animation on demand
/// Demonstrates playing a one-shot animation on demand
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
@ -36,7 +36,7 @@ class _PlayOneShotAnimationState extends State<PlayOneShotAnimation> {
),
body: Center(
child: RiveAnimation.network(
'https://cdn.rive.app/vehicles.riv',
'https://cdn.rive.app/animations/vehicles.riv',
animations: const ['idle', 'curves'],
controllers: [_controller],
),