bear_log_in
an example built using jctoon’s flare file as a custom ui component.
bear will follow the cursor as you type or move it around.
overview
the basic idea is to use the ctrl_face
node in jctoon’s file to change the direction of teddy’s gaze, as it’s shown here in the gif to the right.
this is done by using custom flarecontrols
, available in /lib/bear_log_in_controller.dart
.
flarecontrols
is a custom implementation of the flarecontroller
interface.
the interface and can be found in flare_actor.dart and it has three methods:
abstract class flarecontroller {
void initialize(flutteractorartboard artboard);
void setviewtransform(mat2d viewtransform);
bool advance(flutteractorartboard artboard, double elapsed);
}
an instance of bearlogincontroller
is passed to the flareactor
in /lib/main.dart
. this ties the controller to this widget, and allows it to use the three overrides to perform custom actions:
flareactor(
"assets/teddy.flr",
controller: _bearlogincontroller,
[...]
)
in this example, initialize()
will grab the reference to the ctrl_face
node through the library call artboard.getnode("ctrl_face")
.
moreover, by extending flarecontrols
, bearlogincontroller
can take advantage of a concrete implementation of this interface:
play(string animationname)
advance(double elapsed)
– a base implementation which advances and mixes multiple animations
Comments are closed.