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

add stopwatch #3661

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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://bobuskyi.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 stopwatch--speed-up">
<div class="stopwatch__dot"></div>
<div class="stopwatch__minutes"></div>
<div class="stopwatch__seconds"></div>
</div>
</body>
</html>
71 changes: 71 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
@import 'variables';
@import 'mixins';

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

.stopwatch {
width: $watch-size;
height: $watch-size;
border-radius: 50%;
border: $border-size dotted $color-black;

&__dot {
@include aligin-center;

width: $dot-size;
height: $dot-size;
border-radius: 50%;
background: $color-orange;
transform: translateY(-50%);
z-index: 3;
}

&__minutes {
@include aligin-center;
@include watch-animation(3600s);

width: $minutes-width;
z-index: 1;

&::before {
background: $color-blue;
content: '';
display: block;
width: $minutes-width;
height: $minutes-height;
position: absolute;
top: -$minutes-height;
}
}

&__seconds {
@include aligin-center;
@include watch-animation(60s);

width: $seconds-width;
z-index: 2;

&::before {
background: $color-green;
content: '';
display: block;
width: $seconds-width;
height: $seconds-height;
position: absolute;
top: -$seconds-height;
}
}

&--speed-up {
.stopwatch__minutes {
animation-duration: 600s;
}

.stopwatch__seconds {
animation-duration: 10s;
}
}
}
21 changes: 21 additions & 0 deletions src/styles/mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@mixin aligin-center {
position: absolute;
top: 50%;
margin: 0 auto;
left: 0;
right: 0;
}

@keyframes watch {
from {
transform: rotate(0);
}

to {
transform: rotate(360deg);
}
}

@mixin watch-animation($speed) {
animation: watch $speed steps(360, end) infinite;
}
14 changes: 14 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Colors
$color-black: #000;
$color-orange: #f6a603;
$color-blue: #0700ff;
$color-green: #2c8000;

// Sizes
$watch-size: 80vmin;
$dot-size: 5vmin;
$border-size: 1vmin;
$minutes-width: 3vmin;
$minutes-height: 20vmin;
$seconds-width: 1.5vmin;
$seconds-height: 38vmin;