luigi-rosso e618def5cd Text
Uses it in the artboard title but also updates the flutter runtime massively to support FFI & WASM C++ Rive Text. PRing to let the tests run.

Diffs=
3be5ff0d8 Text (#4372)
90245a5e1 Fix the Android debug build
0a0f3c267 Fix for missing animation in a blend state. (#4415)
440512dca Add simd::if_then_else (#4403)
ec9fb5bfc Revert "Update SIMD booleans to use bitwise logic operators"
701d8dee2 Update SIMD booleans to use bitwise logic operators
e98b93a61 Add SIMD fallbacks for missing builtins
466f68e3a Add some more core math and SIMD functions
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-06-16 15:51:45 -07:00
2020-07-08 16:36:55 -07:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-11-15 23:07:11 +00:00
2022-06-16 15:51:45 -07:00

Pub Version Build Status Discord badge Twitter handle

Rive

Runtime docs are available in Rive's help center.

Rive is a real-time interactive design and animation tool. Use our collaborative editor to create motion graphics that respond to different states and user inputs. Then load your animations into apps, games, and websites with our lightweight open-source runtimes.

Add dependency to pubspec.yaml

dependencies:
  rive: ^0.9.0

Platform Considerations

Read some platform specific considerations with regards to the Rive Flutter package.

Quick Start

Play an animation from a Rive file 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),
      ),
    );
  }
}

Antialiasing

If you want to disable antialiasing (usually for performance reasons), you can set antialiasing to false on the Rive and RiveAnimation widgets.

API Documentation

Check out our more extensive API documentation on pub.dev: https://pub.dev/documentation/rive/latest/

Description
Flutter runtime for Rive
Readme MIT 8.9 MiB
Languages
Dart 96.8%
C++ 1.3%
Lua 0.7%
CMake 0.6%
Shell 0.2%
Other 0.2%