Added time shift parameter - #2
Open
MisterProper9000 wants to merge 5 commits into
Open
MisterProper9000 wants to merge 5 commits into
MisterProper9000 wants to merge 5 commits into
Conversation
Added a time shift parameter for each transition type (except dissolve): as if the transition had already been in progress for some time by the moment of its start. Updated test script to show new behaviour.
To fix typo in blink function and not affecting existing projects a blinkContinuous function was added.
Added blinkContinuous function
To provide more natural behaviour onPause call was added in case if time shifted transition has delay. onPause called after one execution of object`s parameter recalculation which performs even if time shifted transition has delay and only after that thansition waits for delay ms. So there is some kind of pause happens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into a problem that the library doesn't have the ability to start the transition from the values of object's properties that were on the transition at the moment t, which can be difficult to calculate, especially if the transition rule is complex (for example, outInBounce).
In my case, it was needed to initialize the scales of objects that approach the player from the horizon and grow up nonlinearly and which have to be between the player and the horizon when scene appears.
So I added a
time shiftparameter to all transitions (exceptdissolve) which defines initial value of object's property when the transition starts.A short explanation of how
time shiftparameter behaves and interacts with thedelayparameter in transition with durationT:time shift> 0 then transition begins with the value of the object's properties that would have been reached by the object by time equalstime shiftwith an unmodified transition and lasts forT - time shiftms.delayms, and then transition continues forT - time shiftms.time shift< 0 then trasition behaves as ifdelayis defined and equals|time shift|.delay> 0 andtime shift< 0 then transition waits fordelay + |time shift|ms and then starts from the initial values of object's property and lasts forTms.These code changes will not affect any existing projects.