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

Added time shift parameter #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

MisterProper9000
Copy link

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 shift parameter to all transitions (except dissolve) which defines initial value of object's property when the transition starts.

A short explanation of how time shift parameter behaves and interacts with the delay parameter in transition with duration T:

  • if time shift > 0 then transition begins with the value of the object's properties that would have been reached by the object by time equals time shift with an unmodified transition and lasts for T - time shift ms.
  • if both are defined and both > 0 then one calculation of object's properties is performed, then it waits for delay ms, and then transition continues for T - time shift ms.
  • if time shift < 0 then trasition behaves as if delay is defined and equals |time shift|.
  • if both are defined and delay > 0 and time shift < 0 then transition waits for delay + |time shift| ms and then starts from the initial values of object's property and lasts for T ms.

These code changes will not affect any existing projects.

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.
@CLAassistant
Copy link

CLAassistant commented Jan 19, 2021

CLA assistant check
All committers have signed the CLA.

To fix typo in blink function and not affecting existing projects a blinkContinuous function was added.
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.
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

Successfully merging this pull request may close these issues.

2 participants