From 55aab24a5e1eafa492b1c565a32fc547e9df62ee Mon Sep 17 00:00:00 2001
From: Hakim El Hattab <hakim.elhattab@gmail.com>
Date: Tue, 11 Feb 2020 10:39:59 +0100
Subject: [PATCH] allow custom auto-animate matchers to override transition
 settings

---
 js/reveal.js | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/js/reveal.js b/js/reveal.js
index f07c0ef6..f44b36fe 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -3854,12 +3854,14 @@
 			delete element.dataset.autoAnimateTarget;
 		} );
 
-		var animationOptions = getAutoAnimateOptions( toSlide );
+		var animationOptions = getAutoAnimateOptions( toSlide, {
 
-		// If our slides are centered vertically, we need to
-		// account for their difference in position when
-		// calculating deltas for animated elements
-		if( config.center ) animationOptions.offsetY = fromSlide.offsetTop - toSlide.offsetTop;
+			// If our slides are centered vertically, we need to
+			// account for their difference in position when
+			// calculating deltas for animated elements
+			offsetY: config.center ? fromSlide.offsetTop - toSlide.offsetTop : 0
+
+		} );
 
 		// Set our starting state
 		fromSlide.dataset.autoAnimate = 'pending';
@@ -3933,6 +3935,12 @@
 		// like transition easing, duration and delay
 		animationOptions = getAutoAnimateOptions( to, animationOptions );
 
+		// Individual transition settings can be overridden via
+		// element options
+		if( typeof elementOptions.delay !== 'undefined' ) animationOptions.delay = elementOptions.delay;
+		if( typeof elementOptions.duration !== 'undefined' ) animationOptions.duration = elementOptions.duration;
+		if( typeof elementOptions.easing !== 'undefined' ) animationOptions.easing = elementOptions.easing;
+
 		var fromProps = getAutoAnimatableProperties( 'from', from, elementOptions ),
 			toProps = getAutoAnimatableProperties( 'to', to, elementOptions );
 
-- 
GitLab