22 * Handles all the animation process
33 * @module animate
44 */
5+ import VisibilityAnimationWithParentResizeHandler from './VisibilityAnimationWithParentResizeHandler.js' ;
56import {
67 MOTION_ANIMS_ID ,
78 PROPERTY_NAMES ,
@@ -484,7 +485,7 @@ const getAction = (element, animType) => {
484485 * @param {HTMLElement } el - The DOM element being animated
485486 * @param {Object } args - The animation's ID and type and all the options passed by the user
486487 */
487- const preset = ( el , args ) => {
488+ const preset = async ( el , args ) => {
488489 const { opts, animationId } = args ;
489490 const { animType } = opts ;
490491 if (
@@ -495,14 +496,14 @@ const preset = (el, args) => {
495496 )
496497 opts . angle = undefined ;
497498
498- updateCssProperties ( el , opts ) . then ( ( ) => {
499- if ( opts . staggerDelay ) {
500- const staggeredDelay =
501- getTimeInMs ( opts . delay ) +
502- getTimeInMs ( opts . staggerDelay ) * opts . queryIndex ;
503- setCssProperty ( el , 'delay' , ` ${ staggeredDelay } ms` ) ;
504- }
505- } ) ;
499+ await updateCssProperties ( el , opts ) ;
500+
501+ if ( opts . staggerDelay ) {
502+ const staggeredDelay =
503+ getTimeInMs ( opts . delay ) +
504+ getTimeInMs ( opts . staggerDelay ) * opts . queryIndex ;
505+ setCssProperty ( el , 'delay' , ` ${ staggeredDelay } ms` ) ;
506+ }
506507} ;
507508
508509/**
@@ -515,7 +516,7 @@ const preset = (el, args) => {
515516 * @see {@link module:globals.MOTION_ANIMS_ID }
516517 */
517518const eventHandler = ( el , animationId , opts ) => {
518- return ( /** @type {Event } */ e ) => {
519+ return async ( /** @type {Event } */ e ) => {
519520 const {
520521 stopPropagation = CONFIG . stopPropagation ,
521522 preventDefault = CONFIG . preventDefault ,
@@ -529,7 +530,7 @@ const eventHandler = (el, animationId, opts) => {
529530 `Can't find a valid action for this animation type`
530531 ) ;
531532
532- preset ( el , {
533+ await preset ( el , {
533534 animationId,
534535 opts,
535536 } ) ;
0 commit comments