diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index fd92343e147..10b69817aa2 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -6833,7 +6833,12 @@ registry.BackgroundShape = SnippetOptionWidget.extend({ */ shape(previewMode, widgetValue, params) { this._handlePreviewState(previewMode, () => { - return {shape: widgetValue, colors: this._getImplicitColors(widgetValue, this._getShapeData().colors), flip: []}; + return { + shape: widgetValue, + colors: this._getImplicitColors(widgetValue, this._getShapeData().colors), + flip: [], + animated: params.animated, + }; }); }, /** @@ -7015,7 +7020,7 @@ registry.BackgroundShape = SnippetOptionWidget.extend({ // Updates/removes the shape container as needed and gives it the // correct background shape const json = target.dataset.oeShapeData; - const {shape, colors, flip = []} = json ? JSON.parse(json) : {}; + const {shape, colors, flip = [], animated = 'false'} = json ? JSON.parse(json) : {}; let shapeContainer = target.querySelector(':scope > .o_we_shape'); if (!shape) { return this._insertShapeContainer(null); @@ -7027,6 +7032,8 @@ registry.BackgroundShape = SnippetOptionWidget.extend({ // Compat: remove old flip classes as flipping is now done inside the svg shapeContainer.classList.remove('o_we_flip_x', 'o_we_flip_y'); + shapeContainer.classList.toggle('o_we_animated', animated === 'true'); + if (colors || flip.length) { // Custom colors/flip, overwrite shape that is set by the class $(shapeContainer).css('background-image', `url("${this._getShapeSrc()}")`); diff --git a/addons/web_editor/static/src/scss/web_editor.common.scss b/addons/web_editor/static/src/scss/web_editor.common.scss index 8a2b4a924a5..949a217c063 100644 --- a/addons/web_editor/static/src/scss/web_editor.common.scss +++ b/addons/web_editor/static/src/scss/web_editor.common.scss @@ -976,6 +976,10 @@ section, .oe_img_bg, [data-oe-shape-data] { .o_we_shape { @extend %o-we-background-layer; + &.o_we_animated { + will-change: transform; + } + // Default map to use to map shape file colors to color combination // background colors. $default-color-to-cc-bg-map: (