go_gamification 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4ad557e8a5db10702f3275f96148e171cc146b3
4
- data.tar.gz: 97a872ab543cd1a65d7cc7873f7191c916d3016d
3
+ metadata.gz: 80a7dec1101210a1866585ee587956ae75bbac5e
4
+ data.tar.gz: f423d82ff0d74d7164605ed7bc18614fb841e4c5
5
5
  SHA512:
6
- metadata.gz: e31adfb09faf3b00c6f2a393fde6b5ea54af6e6bc3b5e4314f0fa82dcd00b9f4b969f5c725a6bf6df60179297e8b52a82134e8cf8d5ff326152c98a385abfc06
7
- data.tar.gz: 5f4342cc41395ed8956c8d27c4337e576c13d0dce671e1168df199ba9c84670fce1e8c54a0c9599fd06b9c4c4ab5eb03f25741215a567af7fc1ed97f80415e9d
6
+ metadata.gz: 7828712d42bf9f9fd4e92c879178024be6bb76d443c411dc7fc848c986fc5af2517170e2bb7a37474bdd170c7b61cc24347bd505cbb729aa1caf36800fa37b93
7
+ data.tar.gz: 606c89367bf316aa1bcd5e3afaf6f1a57e13ef302848a4b831cbd416b3f7dad6cc15cdb29bcf5fb38e3f5162e6c9f179a3d9cc1e63d41dbb5cdf9e1c70c0716c
@@ -0,0 +1,1298 @@
1
+ function bHive(a) {
2
+ this.setStageDimensions(a.width, a.height);
3
+ this.setStageObject(a.domobject);
4
+ this.init();
5
+ for (var c in a) {
6
+ this[c] = a[c]
7
+ }
8
+ if (a.hasOwnProperty("backgroundColor")) {
9
+ this.setStageColor(a.backgroundColor)
10
+ }
11
+ if (a.hasOwnProperty("globalCompositeOperation")) {
12
+ this.setGlobalComposite(a.globalCompositeOperation)
13
+ }
14
+ }bHive.fn = bHive.prototype = {
15
+ stageTarget: null,
16
+ stageObject: null,
17
+ stage2d: null,
18
+ undef: "undefined",
19
+ defGA: 1,
20
+ clearFrame: true,
21
+ debug: false,
22
+ _objects: [],
23
+ _events: [],
24
+ _radians: Math.PI / 180,
25
+ _mouseX: 0,
26
+ _mouseY: 0,
27
+ _stageHeight: 320,
28
+ _stageWidth: 256,
29
+ _frameRate: 33,
30
+ _fpsInterval: new Date().getTime(),
31
+ _fps: 0,
32
+ _fpscounter: 0,
33
+ _currentFrame: 0,
34
+ _initialisedAt: null,
35
+ _loopIdent: null,
36
+ _loopFunction: null,
37
+ _gfxLibrary: [],
38
+ _gfxErrorCount: 0,
39
+ _gfxLoaded: 0,
40
+ _ready: false,
41
+ _globalCompositeOperation: "source-over",
42
+ KEYUP: 38,
43
+ KEYDOWN: 40,
44
+ KEYLEFT: 37,
45
+ KEYRIGHT: 39,
46
+ SPACE: 32,
47
+ KEYA: 65,
48
+ KEYS: 83,
49
+ KEYW: 87,
50
+ KEYD: 68,
51
+ KEYENTER: 13,
52
+ KEYESCAPE: 27,
53
+ init: function () {
54
+ this.stageObject = document.createElement("canvas");
55
+ this.stage2d = this.stageObject.getContext("2d");
56
+ this.stageObject.height = this.sh = this._stageHeight;
57
+ this.stageObject.width = this.sw = this._stageWidth;
58
+ this.stage2d.globalAlpha = this.defGA;
59
+ var a = this;
60
+ this.bind(this.stageObject, "mousemove", function (c) {
61
+ return function (d) {
62
+ c.mouseMover(d, c)
63
+ }
64
+ }(a), true);
65
+ this.bind(this.stageObject, "click", function (c) {
66
+ return function (d) {
67
+ c.mouseClick(d, c)
68
+ }
69
+ }(a), true);
70
+ this.bind(this.stageObject, "mousedown", function (c) {
71
+ return function (d) {
72
+ c.mouseDown(d, c)
73
+ }
74
+ }(a), true);
75
+ this.bind(this.stageObject, "mouseup", function (c) {
76
+ return function (d) {
77
+ c.mouseUp(d, c)
78
+ }
79
+ }(a), true);
80
+ this.bind(window, "keydown", function (c) {
81
+ return function (d) {
82
+ c.keyDown(d, c)
83
+ }
84
+ }(a), true);
85
+ this.bind(window, "keyup", function (c) {
86
+ return function (d) {
87
+ c.keyUp(d, c)
88
+ }
89
+ }(a), true);
90
+ this.attachStage();
91
+ this._initialisedAt = new Date()
92
+ },
93
+ bind: function (d, c, e, a) {
94
+ if (document.addEventListener) {
95
+ d.addEventListener(c, e, a)
96
+ } else {
97
+ if (document.attachEvent) {
98
+ d.attachEvent("on" + c, e, a)
99
+ }
100
+ }
101
+ },
102
+ addEventListener: function (c, a) {
103
+ this._events[c] = a
104
+ },
105
+ sizeof: function (d) {
106
+ var c = 0;
107
+ var e = /function (.{1,})\(/;
108
+ for (var a in d) {
109
+ result = e.exec(d[a].constructor.toString());
110
+ if (result != null && result[1] == "Array") {
111
+ c += this.sizeof(d[a])
112
+ } else {
113
+ c++
114
+ }
115
+ }
116
+ return c
117
+ },
118
+ MouseEvent: function (a) {
119
+ this.e = (a) ? a : window.event;
120
+ this.x = (a.PageX) ? a.PageX : a.clientX;
121
+ this.y = (a.PageY) ? a.PageY : a.clientY;
122
+ this.target = (a.target) ? a.target : a.srcElement;
123
+ this.button = (a.button) ? a.button : a.button
124
+ },
125
+ MouseWheelEvent: function (a) {
126
+ this.e = (a) ? a : window.event;
127
+ this.delta = (a.detail) ? a.detail * -1 : a.wheelDelta / 40
128
+ },
129
+ KeyEvent: function (a) {
130
+ this.keyCode = (a.keyCode) ? a.keyCode : a.which;
131
+ this.altKey = (a.altKey) ? true : false;
132
+ this.altLeft = (a.altLeft) ? true : false;
133
+ this.ctrlKey = (a.ctrlKey) ? true : false;
134
+ this.ctrlLeft = (a.ctrlLeft) ? true : false;
135
+ this.shiftKey = (a.shiftKey) ? true : false;
136
+ this.shiftLeft = (a.shiftLeft) ? true : false
137
+ },
138
+ mainController: function () {
139
+ var d = this;
140
+ var a = this.stage2d;
141
+ var c = (new Date().getTime() - d._fpsInterval) / 1000;
142
+ d._currentFrame++;
143
+ d._fpscounter++;
144
+ if (c > 1) {
145
+ d._fps = Math.floor((d._fpscounter / c) * 10) / 10;
146
+ d._fpsInterval = new Date().getTime();
147
+ d._fpscounter = 0
148
+ }
149
+ if (d.clearFrame) {
150
+ a.clearRect(0, 0, d._stageWidth, d._stageHeight)
151
+ }
152
+ if (typeof this._loopFunction == "function") {
153
+ d._loopFunction.call(d)
154
+ }
155
+ },
156
+ getFPS: function () {
157
+ return this._fps
158
+ },
159
+ getFrameRate: function () {
160
+ return this._frameRate
161
+ },
162
+ getSystemTime: function () {
163
+ return this._initialisedAt.getTime()
164
+ },
165
+ getFrame: function () {
166
+ return this._currentFrame
167
+ },
168
+ getPosition: function (c) {
169
+ var a = curTop = 0;
170
+ if (c.offsetParent) {
171
+ do {
172
+ a += c.offsetLeft;
173
+ curTop += c.offsetTop
174
+ } while (c = c.offsetParent)
175
+ } else {
176
+ a = c.offsetLeft;
177
+ curTop = c.offsetTop
178
+ }
179
+ return [a, curTop]
180
+ },
181
+ mouseMover: function (f, c) {
182
+ this.engine = c;
183
+ f = new this.engine.MouseEvent(f);
184
+ var h = this.engine.getPosition(this.stageObject);
185
+ this._mouseX = f.x - h[0];
186
+ this._mouseY = f.y - h[1];
187
+ if (typeof this._events.onmousemove != this.undef) {
188
+ this._events.onmousemove.apply(this, [{x: this._mouseX, y: this._mouseY}])
189
+ }
190
+ for (var a in this._objects) {
191
+ xIn = yIn = false;
192
+ var d = this._objects[a];
193
+ if (d instanceof bHive.Clip) {
194
+ parentX = (typeof d.parent != this.undef) ? d.parent.x : 0;
195
+ parentY = (typeof d.parent != this.undef) ? d.parent.y : 0;
196
+ if (this._mouseX > parentX + d.x && this._mouseX < parentX + d.x + d.width()) {
197
+ xIn = true
198
+ }
199
+ if (this._mouseY > parentY + d.y && this._mouseY < parentY + d.y + d.height()) {
200
+ yIn = true
201
+ }
202
+ if ((xIn && yIn) && !d._mouseover) {
203
+ if (typeof d.events.onmouseover == "function") {
204
+ d.events.onmouseover.apply(d, [{x: this._mouseX, y: this._mouseY}])
205
+ }
206
+ d._mouseover = true
207
+ }
208
+ if ((!xIn || !yIn) && d._mouseover) {
209
+ if (typeof d.events.onmouseout == "function") {
210
+ d.events.onmouseout.apply(d, [{x: this._mouseX, y: this._mouseY}])
211
+ }
212
+ d._mouseover = false
213
+ }
214
+ }
215
+ }
216
+ },
217
+ mouseClick: function (f, c) {
218
+ this.engine = c;
219
+ f = new this.engine.MouseEvent(f);
220
+ xIn = yIn = false;
221
+ if (typeof this._events.onclick != this.undef) {
222
+ this._events.onclick.apply(this, [{x: this._mouseX, y: this._mouseY}])
223
+ }
224
+ for (var a in this._objects) {
225
+ xIn = yIn = false;
226
+ var d = this._objects[a];
227
+ if (d instanceof bHive.Clip) {
228
+ parentX = (typeof d.parent != this.undef) ? d.parent.x : 0;
229
+ parentY = (typeof d.parent != this.undef) ? d.parent.y : 0;
230
+ if (this._mouseX > parentX + d.x && this._mouseX < parentX + d.x + d.width()) {
231
+ xIn = true
232
+ }
233
+ if (this._mouseY > parentY + d.y && this._mouseY < parentY + d.y + d.height()) {
234
+ yIn = true
235
+ }
236
+ if ((xIn && yIn) && typeof d.events.onclick == "function") {
237
+ d.events.onclick.apply(d, [{x: this._mouseX, y: this._mouseY}])
238
+ }
239
+ }
240
+ }
241
+ },
242
+ mouseDown: function (f, c) {
243
+ this.engine = c;
244
+ f = new this.engine.MouseEvent(f);
245
+ xIn = yIn = false;
246
+ if (typeof this._events.mousedown != this.undef) {
247
+ this._events.mousedown.apply(this, [{x: this._mouseX, y: this._mouseY}])
248
+ }
249
+ for (var a in this._objects) {
250
+ var d = this._objects[a];
251
+ if (d instanceof bHive.Clip) {
252
+ if (this._mouseX > d.x && this._mouseX < d.x + d.width()) {
253
+ xIn = true
254
+ }
255
+ if (this._mouseY > d.y && this._mouseY < d.y + d.height()) {
256
+ yIn = true
257
+ }
258
+ if (xIn && yIn && typeof d.events.mousedown == "function") {
259
+ d.events.mousedown({x: this._mouseX, y: this._mouseY, src: d})
260
+ }
261
+ }
262
+ }
263
+ },
264
+ mouseUp: function (f, c) {
265
+ this.engine = c;
266
+ f = new this.engine.MouseEvent(f);
267
+ xIn = yIn = false;
268
+ if (typeof this._events.mouseup != this.undef) {
269
+ this._events.mouseup.apply(this, [{x: this._mouseX, y: this._mouseY}])
270
+ }
271
+ for (var a in this._objects) {
272
+ var d = this._objects[a];
273
+ if (d instanceof bHive.Clip) {
274
+ if (this._mouseX > d.x && this._mouseX < d.x + d.width()) {
275
+ xIn = true
276
+ }
277
+ if (this._mouseY > d.y && this._mouseY < d.y + d.height()) {
278
+ yIn = true
279
+ }
280
+ if (xIn && yIn && typeof d.events.mouseup == "function") {
281
+ d.events.mouseup({x: this._mouseX, y: this._mouseY, src: d})
282
+ }
283
+ }
284
+ }
285
+ },
286
+ keyDown: function (f, c) {
287
+ this.engine = c;
288
+ f = new this.engine.KeyEvent(f);
289
+ if (typeof this._events.onkeydown != this.undef) {
290
+ this._events.onkeydown.apply(this, [f])
291
+ }
292
+ for (var a in this._objects) {
293
+ var d = this._objects[a];
294
+ if (d instanceof bHive.Clip) {
295
+ if (typeof d.events.onkeydown == "function") {
296
+ d.events.onkeydown(f)
297
+ }
298
+ }
299
+ }
300
+ },
301
+ keyUp: function (f, c) {
302
+ this.engine = c;
303
+ f = new this.engine.KeyEvent(f);
304
+ if (typeof this._events.onkeyup != this.undef) {
305
+ this._events.onkeyup.apply(this, [f])
306
+ }
307
+ for (var a in this._objects) {
308
+ var d = this._objects[a];
309
+ if (d instanceof bHive.Clip) {
310
+ if (typeof d.events.onkeyup == "function") {
311
+ d.events.onkeyup(f)
312
+ }
313
+ }
314
+ }
315
+ },
316
+ setStageDimensions: function (a, c) {
317
+ this._stageHeight = c;
318
+ this._stageWidth = a
319
+ },
320
+ setStageColor: function (a) {
321
+ this._stageColor = a;
322
+ this.stageObject.style.backgroundColor = a
323
+ },
324
+ setGlobalComposite: function (a) {
325
+ this._globalCompositeOperation = a;
326
+ this.stage2d.globalCompositeOperation = a
327
+ },
328
+ setStageObject: function (a) {
329
+ if (typeof a == "string") {
330
+ var c = document.getElementById(a);
331
+ if (c !== this.undef) {
332
+ this.stageTarget = c
333
+ } else {
334
+ }
335
+ } else {
336
+ this.stageTarget = a
337
+ }
338
+ },
339
+ attachStage: function () {
340
+ this.stageTarget.appendChild(this.stageObject)
341
+ },
342
+ storeObject: function (c) {
343
+ var a = this._objects.length;
344
+ this._objects.push(c);
345
+ return this._objects[a]
346
+ },
347
+ createClip: function (a) {
348
+ var c = this;
349
+ return this.storeObject(new bHive.Clip(a, c))
350
+ },
351
+ createVideo: function (a) {
352
+ var c = this;
353
+ return this.storeObject(new bHive.Video(a, c))
354
+ },
355
+ createAudio: function (a) {
356
+ var c = this;
357
+ return this.storeObject(new bHive.Audio(a, c))
358
+ },
359
+ createSprite: function (a) {
360
+ var c = this;
361
+ return this.storeObject(new bHive.Sprite(a, c))
362
+ },
363
+ createBitmap: function (a) {
364
+ var c = this;
365
+ return this.storeObject(new bHive.Bitmap(a, c))
366
+ },
367
+ createLine: function (a) {
368
+ var c = this;
369
+ return this.storeObject(new bHive.Line(a, c))
370
+ },
371
+ createText: function (a) {
372
+ var c = this;
373
+ return this.storeObject(new bHive.Text(a, c))
374
+ },
375
+ createShape: function (a) {
376
+ var c = this;
377
+ return this.storeObject(new bHive.Shape(a, c))
378
+ },
379
+ createGradient: function (a) {
380
+ var c = this;
381
+ return this.storeObject(new bHive.Gradient(a, c))
382
+ },
383
+ theLoop: function (c) {
384
+ var a = this;
385
+ this._loopFunction = c;
386
+ this._loopIdent = setInterval(function (d) {
387
+ return function () {
388
+ d.mainController()
389
+ }
390
+ }(a), this._frameRate)
391
+ },
392
+ getRotatedSize: function (a) {
393
+ radians = (2 * Math.PI * a.rotation) / 360;
394
+ cosine = Math.cos(radians);
395
+ sine = Math.sin(radians);
396
+ objNH = a.image.naturalHeight;
397
+ objNW = a.image.naturalWidth;
398
+ point1_x = -objNH * sine;
399
+ point1_y = objNH * cosine;
400
+ point2_x = objNW * cosine - objNH * sine;
401
+ point2_y = objNH * cosine + objNW * sine;
402
+ point3_x = objNW * cosine;
403
+ point3_y = objNW * sine;
404
+ minx = Math.min(0, Math.min(point1_x, Math.min(point2_x, point3_x)));
405
+ miny = Math.min(0, Math.min(point1_y, Math.min(point2_y, point3_y)));
406
+ maxx = Math.max(point1_x, Math.max(point2_x, point3_x));
407
+ maxy = Math.max(point1_y, Math.max(point2_y, point3_y));
408
+ rotwidth = Math.round(maxx - minx);
409
+ rotheight = Math.round(maxy - miny);
410
+ return {width: rotwidth, height: rotheight}
411
+ },
412
+ hex2RGBa: function (d, f) {
413
+ var e = g = b = 0;
414
+ var c = 1;
415
+ if (f > 100) {
416
+ f = 100
417
+ } else {
418
+ if (f < 0) {
419
+ f = 0
420
+ }
421
+ }
422
+ c = f / 100;
423
+ d = (d.charAt(0) == "#") ? d.substring(1, d.length) : d;
424
+ if (d.length == 3) {
425
+ e = parseInt(d.substring(0, 1) + d.substring(0, 1), 16);
426
+ g = parseInt(d.substring(1, 2) + d.substring(1, 2), 16);
427
+ b = parseInt(d.substring(2, 3) + d.substring(2, 3), 16)
428
+ } else {
429
+ e = parseInt(d.substring(0, 2), 16);
430
+ g = parseInt(d.substring(2, 4), 16);
431
+ b = parseInt(d.substring(4, 6), 16)
432
+ }
433
+ return "rgba(" + e + ", " + g + ", " + b + ", " + c + ")"
434
+ },
435
+ clone: function (d) {
436
+ var c = this;
437
+
438
+ function a() {
439
+ }
440
+
441
+ a.prototype = d;
442
+ return this.storeObject(new a())
443
+ },
444
+ Tween: function (h, j, c, a, f, i) {
445
+ if (!arguments.length) {
446
+ return false
447
+ }
448
+ var d = this;
449
+ var e = new bHive.Tween();
450
+ e.engine = d;
451
+ e.obj = h;
452
+ e.prop = j;
453
+ e.begin = c;
454
+ e.position = c;
455
+ e.end = a;
456
+ e.duration = f;
457
+ e.isTime = i;
458
+ e.start();
459
+ return e
460
+ }
461
+ };bHive.Tween = function () {
462
+ this._date = new Date();
463
+ this.events = []
464
+ };bHive.Tween.prototype = {
465
+ engine: null,
466
+ obj: null,
467
+ prop: null,
468
+ begin: 0,
469
+ position: 0,
470
+ end: 0,
471
+ change: 0,
472
+ duration: 0,
473
+ isTime: true,
474
+ isPlaying: false,
475
+ looping: false,
476
+ events: null,
477
+ time: 0,
478
+ func: function (e, a, h, f) {
479
+ return h * e / f + a
480
+ },
481
+ _startTime: 0,
482
+ _time: 0,
483
+ _oldTime: 0,
484
+ _loopIdent: 0,
485
+ _oldPos: 0,
486
+ _date: null,
487
+ start: function () {
488
+ this.reset();
489
+ this.startLoop()
490
+ },
491
+ stop: function () {
492
+ this.stopLoop()
493
+ },
494
+ startLoop: function () {
495
+ var c = this;
496
+ var a;
497
+ if (!this.isTime) {
498
+ a = this.engine._frameRate
499
+ } else {
500
+ a = Math.round((this.duration * 1000) / this.engine._frameRate)
501
+ }
502
+ this._loopIdent = setInterval(function (d) {
503
+ return function () {
504
+ d.updateTime()
505
+ }
506
+ }(c), a);
507
+ this.isPlaying = true
508
+ },
509
+ stopLoop: function () {
510
+ this.isPlaying = false;
511
+ clearInterval(this._loopIdent);
512
+ if (typeof this.events.complete == "function") {
513
+ this.events.complete()
514
+ }
515
+ },
516
+ reset: function () {
517
+ t = (isNaN(arguments[0])) ? 0 : parseInt(arguments[0]);
518
+ this._time = t;
519
+ this.change = this.end - this.begin;
520
+ this.fixTime();
521
+ this.updateFrame()
522
+ },
523
+ fixTime: function () {
524
+ if (this.isTime) {
525
+ var a = new Date().getTime();
526
+ this._startTime = a - this._time * 1000
527
+ }
528
+ },
529
+ updateTime: function () {
530
+ this._oldTime = this._time;
531
+ if (this.isTime) {
532
+ var a = new Date().getTime();
533
+ this.updateFrame((a - this._startTime) / 1000)
534
+ } else {
535
+ this.updateFrame(this._time + 1)
536
+ }
537
+ },
538
+ updateFrame: function (a) {
539
+ if (a > this.duration) {
540
+ if (this.looping) {
541
+ } else {
542
+ if (this.isTime) {
543
+ this._time = this.duration;
544
+ this.setPosition(this.getPosition(this._time))
545
+ }
546
+ this.stopLoop()
547
+ }
548
+ } else {
549
+ this.setPosition(this.getPosition(a));
550
+ if (!this.isTime) {
551
+ this._time++
552
+ }
553
+ }
554
+ },
555
+ setPosition: function (a) {
556
+ if (typeof this.obj[this.prop] != this.engine.undef) {
557
+ this.obj[this.prop] = this.position = a
558
+ }
559
+ },
560
+ getPosition: function (a) {
561
+ a = (typeof a == this.engine.undef) ? 0 : a;
562
+ fr = this.func(a, this.begin, this.change, this.duration);
563
+ return fr
564
+ },
565
+ tweenTo: function () {
566
+ },
567
+ addEventListener: function (c, a) {
568
+ this.events[c] = a
569
+ }
570
+ };bHive.Bitmap = function (a, e) {
571
+ var d = this;
572
+ this.engine = e;
573
+ this.events = [];
574
+ for (var c in a) {
575
+ this[c] = a[c]
576
+ }
577
+ this.image = new Image();
578
+ this.image.src = this.src;
579
+ this.image.onload = (function (f) {
580
+ return function () {
581
+ f.width = f.image.naturalWidth;
582
+ f.height = f.image.naturalHeight;
583
+ if (typeof f.events.onload != f.engine.undef) {
584
+ f.events.onload()
585
+ }
586
+ }
587
+ })(d);
588
+ this.image.onerror = (function (f) {
589
+ return function () {
590
+ console.log("cannot load: " + f.image.src);
591
+ if (typeof f.events.onerror != f.engine.undef) {
592
+ f.events.onerror()
593
+ }
594
+ }
595
+ })(d)
596
+ };bHive.Bitmap.prototype = {
597
+ engine: null,
598
+ src: "",
599
+ image: null,
600
+ events: null,
601
+ x: 0,
602
+ y: 0,
603
+ registration_x: 0,
604
+ registration_y: 0,
605
+ rotation: 0,
606
+ visible: true,
607
+ alpha: 100,
608
+ x_scale: 100,
609
+ y_scale: 100,
610
+ addEventListener: function (c, a) {
611
+ this.events[c] = a
612
+ },
613
+ draw: function (d, c) {
614
+ d = (typeof d == this.engine.undef) ? 0 : d;
615
+ c = (typeof c == this.engine.undef) ? 0 : c;
616
+ if (this.visible) {
617
+ if (typeof this.parent != this.engine.undef) {
618
+ pA = this.parent.alpha;
619
+ A = this.alpha;
620
+ if (pA < 100) {
621
+ newGA = pA;
622
+ if (A < 100) {
623
+ percentage = pA * (A / 100);
624
+ newGA = pA - percentage
625
+ }
626
+ this.engine.stage2d.globalAlpha = Math.abs(newGA) / 100
627
+ } else {
628
+ if (A < 100) {
629
+ this.engine.stage2d.globalAlpha = A / 100
630
+ }
631
+ }
632
+ } else {
633
+ if (this.alpha < 100) {
634
+ this.engine.stage2d.globalAlpha = this.alpha / 100
635
+ }
636
+ }
637
+ iW = this.image.naturalWidth;
638
+ iH = this.image.naturalHeight;
639
+ if (typeof this.parent != this.engine.undef) {
640
+ if (this.x_scale != 100) {
641
+ iW = iW * (this.x_scale / 100)
642
+ }
643
+ if (this.parent.x_scale != 100) {
644
+ iW = iW * (this.parent.x_scale / 100)
645
+ }
646
+ } else {
647
+ if (this.x_scale != 100) {
648
+ iW = iW * (this.x_scale / 100)
649
+ }
650
+ }
651
+ if (typeof this.parent != this.engine.undef) {
652
+ if (this.y_scale != 100) {
653
+ iH = iH * (this.y_scale / 100)
654
+ }
655
+ if (this.parent.y_scale != 100) {
656
+ iH = iH * (this.parent.y_scale / 100)
657
+ }
658
+ } else {
659
+ if (this.y_scale != 100) {
660
+ iH = iH * (this.y_scale / 100)
661
+ }
662
+ }
663
+ if (this.rotation != 0) {
664
+ this.engine.stage2d.save();
665
+ var a = d + this.x;
666
+ var e = c + this.y;
667
+ if (this.rotation > 360) {
668
+ this.rotation = 0
669
+ }
670
+ this.engine.stage2d.translate(a, e);
671
+ this.engine.stage2d.rotate(this.rotation * this.engine._radians);
672
+ this.engine.stage2d.drawImage(this.image, this.registration_x * -1, this.registration_y * -1, iW, iH);
673
+ this.engine.stage2d.restore()
674
+ } else {
675
+ this.engine.stage2d.drawImage(this.image, d + this.x, c + this.y, iW, iH)
676
+ }
677
+ if (this.alpha < 100) {
678
+ this.engine.stage2d.globalAlpha = this.engine.defGA
679
+ }
680
+ }
681
+ }
682
+ };bHive.Clip = function (a, d) {
683
+ this.engine = d;
684
+ this._childObjects = [];
685
+ this.events = [];
686
+ for (var c in a) {
687
+ this[c] = a[c]
688
+ }
689
+ };bHive.Clip.prototype = {
690
+ id: null,
691
+ events: null,
692
+ visible: true,
693
+ _childObjects: null,
694
+ _mouseover: false,
695
+ alpha: 100,
696
+ x: 0,
697
+ y: 0,
698
+ x_scale: 100,
699
+ y_scale: 100,
700
+ addEventListener: function (c, a) {
701
+ this.events[c] = a
702
+ },
703
+ add: function (a) {
704
+ this._childObjects.push(a);
705
+ var c = this;
706
+ a.parent = c
707
+ },
708
+ draw: function (d, c) {
709
+ d = (typeof d == this.engine.undef) ? 0 : d;
710
+ c = (typeof c == this.engine.undef) ? 0 : c;
711
+ if (this.visible) {
712
+ for (var a in this._childObjects) {
713
+ this._childObjects[a].draw(d + this.x, c + this.y)
714
+ }
715
+ }
716
+ },
717
+ point: function (a, f, c) {
718
+ var c = 2 * Math.PI * c / 360;
719
+ var e = a * Math.cos(c) + f * Math.sin(c);
720
+ var d = f * Math.cos(c) - a * Math.sin(c);
721
+ return [e, d]
722
+ },
723
+ width: function () {
724
+ var a = [];
725
+ if (this._childObjects.length > 0) {
726
+ for (var d in this._childObjects) {
727
+ var c = this._childObjects[d];
728
+ if (c instanceof bHive.Bitmap) {
729
+ if (c.rotation > 0) {
730
+ rotatedDimensions = engine.getRotatedSize(c);
731
+ a.push(rotatedDimensions.width + c.x)
732
+ } else {
733
+ a.push(c.image.naturalWidth + c.x)
734
+ }
735
+ } else {
736
+ if (c instanceof bHive.Clip && c.visible) {
737
+ a.push(c.width() + c.x)
738
+ } else {
739
+ if (c instanceof bHive.Shape && c.visible) {
740
+ if (c.shape == "square") {
741
+ a.push(c.width + c.x)
742
+ } else {
743
+ if (c.shape == "circle") {
744
+ a.push(c.x + (c.radius * 2))
745
+ }
746
+ }
747
+ }
748
+ }
749
+ }
750
+ }
751
+ return Math.max.apply(0, a)
752
+ } else {
753
+ return 0
754
+ }
755
+ },
756
+ height: function () {
757
+ var a = [];
758
+ if (this._childObjects.length > 0) {
759
+ for (var d in this._childObjects) {
760
+ var c = this._childObjects[d];
761
+ if (c instanceof bHive.Bitmap) {
762
+ if (c.rotation > 0) {
763
+ rotatedDimensions = engine.getRotatedSize(c);
764
+ a.push(rotatedDimensions.height + c.y)
765
+ } else {
766
+ a.push(c.image.naturalHeight + c.y)
767
+ }
768
+ } else {
769
+ if (c instanceof bHive.Clip) {
770
+ a.push(c.height() + c.y)
771
+ } else {
772
+ if (c instanceof bHive.Shape) {
773
+ if (c.shape == "square") {
774
+ a.push(c.height + c.y)
775
+ } else {
776
+ if (c.shape == "circle") {
777
+ a.push(c.y + (c.radius * 2))
778
+ }
779
+ }
780
+ }
781
+ }
782
+ }
783
+ }
784
+ return Math.max.apply(0, a)
785
+ } else {
786
+ return 0
787
+ }
788
+ }
789
+ };bHive.Video = function (a, d) {
790
+ this.engine = d;
791
+ this.source = [];
792
+ this.events = [];
793
+ for (var c in a) {
794
+ this[c] = a[c]
795
+ }
796
+ this.createDOMObject()
797
+ };bHive.Video.prototype = {
798
+ path: "",
799
+ src: "",
800
+ alpha: 100,
801
+ x: 0,
802
+ y: 0,
803
+ x_scale: 100,
804
+ y_scale: 100,
805
+ rotation: 0,
806
+ width: 0,
807
+ height: 0,
808
+ registration_x: 0,
809
+ registration_y: 0,
810
+ events: null,
811
+ formats: ["mp4", "ogg", "webm"],
812
+ duration: 0,
813
+ currentTime: 0,
814
+ ended: false,
815
+ muted: false,
816
+ paused: false,
817
+ format: "",
818
+ looping: true,
819
+ createDOMObject: function () {
820
+ this.domvid = document.createElement("video");
821
+ this.domvid.controls = "true";
822
+ this.domvid.autoplay = "true";
823
+ this.domvid.loop = "true";
824
+ this.domvid.style.display = "none";
825
+ var a = this.domvid;
826
+ this.format = this.supportedFormat();
827
+ console.log(this.format);
828
+ if (this.format != "") {
829
+ this.domvid.setAttribute("src", this.path + "/" + this.src + "." + this.format);
830
+ if (this.looping) {
831
+ this.domvid.setAttribute("loop", "loop");
832
+ this.engine.bind(this.domvid, "ended", function (c) {
833
+ return function (d) {
834
+ c.play()
835
+ }
836
+ }(a), true)
837
+ }
838
+ document.getElementsByTagName("body")[0].appendChild(this.domvid)
839
+ } else {
840
+ return false
841
+ }
842
+ },
843
+ supportedFormat: function () {
844
+ var d = "";
845
+ for (var c = 0, a = this.formats.length; c < a; c++) {
846
+ if (this.domvid.canPlayType("video/" + this.formats[c]) == "probably" || this.domvid.canPlayType("video/" + this.formats[c]) == "maybe") {
847
+ d = this.formats[c];
848
+ break
849
+ }
850
+ }
851
+ return d
852
+ },
853
+ pause: function () {
854
+ if (!this.domvid.paused) {
855
+ this.paused = true;
856
+ this.domvid.pause()
857
+ }
858
+ },
859
+ play: function () {
860
+ if (this.domvid.paused) {
861
+ this.paused = false;
862
+ this.domvid.play()
863
+ }
864
+ },
865
+ draw: function (d, c) {
866
+ d = (typeof d == this.engine.undef) ? 0 : d;
867
+ c = (typeof c == this.engine.undef) ? 0 : c;
868
+ if (typeof this.parent != this.engine.undef) {
869
+ pA = this.parent.alpha;
870
+ A = this.alpha;
871
+ if (pA < 100) {
872
+ newGA = pA;
873
+ if (A < 100) {
874
+ percentage = pA * (A / 100);
875
+ newGA = pA - percentage
876
+ }
877
+ this.engine.stage2d.globalAlpha = Math.abs(newGA) / 100
878
+ } else {
879
+ if (A < 100) {
880
+ this.engine.stage2d.globalAlpha = A / 100
881
+ }
882
+ }
883
+ } else {
884
+ if (this.alpha < 100) {
885
+ this.engine.stage2d.globalAlpha = this.alpha / 100
886
+ }
887
+ }
888
+ iW = this.width;
889
+ iH = this.height;
890
+ if (typeof this.parent != this.engine.undef) {
891
+ if (this.x_scale != 100) {
892
+ iW = iW * (this.x_scale / 100)
893
+ }
894
+ if (this.parent.x_scale != 100) {
895
+ iW = iW * (this.parent.x_scale / 100)
896
+ }
897
+ } else {
898
+ if (this.x_scale != 100) {
899
+ iW = iW * (this.x_scale / 100)
900
+ }
901
+ }
902
+ if (typeof this.parent != this.engine.undef) {
903
+ if (this.y_scale != 100) {
904
+ iH = iH * (this.y_scale / 100)
905
+ }
906
+ if (this.parent.y_scale != 100) {
907
+ iH = iH * (this.parent.y_scale / 100)
908
+ }
909
+ } else {
910
+ if (this.y_scale != 100) {
911
+ iH = iH * (this.y_scale / 100)
912
+ }
913
+ }
914
+ if (this.rotation != 0) {
915
+ this.engine.stage2d.save();
916
+ var a = d + this.x;
917
+ var e = c + this.y;
918
+ if (this.rotation > 360) {
919
+ this.rotation = 0
920
+ }
921
+ this.engine.stage2d.translate(a, e);
922
+ this.engine.stage2d.rotate(this.rotation * this.engine._radians);
923
+ this.engine.stage2d.drawImage(this.domvid, this.registration_x * -1, this.registration_y * -1, iW, iH);
924
+ this.engine.stage2d.restore()
925
+ } else {
926
+ this.engine.stage2d.drawImage(this.domvid, d + this.x, c + this.y, iW, iH)
927
+ }
928
+ if (this.alpha < 100) {
929
+ this.engine.stage2d.globalAlpha = this.engine.defGA
930
+ }
931
+ }
932
+ };bHive.Line = function (a, d) {
933
+ this.engine = d;
934
+ for (var c in a) {
935
+ this[c] = a[c]
936
+ }
937
+ };bHive.Line.prototype = {
938
+ weight: 1,
939
+ cap: "butt",
940
+ corner: "miter",
941
+ start: null,
942
+ end: null,
943
+ visible: true,
944
+ controlpoints: null,
945
+ color: "rgba(0,0,0,1)",
946
+ draw: function () {
947
+ if (this.start instanceof Array) {
948
+ x1 = this.start[0];
949
+ y1 = this.start[1]
950
+ } else {
951
+ if (typeof this.start == "string") {
952
+ switch (this.start) {
953
+ case"mouse":
954
+ x1 = this.engine._mouseX;
955
+ y1 = this.engine._mouseY;
956
+ break
957
+ }
958
+ } else {
959
+ if (this.start instanceof Object) {
960
+ x1 = this.start.x;
961
+ y1 = this.start.y
962
+ }
963
+ }
964
+ }
965
+ if (this.end instanceof Array) {
966
+ x2 = this.end[0];
967
+ y2 = this.end[1]
968
+ } else {
969
+ if (typeof this.end == "string") {
970
+ switch (this.end) {
971
+ case"mouse":
972
+ x2 = this.engine._mouseX;
973
+ y2 = this.engine._mouseY;
974
+ break
975
+ }
976
+ } else {
977
+ if (this.start instanceof Object) {
978
+ x2 = this.end.x;
979
+ y2 = this.end.y
980
+ }
981
+ }
982
+ }
983
+ if (this.color instanceof bHive.Gradient) {
984
+ if (typeof this.color.dimensions == this.engine.undef) {
985
+ if (this.color.type == "linear") {
986
+ color = this.engine.stage2d.createLinearGradient(this.x, this.y, this.x + this.width, this.y + this.height)
987
+ } else {
988
+ color = this.engine.stage2d.createRadialGradient(this.x + (this.width / 2), this.y + (this.height / 2), 0, this.x + (this.width / 2), this.y + (this.height / 2), this.width / 2)
989
+ }
990
+ } else {
991
+ if (this.color.type == "linear") {
992
+ color = this.engine.stage2d.createLinearGradient(this.color.dimensions[0], this.color.dimensions[1], this.color.dimensions[2], this.color.dimensions[3])
993
+ } else {
994
+ color = this.engine.stage2d.createRadialGradient(this.color.dimensions[0], this.color.dimensions[1], this.color.dimensions[2], this.color.dimensions[3], this.color.dimensions[4], this.color.dimensions[5])
995
+ }
996
+ }
997
+ for (var c = 0, a = this.color.colors.length; c < a; c++) {
998
+ color.addColorStop(this.color.stops[c], this.color.colors[c])
999
+ }
1000
+ } else {
1001
+ color = this.color
1002
+ }
1003
+ this.engine.stage2d.save();
1004
+ this.engine.stage2d.beginPath();
1005
+ this.engine.stage2d.lineWidth = this.weight;
1006
+ this.engine.stage2d.lineCap = this.cap;
1007
+ this.engine.stage2d.lineJoin = this.corner;
1008
+ this.engine.stage2d.strokeStyle = color;
1009
+ if (this.controlpoints == null) {
1010
+ this.engine.stage2d.moveTo(x1, y1);
1011
+ this.engine.stage2d.lineTo(x2, y2)
1012
+ } else {
1013
+ if (this.controlpoints.length == 1) {
1014
+ this.engine.stage2d.moveTo(x1, y1);
1015
+ this.engine.stage2d.quadraticCurveTo(this.controlpoints[0].x, this.controlpoints[0].y, x2, y2)
1016
+ } else {
1017
+ if (this.controlpoints.length == 2) {
1018
+ this.engine.stage2d.moveTo(x1, y1);
1019
+ this.engine.stage2d.quadraticCurveTo(this.controlpoints[0].x, this.controlpoints[0].y, this.controlpoints[1].x, this.controlpoints[1].y, x2, y2)
1020
+ }
1021
+ }
1022
+ }
1023
+ this.engine.stage2d.stroke();
1024
+ this.engine.stage2d.restore()
1025
+ }
1026
+ };bHive.Text = function (a, d) {
1027
+ this.engine = d;
1028
+ for (var c in a) {
1029
+ this[c] = a[c]
1030
+ }
1031
+ };bHive.Text.prototype = {
1032
+ text: null, x: 0, y: 0, align: "top", color: "rgb(0, 0, 0, 0)", visible: true, draw: function (c, a) {
1033
+ c = (typeof c == this.engine.undef) ? 0 : c;
1034
+ a = (typeof a == this.engine.undef) ? 0 : a;
1035
+ this.engine.stage2d.textBaseline = this.align;
1036
+ this.engine.stage2d.fillStyle = this.color;
1037
+ this.engine.stage2d.fillText(this.text, c + this.x, a + this.y)
1038
+ },
1039
+ };bHive.Shape = function (a, d) {
1040
+ this.engine = d;
1041
+ for (var c in a) {
1042
+ this[c] = a[c]
1043
+ }
1044
+ };bHive.Shape.prototype = {
1045
+ shape: "square",
1046
+ style: "filled",
1047
+ x: 0,
1048
+ y: 0,
1049
+ width: 0,
1050
+ height: 0,
1051
+ radius: 0,
1052
+ backgroundColor: "rgba(0, 0, 0, 1)",
1053
+ strokeColor: "rgba(0, 0, 0, 1)",
1054
+ strokeWeight: 1,
1055
+ alpha: 100,
1056
+ visible: true,
1057
+ close: true,
1058
+ draw: function (k, j) {
1059
+ k = (typeof k == this.engine.undef) ? 0 : k;
1060
+ j = (typeof j == this.engine.undef) ? 0 : j;
1061
+ var l = this.engine.stage2d;
1062
+ var e = Math.PI * 2;
1063
+ if (this.backgroundColor instanceof bHive.Gradient) {
1064
+ if (typeof this.backgroundColor.dimensions == this.engine.undef) {
1065
+ if (this.backgroundColor.type == "linear") {
1066
+ bgColor = this.engine.stage2d.createLinearGradient(this.x, this.y, this.x + this.width, this.y + this.height)
1067
+ } else {
1068
+ bgColor = this.engine.stage2d.createRadialGradient(this.x + (this.width / 2), this.y + (this.height / 2), 0, this.x + (this.width / 2), this.y + (this.height / 2), this.width / 2)
1069
+ }
1070
+ } else {
1071
+ if (this.backgroundColor.type == "linear") {
1072
+ bgColor = this.engine.stage2d.createLinearGradient(this.backgroundColor.dimensions[0], this.backgroundColor.dimensions[1], this.backgroundColor.dimensions[2], this.backgroundColor.dimensions[3])
1073
+ } else {
1074
+ bgColor = this.engine.stage2d.createRadialGradient(this.backgroundColor.dimensions[0], this.backgroundColor.dimensions[1], this.backgroundColor.dimensions[2], this.backgroundColor.dimensions[3], this.backgroundColor.dimensions[4], this.backgroundColor.dimensions[5])
1075
+ }
1076
+ }
1077
+ for (var c = 0, a = this.backgroundColor.colors.length; c < a; c++) {
1078
+ bgColor.addColorStop(this.backgroundColor.stops[c], this.backgroundColor.colors[c])
1079
+ }
1080
+ } else {
1081
+ if (this.backgroundColor.indexOf("#") != -1) {
1082
+ bgColor = this.engine.hex2RGBa(this.backgroundColor, this.alpha)
1083
+ } else {
1084
+ bgColor = this.backgroundColor
1085
+ }
1086
+ }
1087
+ l.save();
1088
+ switch (this.shape) {
1089
+ case"square":
1090
+ if (this.style == "filled") {
1091
+ l.fillStyle = bgColor;
1092
+ l.fillRect(k + this.x, j + this.y, this.width, this.height)
1093
+ } else {
1094
+ l.lineWidth = 1;
1095
+ l.strokeStyle = bgColor;
1096
+ l.strokeRect(k + this.x, j + this.y, this.width, this.height)
1097
+ }
1098
+ break;
1099
+ case"circle":
1100
+ if (this.style == "filled") {
1101
+ l.beginPath();
1102
+ l.fillStyle = bgColor;
1103
+ l.arc(k + this.x, j + this.y, this.radius, 0, e, true);
1104
+ l.fill()
1105
+ } else {
1106
+ l.beginPath();
1107
+ l.strokeStyle = bgColor;
1108
+ l.arc(k + this.x, j + this.y, this.radius, 0, e, true);
1109
+ l.stroke()
1110
+ }
1111
+ break;
1112
+ case"poly":
1113
+ l.beginPath();
1114
+ var m = this.points;
1115
+ var d = m.length;
1116
+ var h = 0;
1117
+ var f = 0;
1118
+ if (d > 1) {
1119
+ l.moveTo(k + this.x + m[0].x, j + this.y + m[0].y);
1120
+ for (c = 1; c < d; c++) {
1121
+ h = Math.max(h, m[c].x);
1122
+ f = Math.max(f, m[c].y);
1123
+ l.lineTo(k + this.x + m[c].x, j + this.y + m[c].y)
1124
+ }
1125
+ this.width = h;
1126
+ this.height = f
1127
+ }
1128
+ if (this.style == "filled") {
1129
+ l.fillStyle = bgColor;
1130
+ l.fill()
1131
+ } else {
1132
+ if (this.close) {
1133
+ l.closePath()
1134
+ }
1135
+ l.strokeStyle = bgColor;
1136
+ l.stroke()
1137
+ }
1138
+ break;
1139
+ case"elipse":
1140
+ l.beginPath();
1141
+ l.moveTo((k + this.x) + (this.width / 2), j + this.y);
1142
+ l.bezierCurveTo(((k + this.x) + (this.width / 2)) + this.width / 2, ((j + this.y) + (this.height / 2)) - this.height / 2, ((k + this.x) + (this.width / 2)) + this.width / 2, ((j + this.y) + (this.height / 2)) + this.height / 2, ((k + this.x) + (this.width / 2)), ((j + this.y) + (this.height / 2)) + this.height / 2);
1143
+ l.bezierCurveTo(((k + this.x) + (this.width / 2)) - this.width / 2, ((j + this.y) + (this.height / 2)) + this.height / 2, ((k + this.x) + (this.width / 2)) - this.width / 2, ((j + this.y) + (this.height / 2)) - this.height / 2, ((k + this.x) + (this.width / 2)), ((j + this.y) + (this.height / 2)) - this.height / 2);
1144
+ if (this.style == "filled") {
1145
+ l.fillStyle = bgColor;
1146
+ l.fill()
1147
+ } else {
1148
+ l.strokeStyle = bgColor;
1149
+ l.stroke()
1150
+ }
1151
+ break
1152
+ }
1153
+ l.restore()
1154
+ }
1155
+ };bHive.Sprite = function (a, e) {
1156
+ var d = this;
1157
+ this.engine = e;
1158
+ this.events = [];
1159
+ for (var c in a) {
1160
+ this[c] = a[c]
1161
+ }
1162
+ this.image = new Image();
1163
+ this.image.src = this.src;
1164
+ this.image.onload = (function (f) {
1165
+ return function () {
1166
+ if (typeof f.events.onload != f.engine.undef) {
1167
+ f.events.onload()
1168
+ }
1169
+ d.framecount = d.framedata.length
1170
+ }
1171
+ })(d)
1172
+ };bHive.Sprite.prototype = {
1173
+ src: "",
1174
+ width: 0,
1175
+ height: 0,
1176
+ buffer: null,
1177
+ framedata: null,
1178
+ events: null,
1179
+ image: null,
1180
+ alpha: 100,
1181
+ rotation: 0,
1182
+ visible: true,
1183
+ frame: 0,
1184
+ framecount: 0,
1185
+ framespeed: 0,
1186
+ frametimer: 0,
1187
+ registration_x: 0,
1188
+ registration_y: 0,
1189
+ x_scale: 100,
1190
+ y_scale: 100,
1191
+ createBuffer: function () {
1192
+ this.buffer = document.createElement("canvas");
1193
+ this.buffer.width = this.width;
1194
+ this.buffer.height = this.height;
1195
+ document.getElementsByTagName("body")[0].appendChild(this.buffer)
1196
+ },
1197
+ addEventListener: function (c, a) {
1198
+ this.events[c] = a
1199
+ },
1200
+ draw: function (l, k) {
1201
+ l = (typeof l == this.engine.undef) ? 0 : l;
1202
+ k = (typeof k == this.engine.undef) ? 0 : k;
1203
+ if (typeof this.parent != this.engine.undef) {
1204
+ pA = this.parent.alpha;
1205
+ A = this.alpha;
1206
+ if (pA < 100) {
1207
+ newGA = pA;
1208
+ if (A < 100) {
1209
+ percentage = pA * (A / 100);
1210
+ newGA = pA - percentage
1211
+ }
1212
+ this.engine.stage2d.globalAlpha = Math.abs(newGA) / 100
1213
+ } else {
1214
+ if (A < 100) {
1215
+ this.engine.stage2d.globalAlpha = A / 100
1216
+ }
1217
+ }
1218
+ } else {
1219
+ if (this.alpha < 100) {
1220
+ this.engine.stage2d.globalAlpha = this.alpha / 100
1221
+ }
1222
+ }
1223
+ iW = this.framedata[this.frame].frame.w;
1224
+ iH = this.framedata[this.frame].frame.h;
1225
+ if (typeof this.parent != this.engine.undef) {
1226
+ if (this.x_scale != 100) {
1227
+ iW = iW * (this.x_scale / 100)
1228
+ }
1229
+ if (this.parent.x_scale != 100) {
1230
+ iW = iW * (this.parent.x_scale / 100)
1231
+ }
1232
+ } else {
1233
+ if (this.x_scale != 100) {
1234
+ iW = iW * (this.x_scale / 100)
1235
+ }
1236
+ }
1237
+ if (typeof this.parent != this.engine.undef) {
1238
+ if (this.y_scale != 100) {
1239
+ iH = iH * (this.y_scale / 100)
1240
+ }
1241
+ if (this.parent.y_scale != 100) {
1242
+ iH = iH * (this.parent.y_scale / 100)
1243
+ }
1244
+ } else {
1245
+ if (this.y_scale != 100) {
1246
+ iH = iH * (this.y_scale / 100)
1247
+ }
1248
+ }
1249
+ var i = this.framedata[this.frame].frame.x;
1250
+ var f = this.framedata[this.frame].frame.y;
1251
+ var a = this.framedata[this.frame].frame.w;
1252
+ var d = this.framedata[this.frame].frame.h;
1253
+ var n = this.x;
1254
+ var m = this.y;
1255
+ var e = iW;
1256
+ var c = iH;
1257
+ if (this.rotation != 0) {
1258
+ this.engine.stage2d.save();
1259
+ var j = l + this.x;
1260
+ var h = k + this.y;
1261
+ if (this.rotation > 360) {
1262
+ this.rotation = 0
1263
+ }
1264
+ this.engine.stage2d.translate(j, h);
1265
+ this.engine.stage2d.rotate(this.rotation * this.engine._radians);
1266
+ this.engine.stage2d.drawImage(this.image, i, f, a, d, this.registration_x * -1, this.registration_y * -1, e, c);
1267
+ this.engine.stage2d.restore()
1268
+ } else {
1269
+ this.engine.stage2d.drawImage(this.image, i, f, a, d, n, m, e, c)
1270
+ }
1271
+ if (this.frametimer == 0) {
1272
+ this.frame++;
1273
+ if (this.frame > this.framecount - 1) {
1274
+ this.frame = 0
1275
+ }
1276
+ this.frametimer = this.framespeed
1277
+ } else {
1278
+ if (this.frametimer > 0) {
1279
+ this.frametimer--
1280
+ }
1281
+ }
1282
+ if (this.alpha < 100) {
1283
+ this.engine.stage2d.globalAlpha = this.engine.defGA
1284
+ }
1285
+ }
1286
+ };bHive.Gradient = function (a, d) {
1287
+ this.engine = d;
1288
+ this.colors = [];
1289
+ this.stops = [];
1290
+ for (var c in a) {
1291
+ this[c] = a[c]
1292
+ }
1293
+ };bHive.Gradient.prototype = {};bHive.Audio = function (a, d) {
1294
+ this.engine = d;
1295
+ for (var c in a) {
1296
+ this[c] = a[c]
1297
+ }
1298
+ };bHive.Audio.prototype = {};