2018-02-01 19:53:46 +00:00
|
|
|
const cmd = {};
|
2016-06-09 21:21:49 +00:00
|
|
|
|
2019-03-13 19:28:17 +00:00
|
|
|
/**
|
|
|
|
* Move the projector one frame forward
|
|
|
|
*
|
|
|
|
* @param {function} callback Function to call after projector moves one frame
|
|
|
|
**/
|
2019-03-22 01:02:28 +00:00
|
|
|
cmd.projector_forward = function (callback) {
|
2016-06-09 21:21:49 +00:00
|
|
|
'use strict';
|
|
|
|
var res = function (ms) {
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_proj_forward').removeClass('active');
|
2016-06-09 21:21:49 +00:00
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
};
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_proj_forward').addClass('active');
|
2019-03-31 00:29:01 +00:00
|
|
|
if (!proj.dir) {
|
2016-06-09 21:21:49 +00:00
|
|
|
proj.set(true, function (ms) {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
}
|
|
|
|
};
|
2019-03-13 19:28:17 +00:00
|
|
|
/**
|
|
|
|
* Move the projector one frame backward
|
|
|
|
*
|
|
|
|
* @param {function} callback Function to call after projector moves one frame
|
|
|
|
**/
|
2019-03-22 01:02:28 +00:00
|
|
|
cmd.projector_backward = function (callback) {
|
2016-06-09 21:21:49 +00:00
|
|
|
'use strict';
|
|
|
|
var res = function (ms) {
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_proj_backward').removeClass('active');
|
2016-06-09 21:21:49 +00:00
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
};
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_proj_backward').addClass('active');
|
2019-03-31 00:29:01 +00:00
|
|
|
if (proj.dir) {
|
2016-06-09 21:21:49 +00:00
|
|
|
proj.set(false, function (ms) {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
}
|
|
|
|
};
|
2019-04-20 14:15:28 +00:00
|
|
|
|
|
|
|
cmd.projector_second_forward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var res = function (ms) {
|
|
|
|
$('#cmd_proj2_forward').removeClass('active');
|
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
};
|
|
|
|
$('#cmd_proj2_forward').addClass('active');
|
|
|
|
if (!proj.second.dir) {
|
|
|
|
proj.second.set(true, function (ms) {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
cmd.projector_second_backward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var res = function (ms) {
|
|
|
|
$('#cmd_proj2_backward').removeClass('active');
|
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
};
|
|
|
|
$('#cmd_proj2_backward').addClass('active');
|
|
|
|
if (proj.second.dir) {
|
|
|
|
proj.second.set(false, function (ms) {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
proj.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
no ui for these?
|
|
|
|
cmd.projectors_forward = function (callback) {};
|
|
|
|
cmd.projectors_backward = function (callback) {};
|
|
|
|
|
|
|
|
cmd.projector_forward_projector_second_backward = function (callback) {};
|
|
|
|
cmd.projector_backward_projector_second_forward = function (callback) {};
|
|
|
|
*/
|
|
|
|
|
2019-03-13 19:28:17 +00:00
|
|
|
/**
|
|
|
|
* Move the camera one frame forward
|
|
|
|
*
|
2019-03-18 22:41:35 +00:00
|
|
|
* @param {array} rgb Color to set light for frame
|
2019-03-13 19:28:17 +00:00
|
|
|
* @param {function} callback Function to call after camera moves one frame
|
|
|
|
**/
|
2019-03-22 01:02:28 +00:00
|
|
|
cmd.camera_forward = function (rgb, callback) {
|
2016-06-09 21:21:49 +00:00
|
|
|
'use strict';
|
2018-01-09 18:01:19 +00:00
|
|
|
var off = [0, 0, 0];
|
2016-06-09 21:21:49 +00:00
|
|
|
var res = function (ms) {
|
|
|
|
gui.updateState();
|
|
|
|
setTimeout(function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
light.display(off);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(off, function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_cam_forward').removeClass('active');
|
2016-06-09 21:21:49 +00:00
|
|
|
if (callback) { callback(ms); }
|
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
};
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_cam_forward').addClass('active');
|
2019-03-31 00:29:01 +00:00
|
|
|
if (!cam.dir) {
|
2016-06-09 21:21:49 +00:00
|
|
|
cam.set(true, function () {
|
|
|
|
setTimeout( function () {
|
|
|
|
light.display(rgb);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(rgb, function () {
|
2016-06-09 21:21:49 +00:00
|
|
|
setTimeout( function () {
|
|
|
|
cam.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
light.display(rgb);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(rgb, function () {
|
2016-06-09 21:21:49 +00:00
|
|
|
setTimeout(function () {
|
|
|
|
cam.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2019-03-18 22:41:35 +00:00
|
|
|
/**
|
|
|
|
* Move the camera one frame forward, light set to black or off
|
|
|
|
*
|
|
|
|
* @param {function} callback Function to call after camera moves one frame
|
|
|
|
**/
|
2016-06-09 21:21:49 +00:00
|
|
|
cmd.black_forward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var off = [0, 0, 0];
|
2018-01-09 18:01:19 +00:00
|
|
|
var res = function (ms) {
|
|
|
|
$('#cmd_black_forward').removeClass('active');
|
2018-03-15 01:06:39 +00:00
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
2018-01-09 18:01:19 +00:00
|
|
|
};
|
|
|
|
$('#cmd_black_forward').addClass('active');
|
2019-03-31 00:29:01 +00:00
|
|
|
if (!cam.dir) {
|
2018-01-09 18:01:19 +00:00
|
|
|
cam.set(true, function () {
|
|
|
|
setTimeout( function () {
|
|
|
|
light.display(off);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(off, function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
setTimeout( function () {
|
|
|
|
cam.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2018-01-09 18:01:19 +00:00
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2018-01-09 18:01:19 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
light.display(off);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(off, function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
setTimeout(function () {
|
|
|
|
cam.move(res);
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2018-01-09 18:01:19 +00:00
|
|
|
});
|
|
|
|
}
|
2016-06-09 21:21:49 +00:00
|
|
|
};
|
2019-03-18 22:41:35 +00:00
|
|
|
/**
|
|
|
|
* Move the camera one frame backward
|
|
|
|
*
|
|
|
|
* @param {array} rgb Color to set light for frame
|
|
|
|
* @param {function} callback Function to call after camera moves one frame
|
|
|
|
**/
|
2019-03-22 01:02:28 +00:00
|
|
|
cmd.camera_backward = function (rgb, callback) {
|
2016-06-09 21:21:49 +00:00
|
|
|
'use strict';
|
2018-01-09 18:01:19 +00:00
|
|
|
var off = [0, 0, 0];
|
2016-06-09 21:21:49 +00:00
|
|
|
var res = function (ms) {
|
|
|
|
gui.updateState();
|
2018-01-09 18:01:19 +00:00
|
|
|
light.display(off);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(off, function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
$('#cmd_cam_backward').removeClass('active');
|
2016-06-09 21:21:49 +00:00
|
|
|
if (callback) { callback(ms); }
|
|
|
|
});
|
|
|
|
};
|
2018-01-21 00:51:08 +00:00
|
|
|
$('#cmd_cam_backward').addClass('active');
|
2019-03-31 00:29:01 +00:00
|
|
|
if (cam.dir) {
|
2016-06-09 21:21:49 +00:00
|
|
|
cam.set(false, function () {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(rgb);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(rgb, function () {
|
2016-06-09 21:21:49 +00:00
|
|
|
cam.move(res);
|
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(rgb);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(rgb, function () {
|
2016-06-09 21:21:49 +00:00
|
|
|
cam.move(res);
|
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2016-06-09 21:21:49 +00:00
|
|
|
}
|
|
|
|
};
|
2019-03-18 22:41:35 +00:00
|
|
|
/**
|
|
|
|
* Move the camera one frame forward, light set to black or off
|
|
|
|
*
|
|
|
|
* @param {function} callback Function to call after camera moves one frame
|
|
|
|
**/
|
2016-06-09 21:21:49 +00:00
|
|
|
cmd.black_backward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var off = [0, 0, 0];
|
2018-01-09 18:01:19 +00:00
|
|
|
var res = function (ms) {
|
|
|
|
$('#cmd_black_backward').removeClass('active');
|
|
|
|
gui.updateState();
|
2018-03-15 01:06:39 +00:00
|
|
|
if (callback) { callback(ms); }
|
2018-01-09 18:01:19 +00:00
|
|
|
};
|
2018-01-21 00:51:08 +00:00
|
|
|
$('#cmd_black_backward').addClass('active');
|
2019-03-31 00:29:01 +00:00
|
|
|
if (cam.dir) {
|
2018-01-09 18:01:19 +00:00
|
|
|
cam.set(false, function () {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(off);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(off, function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
cam.move(res);
|
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2018-01-09 18:01:19 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(off);
|
2019-02-13 23:57:18 +00:00
|
|
|
light.set(off, function () {
|
2018-01-09 18:01:19 +00:00
|
|
|
cam.move(res);
|
|
|
|
});
|
2019-03-22 08:33:53 +00:00
|
|
|
}, cfg.arduino.serialDelay);
|
2018-01-09 18:01:19 +00:00
|
|
|
}
|
2016-06-09 21:21:49 +00:00
|
|
|
};
|
2019-03-20 19:44:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
cam2_forward : 'C2F',
|
|
|
|
cam2_backward : 'C2B',
|
|
|
|
|
|
|
|
cams_forward : 'CCF',
|
|
|
|
cams_forward : 'CCB',
|
|
|
|
|
|
|
|
cam_forward_cam2_backward : 'CFCB',
|
|
|
|
cam_backward_cam2_forward : 'CBCF',
|
2019-03-20 22:37:00 +00:00
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Move the secondary projector forward one frame
|
|
|
|
*
|
|
|
|
* @param {function} callback Function to call after action
|
|
|
|
**/
|
2019-04-20 14:15:28 +00:00
|
|
|
cmd.camera_second_forward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var off = [0, 0, 0];
|
|
|
|
var res = function (ms) {
|
|
|
|
gui.updateState();
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(off);
|
|
|
|
light.set(off, function () {
|
|
|
|
$('#cmd_cam2_forward').removeClass('active');
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
};
|
|
|
|
$('#cmd_cam2_forward').addClass('active');
|
|
|
|
if (!cam.second.dir) {
|
|
|
|
cam.second.set(true, function () {
|
|
|
|
setTimeout( function () {
|
|
|
|
light.display(rgb);
|
|
|
|
light.set(rgb, function () {
|
|
|
|
setTimeout( function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
light.display(rgb);
|
|
|
|
light.set(rgb, function () {
|
|
|
|
setTimeout(function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
cmd.camera_second_backward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var off = [0, 0, 0];
|
|
|
|
var res = function (ms) {
|
|
|
|
gui.updateState();
|
|
|
|
light.display(off);
|
|
|
|
light.set(off, function () {
|
|
|
|
$('#cmd_cam_backward').removeClass('active');
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
});
|
|
|
|
};
|
|
|
|
$('#cmd_cam_backward').addClass('active');
|
|
|
|
if (cam.second.dir) {
|
|
|
|
cam.second.set(false, function () {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(rgb);
|
|
|
|
light.set(rgb, function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(rgb);
|
|
|
|
light.set(rgb, function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
}
|
|
|
|
};
|
2019-03-20 19:44:07 +00:00
|
|
|
|
2019-04-20 14:15:28 +00:00
|
|
|
cmd.black_second_forward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var off = [0, 0, 0];
|
|
|
|
var res = function (ms) {
|
|
|
|
$('#cmd_black2_forward').removeClass('active');
|
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
};
|
|
|
|
$('#cmd_black2_forward').addClass('active');
|
|
|
|
if (!cam.second.dir) {
|
|
|
|
cam.second.set(true, function () {
|
|
|
|
setTimeout( function () {
|
|
|
|
light.display(off);
|
|
|
|
light.set(off, function () {
|
|
|
|
setTimeout( function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
light.display(off);
|
|
|
|
light.set(off, function () {
|
|
|
|
setTimeout(function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2019-03-20 19:44:07 +00:00
|
|
|
|
2019-04-20 14:15:28 +00:00
|
|
|
cmd.black2_backward = function (callback) {
|
|
|
|
'use strict';
|
|
|
|
var off = [0, 0, 0];
|
|
|
|
var res = function (ms) {
|
|
|
|
$('#cmd_black2_backward').removeClass('active');
|
|
|
|
gui.updateState();
|
|
|
|
if (callback) { callback(ms); }
|
|
|
|
};
|
|
|
|
$('#cmd_black2_backward').addClass('active');
|
|
|
|
if (cam.second.dir) {
|
|
|
|
cam.second.set(false, function () {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(off);
|
|
|
|
light.set(off, function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
setTimeout(function () {
|
|
|
|
light.display(off);
|
|
|
|
light.set(off, function () {
|
|
|
|
cam.second.move(res);
|
|
|
|
});
|
|
|
|
}, cfg.arduino.serialDelay);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
cmd.cameras_forward = function (callback) {};
|
|
|
|
cmd.cameras_backward = function (callback) {};
|
|
|
|
|
|
|
|
cmd.camera_forward_camera_second_backward = function (callback) {};
|
|
|
|
cmd.camera_backward_camera_second_forward = function (callback) {};
|
|
|
|
*/
|
2019-03-20 19:44:07 +00:00
|
|
|
|
2019-03-18 23:42:12 +00:00
|
|
|
/**
|
|
|
|
* Move the camera to a specific frame. Accepts the input with the "move_cam_to"
|
|
|
|
* value. Moves as black frames to prevent multiple exposure.
|
|
|
|
*
|
|
|
|
* @param {object} t HTML input element with the move to val
|
|
|
|
**/
|
2019-03-22 01:02:28 +00:00
|
|
|
cmd.camera_to = function (t) {
|
2018-03-15 01:06:39 +00:00
|
|
|
const raw = $('#move_cam_to').val();
|
|
|
|
const val = parseInt(raw);
|
|
|
|
let proceed = false;
|
|
|
|
let total;
|
|
|
|
let steps = [];
|
|
|
|
let c;
|
|
|
|
let cont;
|
2019-03-31 00:29:01 +00:00
|
|
|
if (val !== cam.pos) {
|
|
|
|
if (val < cam.pos) {
|
2019-05-28 16:52:50 +00:00
|
|
|
total = -(cam.pos - val);
|
2019-03-31 00:29:01 +00:00
|
|
|
} else if (val > cam.pos) {
|
2019-05-28 16:52:50 +00:00
|
|
|
total = val - cam.pos;
|
2018-02-01 19:53:46 +00:00
|
|
|
}
|
2018-03-15 01:06:39 +00:00
|
|
|
if (total > 0) {
|
2019-03-31 00:29:01 +00:00
|
|
|
c = cfg.cmd.black_forward;
|
2018-03-15 01:06:39 +00:00
|
|
|
} else if (total < 0) {
|
2019-03-31 00:29:01 +00:00
|
|
|
c = cfg.cmd.black_backward;
|
2018-03-15 01:06:39 +00:00
|
|
|
}
|
2019-03-31 00:29:01 +00:00
|
|
|
steps = [{ cmd : c, light : [0, 0, 0] }]
|
2018-03-15 01:06:39 +00:00
|
|
|
cont = confirm(`Do you want to ${(total > 0 ? 'advance' : 'rewind')} the camera ${total} frame${(total === 1 ? '' : 's')} to frame ${val}?`)
|
|
|
|
if (cont) {
|
2019-03-31 00:29:01 +00:00
|
|
|
gui.overlay(true);
|
|
|
|
gui.spinner(true, `Camera ${(total > 0 ? 'advancing' : 'rewinding')} ${total} frame${(total === 1 ? '' : 's')} `, true, true);
|
|
|
|
seq.exec(steps, Math.abs(total));
|
2018-03-15 01:06:39 +00:00
|
|
|
}
|
2018-02-01 19:53:46 +00:00
|
|
|
}
|
|
|
|
};
|
2019-05-28 16:52:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the secondary camera to a specific frame. Accepts the input with the "move_cam_to_2"
|
|
|
|
* value. Moves as black frames to prevent multiple exposure.
|
|
|
|
*
|
|
|
|
* @param {object} t HTML input element with the move to val
|
|
|
|
**/
|
|
|
|
cmd.camera_second_to = function (t) {
|
|
|
|
const raw = $('#move_cam_to_2').val();
|
|
|
|
const val = parseInt(raw);
|
|
|
|
let proceed = false;
|
|
|
|
let total;
|
|
|
|
let steps = [];
|
|
|
|
let c;
|
|
|
|
let cont;
|
|
|
|
if (val !== cam.second.pos) {
|
|
|
|
if (val < cam.second.pos) {
|
|
|
|
total = -(cam.second.pos - val)
|
|
|
|
} else if (val > cam.second.pos) {
|
|
|
|
total = val - cam.second.pos;
|
|
|
|
}
|
|
|
|
if (total > 0) {
|
|
|
|
c = cfg.cmd.black_second_forward;
|
|
|
|
} else if (total < 0) {
|
|
|
|
c = cfg.cmd.black_second_backward;
|
|
|
|
}
|
|
|
|
steps = [{ cmd : c, light : [0, 0, 0] }]
|
|
|
|
cont = confirm(`Do you want to ${(total > 0 ? 'advance' : 'rewind')} the secondary camera ${total} frame${(total === 1 ? '' : 's')} to frame ${val}?`)
|
|
|
|
if (cont) {
|
|
|
|
gui.overlay(true);
|
|
|
|
gui.spinner(true, `Second camera ${(total > 0 ? 'advancing' : 'rewinding')} ${total} frame${(total === 1 ? '' : 's')} `, true, true);
|
|
|
|
seq.exec(steps, Math.abs(total));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-03-20 19:44:07 +00:00
|
|
|
/**
|
|
|
|
* Move the projector to a specific frame. Accepts the input with the "move_proj_to"
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* @param {object} t HTML input element with the move to val
|
|
|
|
**/
|
2019-03-22 01:02:28 +00:00
|
|
|
cmd.projector_to = function (t) {
|
2018-03-15 01:06:39 +00:00
|
|
|
const raw = $('#move_proj_to').val();
|
|
|
|
const val = parseInt(raw);
|
|
|
|
let proceed = false;
|
|
|
|
let total;
|
|
|
|
let steps = [];
|
|
|
|
let c;
|
|
|
|
let cont
|
2019-03-31 00:29:01 +00:00
|
|
|
if (val !== proj.pos) {
|
|
|
|
if (val < proj.pos) {
|
2019-05-28 16:52:50 +00:00
|
|
|
total = -(proj.pos - val);
|
2019-03-31 00:29:01 +00:00
|
|
|
} else if (val > proj.pos) {
|
2019-05-28 16:52:50 +00:00
|
|
|
total = val - proj.pos;
|
2018-02-01 19:53:46 +00:00
|
|
|
}
|
2018-03-15 01:06:39 +00:00
|
|
|
if (total > 0) {
|
2019-03-31 00:29:01 +00:00
|
|
|
c = cfg.cmd.projector_forward;
|
2018-03-15 01:06:39 +00:00
|
|
|
} else if (total < 0) {
|
2019-03-31 00:29:01 +00:00
|
|
|
c = cfg.cmd.projector_backward;
|
|
|
|
} else {
|
|
|
|
return false;
|
2018-03-15 01:06:39 +00:00
|
|
|
}
|
2019-03-31 00:29:01 +00:00
|
|
|
steps = [ { cmd : c }];
|
2018-03-15 01:06:39 +00:00
|
|
|
cont = confirm(`Do you want to ${(total > 0 ? 'advance' : 'rewind')} the projector ${total} frame${(total === 1 ? '' : 's')} to frame ${val}?`)
|
|
|
|
if (cont) {
|
2019-03-31 00:29:01 +00:00
|
|
|
gui.overlay(true);
|
|
|
|
gui.spinner(true, `Projector ${(total > 0 ? 'advancing' : 'rewinding')} ${total} frame${(total === 1 ? '' : 's')} `, true, true);
|
|
|
|
seq.exec(steps, Math.abs(total));
|
2018-03-15 01:06:39 +00:00
|
|
|
}
|
2018-02-01 19:53:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 16:52:50 +00:00
|
|
|
/**
|
|
|
|
* Move the secondary projector to a specific frame. Accepts the input with the "move_proj_to_2"
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* @param {object} t HTML input element with the move to val
|
|
|
|
**/
|
|
|
|
cmd.projector_second_to = function (t) {
|
|
|
|
const raw = $('#move_proj_to_2').val();
|
|
|
|
const val = parseInt(raw);
|
|
|
|
let proceed = false;
|
|
|
|
let total;
|
|
|
|
let steps = [];
|
|
|
|
let c;
|
|
|
|
let cont
|
|
|
|
if (val !== proj.second.pos) {
|
|
|
|
if (val < proj.second.pos) {
|
|
|
|
total = -(proj.second.pos - val);
|
|
|
|
} else if (val > proj.second.pos) {
|
|
|
|
total = val - proj.second.pos;
|
|
|
|
}
|
|
|
|
if (total > 0) {
|
|
|
|
c = cfg.cmd.projector_second_forward;
|
|
|
|
} else if (total < 0) {
|
|
|
|
c = cfg.cmd.projector_second_backward;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
steps = [ { cmd : c }];
|
|
|
|
cont = confirm(`Do you want to ${(total > 0 ? 'advance' : 'rewind')} the secondary projector ${total} frame${(total === 1 ? '' : 's')} to frame ${val}?`)
|
|
|
|
if (cont) {
|
|
|
|
gui.overlay(true);
|
|
|
|
gui.spinner(true, `Second projector ${(total > 0 ? 'advancing' : 'rewinding')} ${total} frame${(total === 1 ? '' : 's')} `, true, true);
|
|
|
|
seq.exec(steps, Math.abs(total));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-09 21:21:49 +00:00
|
|
|
module.exports = cmd;
|