@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
24 lines • 713 B
JavaScript
import { Node } from '../../programmatic/node.js';
import { Vec2Schema } from '../../schemas/index.js';
export default class NodeDefinition extends Node {
static title = 'Add Vector2';
static type = 'studio.tokens.vector2.add';
static description = 'Adds two 2D vectors';
constructor(props) {
super(props);
this.addInput('a', {
type: Vec2Schema
});
this.addInput('b', {
type: Vec2Schema
});
this.addOutput('value', {
type: Vec2Schema
});
}
execute() {
const { a, b } = this.getAllInputs();
this.outputs.value.set([a[0] + b[0], a[1] + b[1]]);
}
}
//# sourceMappingURL=add.js.map