javascript-clock's People
Forkers
shiva-srk thien521999 patrickebs raresmihalache stanleytorres trivedisorabh zubairkh sumit07sinha viridianajim mohsen3241 romeomurmu 20natalialui dilkax1023 askinekincihf anirudhchopra2810 nebeddag ashuamith acolasso justindcole soumendas123 hrshk15 smwaziri bengarlock matthewgermeyer jaigora24 ez-it-solutions bbrad3 mertcantopal priysharma26 web-dev-ritchie satyam9721 freddaoism mrhappyhere emetlevy nowha52 windypham erickodaga iantitford shahmeerhamza ruchitha462 valentino-junior yigitsr amitxfactor018 banglasky gandalf1123 smroble1996 joshuad48 muhseenhub kshermanstudios simo1785 parthp1298 garyhost2 bhargav-borah rook16rus tecfay fmgono edwardsmacca rabatamedia chathura98210 boatheadsheena olowojibola jhonyuui gexer007 kim13kih itbj yasinpalizban iambeskmot begoon ethanr00driguez mashmummashuk meut02 beshur mionitrajavascript-clock's Issues
Adjusting how the hands work
So I took WebDevSimplified's code and tried to tinker it so that on the final output, the hands of the clock would move like how a normal clock moves.
I changed the CSS and JS. With the JS, I got rid of three variables and based fixing the rotations around only having the second hand moving initially.
What I came up with doesn't work, but hopefully someone can look at what I wrote and debug it.
``
const hourHand = document.querySelector('[data-hour-hand]')
const minuteHand = document.querySelector('[data-minute-hand]')
const secondHand = document.querySelector('[data-second-hand]')
const begin = document.getElementById('top')
const leverage = minuteHand.style.transform
const constant = hourHand.style.transform
const manos = document.getElementsByClassName('.number').innerText // get all the numbers on the clock and their inner text
const typeclock = Array.from(manos) // create an array out of all the numbers collected
function setMinuteHand () {
while (secondHand.style.transform === 'rotate(360deg)') {
minuteHand.style.position = begin.style.position // the minute hand starts at 12
if (secondHand.style.position === begin.style.position) { // Once the second hand hits "12" again...
leverage.style.transform = 'rotateZ(30deg)' // the minute hand should shift 30 degrees right
}
for (var i = 0; i < typeclock.length; i++) {
minuteHand.style.position = typeclock[i]++ // Buffer in case the leverage statement doesn't work (we shift from "12" to "1")
}
}
}
setMinuteHand()
function setHourHand () {
while (secondHand.style.transform === 'rotate(360deg)') {
hourHand.style.position = begin.style.position // the hour hand starts at 12
if (secondHand.style.position === begin.style.position) { // Once the second hand hits "12" again...
constant.style.transform = 'rotateZ(30deg)'// the hour hand should shift 30 degrees right
}
for (var i = 0; i < typeclock.length; i++) {
hourHand.style.position = typeclock[i]++ // Buffer in case the statement with constant above doesn't work (we shift from "12" to "1")
}
}
}
setHourHand()''
Confused a little. Sorry m8s.
So, I downloaded all 3 files to a new folder. Then I opened index.html, and all I see is a column of number 1-10. There's no js clock. What am I doing wrong here? I'm pretty sure the css file and the .js file are being linked to properly in the html file.
Thanks!
Css - numbers
All the numbers starting with 6 are backwards can I get help ?
the hours
Idk why its showing a wrong hour!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.