FrameElement.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @file
  3. * Handles element's layer frame update.
  4. * Checks layer in point and out point
  5. *
  6. */
  7. function FrameElement() {}
  8. FrameElement.prototype = {
  9. /**
  10. * @function
  11. * Initializes frame related properties.
  12. *
  13. */
  14. initFrame: function () {
  15. // set to true when inpoint is rendered
  16. this._isFirstFrame = false;
  17. // list of animated properties
  18. this.dynamicProperties = [];
  19. // If layer has been modified in current tick this will be true
  20. this._mdf = false;
  21. },
  22. /**
  23. * @function
  24. * Calculates all dynamic values
  25. *
  26. * @param {number} num
  27. * current frame number in Layer's time
  28. * @param {boolean} isVisible
  29. * if layers is currently in range
  30. *
  31. */
  32. prepareProperties: function (num, isVisible) {
  33. var i;
  34. var len = this.dynamicProperties.length;
  35. for (i = 0; i < len; i += 1) {
  36. if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {
  37. this.dynamicProperties[i].getValue();
  38. if (this.dynamicProperties[i]._mdf) {
  39. this.globalData._mdf = true;
  40. this._mdf = true;
  41. }
  42. }
  43. }
  44. },
  45. addDynamicProperty: function (prop) {
  46. if (this.dynamicProperties.indexOf(prop) === -1) {
  47. this.dynamicProperties.push(prop);
  48. }
  49. },
  50. };
  51. export default FrameElement;