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

Animations is blinking if change it in LOOP_COMPLETE event #80

Open
WeslomPo opened this issue Aug 4, 2016 · 2 comments
Open

Animations is blinking if change it in LOOP_COMPLETE event #80

WeslomPo opened this issue Aug 4, 2016 · 2 comments

Comments

@WeslomPo
Copy link

WeslomPo commented Aug 4, 2016

If use two different animation, like one very small object grow to large call it "fadeIn", and second animation when grown object is stay calm - call it "idle".

Made a simple armature and add listener to it to LOOP_COMPLETE event, like that:

this.armature.addEventListener(EventObject.LOOP_COMPLETE, onLoopComplete);

in on onLoopComplete change animation from fadeIn to idle, and wise versa.

private function onLoopComplete(event:StarlingEvent):void {
        var data:EventObject = event.data as EventObject;
        if (data != null) {
            const state:String = data.animationState.name;
            switch (state) {
                case "fadeIn:
                    armature.animation.play("idle");
                    break;
                case "idle":
                    armature.animation.play("fadeIn");
                    break;
            }
        }
    }

And you see that when fadeIn changes to idle it wil blink very noticeably. It occurs because event called not right after loop ended but after it ended and some calculations has made. This means that the event does not called in that frame but in the next.

If fadeIn has 10 frames, it will called in (11 % 10) == first frame. Animation is played succesfully played first frame and then on 2 (12 % 10) frame it will be changed to another animation. But user will see annoying glitch.

Please fix it please.

@WeslomPo
Copy link
Author

WeslomPo commented Aug 4, 2016

You can see that by that link

https://dl.dropboxusercontent.com/u/7788967/Demo/ururu-bug/index.html

After 1/3 second it blinking

@WeslomPo
Copy link
Author

WeslomPo commented Aug 4, 2016

I find some workaround. Need to use complete event and play("fadeIn",1); And after it change animations.
It counterintuitive, because default settings in dbpro playing animation with -1 and it makes that you never ever catch COMPLETE event, NEVER. You need or disable that feature by hand or stop animation and play it in next line with parameter 1. If LOOP_COMPLETE called in right time this is workaround not needed.

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

1 participant