This repository has been archived by the owner on Aug 22, 2021. It is now read-only.
Support Exponential Counter #35
Comments
Maybe a custom |
Unfortunately callback is only called at the end. For something like this, we would need to provide a custom delay function, which can be tweaked to some easing formula with the parameter divisions. |
I've made simple tweaks to the library to allow easing functions, here is an example: jquery.counterup.js ...
var step = 0;
var easing = 'easeInOutQuint';
var f = function () {
step++;
var progress = step / divisions
var delay = easings[easing](progress);
delay = parseFloat(delay.toFixed(2));
delay = delay * 20; // tends to 20 ms
...
if ($this.data('counterup-nums').length) {
setTimeout($this.data('counterup-func'), delay);
}
... where |
Open
@weisk so i need jquery easings as a dependency now? Or can I just declare my own? |
@luckydonald you don't really need it as a dependency, open the file, and grab the formula for the easing you want |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I love this library.
Could we support exponential counting so the numbers look like they are accelerating faster as time goes by giving the user a perception of faster experience?
To do this we would have to replace
parseInt(num / divisions * i)
with aMath.Log
functionThe text was updated successfully, but these errors were encountered: