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

Animations #31

Open
tmandry opened this issue Nov 17, 2018 · 0 comments
Open

Animations #31

tmandry opened this issue Nov 17, 2018 · 0 comments

Comments

@tmandry
Copy link
Owner

tmandry commented Nov 17, 2018

I'm liking the way Hammerspoon does animations. In short, it drives the animation from its own event loop, dispatching writes at a set interval (looks like it's 10ms or so). I wasn't sure if such an approach would work, but it looks pretty decent to me on my machine.

Some thoughts on implementation...

  • Animations should happen on a per-property basis.
  • While a property is being animated, we can keep the property's requestLock locked so no other reads/writes go through
    • This means no events on the property until the animation is done. external would be properly set.
  • Synchronous writes under a timer are probably the best approach. That way we don't pay the overhead of scheduling a function on the event loop.
    • On the other hand, if we are animating many properties at once, do we want many timers firing? Would only one be best? Many timers would provide "fairness" so that one application can't freeze out the rest, but it might be inefficient.
    • Perhaps one per application?? Pass an AnimationContext to each writeable property which contains the timer, and have one per application.
    • Also, don't forget that we can use timeout.
  • The core Animation class should simply provide the proper integration with the property internals. Allow a user to compute the actual values for each animation step. Include a simple "linear schedule" to get started. API should be similar to Cocoa animation APIs.
    • Is there a way to actually use the Cocoa animation schedules with our class?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant