It turned out that the root cause for not working animations triggered from the other animation's callback is clearing the context after the new animation is set up. Ie. calling m["$$animatorContexts"][contextName].promise.resolve("stopped") triggers the callback, which calls Animator.animate, which sets fields in the m["$$animatorContexts"][contextName]. After the execution of the callback is finished m["$$animatorContexts"].delete(contextName) is called which removes fields that were just set.
How did you implement it:
The previous fix is not needed anymore, hence I reverted it.
Instead of it, I changed the order of resolving the promise and deleting context from the $$animatorContexts object
How can we verify it:
Given there is a component with an id container the following code:
m.container.opacity = 1.0
' Immediate calls
Animator().fadeOut(m.container, { duration: 2 }).finally(sub (state as String)
?"Faded Out - ";state
end sub)
Animator().fadeIn(m.container, { duration: 2 }).finally(sub (state as String)
?"Faded In - ";state
end sub)
Animator().fadeOut(m.container, { duration: 2 }).finally(sub (state as String, m as Object)
?"Again Faded Out - ";state
' Callback calls
Animator().fadeIn(m.container, { duration: 2 }).finally(sub (state as String, m as Object)
?"Again Faded In - ";state
Animator().fadeOut(m.container, { duration: 2 }).finally(sub (state as String, m as Object)
?"And Again Faded Out - ";state
Animator().fadeIn(m.container, { duration: 2 }).finally(sub (state as String)
?"And Again Faded In - ";state
end sub)
end sub, m)
end sub, m)
end sub, m)
Todos:
[X] Write documentation (if required)
[X] Fix linting errors
[X] Enable "Allow edits from maintainers" for this PR
[X] Update the messages below
Is this ready for review?: YES
Is it a breaking change?: NO
What did you implement:
It turned out that the root cause for not working animations triggered from the other animation's callback is clearing the context after the new animation is set up. Ie. calling
m["$$animatorContexts"][contextName].promise.resolve("stopped")
triggers the callback, which callsAnimator.animate
, which sets fields in them["$$animatorContexts"][contextName]
. After the execution of the callback is finishedm["$$animatorContexts"].delete(contextName)
is called which removes fields that were just set.How did you implement it:
The previous fix is not needed anymore, hence I reverted it. Instead of it, I changed the order of resolving the promise and deleting context from the
$$animatorContexts
objectHow can we verify it:
Given there is a component with an id container the following code:
Todos:
Is this ready for review?: YES Is it a breaking change?: NO