@@ -316,16 +316,7 @@ function plvt_load_view_transitions(): void {
316
316
*/
317
317
$ default_animation_args = isset ( $ theme_support ['default-animation-args ' ] ) ? (array ) $ theme_support ['default-animation-args ' ] : array ();
318
318
$ default_animation_stylesheet = $ animation_registry ->get_animation_stylesheet ( $ theme_support ['default-animation ' ], $ default_animation_args );
319
- if ( '' !== $ default_animation_stylesheet ) {
320
- $ default_animation_stylesheet = plvt_inject_animation_duration ( $ default_animation_stylesheet , absint ( $ theme_support ['default-animation-duration ' ] ) );
321
- } else {
322
- $ seconds = absint ( $ theme_support ['default-animation-duration ' ] ) / 1000 ;
323
- $ default_animation_stylesheet = sprintf (
324
- /* translators: %s is animation duration in seconds. */
325
- '::view-transition-group(*) { animation-duration: %ss; } ' ,
326
- $ seconds
327
- );
328
- }
319
+ $ default_animation_stylesheet = plvt_inject_animation_duration ( $ default_animation_stylesheet , absint ( $ theme_support ['default-animation-duration ' ] ) );
329
320
wp_add_inline_style ( 'plvt-view-transitions ' , $ default_animation_stylesheet );
330
321
331
322
/*
@@ -390,8 +381,9 @@ function plvt_inject_animation_duration( string $css, int $animation_duration ):
390
381
391
382
// Inject animation duration as CSS variable to take effect.
392
383
$ css .= sprintf (
393
- /* translators: %s is animation duration in seconds. */
394
- '::view-transition-group(*) { --plvt-view-transition-animation-duration: %ss; } ' ,
384
+ /* translators: %1$s: CSS property name. %2$s: Animation duration in seconds. */
385
+ '::view-transition-group(*) { %1$s: %2$ss; } ' ,
386
+ '' !== $ css ? '--plvt-view-transition-animation-duration ' : 'animation-duration ' ,
395
387
$ seconds
396
388
);
397
389
0 commit comments