2023-06-04 12:38:40 +02:00
|
|
|
function Node_Animation_Control(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2024-03-28 14:18:02 +01:00
|
|
|
name = "Animation Control";
|
|
|
|
setDimension(96, 96);
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[0] = nodeValue_Trigger("Toggle Play / Pause", self, false );
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[1] = nodeValue_Trigger("Pause", self, false );
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[2] = nodeValue_Trigger("Resume", self, false );
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[3] = nodeValue_Trigger("Play From Beginning", self, false );
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[4] = nodeValue_Trigger("Play once", self, false );
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[5] = nodeValue_Trigger("Skip Frames", self, false );
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[6] = nodeValue_Int("Skip Frames Count", self, 1);
|
2023-06-04 12:38:40 +02:00
|
|
|
|
|
|
|
static step = function() {
|
2023-10-02 08:57:44 +02:00
|
|
|
if(getInputData(0))
|
2023-07-06 19:49:16 +02:00
|
|
|
PROJECT.animator.toggle();
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(getInputData(1))
|
2023-07-06 19:49:16 +02:00
|
|
|
PROJECT.animator.pause();
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(getInputData(2))
|
2023-07-06 19:49:16 +02:00
|
|
|
PROJECT.animator.resume();
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(getInputData(3)) {
|
2023-07-06 19:49:16 +02:00
|
|
|
PROJECT.animator.stop();
|
|
|
|
PROJECT.animator.play();
|
2023-06-04 12:38:40 +02:00
|
|
|
}
|
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(getInputData(4))
|
2023-07-06 19:49:16 +02:00
|
|
|
PROJECT.animator.render();
|
2023-06-04 12:38:40 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(getInputData(5)) {
|
|
|
|
var fr = getInputData(6);
|
2023-10-09 16:07:33 +02:00
|
|
|
PROJECT.animator.setFrame(CURRENT_FRAME + fr);
|
2023-06-04 12:38:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
|
|
|
var bbox = drawGetBbox(xx, yy, _s);
|
|
|
|
var ind = 0;
|
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
if(PROJECT.animator.is_playing) ind = 1;
|
2023-06-04 12:38:40 +02:00
|
|
|
|
|
|
|
draw_sprite_fit(THEME.sequence_control, ind, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
|
|
|
}
|
|
|
|
}
|