UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

37 lines (36 loc) 1.14 kB
"use strict"; import { TypedAnimNode } from "./_Base"; import { TimelineBuilder } from "../../../core/animation/TimelineBuilder"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { OPERATIONS } from "../../../core/animation/vars/AnimBuilderTypes"; class OperationAnimParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param sets the operation (set, add or subtract) */ this.operation = ParamConfig.INTEGER(0, { menu: { entries: OPERATIONS.map((name, value) => { return { value, name }; }) } }); } } const ParamsConfig = new OperationAnimParamsConfig(); export class OperationAnimNode extends TypedAnimNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "operation"; } initializeNode() { this.io.inputs.setCount(0, 1); } cook(input_contents) { const timeline_builder = input_contents[0] || new TimelineBuilder(); timeline_builder.setOperation(OPERATIONS[this.pv.operation]); this.setTimelineBuilder(timeline_builder); } }