11import { queryAll , extend , createStyleSheet } from '../utils/util.js'
22import { FRAGMENT_STYLE_REGEX } from '../utils/constants.js'
33
4+ // Counter used to generate unique IDs for auto-animated elements
5+ let autoAnimateCounter = 0 ;
6+
47/**
58 * Automatically animates matching elements across
69 * slides with the [data-auto-animate] attribute.
@@ -11,9 +14,6 @@ export default class AutoAnimate {
1114
1215 this . Reveal = Reveal ;
1316
14- // Counter used to generate unique IDs for auto-animated elements
15- this . autoAnimateCounter = 0 ;
16-
1717 }
1818
1919 /**
@@ -45,7 +45,7 @@ export default class AutoAnimate {
4545
4646 // Inject our auto-animate styles for this transition
4747 let css = this . getAutoAnimatableElements ( fromSlide , toSlide ) . map ( elements => {
48- return this . autoAnimateElements ( elements . from , elements . to , elements . options || { } , animationOptions , this . autoAnimateCounter ++ ) ;
48+ return this . autoAnimateElements ( elements . from , elements . to , elements . options || { } , animationOptions , autoAnimateCounter ++ ) ;
4949 } ) ;
5050
5151 // Animate unmatched elements, if enabled
@@ -63,7 +63,7 @@ export default class AutoAnimate {
6363 // If there is a duration or delay set specifically for this
6464 // element our unmatched elements should adhere to those
6565 if ( unmatchedOptions . duration !== animationOptions . duration || unmatchedOptions . delay !== animationOptions . delay ) {
66- id = 'unmatched-' + this . autoAnimateCounter ++ ;
66+ id = 'unmatched-' + autoAnimateCounter ++ ;
6767 css . push ( `[data-auto-animate="running"] [data-auto-animate-target="${ id } "] { transition: opacity ${ unmatchedOptions . duration } s ease ${ unmatchedOptions . delay } s; }` ) ;
6868 }
6969
0 commit comments