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

Added a small animation for the clock and the menu bar exit button. #40

Merged
merged 7 commits into from
Oct 18, 2024

Conversation

kerogs
Copy link
Contributor

@kerogs kerogs commented Oct 7, 2024

  • The clock hands will be animated when the time is loaded.
  • The menu bar exit button has a slightly smoother animation than before.

- The clock hands will be animated when the time is loaded.
- The menu bar exit button has a slightly smoother animation than before.
Copy link
Collaborator

@itz-rj-here itz-rj-here left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@itz-rj-here
Copy link
Collaborator

@XengShi You can merge this pull to your repository. It works fine. It adds an animation to the clock and when we exit the menu bar.

Copy link
Collaborator

@itz-rj-here itz-rj-here left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you kindly resolve the conflicts...

@XengShi
Copy link
Owner

XengShi commented Oct 10, 2024

Screencast from 2024-10-10 20-52-54.webm
Kindly fix these issue:

  • When second dot completes it cycle it rotates once in opposite direction
  • Add some margin top for close button & make it perfect circle

- Corrected the rotation of the second dot to prevent it from rotating in the opposite direction after completing its cycle.
- Added top margin to the close button and adjusted its styling to ensure it is a perfect circle.
@kerogs
Copy link
Contributor Author

kerogs commented Oct 10, 2024

Screencast from 2024-10-10 20-52-54.webm Kindly fix these issue:

* When second dot completes it cycle it rotates once in opposite direction

* Add some margin top for close button &  make it perfect circle
  • Corrected the rotation of the second dot to prevent it from rotating in the opposite direction after completing its cycle.
  • Added top margin to the close button and adjusted its styling to ensure it is a perfect circle.

Copy link
Collaborator

@itz-rj-here itz-rj-here left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still the branch has conflicts...

@itz-rj-here
Copy link
Collaborator

@kerogs can you fix this conflicts one more time? So I can review it and ask @XengShi to check the code and merge the pull.

@kerogs
Copy link
Contributor Author

kerogs commented Oct 17, 2024

The conflicts have been resolved

@itz-rj-here
Copy link
Collaborator

@XengShi Can you kindly check this and merge it to the repo. Please.

@itz-rj-here
Copy link
Collaborator

The conflicts have been resolved

Thank you.

@itz-rj-here
Copy link
Collaborator

https://screenrec.com/share/kYws8cfAtO

@XengShi XengShi merged commit ad95658 into XengShi:main Oct 18, 2024
@XengShi
Copy link
Owner

XengShi commented Oct 18, 2024

@kerogs Clock has still some weird animations issues
https://github.com/user-attachments/assets/c9211ca8-bd66-4497-9718-6e55e2307c46

@itz-rj-here
Copy link
Collaborator

@kerogs

@itz-rj-here
Copy link
Collaborator

Looks like it happens when keeping the tab open for too long and using other tab. when going back to the home tab something happens.

@kerogs
Copy link
Contributor Author

kerogs commented Oct 19, 2024

I just tried with different browsers, it happens on browsers like chrome or edge from what I see. I'm on Firefox and I don't have any problems.

So the problem does indeed stem from what @itz-rj-here said.

To ensure that the animation is smooth and that the hands don't move backwards, I had to add up the degrees.
It's not possible (or at least I haven't figured out how) to make the hands go from 280 degrees to 0 degrees correctly with the animation. This would teleport the hands and break the animation.

The problem is that browsers like chrome and edge stop the tab and reload it directly where it's supposed to be. This makes the animation play. If you return to the tab after a while, it will add the number of degrees from where it should be. And since the JS code adds the degrees, it will play an animation (with css) because it will go from 180 degrees to 400 degrees, for example. But I don't know how to make browsers like google and edge not play the CSS animation when you come back to the tab and put the css animation back once the page has added the number of degrees correctly...

@kerogs
Copy link
Contributor Author

kerogs commented Oct 19, 2024

I did some research and the way I found is this:

You need to add code to script.js that will disable the animation for 100 ms after returning to a tab, temporarily disabling the animation so that the browser doesn't rotate the hands too quickly.

window.addEventListener("focus", function() {
    document.querySelector(".clock").classList.add("stop");
    setTimeout(function() {
        document.querySelector(".clock").classList.remove("stop");
    }, 100);
});

and add a class in style.css that will disable the animation. I've tried it on chrome and edge and it works.

.clock.stop #hour,
.clock.stop #minute,
.clock.stop #second {
    transition: unset !important;
}

@itz-rj-here
Copy link
Collaborator

I have classes to attend. Talk to @Minuga-RC about it. I think he had managed to fix the clock but still.

@Minuga-RC
Copy link
Contributor

It's not possible (or at least I haven't figured out how) to make the hands go from 280 degrees to 0 degrees correctly with the animation. This would teleport the hands and break the animation.

I had the same problem so what I did is if the rotation is 0deg i will turn off animations and manually set the rotation to 360deg and it seems to work until #75 happened

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.

4 participants