Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com Clock rotation help! :( (SVG IMAGE)

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 10-25-2013, 12:44 AM PM User | #1 fraged New to the CF scene   Join Date: Oct 2013 Posts: 3 Thanks: 1 Thanked 0 Times in 0 Posts Clock rotation help! :( (SVG IMAGE) So I'm working on a project for university, we have to design different concepts for clocks. Mine was a microwave ha, the dials turning, representing minutes, seconds and hours. The dials aren't moving? Can anyone see the problem? Heres a link to my JSBin, http://jsbin.com/OjUzewO/2/edit?js,output But if that doesn't load, I'll post a snippet now of the javascript code! Thanks! Code: ``` function updateclock () { var currentTime = new Date(); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); var handRotation = 0; //the degrees the hand is rotated var secondsHand = document.getElementById("seconds"); var minutesHand = document.getElementById("minutes"); var hoursHand = document.getElementById("hours"); //rotation for the seconds handRotation = currentSeconds*6+currentTime.getMilliseconds()/1000*6; //adds 6 degrees to the rotation if (handRotation > 359) { handRotation = 0; } secondsHand.setAttribute('transform', 'rotate('+handRotation+', 1262.67, 614'); //rotation for the minutes handRotation = currentMinutes*6+currentTime.getSeconds()/59*6; //adds 6 degrees to the rotation if (handRotation > 359) { handRotation = 0; } minsHand.setAttribute('transform', 'rotate('+handRotation+', 1265.33, 418.5'); //rotation for the hours handRotation = currentHours*30+currentTime.getMinutes()/59*6; //adds 6 degrees to the rotation if (handRotation > 359) { handRotation = 0; } hoursHand.setAttribute('transform', 'rotate('+handRotation+', 1261.33, 276.5'); } setInterval(updateClock, 20);```
 10-25-2013, 02:27 PM PM User | #2 fraged New to the CF scene   Join Date: Oct 2013 Posts: 3 Thanks: 1 Thanked 0 Times in 0 Posts Any help please? anyone? My work is due sunday, and I've been doing so much research. Can't find anything!
10-26-2013, 01:41 AM   PM User | #3
Arbitrator
Senior Coder

Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 3,139
Thanks: 11
Thanked 242 Times in 238 Posts
Quote:
 Originally Posted by fraged Any help please? anyone? My work is due sunday, and I've been doing so much research. Can't find anything!
`minsHand` should be `minutesHand`. Also, your `transform` attribute values are malformed; a right parenthesis character is missing from the end of each `rotate` function value. With those things fixed, your dial rotates, though not in place.

Edit: Note: Only the bottom dial rotates.

Edit: Nevermind. The other two look like they're animating. Just really, really slowly.
__________________
For every complex problem, there is an answer that is clear, simple, and wrong.

Last edited by Arbitrator; 10-26-2013 at 01:47 AM.. Reason: See the post.

 Users who have thanked Arbitrator for this post: fraged (10-26-2013)
10-26-2013, 11:14 PM   PM User | #4
fraged
New to the CF scene

Join Date: Oct 2013
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by Arbitrator `minsHand` should be `minutesHand`. Also, your `transform` attribute values are malformed; a right parenthesis character is missing from the end of each `rotate` function value. With those things fixed, your dial rotates, though not in place. Edit: Note: Only the bottom dial rotates. Edit: Nevermind. The other two look like they're animating. Just really, really slowly.
Mind sharing the code you got?
Tried doing just now, getting errors! Thanks so much!!

10-26-2013, 11:23 PM   PM User | #5
Arbitrator
Senior Coder

Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 3,139
Thanks: 11
Thanked 242 Times in 238 Posts
Quote:
 Originally Posted by fraged Mind sharing the code you got? Tried doing just now, getting errors! Thanks so much!!
I fixed the four errors and left comments to show where they were: http://jsbin.com/OjUzewO/11/edit.
__________________
For every complex problem, there is an answer that is clear, simple, and wrong.

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 03:56 PM.