mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-07-06 08:26:42 +08:00

- 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)
47 lines
1.2 KiB
Dart
47 lines
1.2 KiB
Dart
/// Demonstrates how to create a custom controller to change the speed of an
|
|
/// animation
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:rive/rive.dart';
|
|
|
|
class SpeedyAnimation extends StatelessWidget {
|
|
const SpeedyAnimation({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Custom Controller - Speed'),
|
|
),
|
|
body: Center(
|
|
child: RiveAnimation.asset(
|
|
'assets/vehicles.riv',
|
|
fit: BoxFit.cover,
|
|
animations: const ['idle'],
|
|
controllers: [SpeedController('curves', speedMultiplier: 3)],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class SpeedController extends SimpleAnimation {
|
|
final double speedMultiplier;
|
|
|
|
SpeedController(
|
|
String animationName, {
|
|
double mix = 1,
|
|
this.speedMultiplier = 1,
|
|
}) : super(animationName, mix: mix);
|
|
|
|
@override
|
|
void apply(RuntimeArtboard artboard, double elapsedSeconds) {
|
|
if (instance == null || !instance!.keepGoing) {
|
|
isActive = false;
|
|
}
|
|
instance!
|
|
..animation.apply(instance!.time, coreContext: artboard, mix: mix)
|
|
..advance(elapsedSeconds * speedMultiplier);
|
|
}
|
|
}
|