UNPKG

@polygonjs/polygonjs

Version:

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

33 lines (32 loc) 978 B
"use strict"; import { TypedAnimNode } from "./_Base"; import { TimelineBuilder } from "../../../core/animation/TimelineBuilder"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { RampParam } from "../../params/Ramp"; class KeyframesParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); /** @param keyframes */ this.keyframes = ParamConfig.RAMP(RampParam.DEFAULT_VALUE, { hideLabel: true }); } } const ParamsConfig = new KeyframesParamsConfig(); export class KeyframesAnimNode extends TypedAnimNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "keyframes"; } initializeNode() { this.io.inputs.setCount(0, 1); } cook(inputContents) { const timelineBuilder = inputContents[0] || new TimelineBuilder(); timelineBuilder.setKeyframes(this.pv.keyframes); this.setTimelineBuilder(timelineBuilder); } }