From 4802a2b7f49bc7e8462db3e721cf4ba07621e1bd Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 5 Feb 2020 15:55:08 +0100 Subject: [PATCH] auto-animate applies styles via stylesheet to avoid changing the slide dom --- css/reveal.scss | 11 -- js/reveal.js | 264 ++++++++++++++++++-------------- test/examples/auto-animate.html | 7 +- 3 files changed, 151 insertions(+), 131 deletions(-) diff --git a/css/reveal.scss b/css/reveal.scss index 7dcec07e..ab11f32e 100644 --- a/css/reveal.scss +++ b/css/reveal.scss @@ -990,17 +990,6 @@ $controlsArrowAngleActive: 36deg; } -/********************************************* - * AUTO ANIMATE - *********************************************/ - -.reveal section[data-auto-animate] .auto-animate-target { - transition-property: all; - transform-origin: top left; -} - - - /********************************************* * PAUSED MODE *********************************************/ diff --git a/js/reveal.js b/js/reveal.js index ca9daa13..f651bdbc 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -190,6 +190,11 @@ // Can be used to globally disable auto-animation autoAnimate: true, + // Optionally provide a custom element matcher function, + // the function needs to return an array where each value is + // an array of animation pairs [fromElement, toElement] + autoAnimateMatcher: null, + // Default settings for or auto-animate transitions, can be // overridden per-slide via data arguments autoAnimateEasing: 'ease', @@ -197,16 +202,19 @@ // CSS styles that auto-animations will animate between autoAnimateStyles: [ - 'opacity', - 'color', - 'backgroundColor', - 'font-size', - 'line-height', - 'letter-spacing', - 'border-top-left-radius', - 'border-top-right-radius', - 'border-bottom-left-radius', - 'border-bottom-right-radius' + { property: 'opacity' }, + { property: 'color' }, + { property: 'backgroundColor' }, + { property: 'padding', defaultValue: 'computed' }, + { property: 'font-size', defaultValue: 'computed' }, + { property: 'line-height', defaultValue: 'computed' }, + { property: 'letter-spacing', defaultValue: 'computed' }, + { property: 'border-width', defaultValue: 'computed' }, + { property: 'border-color' }, + { property: 'border-top-left-radius' }, + { property: 'border-top-right-radius' }, + { property: 'border-bottom-left-radius' }, + { property: 'border-bottom-right-radius' } ], // Controls automatic progression to the next slide @@ -383,9 +391,8 @@ // Flags if the interaction event listeners are bound eventsAreBound = false, - // A list of all elements that we have animated through - // auto-animations - autoAnimatedRollbacks = [], + //