UNPKG

@polygonjs/polygonjs

Version:

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

36 lines (35 loc) 987 B
"use strict"; import { TypedSopNode } from "./_Base"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { InputCloneMode } from "../../poly/InputCloneMode"; class DelaySopParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param duration in milliseconds */ this.duration = ParamConfig.INTEGER(1e3, { range: [0, 1e3], rangeLocked: [true, false] }); } } const ParamsConfig = new DelaySopParamsConfig(); export class DelaySopNode extends TypedSopNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "delay"; } initializeNode() { this.io.inputs.setCount(1); this.io.inputs.initInputsClonedState(InputCloneMode.ALWAYS); } cook(inputs_contents) { const core_group = inputs_contents[0]; const c = () => { this.setCoreGroup(core_group); }; setTimeout(c, Math.max(this.pv.duration, 0)); } }