Ontherighthandside, wecanseethefinalversionofouractualclock, whichisjust a typicalanalogclock.
Andontheleft, wehaveanemptyindexdothtmlfilewhichcontains a linkforbothourstylesheetaswellas a scripttagforourJavaScriptandnowinsideofhisbodytag.
Thefirstthingweneedtodoisweneededtofind a dipthatisgoingtocontainourclock.
Sowe'respendingcreditifwe'regonnagiveit a classofclockandinsideofhere, thisDiv, we'regoingtoputallofourdifferenthandsaswellasallthedifferentnumbersforourclock.
Inourcase, we'regoingtouse 300 pixelsasairwithinheightbecauseweneedthistobe a squareandwe'realsogoingtogiveit a backgroundcolor, thisbackgroundcolor, I'm goingtouseour G ve A because I wantedtobepartiallytransparent.
So I'm gonnauseentirelywhite, butwithan 80% transparency.
Andessentiallywhatthat's goingtodoisthat's goingtomakethisblueandgreencolorsshinethrough a littlebit, whichisjustgonnamakeitlook a littlebitcleaner.
Whichmeansifwewanttomakethemrelativetotheclock, wehadtomaketheclock a positionofrelativenowinsideofhereforournumbers, we'regonnado a nicelittletricktomakerotatingthesearoundtheclockreallyeasy.
We'regonnasetthewith 2 100% andtheheightto 100%.
Andifwesaythat, youseeeverythinggetsmovedinitstopleftandhavetovisualizewhatwe'vejustdone, I'm goingtoapply a backgroundcourt, thiselement.
Andwe'regonnause a variablecalledrotationandthiswe'regoingtoactuallysetintheJavascriptforhowWewantourhandstorotate, butbydefaultwejustwantthistobezerosothattheyactuallyshowuponourscreen.
Now, ifwesaythatournumbershavegottenquite a bitbiggerandeasiertoreadnowallwehavetodoisactuallymoveontotheJavascripttomakeourhandsmovearoundastheydooverhere.
Solet's jumpintotheJavascript.
Thefirstthingweneedtodoisweneedtousesetintervalbecausewewanttocall a certainfunction.
Andifyoujustcallthenewdateconstructorfordate, that's goingtogiveyou a currentdate, whichistheexactcurrenttimethatyourunitonfromhere.
Wecangetthesecondsfromthat.
Sowecansaythataresecondsratioisgoingtobeequaltoourcurrentdatedotgetsecondsandthensincethere's 60 secondsin a minute, wejustwantedtobuybackby 60 sothatweknowhowfartorotateoursecondsHandwascopythisdown a fewtimesbecauseweneedtodothesamethingforminutesandweneedtodothesamethingforhours.
Sowecanjustsaygetminutesandwecansayhere, getours.
Butsincewedon't wantourminuteandourhandstojumpbyentirehoursandentireminutesat a time, wewantthemtoslowlyandgraduallygothrough.
Weneedtousethesecondsratio, andwewanttoaddthatinsowecansaysecondsratioplusthegetminutesandessentiallythissecondsratiois a percentageof a minute.
Wedidtheexactsamethingfor a minuteandsecondDelicious.
Copythatdown.
Wehave a minutehandandlastly, oursecondhand.
Nowwecanactuallyselectthesesotheycansay, Const, ourhandisgoingtoequaltodocumentthatqueryselectorandwejustwanttoselectthatdataattributeswillsaydataourhandcopythatdownbecausewewanttoalsoget a minutehand.