Make the progress animation smoother
sindresorhus opened this issue · comments
Right now it only updates each time progressValue
is updated or the NSProgress instance in progress
changes. Let say you use this to update on each processed frame of a video, so the longer the video is, the smoother the progress animation is. That also means it will be pretty choppy on short clips.
Normally you would use a CALayer, which would animate between the progress events. This is however not possible for the Dock icon as we have to call .display()
manually each time we want to update it. I tried to use CALayer and just capture an image of the layer 30 times a second, but it seems it's only possible to capture before or after the animation.
I think the solution is to simply implement the animation ourselves with an interval timer. We already have the previous progress and the current progress, so we can animate between them. It's a bit more complicated though as if we receive a new progress change while we're animation, we now need to animate to the new progress.
I'm also happy to consider other ideas.
I think we should also fade-in and fade-out the progress animation so it doesn't just suddenly appear at 0% and disappear at 100%.
IssueHunt Summary
hazeycode has been rewarded.
Backers (Total: $100.00)
- issuehunt ($100.00)
Submitted pull Requests
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
@issuehuntfest has funded $100.00 to this issue. See it on IssueHunt
@sindresorhus We could implement CADisplayLink. Basically 60fps animation. Shouldn't be too much code, and I need to update my own CADisplayLink animation libs anyways.
I could take a look at this. However, I think performance issues with the badge/pie styles may want to be addressed first (some comments on performance: #17)
@sindresorhus has rewarded $90.00 to @hazeycode. See it on IssueHunt
- 💰 Total deposit: $100.00
- 🎉 Repository reward(0%): $0.00
- 🔧 Service fee(10%): $10.00