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