Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Age calculator

@ranieto

Desktop design screenshot for the Age calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Not quite satisfied with this one. I couldn't figure out the animation of the numbers. I'll try again in the future. Feedback welcomed.

Community feedback

@TomasPereira-Dev

Posted

Hey!, what's up?.

Glad to hear that you were brave enough to try to solve the bonus animation! it's quite tricky.

What you need to do is use the setInterval function, that every x miliseconds adds +1 to a state variable, if the state variable is bigger than the variable that you used to save the calculated date, the function should stop.

I did it this way in vanilla JS:

let dayNumber = 0; //this should be a state.
let calculatedDays = 420 //this should be what you used for saving the aready calculated days

const daysIntervalAnimation = setInterval((days) => {
            daysNumberParagraph.innerHTML = `<p>${dayNumber} <span>days</span></p>`;
            dayNumber += 1;
            if (dayNumber > days) clearInterval(daysIntervalAnimation);
        }, 30, calculatedDays); 

here's some info about how the setInterval method works

You can also check my code out if you want a more detail version .

Good luck!.

0

@kevorklepedjian1

Posted

Great job, it looks very good. for the animation check gsap and framermotion they will help you alot. keep up the good work

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord