summaryrefslogtreecommitdiffstats
path: root/src/utilities.js
blob: 0c1a0a391f0383eafe1e17b58e8bc272f5f7c63c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
SVG.utils = {
  // Map function
  map: function(array, block) {
    var i
      , il = array.length
      , result = []

    for (i = 0; i < il; i++)
      result.push(block(array[i]))
    
    return result
  }

  // Degrees to radians
, radians: function(d) {
		return d % 360 * Math.PI / 180
	}
	// Radians to degrees
, degrees: function(r) {
		return r * 180 / Math.PI % 360
	}

}