Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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://Denis-Melnikov-dev.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
12 changes: 10 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
content="width=device-width,
user-scalable=no,
initial-scale=1.0,
maximum-scale=1.0,
minimum-scale=1.0"
/>
<meta
http-equiv="X-UA-Compatible"
Expand All @@ -17,6 +21,10 @@
/>
</head>
<body>
<h1>Stop watch</h1>
<div class="stopwatch stopwatch--speed-up">
<div class="stopwatch__minutes"></div>
<div class="stopwatch__seconds"></div>
<div class="stopwatch__center"></div>
</div>
</body>
</html>
66 changes: 66 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
@import './utils/variables';

@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

body {
margin: 0;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}

.stopwatch {
width: $stopwatch-size;
height: $stopwatch-size;
border: 1vmin dotted #000;
border-radius: 50%;
position: relative;

&__minutes {
height: 20vmin;
width: $minutes-width;
background-color: #0700ff;
box-sizing: border-box;
position: absolute;
bottom: 50%;
left: calc(50% - ($minutes-width / 2));
transform-origin: center bottom;
animation: rotation #{$seconds-in-hour}s steps(60) infinite;
}

&__seconds {
height: 38vmin;
width: $seconds-width;
background-color: #2c8000;
box-sizing: border-box;
position: absolute;
bottom: 50%;
left: calc(50% - ($seconds-width / 2));
transform-origin: center bottom;
animation: rotation #{$seconds-in-min}s linear infinite;
}

&__center {
height: $center-size;
width: $center-size;
background-color: #f6a603;
border-radius: 50%;
box-sizing: border-box;
position: absolute;
bottom: calc(50% - ($center-size / 2));
left: calc(50% - ($center-size / 2));
}

&--speed-up &__minutes {
animation: rotation #{$seconds-in-min * 10}s steps(60) infinite;
}

&--speed-up &__seconds {
animation: rotation 10s linear infinite;
}
}
6 changes: 6 additions & 0 deletions src/styles/utils/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$stopwatch-size: 80vmin;
$minutes-width: 3vmin;
$seconds-width: 1.5vmin;
$center-size: 5vmin;
$seconds-in-min: 60;
$seconds-in-hour: $seconds-in-min * 60;
Loading