2d-inc / Flare-Flutter

Load and get full control of your Rive files in a Flutter project using this library.
https://rive.app/
MIT License
2.55k stars 469 forks source link

Added function to test hit on nodes in the animation. #289

Open gnudles opened 3 years ago

gnudles commented 3 years ago

Very useful feature, that should help with making animatable buttons etc.. When extending FlareControls and overriding setViewTransform, one should add call to "super.setViewTransform(viewTransform);" in order to make it work. Example: wrap your FlareActor with GestureDetector. add onTapDown Event, and ask the flare controller which nodes were clicked. GestureDetector(child: FlareActor( "assets/Teddy.flr", shouldClip: false, alignment: Alignment.bottomCenter, fit: BoxFit.contain, controller: _teddyController, ), onTapDown : (details){ print (_teddyController.deepHitTest(details.globalPosition)); } )