first commit
This commit is contained in:
29
node_modules/lottie-web/player/js/utils/shapes/ShapeCollection.js
generated
vendored
Normal file
29
node_modules/lottie-web/player/js/utils/shapes/ShapeCollection.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
createSizedArray,
|
||||
} from '../helpers/arrays';
|
||||
import shapePool from '../pooling/shape_pool';
|
||||
|
||||
function ShapeCollection() {
|
||||
this._length = 0;
|
||||
this._maxLength = 4;
|
||||
this.shapes = createSizedArray(this._maxLength);
|
||||
}
|
||||
|
||||
ShapeCollection.prototype.addShape = function (shapeData) {
|
||||
if (this._length === this._maxLength) {
|
||||
this.shapes = this.shapes.concat(createSizedArray(this._maxLength));
|
||||
this._maxLength *= 2;
|
||||
}
|
||||
this.shapes[this._length] = shapeData;
|
||||
this._length += 1;
|
||||
};
|
||||
|
||||
ShapeCollection.prototype.releaseShapes = function () {
|
||||
var i;
|
||||
for (i = 0; i < this._length; i += 1) {
|
||||
shapePool.release(this.shapes[i]);
|
||||
}
|
||||
this._length = 0;
|
||||
};
|
||||
|
||||
export default ShapeCollection;
|
Reference in New Issue
Block a user