time_node.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. type time_node_t = {
  2. base?: logic_node_t;
  3. };
  4. function time_node_create(arg: any): time_node_t {
  5. let n: time_node_t = {};
  6. n.base = logic_node_create();
  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: time_time() };
  13. return v;
  14. }
  15. else if (from == 1) {
  16. let v: logic_node_value_t = { _f32: time_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: zui_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. };