Skip to content

How to stop animation ? #14

@chenjun-110

Description

@chenjun-110
class Pandy extends StatefulWidget {
  @override
  PandyS createState() => PandyS();
}
class PandyS extends State<Pandy> implements FlareController {
  ActorAnimation _rock;
  String animationName = "Untitled";
  int start;
  void initialize(FlutterActorArtboard artboard) {
    _rock = artboard.getAnimation("Untitled");
    artboard.advance(2.0);
    print('initialize');
    start = DateTime.now().millisecondsSinceEpoch;
  }
  void setViewTransform( viewTransform) {
    // print('setViewTransform ${_rock.animatedComponents}');
  }
  bool advance(FlutterActorArtboard artboard, double elapsed) {
    // _rock.apply(1.0, artboard, 0.5);
    var now = DateTime.now().millisecondsSinceEpoch;
    if ((now - start) > 3000) {
      // setState(() {
      //   animationName = "1";
      // });
    } else {
      print('advances ${_rock.isLooping} ${(now - start)}');
    }
    return false;
  }
  Widget build(BuildContext context) {
    print('flr build');
    var flr = new FlareActor("images/test.flr", 
      alignment:Alignment.center, 
      fit:BoxFit.contain, 
      animation: animationName,
      controller: this,
      isPaused: false,
      callback: (r) {
        print(r);
      },
    );
    return flr;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions