sindresorhus/DockProgress

Make the progress animation smoother #1

sindresorhus posted onGitHub

https://github.com/sindresorhus/DockProgress/blob/2fd7035c8c17e28b261efa04da91d3a6ad403cf2/Sources/DockProgress/DockProgress.swift#L40

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%.


@issuehuntfest has funded $100.00 to this issue. See it on IssueHunt

posted by IssueHuntBot about 6 years ago

@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.

posted by eonist almost 6 years ago

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: https://github.com/sindresorhus/DockProgress/pull/17)

posted by hazeycode almost 2 years ago

@sindresorhus has rewarded $90.00 to @hazeycode. See it on IssueHunt

  • :moneybag: Total deposit: $100.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $10.00
posted by issuehunt-oss[bot] almost 2 years ago

Fund this Issue

$100.00
Rewarded

Rewarded pull request

Other pull requests

Recent activities

hazeycode was rewarded by sindresorhus for sindresorhus/DockProgress# 1
almost 2 years ago
hazeycode submitted an output to  sindresorhus/ DockProgress# 1
almost 2 years ago