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

watch #3644

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

watch #3644

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This is possible because [we use the Parcel library](https://en.parceljs.org/scs
## Checklist

❗️ Replace `<your_account>` with your GitHub username and copy the links to the `Pull Request` description:
- [DEMO LINK](https://<your_account>.github.io/layout_stop-watch/)
- [DEMO LINK](https://Diana2369.github.io/layout_stop-watch/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

Expand Down
6 changes: 5 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
/>
</head>
<body>
<h1>Stop watch</h1>
<div class="stopwatch">

Choose a reason for hiding this comment

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

Add the modifier class here .stopwatch--speed-up

<div class="stopwatch__circle"></div>
<div class="stopwatch__minute-hand"></div>
<div class="stopwatch__second-hand"></div>
</div>
</body>
</html>
76 changes: 76 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
body {
height: 100vh;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
}

.stopwatch {
position: relative;
width: 80vmin;
height: 80vmin;
border: 1vmin dotted #000;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}

.stopwatch__circle {
position: absolute;
width: 5vmin;
height: 5vmin;
background-color: #f6a603;
border-radius: 50%;
z-index: 10;
}

.stopwatch__minute-hand {
position: absolute;
width: 3vmin;
height: 20vmin;
background-color: #0700ff;
transform-origin: bottom;
top: 50%;
left: 50%;
transform: translate(-50%, -100%) rotate(0deg);
animation: minute-rotation 3600s steps(60) infinite;
z-index: 1;
}

.stopwatch__second-hand {
position: absolute;
width: 1.5vmin;
height: 38vmin;
background-color: #2c8000;
transform-origin: bottom;
top: 50%;
left: 50%;
transform: translate(-50%, -100%) rotate(0deg); /* Начальная позиция */
animation: second-rotation 60s linear infinite;
z-index: 1;
}

@keyframes second-rotation {
0% {
transform: translate(-50%, -100%) rotate(0deg);
}
100% {
transform: translate(-50%, -100%) rotate(360deg);
}
}

@keyframes minute-rotation {
0% {
transform: translate(-50%, -100%) rotate(0deg);
}
100% {
transform: translate(-50%, -100%) rotate(360deg);
}
}

Choose a reason for hiding this comment

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

Don't need to duplicate key frames with the same scenario

Suggested change
@keyframes second-rotation {
0% {
transform: translate(-50%, -100%) rotate(0deg);
}
100% {
transform: translate(-50%, -100%) rotate(360deg);
}
}
@keyframes minute-rotation {
0% {
transform: translate(-50%, -100%) rotate(0deg);
}
100% {
transform: translate(-50%, -100%) rotate(360deg);
}
}
@keyframes rotation {
0% {
transform: translate(-50%, -100%) rotate(0deg);
}
100% {
transform: translate(-50%, -100%) rotate(360deg);
}
}


.stopwatch--speed-up .stopwatch__minute-hand {
animation-duration: 600s;
}

.stopwatch--speed-up .stopwatch__second-hand {
animation-duration: 10s;
}