Prevent elements from jump-cutting after an interruption
This CL adds initial support for interruptions. Before this CL, whenever a new transition was started, all elements taking part in this transition (i.e. elements in the transition fromScene or toScene) would instantly jump to their new state in this transition. This CL improves this by tracking the current transition used by an element. If that transition is interrupted (i.e. the transition for that element changed), we save the current state of the element. Then, the next time we compute the state of the element, which is the first time we compute the state of the element given the new transition, we also compute and save the diff/delta between the state we saved earlier and the new state. This delta is then animated to zero and added to the state computed with the new transition. That way, we nicely animate to the new state of the new transition while preventing jump cuts caused by the interruption. This CL adds support for elements offset, alpha and scale. The size will be supported in a follow-up CL; it is quite harder to support given that elements can be measured only once. The unit test focus on offset only at the moment, because testing scale and alpha in a unit test can't really be done without changing production code. I *might* add some screenshot tests for this in another CL. See b/290930950#comment5 for details on how this works. Bug: 290930950 Test: ElementTest Test: Performed a lot of different transitions in a row in the STL demo manually. Test: This change should not have any impact on usages outside of the STL demo given that interruptions were disabled everywhere in ag/26621600 and will be enabled later after thorough manual testing. Flag: N/A Change-Id: I5b2ee38d71b947cd3aaf587194281c75eca1a0ca
Loading
Please register or sign in to comment