|
|
@ -1,6 +1,6 @@
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
|
|
// Generated by CoffeeScript 1.7.1
|
|
|
|
(function() {
|
|
|
|
(function() {
|
|
|
|
var Engine, Object, ResourceManager, Scene, Sound, Sprite, Tileset, TilesetTile, util,
|
|
|
|
var Ease, Engine, Object, ResourceManager, Scene, Sound, Sprite, Tileset, TilesetTile, Timer, util,
|
|
|
|
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
|
|
|
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
|
|
|
__slice = [].slice;
|
|
|
|
__slice = [].slice;
|
|
|
|
|
|
|
|
|
|
|
@ -475,6 +475,430 @@
|
|
|
|
})(this)
|
|
|
|
})(this)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Engine.prototype.ease = {
|
|
|
|
|
|
|
|
_calculateElasticValues: (function(_this) {
|
|
|
|
|
|
|
|
return function(amplitude, period, change, inout) {
|
|
|
|
|
|
|
|
var overshoot;
|
|
|
|
|
|
|
|
if (inout == null) {
|
|
|
|
|
|
|
|
inout = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (period == null) {
|
|
|
|
|
|
|
|
if (inout) {
|
|
|
|
|
|
|
|
period = duration * (0.3 * 1.5);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
period = duration * 0.3;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((amplitude == null) || amplitude < Math.abs(change)) {
|
|
|
|
|
|
|
|
amplitude = change;
|
|
|
|
|
|
|
|
overshoot = period / 4;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
overshoot = period / (2 * Math.PI) * Math.asin(change / amplitude);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return [amplitude, period, change];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
backIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite, overshoot) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (overshoot == null) {
|
|
|
|
|
|
|
|
overshoot = 1.70158;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("backIn", infinite, start, end, _this.current_frame, duration, overshoot);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
backOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite, overshoot) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (overshoot == null) {
|
|
|
|
|
|
|
|
overshoot = 1.70158;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("backOut", infinite, start, end, _this.current_frame, duration, overshoot);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
backInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite, overshoot) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (overshoot == null) {
|
|
|
|
|
|
|
|
overshoot = 1.70158;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("backInOut", infinite, start, end, _this.current_frame, duration, overshoot);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
bounceOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("bounceOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
bounceIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("bounceIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
bounceInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("bounceInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
circOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("circOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
circIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("circIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
circInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("circInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
cubicOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("cubicOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
cubicIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("cubicIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
cubicInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("cubicInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
elasticOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite, amplitude, period) {
|
|
|
|
|
|
|
|
var change, _ref;
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amplitude == null) {
|
|
|
|
|
|
|
|
amplitude = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (period == null) {
|
|
|
|
|
|
|
|
period = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_ref = _this._calculateElasticValues(amplitude, period, end - start), amplitude = _ref[0], period = _ref[1], change = _ref[2];
|
|
|
|
|
|
|
|
end = start + change;
|
|
|
|
|
|
|
|
return new Ease("elasticOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
elasticIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite, amplitude, period) {
|
|
|
|
|
|
|
|
var change, _ref;
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amplitude == null) {
|
|
|
|
|
|
|
|
amplitude = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (period == null) {
|
|
|
|
|
|
|
|
period = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_ref = _this._calculateElasticValues(amplitude, period, end - start), amplitude = _ref[0], period = _ref[1], change = _ref[2];
|
|
|
|
|
|
|
|
end = start + change;
|
|
|
|
|
|
|
|
return new Ease("elasticIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
elasticInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite, amplitude, period) {
|
|
|
|
|
|
|
|
var change, _ref;
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amplitude == null) {
|
|
|
|
|
|
|
|
amplitude = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (period == null) {
|
|
|
|
|
|
|
|
period = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_ref = _this._calculateElasticValues(amplitude, period, end - start, true), amplitude = _ref[0], period = _ref[1], change = _ref[2];
|
|
|
|
|
|
|
|
end = start + change;
|
|
|
|
|
|
|
|
return new Ease("elasticInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
expoOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("expoOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
expoIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("expoIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
expoInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("expoInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
linearNone: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("linearNone", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
linearOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("linearNone", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
linearIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("linearNone", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
linearInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("linearNone", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
quadOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("quadOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
quadIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("quadIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
quadInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("quadInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
quartOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("quartOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
quartIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("quartIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
quartInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("quartInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
sineOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("sineOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
sineIn: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("sineIn", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
sineInOut: (function(_this) {
|
|
|
|
|
|
|
|
return function(start, end, duration, infinite) {
|
|
|
|
|
|
|
|
if (infinite == null) {
|
|
|
|
|
|
|
|
infinite = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Ease("sineInOut", infinite, start, end, _this.current_frame, duration);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease = (function() {
|
|
|
|
|
|
|
|
function Ease() {
|
|
|
|
|
|
|
|
var duration, end, infinite, params, start, start_frame, type;
|
|
|
|
|
|
|
|
type = arguments[0], infinite = arguments[1], start = arguments[2], end = arguments[3], start_frame = arguments[4], duration = arguments[5], params = 7 <= arguments.length ? __slice.call(arguments, 6) : [];
|
|
|
|
|
|
|
|
this.infinite = infinite;
|
|
|
|
|
|
|
|
this.start = start;
|
|
|
|
|
|
|
|
this.start_frame = start_frame;
|
|
|
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
|
|
|
this.params = params;
|
|
|
|
|
|
|
|
this.circInOut = __bind(this.circInOut, this);
|
|
|
|
|
|
|
|
this.circOut = __bind(this.circOut, this);
|
|
|
|
|
|
|
|
this.circIn = __bind(this.circIn, this);
|
|
|
|
|
|
|
|
this.bounceInOut = __bind(this.bounceInOut, this);
|
|
|
|
|
|
|
|
this.bounceIn = __bind(this.bounceIn, this);
|
|
|
|
|
|
|
|
this.bounceOut = __bind(this.bounceOut, this);
|
|
|
|
|
|
|
|
this.backInOut = __bind(this.backInOut, this);
|
|
|
|
|
|
|
|
this.backOut = __bind(this.backOut, this);
|
|
|
|
|
|
|
|
this.backIn = __bind(this.backIn, this);
|
|
|
|
|
|
|
|
this.updateValue = __bind(this.updateValue, this);
|
|
|
|
|
|
|
|
this.func = this[type];
|
|
|
|
|
|
|
|
this.change = end - this.start;
|
|
|
|
|
|
|
|
this.value = this.start;
|
|
|
|
|
|
|
|
this.finished = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.updateValue = function(current_frame) {
|
|
|
|
|
|
|
|
return this.value = this.func(current_frame - this.start_frame);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.backIn = function(time) {
|
|
|
|
|
|
|
|
var overshoot;
|
|
|
|
|
|
|
|
time = time / this.duration;
|
|
|
|
|
|
|
|
overshoot = this.params[0];
|
|
|
|
|
|
|
|
return this.change * time * time * ((overshoot + 1) * time - overshoot) + this.start;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.backOut = function(time) {
|
|
|
|
|
|
|
|
var overshoot;
|
|
|
|
|
|
|
|
time = time / this.duration - 1;
|
|
|
|
|
|
|
|
overshoot = this.params[0];
|
|
|
|
|
|
|
|
return this.change * (time * time * ((overshoot + 1) * time + overshoot) + 1) + this.start;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.backInOut = function(time) {
|
|
|
|
|
|
|
|
var overshoot;
|
|
|
|
|
|
|
|
time = time / (this.duration / 2);
|
|
|
|
|
|
|
|
overshoot = this.params[0] * 1.525;
|
|
|
|
|
|
|
|
if (time < 1) {
|
|
|
|
|
|
|
|
return this.change / 2 * (time * time * ((overshoot + 1) * time - overshoot)) + this.start;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
time -= 2;
|
|
|
|
|
|
|
|
return this.change / 2 * (time * time * ((overshoot + 1) * time + overshoot) + 2) + this.start;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.bounceOut = function(time, start) {
|
|
|
|
|
|
|
|
if (start == null) {
|
|
|
|
|
|
|
|
start = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
time = time / this.duration;
|
|
|
|
|
|
|
|
start = start != null ? start : this.start;
|
|
|
|
|
|
|
|
if (time < 1 / 2.75) {
|
|
|
|
|
|
|
|
return this.change * (7.5625 * time * time) + start;
|
|
|
|
|
|
|
|
} else if (time < 2 / 2.75) {
|
|
|
|
|
|
|
|
time = time - (1.5 / 2.75);
|
|
|
|
|
|
|
|
return this.change * (7.5625 * time * time + 0.75) + start;
|
|
|
|
|
|
|
|
} else if (time < 2.5 / 2.75) {
|
|
|
|
|
|
|
|
time = time - (2.25 / 2.75);
|
|
|
|
|
|
|
|
return this.change * (7.5625 * time * time + 0.9375) + start;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
time = time - (2.625 / 2.75);
|
|
|
|
|
|
|
|
return this.change * (7.5625 * time * time + 0.984375) + start;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.bounceIn = function(time, start) {
|
|
|
|
|
|
|
|
if (start == null) {
|
|
|
|
|
|
|
|
start = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
start = start != null ? start : this.start;
|
|
|
|
|
|
|
|
return this.change - this.bounceOut(this.duration - time, 0) + start;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.bounceInOut = function(time) {
|
|
|
|
|
|
|
|
if (time < this.duration / 2) {
|
|
|
|
|
|
|
|
return this.bounceIn(time * 2, 0) + this.start;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return this.bounceOut(time * 2 - this.duration, 0) + this.start;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.circIn = function(time) {
|
|
|
|
|
|
|
|
time = time / this.duration;
|
|
|
|
|
|
|
|
return -this.change * (Math.sqrt(1 - time * time) - 1) + this.start;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.circOut = function(time) {
|
|
|
|
|
|
|
|
time = time / this.duration - 1;
|
|
|
|
|
|
|
|
return this.change * Math.sqrt(1 - time * time) + this.start;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ease.prototype.circInOut = function(time) {
|
|
|
|
|
|
|
|
time = time / (this.duration / 2);
|
|
|
|
|
|
|
|
if (time < 1) {
|
|
|
|
|
|
|
|
return -this.change / 2 * (Math.sqrt(1 - time * time) - 1) + this.start;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
time = time - 2;
|
|
|
|
|
|
|
|
return this.change / 2 * (Math.sqrt(1 - time * time) + 1) + this.begin;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
Engine.prototype.random = {
|
|
|
|
Engine.prototype.random = {
|
|
|
|
number: (function(_this) {
|
|
|
|
number: (function(_this) {
|
|
|
|
return function(min, max, precision) {
|
|
|
|
return function(min, max, precision) {
|
|
|
@ -510,6 +934,66 @@
|
|
|
|
})(this)
|
|
|
|
})(this)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Engine.prototype.timing = {
|
|
|
|
|
|
|
|
startTimer: (function(_this) {
|
|
|
|
|
|
|
|
return function(frames, callback, name, repeat) {
|
|
|
|
|
|
|
|
var timer;
|
|
|
|
|
|
|
|
if (name == null) {
|
|
|
|
|
|
|
|
name = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (repeat == null) {
|
|
|
|
|
|
|
|
repeat = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
timer = new Timer(frames, callback, repeat);
|
|
|
|
|
|
|
|
if (name != null) {
|
|
|
|
|
|
|
|
return _this.named_timers[name] = timer;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return _this.unnamed_timers.push(timer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this),
|
|
|
|
|
|
|
|
stopTimer: (function(_this) {
|
|
|
|
|
|
|
|
return function(name) {
|
|
|
|
|
|
|
|
return _this.timers[name].stop();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})(this)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer = (function() {
|
|
|
|
|
|
|
|
function Timer(frames, callback, repeat) {
|
|
|
|
|
|
|
|
this.frames = frames;
|
|
|
|
|
|
|
|
this.callback = callback;
|
|
|
|
|
|
|
|
this.repeat = repeat;
|
|
|
|
|
|
|
|
this.stop = __bind(this.stop, this);
|
|
|
|
|
|
|
|
this.skip = __bind(this.skip, this);
|
|
|
|
|
|
|
|
this.step = __bind(this.step, this);
|
|
|
|
|
|
|
|
this.current_frame = 0;
|
|
|
|
|
|
|
|
this.finished = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer.prototype.step = function() {
|
|
|
|
|
|
|
|
if (this.current_frame >= this.frames) {
|
|
|
|
|
|
|
|
this.callback();
|
|
|
|
|
|
|
|
if (repeat) {
|
|
|
|
|
|
|
|
return this.current_frame = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return this.finished = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer.prototype.skip = function(frames) {
|
|
|
|
|
|
|
|
return this.current_frame += frames;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer.prototype.stop = function() {
|
|
|
|
|
|
|
|
return this.finished = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Timer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
Object = (function() {
|
|
|
|
Object = (function() {
|
|
|
|
function Object(engine, name) {
|
|
|
|
function Object(engine, name) {
|
|
|
|
this.engine = engine;
|
|
|
|
this.engine = engine;
|
|
|
|