-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtilities.js
More file actions
34 lines (31 loc) · 827 Bytes
/
Utilities.js
File metadata and controls
34 lines (31 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Utilities
// Radians converter
if (typeof(Number.prototype.toRad) === "undefined")
{
// 360 degrees = 2PI radians
Number.prototype.toRad = function()
{
return this * (Math.PI / 180);
}
}
// Degrees converter
if (typeof(Number.prototype.toDegrees) === "undefined")
{
// 360 degrees = 2PI radians
Number.prototype.toDegrees = function ()
{
return this * (180 / Math.PI);
}
}
// Shim for frame rate animation
if (typeof (window.requestAnimationFrame) === "undefined")
{
window.requestAnimationFrame = (function ()
{
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame ||
function (callback)
{
window.setTimeout(callback, 1000 / 60);
};
})();
}