Page 419 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 419
/**
* @class Slot
* @constructor
*/
/*$.ajax({
dataType : 'json',
url : "192.168.1.49:3000/Userdata",
//type : "GET",
success : function(data){
console.log(data);
data = JSON.parse(data);
UID = data.UID;
Nick = data.Nick;
Money = data.Money;
}
});*/
function Slot(el, max, step) {
this.speed = 0; //speed of the slot at any point of time
this.step = step; //speed will increase at this rate
this.si = null; //holds setInterval object for the given slot
this.el = el; //dom element of the slot
this.maxSpeed = max; //max speed this slot can have
this.pos = null; //final position of the slot
$(el).pan({
fps:30,
dir:'down'
});
$(el).spStop();
}
/**
* @method start
* Starts a slot
*/
Slot.prototype.start = function() {
var _this = this;
$(_this.el).addClass('motion');
$(_this.el).spStart();
_this.si = window.setInterval(function() {
if(_this.speed < _this.maxSpeed) {
_this.speed += _this.step;
- 412 -