Add random brush node

This commit is contained in:
luboslenco
2020-03-25 16:42:09 +01:00
parent ec9d11e7f5
commit eaec716443
2 changed files with 52 additions and 0 deletions
+37
View File
@@ -151,6 +151,43 @@ class NodesBrush {
],
buttons: []
},
{
id: 0,
name: "Random",
type: "RandomNode",
x: 0,
y: 0,
color: 0xffb34f5a,
inputs: [
{
id: 0,
node_id: 0,
name: "Min",
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.0
},
{
id: 0,
node_id: 0,
name: "Max",
type: "VALUE",
color: 0xffa1a1a1,
default_value: 1.0
}
],
outputs: [
{
id: 0,
node_id: 0,
name: "Value",
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.5
}
],
buttons: []
},
{
id: 0,
name: "Vector",
+15
View File
@@ -0,0 +1,15 @@
package arm.node.brush;
@:keep
class RandomNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
var min = inputs[0].get();
var max = inputs[1].get();
return min + (Math.random() * (max - min));
}
}