Requires

Provides

The heart of ART.

  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
(function(){ this.ART = new Class; ART.version = '09.dev'; ART.build = 'DEV'; ART.Element = new Class({

dom

  1. 22
  2. 23
  3. 24
  4. 25
  5. 26
  6. 27
  7. 28
  8. 29
  9. 30
  10. 31
  11. 32
inject: function(element){ if (element.element) element = element.element; element.appendChild(this.element); return this; }, eject: function(){ var element = this.element, parent = element.parentNode; if (parent) parent.removeChild(element); return this; },

events

  1. 36
  2. 37
  3. 38
  4. 39
  5. 40
  6. 41
  7. 42
  8. 43
  9. 44
  10. 45
  11. 46
  12. 47
  13. 48
  14. 49
  15. 50
  16. 51
  17. 52
  18. 53
  19. 54
  20. 55
  21. 56
  22. 57
  23. 58
  24. 59
  25. 60
  26. 61
  27. 62
  28. 63
  29. 64
  30. 65
  31. 66
  32. 67
  33. 68
  34. 69
  35. 70
  36. 71
  37. 72
  38. 73
  39. 74
  40. 75
  41. 76
  42. 77
  43. 78
  44. 79
  45. 80
  46. 81
  47. 82
  48. 83
  49. 84
  50. 85
  51. 86
  52. 87
  53. 88
  54. 89
  55. 90
  56. 91
  57. 92
  58. 93
  59. 94
  60. 95
  61. 96
  62. 97
  63. 98
  64. 99
  65. 100
  66. 101
  67. 102
  68. 103
  69. 104
  70. 105
  71. 106
  72. 107
  73. 108
  74. 109
  75. 110
  76. 111
  77. 112
  78. 113
  79. 114
  80. 115
  81. 116
  82. 117
  83. 118
  84. 119
  85. 120
  86. 121
  87. 122
  88. 123
  89. 124
  90. 125
  91. 126
  92. 127
  93. 128
  94. 129
  95. 130
  96. 131
  97. 132
  98. 133
  99. 134
  100. 135
  101. 136
  102. 137
  103. 138
  104. 139
  105. 140
  106. 141
  107. 142
  108. 143
  109. 144
  110. 145
  111. 146
  112. 147
  113. 148
  114. 149
  115. 150
  116. 151
  117. 152
  118. 153
  119. 154
  120. 155
  121. 156
  122. 157
  123. 158
  124. 159
  125. 160
  126. 161
  127. 162
  128. 163
  129. 164
  130. 165
  131. 166
  132. 167
  133. 168
subscribe: function(type, fn, bind){ if (typeof type != 'string'){ // listen type / fn with object var subscriptions = []; for (var t in type) subscriptions.push(this.subscribe(t, type[t])); return function(){ // unsubscribe for (var i = 0, l = subscriptions.length; i < l; i++) subscriptions[i](); return this; }; } else { // listen to one var bound = fn.bind(bind || this); var element = this.element; if (element.addEventListener){ element.addEventListener(type, bound, false); return function(){ // unsubscribe element.removeEventListener(type, bound, false); return this; }; } else { element.attachEvent('on' + type, bound); return function(){ // unsubscribe element.detachEvent('on' + type, bound); return this; }; } } } }); ART.Container = new Class({ grab: function(){ for (var i = 0; i < arguments.length; i++) arguments[i].inject(this); return this; } }); var transformTo = function(xx, yx, xy, yy, x, y){ if (xx && typeof xx == 'object'){ yx = xx.yx; yy = xx.yy; y = xx.y; xy = xx.xy; x = xx.x; xx = xx.xx; } this.xx = xx == null ? 1 : xx; this.yx = yx || 0; this.xy = xy || 0; this.yy = yy == null ? 1 : yy; this.x = (x == null ? this.x : x) || 0; this.y = (y == null ? this.y : y) || 0; this._transform(); return this; }; ART.Transform = new Class({ initialize: transformTo, _transform: function(){}, xx: 1, yx: 0, x: 0, xy: 0, yy: 1, y: 0, transform: function(xx, yx, xy, yy, x, y){ var m = this; if (xx && typeof xx == 'object'){ yx = xx.yx; yy = xx.yy; y = xx.y; xy = xx.xy; x = xx.x; xx = xx.xx; } if (!x) x = 0; if (!y) y = 0; return this.transformTo( m.xx * xx + m.xy * yx, m.yx * xx + m.yy * yx, m.xx * xy + m.xy * yy, m.yx * xy + m.yy * yy, m.xx * x + m.xy * y + m.x, m.yx * x + m.yy * y + m.y ); }, transformTo: transformTo, translate: function(x, y){ return this.transform(1, 0, 0, 1, x, y); }, move: function(x, y){ this.x += x || 0; this.y += y || 0; this._transform(); return this; }, scale: function(x, y){ if (y == null) y = x; return this.transform(x, 0, 0, y, 0, 0); }, rotate: function(deg, x, y){ if (x == null || y == null){ x = (this.left || 0) + (this.width || 0) / 2; y = (this.top || 0) + (this.height || 0) / 2; } var rad = deg * Math.PI / 180, sin = Math.sin(rad), cos = Math.cos(rad); this.transform(1, 0, 0, 1, x, y); var m = this; return this.transformTo( cos * m.xx - sin * m.yx, sin * m.xx + cos * m.yx, cos * m.xy - sin * m.yy, sin * m.xy + cos * m.yy, m.x, m.y ).transform(1, 0, 0, 1, -x, -y); }, moveTo: function(x, y){ var m = this; return this.transformTo(m.xx, m.yx, m.xy, m.yy, x, y); }, rotateTo: function(deg, x, y){ var m = this; var flip = m.yx / m.xx > m.yy / m.xy ? -1 : 1; if (m.xx < 0 ? m.xy >= 0 : m.xy < 0) flip = -flip; return this.rotate(deg - Math.atan2(flip * m.yx, flip * m.xx) * 180 / Math.PI, x, y); }, scaleTo: function(x, y){

Normalize

  1. 170
  2. 171
  3. 172
  4. 173
  5. 174
  6. 175
  7. 176
  8. 177
  9. 178
  10. 179
  11. 180
  12. 181
  13. 182
  14. 183
  15. 184
  16. 185
  17. 186
  18. 187
  19. 188
  20. 189
  21. 190
  22. 191
  23. 192
  24. 193
  25. 194
  26. 195
  27. 196
  28. 197
  29. 198
  30. 199
  31. 200
  32. 201
  33. 202
var m = this; var h = Math.sqrt(m.xx * m.xx + m.yx * m.yx); m.xx /= h; m.yx /= h; h = Math.sqrt(m.yy * m.yy + m.xy * m.xy); m.yy /= h; m.xy /= h; return this.scale(x, y); }, resizeTo: function(width, height){ var w = this.width, h = this.height; if (!w || !h) return this; return this.scaleTo(width / w, height / h); }, point: function(x, y){ var m = this; return { x: m.xx * x + m.xy * y + m.x, y: m.yx * x + m.yy * y + m.y }; } }); Color.detach = function(color){ color = new Color(color); return [Color.rgb(color.red, color.green, color.blue).toString(), color.alpha]; }; })();