time_node.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. type time_node_t = {
  2. base?: logic_node_t;
  3. };
  4. function time_node_create(raw: ui_node_t, args: f32_array_t): time_node_t {
  5. let n: time_node_t = {};
  6. n.base = logic_node_create(n);
  7. n.base.get = time_node_get;
  8. return n;
  9. }
  10. function time_node_get(self: time_node_t, from: i32): logic_node_value_t {
  11. if (from == 0) {
  12. let v: logic_node_value_t = {_f32 : sys_time()};
  13. return v;
  14. }
  15. else if (from == 1) {
  16. let v: logic_node_value_t = {_f32 : sys_delta()};
  17. return v;
  18. }
  19. else {
  20. let v: logic_node_value_t = {_f32 : context_raw.brush_time};
  21. return v;
  22. }
  23. }
  24. let time_node_def: ui_node_t = {
  25. id : 0,
  26. name : _tr("Time"),
  27. type : "time_node",
  28. x : 0,
  29. y : 0,
  30. color : 0xff4982a0,
  31. inputs : [],
  32. outputs : [
  33. {
  34. id : 0,
  35. node_id : 0,
  36. name : _tr("Time"),
  37. type : "VALUE",
  38. color : 0xffa1a1a1,
  39. default_value : f32_array_create_x(0.0),
  40. min : 0.0,
  41. max : 1.0,
  42. precision : 100,
  43. display : 0
  44. },
  45. {
  46. id : 0,
  47. node_id : 0,
  48. name : _tr("Delta"),
  49. type : "VALUE",
  50. color : 0xffa1a1a1,
  51. default_value : f32_array_create_x(0.0),
  52. min : 0.0,
  53. max : 1.0,
  54. precision : 100,
  55. display : 0
  56. },
  57. {
  58. id : 0,
  59. node_id : 0,
  60. name : _tr("Brush"),
  61. type : "VALUE",
  62. color : 0xffa1a1a1,
  63. default_value : f32_array_create_x(0.0),
  64. min : 0.0,
  65. max : 1.0,
  66. precision : 100,
  67. display : 0
  68. }
  69. ],
  70. buttons : [],
  71. width : 0,
  72. flags : 0
  73. };