https://github.com/ctmax-ui/analog_clock
An analog clock where you can see date and time
https://github.com/ctmax-ui/analog_clock
Last synced: 12 days ago
JSON representation
An analog clock where you can see date and time
- Host: GitHub
- URL: https://github.com/ctmax-ui/analog_clock
- Owner: Ctmax-ui
- Created: 2024-01-31T05:42:05.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-08T05:04:11.000Z (about 1 year ago)
- Last Synced: 2025-01-18T23:18:06.577Z (12 months ago)
- Language: JavaScript
- Homepage: https://ctmax-ui.github.io/Analog_clock/
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# This is an analog clock with digital date and time.
## Technology I used:
Html, CSS, JavaScript, Bootstrap 5.
### Project Link: https://ctmax-ui.github.io/Analog_clock/
I really appricate this Mapping function.
function scale(number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
};
scale(h % 12, 0, 12, 0, 359);
#### Description about this function:
The scale function performs linear scaling or interpolation of a numerical value from one range to another. Given an input value (number) within a specified input range (inMin to inMax), the function transforms this value to a corresponding position within a specified output range (outMin to outMax). The scaling maintains a linear relationship between the input and output, ensuring a proportional mapping.
In essence, the function allows you to convert or map values from one scale to another, making it useful for tasks such as normalizing data, adjusting values to fit within a desired range, or mapping input values to a different output scale. The formula (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin encapsulates this linear scaling process.
### How did i get date and time:
let now = new Date();
let h = now.getHours();
let m = now.getMinutes();
let s = now.getSeconds();
let month = now.getMonth();
let week = now.getDay();
let date = now.getDate();
let amorpm = h <= 12 ? "AM" : "PM";