Skip to main content

How To Create A Simple Analog Clock

 How To Create A Simple Analog Clock

#JAVA #CSS #HTML #coding #tutorial

First you will need to include javascript, Html and CSS codes in your text editor as follows;
Lets first add HTML CODES as below;
<div class="clock">
<div class="hour">
<div class="hr" id="hr"></div>
</div>
<div class="min">
<div class="mn" id="mn"></div>
</div>
<div class="sec">
<div class="sc" id="sc"></div>
</div>
</div>

After you have inserted the Html code in your text editor you will have now to edit Css code using embedded style, where by the css codes are inserted in between <style> </style>tags, which are normally placed in between <head></head> tags of a html file. The css codes are used to apply formatting to the whole clock . Therefore the CSS codes will be inserted as follows;

body{
display: flex;
justify-content: center;
align-items: center;
height: 100px;
background-color: gray;
}

.clock{
width: 300px;
height: 300px;
border-radius: 50%;
background-size: cover;
background-image: url("https://i.posting.cc/hjVspvcJ/clock.png");
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 -15px 15px 0px brown;
inset o -15px 15px gray, 0.15px 15px(0,0,0, 0.3),inset 0 15px 15px(0, 0, 0, 0.3);
}

.clock::before{
content: " ";
width: 15px;
height: 15px;
position: absolute;
background-color: #fff;
border-radius: 50%;
z-index: 1000;
}
.hr::before{
content: " ";
width: 8px;
height: 80px;

background-color: #ff1o5e;
border-radius: 5px;
z-index: 100;
}
.mn::before{
content: " ";
width: 6px;
height: 90px;

background-color: red;
border-radius: 5px;
z-index: 11;
}
.sc::before{
content: " ";
width: 2px;
height: 140px;

background-color: #fff;
border-radius: 5px;
z-index: 10;
}

.hour, .min, .sec{
position: absolute;
}

.hr{
width: 160px;
height: 160px;
}
.mn{
width: 230px;
height: 230px;
}
.sc{
width: 180px;
height: 180px;
}
.hr, .mn,.sc{
display: flex;
justify-content: center;
}

After you have successfully added the css and html codes, the last step you will now have to add the javascript codes in your html tags, where by they are enclosed in between <script></script>tags, which are normally inserted in between <html></html> tags anywhere in within the html file. Therefore the javascript codes are are inserted as follows;

<script>
const deg=6;
const hr=documnet: queryselector("#hr");
const mn=documnet: queryselector("#mn");
const sc=documnet: queryselector("#sc");
setInterval(()=>{
let day=new Date();
let hh=day.getHours()*30;
let mm=day.getMinutes()*deg;
let ss=day.getSeconds()*deg;
hr.style.transform='rotateZ(${hh + mm/12}deg);
mn.style.transform='rotateZ(${mm}deg);
sc.style.transform='rotateZ(${ss}deg);
});
</script>

Comments

Popular posts from this blog

Weekly challenge 3 data analyst google professional certificate

1 . Question 1 The manage stage of the data life cycle is when a business decides what kind of data it needs, how the data will be handled, and who will be responsible for it. 1 / 1  point True False Correct During planning, a business decides what kind of data it needs, how it will be managed throughout its life cycle, who will be responsible for it, and the optimal outcomes. 2 . Question 2 A data analyst is working at a small tech startup. They’ve just completed an analysis project, which involved private company information about a new product launch. In order to keep the information safe, the analyst uses secure data-erasure software for the digital files and a shredder for the paper files. Which stage of the data life cycle does this describe? 1 / 1  point Archive Plan Manage Destroy Correct This describes the destroy phase, during which data analysts use secure data-erasure software and shred paper files to protect private information. 3 . Question 3 In the analyze phase of the d

Prepare Data for Exploration: Weekly challenge 4

Prepare Data for Exploration: Weekly challenge 4 1 . Question 1 A data analytics team labels its files to indicate their content, creation date, and version number. The team is using what data organization tool? 1 / 1  point File-naming verifications File-naming references File-naming conventions File-naming attributes Correct 2 . Question 2 Your boss assigns you a new multi-phase project and you create a naming convention for all of your files. With this project lasting years and incorporating multiple analysts it’s crucial that you create data explaining how your naming conventions are structured. What is this data called? 0 / 1  point Descriptive data Named convention Metadata Labeled data Incorrect Please review the video on naming conventions . 3 . Question 3 A grocery store is collecting inventory data from their produce section. What is an appropriate naming convention for this file? 0 / 1  point Todays_Produce Produce_Inventory_2022-09-15_V01 Todays Produce 2022-15-09 Inventory

Prepare Data for Exploration : weekly challenge 1

Prepare Data for Exploration : weekly challenge 1 #coursera #exploration #weekly #challenge 1 #cybersecurity #coursera #quiz #solution #network Are you prepared to increase your data exploration abilities? The goal of Coursera's Week 1 challenge, "Prepare Data for Exploration," is to provide you the skills and resources you need to turn unprocessed data into insightful information. With the knowledge you'll gain from this course, you can ensure that your data is organised, clean, and ready for analysis. Data preparation is one of the most important processes in any data analysis effort. Inaccurate results and flawed conclusions might emerge from poorly prepared data. You may prepare your data for exploration with Coursera's Weekly Challenge 1. You'll discover industry best practises and insider advice. #answers #questions #flashcard 1 . Question 1 What is the most likely reason that a data analyst would use historical data instead of gathering new data? 1 / 1