UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

24 lines 806 B
import { Node } from '../../programmatic/node.js'; import { NumberSchema, Vec2Schema } from '../../schemas/index.js'; export default class NodeDefinition extends Node { static title = 'Scale Vector2'; static type = 'studio.tokens.vector2.scale'; static description = 'Multiplies a vector by a scalar value'; constructor(props) { super(props); this.addInput('vector', { type: Vec2Schema }); this.addInput('scalar', { type: { ...NumberSchema, default: 1 } }); this.addOutput('value', { type: Vec2Schema }); } execute() { const { vector, scalar } = this.getAllInputs(); this.outputs.value.set([vector[0] * scalar, vector[1] * scalar]); } } //# sourceMappingURL=scale.js.map