Add random brush node
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user