wip
This commit is contained in:
1 parent
1cb3b0bad9
commit
2bb7fdbc27
3 files changed
+11
-6
No files matched your search
@@ -1,4 +1,4 @@
|
||||
function animate(element, end, duration = 500) {
|
||||
function animate(element, end, duration = 500, fixtotwo = false) {
|
||||
console.log(element, end);
|
||||
|
||||
var element = document.getElementById(element);
|
||||
@@ -21,7 +21,8 @@ function animate(element, end, duration = 500) {
|
||||
// Calculate current value and round to integer
|
||||
const currentCount = Math.round(end * easedProgress * 100) / 100;
|
||||
|
||||
element.innerHTML = currentCount;
|
||||
if (fixtotwo) element.innerHTML = currentCount.toFixed(2);
|
||||
else element.innerHTML = currentCount;
|
||||
|
||||
if (progress < 1) {
|
||||
requestAnimationFrame(updateCount);
|
||||
|
||||
Reference in new issue
Block a user