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
7 changes: 5 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Stopwatch task

Create a working stopwatch with minute and second hands using **only CSS animations**.

- Use the reference image below to create a stopwatch:
- place it in the center of the page (vertically and horizontally)
- stopwatch must have a size of `80vmin` x `80vmin`
Expand All @@ -14,6 +15,7 @@ Create a working stopwatch with minute and second hands using **only CSS animati
- For minutes hand use steps animation with 60 steps. It should take the `60min` for the minutes hand to make a full circle.

In addition to the basic functionality create a BEM modifier called `speed-up` for your stopwatch block:

- it will take only `10s` for the seconds hand to make a full circle (change animation duration)
- it will take only `10min` for the minutes hand to make a full circle (change animation duration)

Expand All @@ -23,7 +25,7 @@ In addition to the basic functionality create a BEM modifier called `speed-up` f

> Here are the [Layout Tasks Instructions](https://mate-academy.github.io/layout_task-guideline)

*Important note*: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
_Important note_: In this task, you are allowed to link `*.scss` files directly in HTML `<link>` tags using `href` attribute.
This is possible because [we use the Parcel library](https://en.parceljs.org/scss.html) to bundle your solution's source code.

![reference image](reference.png)
Expand All @@ -32,7 +34,8 @@ 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://AdrJeeN.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__minutes-hand"></div>
<div class="stopwatch__seconds-hand"></div>
<div class="stopwatch__center"></div>
</div>
</body>
</html>
79 changes: 79 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,82 @@
$stop-watch-size: 80vmin;
$border-weight: 1vmin;
$border-color: #000;
$minute-hand-length: 20vmin;
$minute-hand-width: 3vmin;
$minute-hand-bgc: #0700ff;
$second-hand-length: 38vmin;
$sedond-hand-width: 1.5vmin;
$second-hand-bgc: #2c8000;
$center-size: 5vmin;
$center-bgc: #f6a603;

@mixin hand {
position: absolute;
bottom: 50%;
left: 50%;
transform: translateX(-50%);
}

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

.stopwatch {
height: $stop-watch-size;
width: $stop-watch-size;
border: $border-weight dotted $border-color;
border-radius: 50%;
position: relative;

&__minutes-hand {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item Keyframes implemented using from/to + transform with rotate property for the minutes hand in base state: you never assign any animation to .stopwatch__minutes-hand without the speed-up modifier. You need a default animation using these keyframes so the watch works when mentors remove stopwatch--speed-up.

@include hand;

width: $minute-hand-width;
height: $minute-hand-length;
background-color: $minute-hand-bgc;
transform-origin: center bottom;
animation: rotate-clock 3600s steps(60, end) infinite;
}

&__seconds-hand {
@include hand;

width: $sedond-hand-width;
height: $second-hand-length;
background-color: $second-hand-bgc;
transform-origin: center bottom;
animation: rotate-clock 60s linear infinite;
}

&__center {
width: $center-size;
height: $center-size;
background-color: $center-bgc;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

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

&--speed-up .stopwatch__seconds-hand {
animation-duration: 10s;
}
}

@keyframes rotate-clock {
from {
transform: translateX(-50%) rotate(0deg);
}
to {
transform: translateX(-50%) rotate(360deg);
}
}
Loading