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 task solution #3630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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://akyval.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
10 changes: 8 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
<title>Stop watch</title>
<link
rel="stylesheet"
href="./styles/index.scss"
href="/src/styles/index.scss"
/>
</head>
<body>
<h1>Stop watch</h1>
<div class="stopwatch">
<div class="stopwatch__dial">
<div class="stopwatch__hand stopwatch__hand--minutes"></div>
<div class="stopwatch__hand stopwatch__hand--seconds"></div>
<div class="stopwatch__center"></div>
</div>
</div>
</body>
</html>
82 changes: 82 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: white;
}

.stopwatch {
width: 80vmin;
height: 80vmin;
position: relative;
}

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

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

.stopwatch__hand {
position: absolute;
bottom: 50%;
left: 50%;
transform-origin: bottom;
transform: translateX(-50%) rotate(0deg);
z-index: 5;
}

.stopwatch__hand--minutes {
width: 3vmin;
height: 20vmin;
background-color: #0700ff;
animation: rotate-minutes 3600s steps(60) infinite;
}

.stopwatch__hand--seconds {
width: 1.5vmin;
height: 38vmin;
background-color: #2c8000;
animation: rotate-seconds 60s linear infinite;
}

@keyframes rotate-seconds {
from {
transform: translateX(-50%) rotate(0deg);
}

to {
transform: translateX(-50%) rotate(360deg);
}
}

@keyframes rotate-minutes {
from {
transform: translateX(-50%) rotate(0deg);
}

to {
transform: translateX(-50%) rotate(360deg);
}
}

.stopwatch--speed-up .stopwatch__hand--seconds {
animation-duration: 10s;
}

.stopwatch--speed-up .stopwatch__hand--minutes {
animation-duration: 600s;
}
Loading