class Composer {
constructor(width, height) {
this.root = document.createElement('div');
this.width = width;
this.height = height;
this.root.style.overflow = 'hidden';
this.root.style.position = 'relative';
this.root.style.width = width + 'px';
this.root.style.height = height + 'px';
this.root.style.perspective = '300px';
this.root.style.perspectiveOrigin = 'center center';
this.root.style.transformStyle = 'preserve-3d';
this.objects = [];
}
add(obj) {
this.root.appendChild(obj.root);
obj.root.style.position = 'absolute';
if (obj instanceof CanvasBg) {
} else if (obj instanceof CanvasGalleryObject) {
obj.root.style.transform = `translate3d(${this.width / 2}px, ${this.height / 2}px, 0px) matrix3d(${cameraPosMat.join(', ')}) translate3d(${obj.position[0]}px, ${obj.position[1]}px, ${obj.position[2]}px)`;
} else {
obj.root.style.transform = `translate3d(${this.width / 2}px, ${this.height / 2}px, 0px) matrix3d(${cameraPosMat.join(', ')}) translate3d(${obj.position[0]}px, ${obj.position[1]}px, ${obj.position[2]}px) ${obj.transform || ''}`;
}
this.objects.push(obj);
}
}