Current time clock icon
How do I make an current time clock icon?
A little dynamic clock icon that displays the current time on which the browser first entered the site.. What is a current time clock icon? How do you make a current time clock icon? This script and codes were developed by Michael Lee on 20 January 2023, Friday.
Current time clock icon - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Current time clock icon</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="centerer"> Current time is <span class="currentTime"></span> <div class="clock"> <div class="clock-center"></div> <div class="clock-hand-container clock-hours"> <div class="clock-hand clock-hand-hours"></div> </div> <div class="clock-hand-container clock-minutes"> <div class="clock-hand clock-hand-minutes"></div> </div> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Current time clock icon - Script Codes CSS Codes
.clock { height: 40px; width: 40px; border: 4px solid #000; border-radius: 100%; position: relative; margin: 0.5rem auto 0;
}
.clock-center { height: 6px; width: 6px; background: #000; border-radius: 100%; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);
}
.clock-hand-container { height: 40px; width: 40px; display: block; position: absolute; left: 0; top: 0; -webkit-transition: 0.1s -webkit-transform ease-in; transition: 0.1s -webkit-transform ease-in; transition: 0.1s transform ease-in; transition: 0.1s transform ease-in, 0.1s -webkit-transform ease-in;
}
.clock-hand { width: 4px; background: #000; position: absolute; left: 50%; border-radius: 4px;
}
.clock-hand-hours { height: 8px; top: 7px; -webkit-transform-origin: 0px 14px; transform-origin: 0px 14px; -webkit-transform: translateX(-50%); transform: translateX(-50%);
}
.clock-hand-minutes { height: 12px; top: 3px; -webkit-transform-origin: 0px 18px; transform-origin: 0px 18px; -webkit-transform: translateX(-50%); transform: translateX(-50%);
}
.centerer { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);
}
Current time clock icon - Script Codes JS Codes
function formatHours(x){ if(x > 12){ return x - 12; }else{ return x; }
}
function formatMinutes(x){ if(x < 10){ return "0"+x }else{ return x; }
}
function rotateArms(time, armType){ if(armType == "hours"){ return (time * 360)/12; }else{ return (time * 360)/60; }
}
jQuery.fn.rotate = function(degrees) { $(this).css({'-webkit-transform' : 'rotate('+ degrees +'deg)', '-moz-transform' : 'rotate('+ degrees +'deg)', '-ms-transform' : 'rotate('+ degrees +'deg)', 'transform' : 'rotate('+ degrees +'deg)'}); return $(this);
};
var currentTime = new Date();
var hours = formatHours(currentTime.getHours());
var minutes = formatMinutes(currentTime.getMinutes());
$(".currentTime").text(hours+":"+minutes);
$('.clock-hours').rotate(rotateArms(hours, "hours"));
$('.clock-minutes').rotate(rotateArms(minutes, "minutes"));
Developer | Michael Lee |
Username | michaellee |
Uploaded | January 20, 2023 |
Rating | 4 |
Size | 2,794 Kb |
Views | 16,192 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Page Animation | 3,202 Kb |
Breathing Giphy Logo | 3,483 Kb |
Ringing bell | 3,287 Kb |
Profile background and color changer prototype for CodeHive | 6,454 Kb |
SVG Hearts | 1,513 Kb |
Stop Using Corner Banners | 2,765 Kb |
IOS Messages Typing Bubble | 2,933 Kb |
Responsive C3.js chart | 2,111 Kb |
My Daily Routine Visualized | 3,544 Kb |
Axe the Hamburger, Hail the Tab Bar | 3,901 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
React Recipe Box | Krokodill | 5,347 Kb |
Velocity.js custom stagger | Tommiehansen | 4,805 Kb |
Kudos Please | TimPietrusky | 6,624 Kb |
Css3 loader | Clknap | 2,391 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Pure CSS Animated Photo Stack | Depthdev | 2,486 Kb |
Border image | JohnRiordan | 2,120 Kb |
Navier Stoke Fluid Simulation | Esimov | 8,584 Kb |
SVG Hover Animations | Kjbrum | 10,557 Kb |
Experiments with Vertical Centering | KatieK2 | 3,924 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!