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

FlareActor flashing last frame when creating dynamically #80

Open
soyangel opened this issue Apr 25, 2019 · 10 comments
Open

FlareActor flashing last frame when creating dynamically #80

soyangel opened this issue Apr 25, 2019 · 10 comments
Assignees

Comments

@soyangel
Copy link

Hi,

When creating a FlareActor "dynamically" I'm seeing at the beginning a brief flash of what I guess is the last frame of the animation. This does not happen when using FlareActor in a normal way.

This works:

@override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          SizedBox(
            width: 300,
            height: 300,
            child: FlareActor(
              'animations/success.flr',
              animation: 'Untitled',
              snapToEnd: false,
            ),
          )
        ],
      ),
    );
  }

This doesn't work:

  @override
  Widget build(BuildContext context) {
    var children = <Widget>[];

    if (_showAnimation) {
      children.add(SizedBox(
        width: 300,
        height: 300,
        child: FlareActor(
          'animations/success.flr',
          animation: 'Untitled',
          snapToEnd: false,
        ),
      ));
    }

    return Container(
      child: Column(
        children: children,
      ),
    );
  }

I'm using 1.5.0, also happens with 1.3.13.

To replicate just use this Flare: https://www.2dimensions.com/a/pollux/files/flare/success-check

And this example code:

import 'package:flutter/material.dart';
import 'package:flare_flutter/flare_actor.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _showAnimation = false;

  @override
  void initState() {
    Future.delayed(Duration(seconds: 2), () {
      setState(() {
        _showAnimation = true;
      });
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    var children = <Widget>[];

    if (_showAnimation) {
      children.add(SizedBox(
        width: 300,
        height: 300,
        child: FlareActor(
          'animations/success.flr',
          animation: 'Untitled',
          snapToEnd: false,
        ),
      ));
    }

    return Container(
      child: Column(
        children: children,
      ),
    );
  }
}
@Nazacheres
Copy link

Got the same issue, also had it on 1.3.12, please any response?

@luigi-rosso luigi-rosso self-assigned this Apr 25, 2019
@luigi-rosso
Copy link
Contributor

We'll take a look soon!

umberto-sonnino added a commit that referenced this issue Apr 26, 2019
Address a condition where `load()` is being called multiple times in a very short timespan.
@aliceblock
Copy link

Same here,
But I think it is a cover image.

@mdanics
Copy link

mdanics commented May 3, 2019

Also getting this, makes the whole animation look jagged

@Nazacheres
Copy link

Nazacheres commented May 13, 2019

Any progress on that one? We just have all flare code commented out cause of that. :(

@luigi-rosso
Copy link
Contributor

We've made numerous updates, please test with dev or master channel of both Flare and Flutter. On master, the latest looks like this:
https://drive.google.com/file/d/17Vst8-y33zMYfx1wSXjYhybsEYe1Gy9l/view?usp=sharing

I believe the flashing has been fixed.

@mdanics
Copy link

mdanics commented May 14, 2019

Fixed for me, thank you!

@mdanics
Copy link

mdanics commented May 14, 2019

When do you think we could see these changes on pub?

@saulmc
Copy link

saulmc commented May 17, 2019

I've been using this workaround on pub: set the actor's opacity to 0 in design mode, then key the actor's opacity to 1 at the start of each animation. The "flash" will presumably still occur but it will be invisible.

@luigi-rosso
Copy link
Contributor

The changes are now on pub with version 1.5.1.

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

6 participants