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 performance.now() and canceled rAF after stop() #91

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

Added performance.now() and canceled rAF after stop() #91

wants to merge 5 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 13, 2016

Currently, operations after stop().

screen shot 2016-12-08 at 07 51 14

With the proposed changes.

screen shot 2016-12-08 at 07 53 07

I took the liberty of adjusting the init/start/stop lifecycle and time handling in function of the rAF callback lifecycle.

  • Now the first context.dt is always 0 because there is no previous frame
  • context.now and context.dt hold meaningful values only when context.running is true
  • context.millis is the overall time spent in the animation loop [1] , not the context's lifetime
  • context.st (start time, in the spirit of .dt) was added in order to easily determine the lifetime of the context
  • Context initialization was adjusted to the new main behavior

I tried to match your coding style, but some air may be missing here and there. :)


[1] Minus the last frame, which is a shortcoming that might need to be addressed.

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.

1 participant