-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix for issue #54 - onComplete not being called for nested timeline. #59
base: master
Are you sure you want to change the base?
Conversation
cc @bchevalier :) |
So the callback of the timeline would trigger before the callback of all its playables? |
The callback for each sub-timeline triggers after all of it's playables are finished (same behavior as it is now). However, as you surmised - it is possible for the timeline to finish on a different (later) tick than one of it's children. For example, if there are two children that should finish on the same tick, then the first will finish, the next tick will occur, then the last child and the timeline will finish in the next tick. I will need to have a look at how we can ensure they complete on the same tick - obviously this is not the current behavior anyway when durations are within the same frame. |
@bchevalier Regarding the issue above. The current implementation does not appear to make any attempt to ensure the tweens/timelines finish on the same tick. So I think this will require some additional work to make sure this can happen in a robust way. So I am investigating potential fixes for this. I have a couple of options that may work: A) Implement messaging so that the tweens can inform their parent that they have been completed - when we add the tween to the timeline, the timeline can register for an onComplete event with the tween. Then we can keep track of completed / uncompleted tweens. or B) Modify the loop that iterates through a Players tweens. Currently it updates the list of playabables before iterating through them, which makes sense, but has the side effect that when you have finished iterating, the Player doesn't know whether they are all complete until the next tick. So I could check the playables once they have been processed and determine if they have completed, then complete the Playable (timeline) that contains them. Do you have any thoughts on this? Few last questions:
|
I am not really in favor of adding an event emission system in TINA, would make it heavier and less performant. About your questions:
|
|
Description
In certain circumstances Tina was killing the main timeline before all it's children were completed. This would result in some Tweens not fully completing, and not triggering their onComplete callbacks.
The issue results from the fact that the both players and playables (timelines/sequences and Tweens) inherit from BriefExtension, and it is in this object that the test for "completion" is made. There are no checks in this code to ensure that we are not currently a player with active dependencies - it treats players and playables as having the same completion conditions, therefore it can complete early - leaving any active tweens stranded.
In many (most) circumstances this would be okay, however, when all or some of the children have a duration that would complete within the current frame this could trigger the issue. Each playable/player in the hierarchy updates themselves, INCLUDING the main timeline.
To this end I added:
Concerns
Images