progressbar.js icon indicating copy to clipboard operation
progressbar.js copied to clipboard

Setting duration to 0 should disable animation

Open lougreenwood opened this issue 6 years ago • 4 comments

It would be useful if when a progress bar has a duration = 0, then animation would be disabled.

I understand that it may be possible to address this with .set() vs .animate() - but unfortunately, my use case doesn't allow for this...

lougreenwood avatar Apr 05 '18 20:04 lougreenwood

Could you explain a bit more why your use case doesn't allow that? Even though the duration would be set to 0, you still have to call .set() or .animate().

kimmobrunfeldt avatar May 28 '18 17:05 kimmobrunfeldt

I'm actually using EmberJS, so I use an add-on which wraps progress.js (https://github.com/patience-tema-baron/ember-progress-bar).

This wrapper doesn't expose a way to set or animate. I could request that maintainer adds it as a feature to the wrapper, but it seems it would make for a cleaner API to your upstream project if it were added here...

Seems that .set() vs .animate() is an implementation detail anyway and presence (or absence) of duration is a better indication of whether to animate the progress bar...

lougreenwood avatar May 28 '18 17:05 lougreenwood

Ok thanks for the explanation. In this case I think duration 0 could indeed disable the animation as you explained.

In general, ProgressBar.js exposes a simple imperative API by design. Wrappers (e.g. for React or Ember) should be wrap this to a more native API in their worlds.

kimmobrunfeldt avatar May 30 '18 14:05 kimmobrunfeldt

I'm open for a PR to this feature. It should be quite simple change.

kimmobrunfeldt avatar May 30 '18 14:05 kimmobrunfeldt