The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

Script: Degrees To O’Clock Position [JS]

Important!

Dear visitors,

This blog and the Tigarus.com network will be changing our website software in May (2024). There will be some down time and there will be a change to the webpage addresses.

We will also be removing the Anime blogs. The Rocksmith Songs website will be unavailable of a few weeks or months while I move the database to the new software.

At the moment we are running on Wordpress, the new software is an in-house project which is 57 times faster. It will also provide more freedom for development.

Thank you for understanding.

, By Patcoola

Script Title: degToClock
Programming Language: Java Script
Date Completed: 2012/09/02

Purpose: To determine the 12 hour clock position from the given degrees, used for clocks or determining direction. Returns a number, or undefined if the degrees argument is not valid.

Advertisement

Donate Now!

Hi there, I spend a lot of time making this blog.

It would be great if you would consider donating.


Description: To determine the 12 hour clock position from degrees, used to determine the hour of a 12 hour clock on a circle or to determine direction based on a clock. Returns a number ( 0,1,2,3,4,5,6,7,8,9,10,11 ) zero meaning 12 o’clock. Returns undefined if the degrees argument is not a number, is a value greater than 360 or is a value lesser than -360.

Method:

degToClock ( degrees_n ); // Returns a value of 0-11

Arguments: degrees_n, accepts a number between -360 to 360.

Note: the value of zero is equal to 12 o’clock.

Example Usage:

degToClock ( 180 ); // Returns 6

degToClock ( -180 ); // Returns 6

degToClock ( 760 ); // Returns undefined

 

Advertisement

Donate Now!

Hey buddy, it takes a lot to make a blog. How about a donation?


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.

 
8.590721 milliseconds