UNPKG

@polygonjs/polygonjs

Version:

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

35 lines (34 loc) 988 B
"use strict"; class AnimatedPropertiesRegisterClass { constructor() { this._propertiesMap = /* @__PURE__ */ new Map(); } static instance() { return this._instance = this._instance || new AnimatedPropertiesRegisterClass(); } registerProp(property, timelineData) { this._propertiesMap.set(this._convert(property), timelineData); } deRegisterProp(property) { this._propertiesMap.delete(this._convert(property)); } registeredTimelineForProperty(property) { return this._propertiesMap.get(this._convert(property)); } registeredPropertiesCount() { let count = 0; this._propertiesMap.forEach(() => { count++; }); return count; } _convert(property) { if (property.object) { const sceneGraphProp = property; return `${sceneGraphProp.object.uuid}:${sceneGraphProp.propertyName}`; } else { return property; } } } export const AnimatedPropertiesRegister = AnimatedPropertiesRegisterClass.instance();