Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects outside the ArtBoard are visible #85

Closed
optimygmbh opened this issue May 6, 2019 · 11 comments
Closed

Objects outside the ArtBoard are visible #85

optimygmbh opened this issue May 6, 2019 · 11 comments

Comments

@optimygmbh
Copy link

Is it a setting in Flare or Flutter, that drawing elements only are visible inside the ArtBoard and not outside?

For example I'm having an animation with clouds flying from left to right. They start at left outside the ArtBoard and end right outside of the ArtBoard. But I can see the clouds "waiting" in the Flutter App. And how you can see the sun is visible as well outside the ArtBoard:

image

@umberto-sonnino
Copy link
Contributor

Did you enable "Clip Contents" for the Artboard in your Flare file?
There's an option for that in the Selection Panel:
Artboard Clipping

@optimygmbh
Copy link
Author

Yes I enabled "Clip Contents" in the Artboard of my Flare file.

Now I thought maybe I overwrite it in Flutter in the Flutter Actor Artboard. But there clipContents is set to true as well:
image

This is my Flare file: https://www.2dimensions.com/a/optimygmbh/files/flare/hollywood/embed.

@jcairo
Copy link

jcairo commented Aug 23, 2019

Any updates on this? I have the exact same problem.

Artboard is 100 x 100 in Flare

Artboard appearance in Flutter at the end of the animation (contains nothing)
Screen Shot 2019-08-23 at 10 02 42 AM

Appearance in Flutter at end of animation (portion of object that has been animated off the artboard is still visible)
Screen Shot 2019-08-23 at 10 04 18 AM

Flare file is set to 'Clip contents'

Actor in Flutter:

Container(
        decoration: BoxDecoration(border: Border.all(color: Colors.black)),
        height: 100,
        width: 100,
        child: FlatButton(
          child: FlareActor(
            "assets/animations/anim.flr",
            fit: BoxFit.fill,
            animation: _animationName,
            sizeFromArtboard: true,
          ),
...)

Also tried Boxfit.contain with same results

Flare File Link

@umberto-sonnino
Copy link
Contributor

Hey @jcairo, I've tested your file locally and I don't see the issue on my side.
Could you share a more complete example with your widget layout where this is happening?

@jcairo
Copy link

jcairo commented Aug 24, 2019

Hey Umberto. Not sure how much you want here. I've added the code for the widget where the problem is. I can also provide you with a Flutter repo if that is easier?

class PlayButton extends StatefulWidget {
  final Player player;
  const PlayButton({
    Key key,
    this.player,
  }) : super(key: key);

  @override
  _PlayButtonState createState() => _PlayButtonState();
}

class _PlayButtonState extends State<PlayButton> with TickerProviderStateMixin {
  String _animationName = "PlayToPause";
  @override
  Widget build(BuildContext context) {
    return Container(
        decoration: BoxDecoration(border: Border.all(color: Colors.black)),
        height: 100,
        width: 100,
        child: FlatButton(
          child: FlareActor(
            "assets/animations/anim.flr",
            fit: BoxFit.fill,
            animation: _animationName,
            sizeFromArtboard: true,
          ),
          onPressed: () {
            var tempName;
            if (_animationName == "PlayToPause") {
               tempName = "PauseToPlay";
            } else {
              tempName = "PlayToPause";
            }

            setState(() {
              _animationName = tempName;
            });
          },
        ));

    return IconButton(
      onPressed: widget.player.fileIsLoaded ? () => widget.player.play() : null,
      icon: Icon(
        FontAwesomeIcons.playCircle,
        color: Colors.black,
      ),
      iconSize: kIconSize,
    );
  }
}

@umberto-sonnino
Copy link
Contributor

With your file above and this configuration, everything still looks fine on my side.

@luigi-rosso
Copy link
Contributor

It looks like the Flare runtime may not be applying the final frame of the animation. Is the behavior consistent amongst re-runs or is it always at a slightly different spot? Does the behavior change in release/debug mode?

@jcairo
Copy link

jcairo commented Aug 25, 2019

Hey Luigi,

I've now tried in release mode and i'm still seeing the same problem.

I don't think it's just the final frame. Using this
animation I'm seeing way outside the artboard.

Artboard in Flare shows:
Screen Shot 2019-08-25 at 11 39 05 AM

Flare actor in Flutter shows:
Screen Shot 2019-08-25 at 11 36 17 AM

Same code as above but with boxfit.contain

class PlayButton extends StatefulWidget {
  final Player player;
  const PlayButton({
    Key key,
    this.player,
  }) : super(key: key);

  @override
  _PlayButtonState createState() => _PlayButtonState();
}

class _PlayButtonState extends State<PlayButton> with TickerProviderStateMixin {
  String _animationName = "PlayToPause";
  @override
  Widget build(BuildContext context) {
    return Container(
        decoration: BoxDecoration(border: Border.all(color: Colors.black)),
        height: 100,
        width: 100,
        child: FlatButton(
          child: FlareActor(
            "assets/animations/PlayPause.flr",
            fit: BoxFit.contain,
            animation: _animationName,
            sizeFromArtboard: true,
          ),
          onPressed: () {
            var tempName;
            if (_animationName == "PlayToPause") {
               tempName = "PauseToPlay";
            } else {
              tempName = "PlayToPause";
            }

            setState(() {
              _animationName = tempName;
            });
          },
        ));
  }
}

@umberto-sonnino
Copy link
Contributor

Hey @jcairo, thanks a lot for your last example! We were finally able to reproduce the problem and found the bug.

We published a new version of the package which should now behave correctly; you can find it here!

@luigi-rosso
Copy link
Contributor

TL;DR: Update your pubspec flare_flutter: ^1.5.7! 😃

@jcairo
Copy link

jcairo commented Aug 26, 2019

Awesome! Great tool you have here guys! Thanks for being so responsive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants