ProjectInterface.js 857 B

12345678910111213141516171819202122232425262728293031
  1. const ProjectInterface = (function () {
  2. function registerComposition(comp) {
  3. this.compositions.push(comp);
  4. }
  5. return function () {
  6. function _thisProjectFunction(name) {
  7. var i = 0;
  8. var len = this.compositions.length;
  9. while (i < len) {
  10. if (this.compositions[i].data && this.compositions[i].data.nm === name) {
  11. if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {
  12. this.compositions[i].prepareFrame(this.currentFrame);
  13. }
  14. return this.compositions[i].compInterface;
  15. }
  16. i += 1;
  17. }
  18. return null;
  19. }
  20. _thisProjectFunction.compositions = [];
  21. _thisProjectFunction.currentFrame = 0;
  22. _thisProjectFunction.registerComposition = registerComposition;
  23. return _thisProjectFunction;
  24. };
  25. }());
  26. export default ProjectInterface;