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
Binary file added Clock/image/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Clock/image/clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions Clock/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Day3</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div class="container">
<div class="circle">
<div class="inner">
<div class="sec"></div>
<div class="min"></div>
<div class="hour"></div>
</div>
</div>
</div>
<script>

setInterval(() => {
d = new Date(); //object of date()
hr = d.getHours();
min = d.getMinutes();
sec = d.getSeconds();
hr_rotation = 30 * hr + min / 2; //converting current time
min_rotation = 6 * min;
sec_rotation = 6 * sec;

hour=document.querySelector(".hour")
minute=document.querySelector(".min")
second=document.querySelector(".sec")

hour.style.transform = `rotate(${hr_rotation}deg)`;
minute.style.transform = `rotate(${min_rotation}deg)`;
second.style.transform = `rotate(${sec_rotation}deg)`;
}, 500);
</script>
</body>

</html>
94 changes: 94 additions & 0 deletions Clock/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
body{
margin: 0;
padding: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
background: url(./image/background.png);
background-color: rgb(77, 51, 51);

}
.container{

height: 40vw;
width: 40vw;
}
.circle{

position: absolute;
border-radius: 50%;
border: 5px solid grey;
background:orangered;
padding: 30px;
top: 10%;


}

.inner{
position: relative;
background: url("./image/clock.png") no-repeat;
background-size: cover;
background-color: aliceblue;

height: 400px;
width: 400px;
border-radius: 50%;
display: inline-block;
padding: 17px;

}
.sec{
position: relative;
height: 150px;
width: 3px;
left: 196px;
top:50px;
background:black;
transform-origin: bottom;
/* transform: rotate(0deg); */
/* animation: sec_anim 60s linear infinite; */
}

.min{
position: relative;
height: 130px;
width: 5px;
left: 195px;
top:-80px;

background:black;
transform-origin: bottom;
transform: rotate(0deg);
/* animation: min_anim 3600s linear infinite; */
}
.hour{
position: relative;
height: 110px;
width: 7px;
left: 194px;
top:-190px;

background:black;
transform-origin: bottom;
transform: rotate(0deg);
/* animation: hour_anim 216000s linear infinite; */
}


/* When Js Is not being Used */

/* @keyframes sec_anim{
from{transform:rotate(0deg);}
to{transform:rotate(360deg);}
}
@keyframes min_anim{
from{transform:rotate(336deg);}
to{transform:rotate(360deg);}
}
@keyframes hour_anim{
from{transform:rotate(24deg);}
to{transform:rotate(360deg);}
} */