UNPKG

lottie-web

Version:

After Effects plugin for exporting animations to SVG + JavaScript or canvas + JavaScript

37 lines (33 loc) 1.37 kB
import { extendPrototype, } from '../../utils/functionExtensions'; import createNS from '../../utils/helpers/svg_elements'; import createTag from '../../utils/helpers/html_elements'; import BaseElement from '../BaseElement'; import TransformElement from '../helpers/TransformElement'; import HierarchyElement from '../helpers/HierarchyElement'; import FrameElement from '../helpers/FrameElement'; import RenderableDOMElement from '../helpers/RenderableDOMElement'; import HBaseElement from './HBaseElement'; function HSolidElement(data, globalData, comp) { this.initElement(data, globalData, comp); } extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement); HSolidElement.prototype.createContent = function () { var rect; if (this.data.hasMask) { rect = createNS('rect'); rect.setAttribute('width', this.data.sw); rect.setAttribute('height', this.data.sh); rect.setAttribute('fill', this.data.sc); this.svgElement.setAttribute('width', this.data.sw); this.svgElement.setAttribute('height', this.data.sh); } else { rect = createTag('div'); rect.style.width = this.data.sw + 'px'; rect.style.height = this.data.sh + 'px'; rect.style.backgroundColor = this.data.sc; } this.layerElement.appendChild(rect); }; export default HSolidElement;