Comments (4)
Hi @izzatzr, one way you could do this right now is by using a custom controller which applies the animation in reverse.
For example, take a look at main.dart in the penguin example:
https://github.com/2d-inc/Flare-Flutter/blob/master/example/penguin_dance/lib/main.dart#L46
You could apply the "music_walk" animation (stored in the ActorAnimation _rock variable) in reverse by changing the apply call to use a _rockTime that is relative to the end of the animation. Something like this:
bool advance(FlutterActorArtboard artboard, double elapsed) {
_rockTime += elapsed * _speed;
_rockTime = _rock.duration - (_rockTime % _rock.duration);
_rock.apply(_rockTime, artboard, _rockAmount);
return true;
}
from flare-flutter.
It'd be great to have FlareController
as easy to use as Flutter's AnimationController
:(
Too much boilerplate to simply run the animation in reverse.
from flare-flutter.
I ran into this problem as well @izzatzr. What I decided to do was just to make one animation for running forwards and one for running in reverse, which was super easy (just swap the start & and key frame positions in Rive).
Then I just used a bool to swap between the two
FlareActor(
'assets/animations/animation.flr',
animation: widget.animationSwitch ? 'forward' : 'reverse',
),
This isn't the best solution but it works!
¯\_(ツ)_/¯
from flare-flutter.
Is there any way to change the key frames pragmatically ?
from flare-flutter.
Related Issues (20)
- Migrate to null safety HOT 8
- Add debug mode HOT 1
- Migration to Null-Safety HOT 3
- Request for Clarification: Flare-Flutter vs Rive Flutter Runtime Use Cases HOT 4
- LateInitializationError HOT 8
- Null Safety for flare_dart HOT 3
- Placeholder widget while animation is loading
- 3.0.0 antialiasing no longer working HOT 13
- IK Constraints not working HOT 4
- Difference between flare-flutter and rive-flutter HOT 4
- FlutterActorImage not visible FlareActor
- Clear Memory after finish an animation HOT 2
- Can't load FlareActor.bundle on Android HOT 2
- Unhandled Exception: Exception: LateInitializationError: Field '_paint@235459774' has not been initialized HOT 2
- LateInitializationError: Field '_paint@xxxxxx' has not been initialized HOT 2
- LateInitializationError: Field '_setupAABB@43245341' has not been initialized HOT 1
- Flutter 2.10 & 3.0 throw warnings during compilation HOT 3
- Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null. HOT 4
- update HOT 1
- Flutter3 Error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flare-flutter.