
- Adds checks to see if a drawable has a 0% opacity before performing draw commands - Add skinning example Diffs= a61f4c6b5 apply changes to rive_core 8152b8a02 docs: update CHANGELOG b8f61022c perf: check if opacity is 0 before drawing 4c4826e67 chore: add typedef argument names ff94982f9 docs: add skinning sample f1ddd88d4 Fix artboard pieces slowly popping in. (#4818) 3039909c2 Update to using deployment workflow similar to ios 53a8f9517 Fix direction when looping. (#4786) 4c5a576ad Fix ping pong hang (#4776) ae1e02afc Fix tess test linking (#4773) 4ecbf9321 Fix remap based on issue JC caught. (#4771) 89e38b700 allow negative speed (#4770) 4d115b4c6 Adding GLSL100 for tess renderer. (#4767) 31a3972aa ios shaders for tess (#4765) 686e5125b Add dependency to correct grand parent for linear gradients. (#4753) e737ee427 Revert "Update to using deployment workflow similar to ios" de0e57d55 Update to using deployment workflow similar to ios 051769242 Runtime Text! (#4741) 331ad0d55 Build cleanups 2538229d6 Use Rive's libpng premake dependency in golden testing 42a0377bc Fix condition with trim paths where all contours are 0 length. (#4722) ea1c83d02 Use os.copyfile() instead of the '{COPY}' command 5c03e1640 Remove forcing arch to arm64 for libpng (#4715) 404a04d35 Cleaning up libpng premake to be isolated/stand-alone. (#4713)
Rive Flutter
Rive Flutter is a runtime library for Rive, a real-time interactive design and animation tool.
This library allows you to fully control Rive files with a high-level API for simple interactions and animations, as well as a low-level API for creating custom render loops for multiple artboards, animations, and state machines in a single canvas.
Table of contents
- ⭐ Rive Overview
- 🚀 Getting Started & API docs
- 🔍 Supported Platforms
- 📚 Examples
- 👨💻 Contributing
- ❓ Issues
Overview of Rive
Rive is a powerful tool that helps teams create and run interactive animations for apps, games, and websites. Designers and developers can use the collaborative editor to create motion graphics that respond to different states and user inputs, and then use the lightweight open-source runtime libraries, like Rive Flutter, to load their animations into their projects.
For more information, check out the following resources:
🏡 Homepage
Getting Started
To get started with Rive Flutter, check out the following resources:
For additional help, see the Runtime sections of the Rive help documentation, such as:
Supported Platforms
Be sure to read the platform specific considerations for the Rive Flutter package.
Examples
To see some examples of what you can do with Rive Flutter, check out the following projects:
Here is an example of how to play an animation from a Rive file retrieved over HTTP:
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
void main() {
runApp(MaterialApp(home: SimpleAnimation()));
}
class SimpleAnimation extends StatelessWidget {
const SimpleAnimation({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: RiveAnimation.network(
'https://cdn.rive.app/animations/vehicles.riv',
),
),
);
}
}
To play an animation from an asset bundle, use:
RiveAnimation.asset('assets/truck.riv');
Control playing and pausing a looping animation:
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
void main() {
runApp(MaterialApp(home: PlayPauseAnimation()));
}
class PlayPauseAnimation extends StatefulWidget {
const PlayPauseAnimation({Key? key}) : super(key: key);
@override
_PlayPauseAnimationState createState() => _PlayPauseAnimationState();
}
class _PlayPauseAnimationState extends State<PlayPauseAnimation> {
// Controller for playback
late RiveAnimationController _controller;
// Toggles between play and pause animation states
void _togglePlay() =>
setState(() => _controller.isActive = !_controller.isActive);
/// Tracks if the animation is playing by whether controller is running
bool get isPlaying => _controller.isActive;
@override
void initState() {
super.initState();
_controller = SimpleAnimation('idle');
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RiveAnimation.network(
'https://cdn.rive.app/animations/vehicles.riv',
controllers: [_controller],
// Update the play state when the widget's initialized
onInit: (_) => setState(() {}),
),
),
floatingActionButton: FloatingActionButton(
onPressed: _togglePlay,
tooltip: isPlaying ? 'Pause' : 'Play',
child: Icon(
isPlaying ? Icons.pause : Icons.play_arrow,
),
),
);
}
}
Play a one-shot animation repeatedly on demand
/// Demonstrates playing a one-shot animation on demand
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
void main() {
runApp(MaterialApp(home: PlayOneShotAnimation()));
}
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 = OneShotAnimation(
'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),
),
);
}
}
Contributing
We love contributions and all are welcome! 💙
Issues
Have an issue with using the runtime, or want to suggest a feature/API to help make your development life better? Log an issue in our issues tab! You can also browse older issues and discussion threads there to see solutions that may have worked for common problems.