I'm using this JS animated counter. At the moment there only seems to be two options for the animation - "linear" or "swing".
There seems to be very little JS defining this so it feels like I'm missing something. How can I make it ease out instead of using linear or swing?
From what I can tell this is the block that controls the easing:
function doCount(num, index, speed, groupClass, direction, easing) {
let className = groupClass + ' ' + counterClass + '.' + 'c_' + index;
if(easing == undefined) easing = "swing";
$(className).animate({
num
}, {
duration: +speed,
easing: easing,
step: function (now) {
if (direction == 'reverse') {
$(this).text(num - Math.floor(now));
} else {
$(this).text(Math.floor(now));
}
},
complete: doCount
});
}
The variable easing
is just calling in the data attribute which is either set to linear by default or swing.
I've tried just adding "easeOut" but no luck with that hit and hope!!
from Add an "Ease out" option to the animation
No comments:
Post a Comment