Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed the age calculator app challenge and also removed the animateValue animation . #96

Merged
merged 12 commits into from
Jan 12, 2024

Conversation

jen67
Copy link
Owner

@jen67 jen67 commented Jan 12, 2024

This challenge was quite difficult but I managed to finish it. The code that I am so Proud of is:

function animateValue(element, start, end, duration) {
    let current = start;
    let range = end - start;
    let increment = end > start ? 1 : -1;
    let stepTime = Math.abs(Math.floor(duration / range));
    let timer = setInterval(function () {
      current += increment;
      element.textContent = ` ${current}`;
      if (current == end) {
        clearInterval(timer);
      }
    }, stepTime);
  }

Copy link

vercel bot commented Jan 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dropdown-nav ✅ Ready (Inspect) Visit Preview Jan 12, 2024 8:58pm
fylo-landing-page ✅ Ready (Inspect) Visit Preview Jan 12, 2024 8:58pm
tip-calculator ✅ Ready (Inspect) Visit Preview Jan 12, 2024 8:58pm

@jen67
Copy link
Owner Author

jen67 commented Jan 12, 2024

This was quite stressful

@jen67 jen67 merged commit ac77b4d into main Jan 12, 2024
4 checks passed
@jen67 jen67 changed the title Completed the age calculator app challenge Completed the age calculator app challenge and also removed the animateValue animation . Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant