Giter VIP home page Giter VIP logo

javascript-clock's People

Contributors

webdevsimplified avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

javascript-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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.