This commit is contained in:
Tanasart 2024-05-31 15:36:29 +07:00
parent 895375d719
commit 733ed54fc4
12 changed files with 250 additions and 315 deletions

View file

@ -33,7 +33,7 @@
{"name":"d3d_modifier","order":6,"path":"folders/nodes/data/3D/d3d_modifier.yy",},
{"name":"d3d_particle","order":7,"path":"folders/nodes/data/3D/d3d_particle.yy",},
{"name":"animation","order":13,"path":"folders/nodes/data/animation.yy",},
{"name":"value","order":7,"path":"folders/nodes/data/animation/value.yy",},
{"name":"fn","order":7,"path":"folders/nodes/data/animation/fn.yy",},
{"name":"canvas","order":30,"path":"folders/nodes/data/canvas.yy",},
{"name":"actions","order":8,"path":"folders/nodes/data/canvas/actions.yy",},
{"name":"shader","order":9,"path":"folders/nodes/data/canvas/shader.yy",},
@ -754,6 +754,8 @@
{"name":"node_flip","order":13,"path":"scripts/node_flip/node_flip.yy",},
{"name":"node_flood_fill","order":3,"path":"scripts/node_flood_fill/node_flood_fill.yy",},
{"name":"node_flow_noise","order":18,"path":"scripts/node_flow_noise/node_flow_noise.yy",},
{"name":"node_fn_wave_table","order":1,"path":"scripts/node_fn_wave_table/node_fn_wave_table.yy",},
{"name":"node_fn","order":2,"path":"scripts/node_fn/node_fn.yy",},
{"name":"node_fold_noise","order":14,"path":"scripts/node_fold_noise/node_fold_noise.yy",},
{"name":"node_frame","order":1,"path":"scripts/node_frame/node_frame.yy",},
{"name":"node_functions","order":2,"path":"scripts/node_functions/node_functions.yy",},
@ -1074,7 +1076,6 @@
{"name":"node_warp","order":2,"path":"scripts/node_warp/node_warp.yy",},
{"name":"node_wav_file_read","order":15,"path":"scripts/node_wav_file_read/node_wav_file_read.yy",},
{"name":"node_wav_file_write","order":16,"path":"scripts/node_wav_file_write/node_wav_file_write.yy",},
{"name":"node_wave_table","order":1,"path":"scripts/node_wave_table/node_wave_table.yy",},
{"name":"node_wavelet_noise","order":13,"path":"scripts/node_wavelet_noise/node_wavelet_noise.yy",},
{"name":"node_websocket_sender","order":1,"path":"scripts/node_websocket_sender/node_websocket_sender.yy",},
{"name":"node_widget_test","order":16,"path":"scripts/node_widget_test/node_widget_test.yy",},

View file

@ -129,7 +129,7 @@
{"$GMFolder":"","%Name":"d3d_modifier","folderPath":"folders/nodes/data/3D/d3d_modifier.yy","name":"d3d_modifier","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"d3d_particle","folderPath":"folders/nodes/data/3D/d3d_particle.yy","name":"d3d_particle","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"animation","folderPath":"folders/nodes/data/animation.yy","name":"animation","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"value","folderPath":"folders/nodes/data/animation/value.yy","name":"value","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"fn","folderPath":"folders/nodes/data/animation/fn.yy","name":"fn","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"canvas","folderPath":"folders/nodes/data/canvas.yy","name":"canvas","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"actions","folderPath":"folders/nodes/data/canvas/actions.yy","name":"actions","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"shader","folderPath":"folders/nodes/data/canvas/shader.yy","name":"shader","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -1172,6 +1172,9 @@
{"id":{"name":"node_flip","path":"scripts/node_flip/node_flip.yy",},},
{"id":{"name":"node_flood_fill","path":"scripts/node_flood_fill/node_flood_fill.yy",},},
{"id":{"name":"node_flow_noise","path":"scripts/node_flow_noise/node_flow_noise.yy",},},
{"id":{"name":"node_fn_wave_table","path":"scripts/node_fn_wave_table/node_fn_wave_table.yy",},},
{"id":{"name":"node_fn_wiggler","path":"scripts/node_fn_wiggler/node_fn_wiggler.yy",},},
{"id":{"name":"node_fn","path":"scripts/node_fn/node_fn.yy",},},
{"id":{"name":"node_fold_noise","path":"scripts/node_fold_noise/node_fold_noise.yy",},},
{"id":{"name":"node_frame","path":"scripts/node_frame/node_frame.yy",},},
{"id":{"name":"node_functions","path":"scripts/node_functions/node_functions.yy",},},
@ -1531,12 +1534,10 @@
{"id":{"name":"node_warp","path":"scripts/node_warp/node_warp.yy",},},
{"id":{"name":"node_wav_file_read","path":"scripts/node_wav_file_read/node_wav_file_read.yy",},},
{"id":{"name":"node_wav_file_write","path":"scripts/node_wav_file_write/node_wav_file_write.yy",},},
{"id":{"name":"node_wave_table","path":"scripts/node_wave_table/node_wave_table.yy",},},
{"id":{"name":"node_wavelet_noise","path":"scripts/node_wavelet_noise/node_wavelet_noise.yy",},},
{"id":{"name":"node_websocket_receiver","path":"scripts/node_websocket_receiver/node_websocket_receiver.yy",},},
{"id":{"name":"node_websocket_sender","path":"scripts/node_websocket_sender/node_websocket_sender.yy",},},
{"id":{"name":"node_widget_test","path":"scripts/node_widget_test/node_widget_test.yy",},},
{"id":{"name":"node_wiggler","path":"scripts/node_wiggler/node_wiggler.yy",},},
{"id":{"name":"node_wrap_area","path":"scripts/node_wrap_area/node_wrap_area.yy",},},
{"id":{"name":"node_wrap_perspective","path":"scripts/node_wrap_perspective/node_wrap_perspective.yy",},},
{"id":{"name":"node_zigzag","path":"scripts/node_zigzag/node_zigzag.yy",},},

View file

@ -0,0 +1,95 @@
function Node_Fn(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Fn";
update_on_frame = true;
setDimension(96, 96);
inputs[| 0] = nodeValue("Display", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "Graph" ]);
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
inl = ds_list_size(inputs);
input_display_list = [
["Display", true], 0,
];
text_display = 0;
graph_display = array_create(64, 0);
graph_display_min = 0;
graph_display_max = 0;
static __fnEval = function(_x = 0) { return 0; }
static refreshDisplay = function() {
graph_display_min = undefined;
graph_display_max = undefined;
for( var i = 0; i < 64; i++ ) {
var _c = __fnEval(i / 64);
graph_display[i] = _c;
graph_display_min = graph_display_min == undefined? _c : min(graph_display_min, _c);
graph_display_max = graph_display_max == undefined? _c : max(graph_display_max, _c);
}
}
static postPostProcess = function() { if(!IS_PLAYING) refreshDisplay(); }
static processData = function(_output, _data, _output_index, _array_index = 0) { }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s);
var disp = array_safe_get_fast(current_data, 0);
var time = CURRENT_FRAME;
var total_time = TOTAL_FRAMES;
switch(disp) {
case 0 :
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
draw_text_bbox(bbox, text_display);
break;
case 1 :
var _min = graph_display_min;
var _max = graph_display_max;
var val = (_min + _max) / 2;
var _ran = _max - _min;
var x0 = bbox.x0;
var x1 = bbox.x1;
var y0 = bbox.y0;
var y1 = bbox.y1;
var ww = bbox.w;
var hh = bbox.h;
var yc = (y0 + y1) / 2;
draw_set_color(COLORS.node_wiggler_frame);
draw_set_alpha(0.5);
draw_line(x0, yc, x1, yc);
draw_set_alpha(1);
draw_set_text(f_sdf, fa_right, fa_bottom, COLORS._main_text_sub);
draw_text_transformed(x1 - 2 * _s, y1, text_display, 0.3 * _s, 0.3 * _s, 0);
var lw = ww / (64 - 1);
var ox, oy;
draw_set_color(c_white);
for( var i = 0; i < 64; i++ ) {
var _x = x0 + i * lw;
var _y = yc - (graph_display[i] - val) / _ran * hh;
if(i) draw_line(ox, oy, _x, _y);
ox = _x;
oy = _y;
}
draw_set_color(COLORS._main_accent);
var _fx = x0 + (time / total_time * ww);
draw_line(_fx, y0, _fx, y1);
draw_set_color(COLORS.node_wiggler_frame);
draw_rectangle(x0, y0, x1, y1, true);
break;
}
} #endregion
}

View file

@ -1,12 +1,12 @@
{
"$GMScript":"",
"%Name":"node_wiggler",
"%Name":"node_fn",
"isCompatibility":false,
"isDnD":false,
"name":"node_wiggler",
"name":"node_fn",
"parent":{
"name":"value",
"path":"folders/nodes/data/animation/value.yy",
"name":"fn",
"path":"folders/nodes/data/animation/fn.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",

View file

@ -0,0 +1,58 @@
function Node_Fn_WaveTable(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) constructor {
name = "WaveTable";
inputs[| inl + 0] = nodeValue("Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 3, 0.01] });
inputs[| inl + 1] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| inl + 2] = nodeValue("Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 8, 0.01] });
array_append(input_display_list, [
["Wave", false], inl + 0, inl + 1, inl + 2,
]);
pattern = 0;
frequency = 0;
range_min = 0;
range_max = 0;
function getPattern(_patt, _x) {
switch(_patt % 3) {
case 0 : return sin(_x * pi * 2);
case 1 : return frac(_x) < 0.5? 1 : -1;
case 2 : return frac(_x + 0.5) * 2 - 1;
}
return 0;
}
static __fnEval = function(_x = 0) {
var _p0 = floor(pattern);
var _p1 = floor(pattern) + 1;
var _fr = frac(pattern);
var _v0 = getPattern(_p0, _x * frequency) * .5 + .5;
var _v1 = getPattern(_p1, _x * frequency) * .5 + .5;
var _lrp = lerp(_v0, _v1, _fr);
return lerp(range_min, range_max, _lrp);
}
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
pattern = _data[inl + 0];
var ran = _data[inl + 1];
range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1);
frequency = _data[inl + 2];
var val = __fnEval(CURRENT_FRAME / TOTAL_FRAMES);
text_display = val;
return val;
} #endregion
}

View file

@ -1,12 +1,12 @@
{
"$GMScript":"",
"%Name":"node_wave_table",
"%Name":"node_fn_wave_table",
"isCompatibility":false,
"isDnD":false,
"name":"node_wave_table",
"name":"node_fn_wave_table",
"parent":{
"name":"value",
"path":"folders/nodes/data/animation/value.yy",
"name":"fn",
"path":"folders/nodes/data/animation/fn.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",

View file

@ -0,0 +1,64 @@
function Node_Wiggler(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) constructor {
name = "Wiggler";
inputs[| inl + 0] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| inl + 1] = nodeValue("Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| inl + 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
inputs[| inl + 3] = nodeValue("Clip", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b11 )
.setDisplay(VALUE_DISPLAY.toggle, { data : [ "Start", "End" ] });
array_append(input_display_list, [
["Wiggle", false], inl + 2, inl + 0, inl + 1, inl + 3,
]);
range_min = 0;
range_max = 0;
wiggle_seed = 0;
wiggle_freq = 1;
clip_start = true;
clip_end = true;
static __fnEval = function(_x = 0) {
var _ed = TOTAL_FRAMES;
_x *= _ed;
var sdMin = floor(_x / wiggle_freq) * wiggle_freq;
var sdMax = min(_ed, sdMin + wiggle_freq);
var _x0 = (clip_start && sdMin <= 0)? 0.5 : random1D(PROJECT.seed + wiggle_seed + sdMin);
var _x1 = (clip_end && sdMax >= _ed)? 0.5 : random1D(PROJECT.seed + wiggle_seed + sdMax);
var t = (_x - sdMin) / (sdMax - sdMin);
t = -(cos(pi * t) - 1) / 2;
var _lrp = lerp(_x0, _x1, t);
return lerp(range_min, range_max, _lrp);
}
static processData = function(_output, _data, _output_index, _array_index = 0) {
var ran = _data[inl + 0];
range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1);
var fre = _data[inl + 1];
wiggle_freq = fre == 0? 1 : max(1, TOTAL_FRAMES / fre);
wiggle_seed = _data[inl + 2];
var clp = _data[inl + 3];
clip_start = bool(clp & 0b01);
clip_end = bool(clp & 0b10);
var val = __fnEval(CURRENT_FRAME / TOTAL_FRAMES);
text_display = val;
return val;
}
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"",
"%Name":"node_fn_wiggler",
"isCompatibility":false,
"isDnD":false,
"name":"node_fn_wiggler",
"parent":{
"name":"fn",
"path":"folders/nodes/data/animation/fn.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -346,10 +346,13 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
processData_postbatch();
postProcess();
postPostProcess();
} #endregion
static postProcess = function() {}
static postPostProcess = function() {}
static processSerialize = function(_map) { #region
_map.array_process = attributes.array_process;
} #endregion

View file

@ -953,8 +953,8 @@ function __initNodes() {
addNodeObject(animation, "Stagger", s_node_stagger, "Node_Stagger", [1, Node_Stagger]).setVersion(11640);
ds_list_add(animation, "Value");
addNodeObject(animation, "Wave Table", s_node_wave, "Node_Wave_Table", [1, Node_Wave_Table],, "Create value changing overtime in wave pattern.");
addNodeObject(animation, "Wiggler", s_node_wiggler, "Node_Wiggler", [1, Node_Wiggler],, "Create random value smoothly changing over time.");
addNodeObject(animation, "WaveTable", s_node_wave, "Node_Fn_WaveTable", [1, Node_Fn_WaveTable],, "Create value changing overtime in wave pattern.");
addNodeObject(animation, "Wiggler", s_node_wiggler, "Node_Wiggler", [1, Node_Wiggler],, "Create random value smoothly changing over time.");
ds_list_add(animation, "Audio");
addNodeObject(animation, "WAV File In", s_node_wav_file_read, "Node_WAV_File_Read", [0, Node_create_WAV_File_Read],, "Load wav audio file.").setVersion(1144);

View file

@ -1,143 +0,0 @@
function Node_Wave_Table(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Wave Table";
update_on_frame = true;
setDimension(96, 96);
inputs[| 0] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue("Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 2 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 8, 0.01] });
inputs[| 2] = nodeValue("Display", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "Graph" ]);
inputs[| 3] = nodeValue("Pattern", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 3, 0.01] });
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
input_display_list = [
["Display", true], 2,
["Wave", false], 3, 0, 1,
];
graph_display = array_create(64, 0);
pattern = 0;
frequency = 0;
range_min = 0;
range_max = 0;
disp_text = 0;
function getPattern(_patt, _time) {
switch(_patt % 3) {
case 0 : return sin(_time * pi * 2);
case 1 : return frac(_time) < 0.5? 1 : -1;
case 2 : return frac(_time + 0.5) * 2 - 1;
}
return 0;
}
function __getWave(_time = 0) {
var _p0 = floor(pattern);
var _p1 = floor(pattern) + 1;
var _fr = frac(pattern);
var _v0 = getPattern(_p0, _time * frequency) * .5 + .5;
var _v1 = getPattern(_p1, _time * frequency) * .5 + .5;
var _lrp = lerp(_v0, _v1, _fr);
return lerp(range_min, range_max, _lrp);
}
static onValueUpdate = function(index = 0) {
var ran = getSingleValue(0);
range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1);
frequency = getSingleValue(1);
pattern = getSingleValue(3);
for( var i = 0; i < 64; i++ )
graph_display[i] = __getWave(i / 64);
}
run_in(1, function() { onValueUpdate(); });
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
var ran = _data[0];
range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1);
frequency = _data[1];
pattern = _data[3];
var val = __getWave(CURRENT_FRAME / TOTAL_FRAMES);
if(_output_index == 0) disp_text = val;
return val;
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s);
var ran = array_safe_get_fast(current_data, 0);
var disp = array_safe_get_fast(current_data, 2);
var time = CURRENT_FRAME;
var total_time = TOTAL_FRAMES;
if(!is_array(ran)) return;
switch(disp) {
case 0 :
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
draw_text_bbox(bbox, disp_text);
break;
case 1 :
var _min = ran[0];
var _max = ran[1];
var val = (_min + _max) / 2;
var _ran = _max - _min;
var x0 = xx + 8 * _s;
var x1 = xx + (w - 8) * _s;
var y0 = yy + 20 * draw_name + 8 * _s;
var y1 = yy + (h - 8) * _s;
var ww = x1 - x0;
var hh = y1 - y0;
var yc = (y0 + y1) / 2;
draw_set_color(COLORS.node_wiggler_frame);
draw_set_alpha(0.5);
draw_line(x0, yc, x1, yc);
draw_set_alpha(1);
draw_set_text(f_sdf, fa_right, fa_bottom, COLORS._main_text_sub);
draw_text_transformed(x1 - 2 * _s, y1, disp_text, 0.3 * _s, 0.3 * _s, 0);
var lw = ww / (64 - 1);
var ox, oy;
draw_set_color(c_white);
for( var i = 0; i < 64; i++ ) {
var _x = x0 + i * lw;
var _y = yc - (graph_display[i] - val) / _ran * hh;
if(i) draw_line(ox, oy, _x, _y);
ox = _x;
oy = _y;
}
draw_set_color(COLORS._main_accent);
var _fx = x0 + (time / total_time * ww);
draw_line(_fx, y0, _fx, y1);
draw_set_color(COLORS.node_wiggler_frame);
draw_rectangle(x0, y0, x1, y1, true);
break;
}
} #endregion
static doApplyDeserialize = function() { onValueUpdate(); }
}

View file

@ -1,157 +0,0 @@
function Node_Wiggler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Wiggler";
update_on_frame = true;
setDimension(96, 96);
inputs[| 0] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 1] = nodeValue("Frequency", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4 )
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
inputs[| 2] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { inputs[| 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
inputs[| 3] = nodeValue("Display", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "Graph" ]);
inputs[| 4] = nodeValue("Clip", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0b11 )
.setDisplay(VALUE_DISPLAY.toggle, { data : [ "Start", "End" ] });
outputs[| 0] = nodeValue("Output", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
input_display_list = [
["Display", true], 3,
["Wiggle", false], 2, 0, 1, 4,
];
graph_display = array_create(64, 0);
range_min = 0;
range_max = 0;
disp_text = 0;
wiggle_seed = 0;
wiggle_freq = 1;
clip_start = true;
clip_end = true;
function __getWiggle(_time = 0) { #region
var _ed = TOTAL_FRAMES;
var sdMin = floor(_time / wiggle_freq) * wiggle_freq;
var sdMax = min(_ed, sdMin + wiggle_freq);
var _x0 = (clip_start && sdMin <= 0)? 0.5 : random1D(PROJECT.seed + wiggle_seed + sdMin);
var _x1 = (clip_end && sdMax >= _ed)? 0.5 : random1D(PROJECT.seed + wiggle_seed + sdMax);
var t = (_time - sdMin) / (sdMax - sdMin);
t = -(cos(pi * t) - 1) / 2;
var _lrp = lerp(_x0, _x1, t);
return lerp(range_min, range_max, _lrp);
} #endregion
static onValueUpdate = function(index = 0) {
var ran = getSingleValue(0);
range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1);
var fre = getSingleValue(1);
wiggle_freq = fre == 0? 1 : max(1, TOTAL_FRAMES / fre);
wiggle_seed = getSingleValue(2);
var clp = getSingleValue(4);
clip_start = bool(clp & 0b01);
clip_end = bool(clp & 0b10);
var step = TOTAL_FRAMES / 64;
for( var i = 0; i < 64; i++ )
graph_display[i] = __getWiggle(step * i);
}
run_in(1, function() { onValueUpdate(); });
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
var ran = _data[0];
range_min = array_safe_get_fast(ran, 0);
range_max = array_safe_get_fast(ran, 1);
var fre = _data[1];
wiggle_freq = fre == 0? 1 : max(1, TOTAL_FRAMES / fre);
wiggle_seed = _data[2];
var clp = _data[4];
clip_start = bool(clp & 0b01);
clip_end = bool(clp & 0b10);
var val = __getWiggle(CURRENT_FRAME);
if(_output_index == 0) disp_text = val;
return val;
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
var bbox = drawGetBbox(xx, yy, _s);
var ran = array_safe_get_fast(current_data, 0);
var fre = array_safe_get_fast(current_data, 1);
var sed = array_safe_get_fast(current_data, 2);
var disp = array_safe_get_fast(current_data, 3);
var time = CURRENT_FRAME;
var total_time = TOTAL_FRAMES;
if(!is_array(ran)) return;
switch(disp) {
case 0 :
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
draw_text_bbox(bbox, disp_text);
break;
case 1 :
var _min = ran[0];
var _max = ran[1];
var val = (_min + _max) / 2;
var _ran = _max - _min;
var x0 = xx + 8 * _s;
var x1 = xx + (w - 8) * _s;
var y0 = yy + 20 * draw_name + 8 * _s;
var y1 = yy + (h - 8) * _s;
var ww = x1 - x0;
var hh = y1 - y0;
var yc = (y0 + y1) / 2;
draw_set_color(COLORS.node_wiggler_frame);
draw_set_alpha(0.5);
draw_line(x0, yc, x1, yc);
draw_set_alpha(1);
draw_set_text(f_sdf, fa_right, fa_bottom, COLORS._main_text_sub);
draw_text_transformed(x1 - 2 * _s, y1, disp_text, 0.3 * _s, 0.3 * _s, 0);
var lw = ww / (64 - 1);
var ox, oy;
draw_set_color(c_white);
for( var i = 0; i < 64; i++ ) {
var _x = x0 + i * lw;
var _y = yc - (graph_display[i] - val) / _ran * hh;
if(i) draw_line(ox, oy, _x, _y);
ox = _x;
oy = _y;
}
draw_set_color(COLORS._main_accent);
var _fx = x0 + (time / total_time * ww);
draw_line(_fx, y0, _fx, y1);
draw_set_color(COLORS.node_wiggler_frame);
draw_rectangle(x0, y0, x1, y1, true);
break;
}
} #endregion
static doApplyDeserialize = function() { onValueUpdate(); }
}